[antlr-interest] NoViableAltException but do not know why
dave at badgers-in-foil.co.uk
Wed Oct 31 08:15:16 PDT 2007
On Wed, Oct 31, 2007 at 03:08:56PM +0100, OJAY78 at gmx.de wrote:
> I have the following rule in my grammar.
> justifyStrFunction returns[String value]
> : 'justify' '(' parameter '|' ('left' | 'center' | 'right')('|' ('0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9')* )? ')'
> Here I have a problem and do not know how to solve this.
> If I try the command: justify("test"|left|4); in the ANTLRWorks Interpreter it works and I see the parser tree for that command. But if I try more than one digit like this command justify("test"|left|44); it resolves in a NoViableAltException.
Do you have a lexer definition for INT (or anything else matching
DIGIT+) in your grammar, by any chance?
More information about the antlr-interest