]> https://gitweb.dealii.org/ - dealii.git/commit
Ignore surrounding whitespace if continuing lines.
authorDavid Wells <wellsd2@rpi.edu>
Fri, 22 Jan 2016 22:57:41 +0000 (17:57 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Mon, 25 Jan 2016 03:44:43 +0000 (22:44 -0500)
commitcaf2c738dba5dcc1351288842754524289235d28
treecedcd1cf82da2fadecd03e4288dac4ff282abcef
parentd961b80de52e45250b0f333387588d7b36f4069f
Ignore surrounding whitespace if continuing lines.

This commit modifies the behavior present in both 23f306dfc5 (which did
not join lines if there was whitespace following a '\') and
0b962b1103 (which did not trim whitespace at the beginning of continued
lines).

We decided to remove whitespace at the beginning of a continued line
both because it was implemented that way in 23f306dfc5 (i.e., the 'fix'
in 0b962b1103 was wrong) and because it makes writing things
like (example provided by Alberto Sartori)

set Finite element space = FESystem[FE_Q(1)^d-\
                           FE_DGPMonomial(0)-\
                           FE_DGPMonomial(0)]

possible.

For the sake of posterity, here is part of the discussion (PR #2101)
which lead to the decision to remove trailing whitespace:

drwells:

I agree with @asartori86 that trailing whitespace is a mistake. I
suppose that I ultimately disagree because I think it is one that we
should 'forgive'. I think we are in agreement that we should join lines
if the last non-whitespace character is a `\`, then.

bangerth:

I agree, too, that trailing whitespace is a mistake. But there are two
options:

* Enforce it. In those cases you'll get an error about the next line not
  being what the parser expects, while the file looks completely correct
  visually. People will probably spend a long time rubbing their eyes
  before they realize the problem.

* Forgive it, at the cost of not being able to support valid cases where
  the user wants to have a backslash within the text, followed by only
  spaces. That seems like a rare case to happen in practice, and also a
  poor choice of syntax for whatever the user wanted to achieve.

From a usability standpoint, option 1 seems more appealing.
source/base/parameter_handler.cc
tests/bits/parameter_handler_backslash_06.cc [new file with mode: 0644]
tests/bits/parameter_handler_backslash_06.output [new file with mode: 0644]
tests/bits/parameter_handler_backslash_07.cc [new file with mode: 0644]
tests/bits/parameter_handler_backslash_07.output [new file with mode: 0644]
tests/bits/prm/parameter_handler_backslash_06.prm [new file with mode: 0644]
tests/bits/prm/parameter_handler_backslash_07.prm [new file with mode: 0644]

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.