Your lexer does not cover all possibilities such as \n \r, space etc. Add as 
the last rule:


ANY : . { skip(); } ;

Jim

> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Timm Meyer
> Sent: Friday, February 05, 2010 11:51 AM
> To: [email protected]
> Subject: [antlr-interest] Simple Parser Problem?
> 
> Hi there,
> 
> I hope this is not a too simple problem, but I am searching for hours
> for a solution.
> 
> The grammar is:
> 
> headerword
>     :    (HEADERWORDCHAR | WORDCHAR)
>      (DIGIT | HEADERWORDCHAR | WORDCHAR)*;
> 
> 
> DIGIT    : '0'..'9' ;
> WORDCHAR    : ('a'..'z' | 'A'..'Z');
> HEADERWORDCHAR : ( '$' | '&' | '(' | ')' | ',' | '.' | '+' | '[' | ']'
> |
> '\'');
> 
> And everey time I try to match
> (137394948)
> or
> (137394948)7
> 
> I get a NoViableAltException.
> 
> Could anyone explain to me what I am doing wrong here?
> 
> Cheers, Timm
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address




List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to