[antlr-interest] related question: multiple grammars..

Eitan Suez eitan.suez at gmail.com
Thu Mar 29 13:41:13 PDT 2007


On 3/29/07, Gavin Lambert <antlr at mirality.co.nz> wrote:
>
>
> No, it shouldn't make a difference.  As long as your INT rule
> isn't too greedy it should be able to match an int immediately
> followed by something else (with the something else producing its
> own token).  Maybe you should post your INT and Unit rules.


right.  :-) here are the relevant parts from my grammar..
(i think i was using the term "length" for "measure" below..)
---

measure returns [Measure value]
 : INT Unit
 {
   $value = new Measure(Integer.parseInt($INT.text), $Unit.text);
 }
 ;
Unit : 'pt' | 'px' | 'em' | 'ex' ;
INT    :    ('0'..'9')+ ;

WS : (' '|'\t'|'\n'|'\r'|'\f')+ { $channel=HIDDEN; } ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070329/76a22f07/attachment.html 


More information about the antlr-interest mailing list