[antlr-interest] Line continuation character problem

Craig Barker cb at phoebussoftware.com
Thu Jun 10 02:09:42 PDT 2004


Hi Folks,
 
I have a small problem that, although trawling all the manuals, examples etc, i can't find an example of (although i'm sure i've read about it somewhere!).
 
I'm trying to analyse a language where each statement appears on a single line, apart from when the '&' character is explicitly used as a line continuation character. 
 
A statement like:
 
and(a>1,b<2) can also be written
 
and (a>1,&
b<2)
 
The only other issue is that a string token can actually be validly split by '& \r \n' so we may have:
 
and(a>"abc",b<"def")
 
written as:
 
and(a>"abc",b<"d&
ef")
 
 
I've tried using a lexer filter and that works fine for the first example but either i'm incorrectly using it in the second example or as the lexer will already be partway through lexing the string (done as per the default java grammer in the distro.) it cannot invoke the filter rule.
 
Is the best way of dealing with this a change in the lexing class to automatically filter out any '&\r\n''s from the character stream before it hits the lexer?
 
If there's another way or if anyone can point me to an example I would be most grateful.
 
Many thanks
 
Craig


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5422 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040610/a553d4d9/attachment.bin


More information about the antlr-interest mailing list