[fpc-devel] Some thoughts on multi-line string support, and a possible syntax that I think is perfectly clean and Pascal-ish.

Michael Van Canneyt michael at freepascal.org
Thu Jul 4 18:28:52 CEST 2019



On Thu, 4 Jul 2019, Ben Grasset wrote:

> General implementation question:
>
> The version of this feature I currently have working introduces something
> of a chicken-and-egg problem while bootstrapping:
>
> The initial version of the compiler being used for the build of course has
> no knowledge of multi-line strings. Thus, all instances of single-character
> backtick literals must appear like single-quote-literal / backtick literal
> / single-quote-literal.
>
> However, once "ppc1" is built, it no longer accepts that, and instead
> requires the backtick equivalent of the current single-quote-literal syntax
> (by which I mean, four backticks.)
>
> Currently, I've solved this via an ifdef, however, as there are indeed a
> number of source files in the FPC codebase besides the compiler where
> currently single-quote-literal / backtick literal / single-quote-literal
> appears, it seems like an unwieldy solution.
>
> Would it be better to continue to allow single backticks to appear
> specifically (and only) inside of *single-line* strings (that is, at any
> point between two apostrophes)?

I would think this is a given... 
After all, they are valid characters in a single line string now, that must be kept
for backward compatibility.

They should start a multiline string only on the places where a single quote
starts a single-line string, i.e. their behaviour is identical to single
quote, except that a newline does not terminate them.

Michael.


More information about the fpc-devel mailing list