[antlr-interest] Simple Parser Problem?

Jim Idle jimi at temporal-wave.com
Fri Feb 5 12:20:10 PST 2010


Well your problems are with the larger grammar then I am afraid as there is nothing wrong with the example you gave other than not covering some characters.

Jim

> -----Original Message-----
> From: Timm Meyer [mailto:meyer.timm at googlemail.com]
> Sent: Friday, February 05, 2010 12:17 PM
> To: Jim Idle
> Subject: Re: [antlr-interest] Simple Parser Problem?
> 
> This doesnt change anything.
> And also, the characters from the input are (theoretically) all
> matched.
> (Also this is just a part of the original grammar, but an isolated
> short
> example which generates an error).
> 
> Timm
> 
> Jim Idle schrieb:
> > Your lexer does not cover all possibilities such as \n \r, space etc.
> Add as the last rule:
> >
> >
> > ANY : . { skip(); } ;
> >
> > Jim
> >
> >
> >> -----Original Message-----
> >> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> >> bounces at antlr.org] On Behalf Of Timm Meyer
> >> Sent: Friday, February 05, 2010 11:51 AM
> >> To: antlr-interest at antlr.org
> >> 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
> >






More information about the antlr-interest mailing list