At 08:52 25/02/2009, Rick Schumeyer wrote:
>If the input string is "12:34:45", then of course antlr returns a 
>STRING token.  I understand why it does that (I think) but I'm 
>not really sure how to fix that.  I'm fuzzy on the difference 
>between a semantic and syntactic predicate, and whether one of 
>those is what I need.
>
>grammar STest;
>
>line    :    timestamp;
>
>timestamp
>     :    INT ':' INT ':' INT
>     ;
>
>INT    :    ('0'..'9')+;
>
>STRING    :    ('!'..'+' | '-'..'~')+; /* anything but ws or 
>comma */

fragment TIMESTAMP: INT ':' INT ':' INT ;

INT : ('0'..'9')+ ;

STRING
   : (TIMESTAMP) => TIMESTAMP { $type = TIMESTAMP; }
   | ('!'..'+' | '-'..'~')+; /* anything but ws or comma */
   ;


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