[antlr-interest] Quoted Name Value Pairs
Jesse Anderson
jesse.anderson at 4bright.com
Tue Apr 22 12:50:50 PDT 2008
Gavin Lambert wrote:
> At 07:29 23/04/2008, Jesse Anderson wrote:
> >Here is my file:
>
> You've left some of the rules out, so it's hard to give a complete
> answer. But for starters:
>
> >WHITESPACE : WHITESPACECHAR+ ;
> >
> >WHITESPACECHAR : ( '\t' | ' ' | '\r' | '\n'| '\u000C' ) ;
>
> WHITESPACECHAR should be a fragment.
>
> >SEMICOLON : ( ';' )* ;
>
> This permits SEMICOLON to match nothing, and lexer rules that can
> match nothing are a big no-no. Either change the * to a + or remove
> it entirely and match multiple SEMICOLON tokens in the parser.
>
> When you're starting out, it's useful to write a test harness for the
> lexer alone; feed it some sample input and print out the tokens it
> generates. You'll often find that the parser isn't behaving the way
> you expect because it's getting different tokens than you expect.
> ANTLRworks currently doesn't really show this very well.
>
I tried that. Still no joy. I changed it to:
SEMICOLON : ( ';' )+;
More information about the antlr-interest
mailing list