[antlr-interest] Adding a Space Leads to Mismatch
quintin.beukes at signio.co.za
Thu Feb 9 09:10:50 PST 2012
Can someone please explain the following behavior to me. I've narrowed
the problem down to a single space match, as described below.
// Begin Grammar //
: EVENTNAME ':' NEWLINE
: WS ALPHANUMERICSPACE NEWLINE
WS '(' ruleExpression '):' NEWLINE
: ('\t' | ' ')+
: ('a'..'z' | 'A'..'Z' | '0'..'9')+ (' '+ ('a'..'z' | 'A'..'Z' | '0'..'9')+)*
: '\r'? '\n'
// End Grammar //
// Begin Input //
// End Input //
The above grammar and input matches perfectly.
Though, if I change the last line of the input to:
And change the ruleExpression in the grammar to:
: 'If' WS
Then it doesn't match. Matching 'If ' works, and 'If' ' ' doesn't.
I've tried numerous things and can't seem to get past this oddity.
More information about the antlr-interest