[antlr-interest] ST feature proposal

Gerald Rosenberg gerald at certiv.net
Fri Jul 10 13:20:17 PDT 2009


At 12:49 PM 7/10/2009, Graham Wideman wrote:
>Hi Ter,
>
>At 7/10/2009 11:42 AM, Terence Parr wrote:
> >Hi Graham, yep, i wonder if we need both "ignore newline" and "ignore
> >newline and indentation".  Actually, Ignore \n without ignoring
> >whitespace doesn't make any sense because without a \n there is no
> >indentation ;)
> >I think <\\> should work just fine and would be very helpful.
>
>I agree that having separate "ignore newline" and "ignore 
>whitespace" is not useful, because once you've decided that you want 
>the line/column positioning of a chunk of ST input text to serve 
>input text aesthetics rather than specifying output then neither 
>line nor column of the input text in that neighborhood is relevant 
>to the output.
>
>That said, there's still a need to address the two points I raised:
>
>1. What is the extent of "ignore newlines and whitespace":
>   -- just one line, or
>   -- all up to next non-whitespace?
>
>2. How to specify what whitespace (if any) that you *do* want in the 
>output at the location of the <\\>.

Given that ST tends to preserve whitespace, the least change rule 
would be to preserve any whitespace immediately prior to the <\\> and 
consume all whitespace immediately after.

If there were some reason to want to ignore a whitespace sequence, 
followed immediately by a whitespace sequence *not* to be ignored, a 
second instance of <\\> could be used as a whitespace ignore 
terminator.  But, are there real circumstances where this is needed? 



More information about the antlr-interest mailing list