Re: Strings proposal

My first reaction was caution, since I find the second form of the example you give so much better than the first; my rule in SGML and XML markup has long been that if a line break or other special whitespace handling carries meaning at some point, it’s better to represent it with markup than with literal whitespace, because literal whitespace is fragile in editors that provide services like reformatting paragraphs.

Then I realized that you were not proposing to allow linebreaks inside of literals, but forbid them.  Since I avoid them already, it will not affect the way I write grammars.

So, yes, I think this is a good idea. 

Michael

> On 22,Oct2021, at 5:27 AM, Steven Pemberton <steven.pemberton@cwi.nl> wrote:
> 
> After experience with my tutorial, I want to make a syntax proposal.
> 
> In brief, strings may not extend over a line.
> 
> The reason for this is that 
> 1) It doesn't reduce functionality, since
> 
>  
> 
> "abc
>         def"
> 
> is equivalent to 
> 
>         "abc", #d?, #a, "def".
> 
> (and also deals with the Windows anomaly).
> 
> 2) It gives far better diagnostics when parsing the ixml, since the source of the error is on the same line as where the error is discovered.
> 
> So the definition of dchar (and likewise schar) becomes:
> dchar: ~['"'; #a; #d];
>          '"', -'"'. {all characters, quotes must be 
> doubled}
> 
> Steven.
> 

Received on Friday, 22 October 2021 16:00:36 UTC