[antlr-interest] Error with date

Jan van der Ven jhvdven at xs4all.nl
Sun Jun 17 05:56:16 PDT 2007


Ok, I solved it, but got another problem in return.
The parser matched the Feb/2003 to ID2
ID2 : ('a'..'z' |'A'..'Z' |'_' ) ('a'..'z' |'A'..'Z' |'_' |'0'..'9' | 
':' | '#' | '.' | '-' | ' ' | '/' )* ;
And if I remove the / from this definition, my timestamp is parsed 
correctly.
But not all my ID's.
I have several sort of ID's: some allow all characters, and some are 
more strict.
How would that be done?

Kind regards,

Jan


Jan van der Ven wrote:
> Dear list,
>
>
> I am taking my first steps with v3 (I have been working with 2.7 
> before). I use AntlrWorks and have created the following snippet:
>
> DIGIT    :    '0'..'9';
>
> INT: DIGIT (DIGIT)*;
>
> timestamp
>    :    day '/' month '/' year ;
>    day    :    INT;
>
> month    :    ('Jan' | 'Feb' | 'Mar' | 'Apr' | 'May' | 'Jun' | 'Jul' | 
> 'Aug' | 'Sep' | 'Oct' | 'Nov' | 'Dec');
>
> year    :    INT;
>
> When I feed it with: 09/Feb/2003 it matches the 09 and then tries to 
> match Feb/2003, which of course fails: line 3:21 mismatched input 
> 'Feb/2003' expecting set null.
>
> Can anyone explain this for me?
>
> Kind regards,
>
>
> Jan
>
>
>



More information about the antlr-interest mailing list