[antlr-interest] how to skip/read next n Characters (n is read form input)

Thomas at ruschival.de Thomas at ruschival.de
Mon Nov 5 05:05:32 PST 2012


Thanks Claus-Dieter,
it seems to work at least in the small test grammar I played around 
with. So far I didn't use semantic predicates, mainly because I don't 
fully understand them and many people warn about side-effects. Anyways I 
will try to integrate it and have our purchaseing department get a copy 
of Terence's book.

Thanks again
Thomas



Am 2012-11-02 13:51, schrieb cd.barth at t-online.de:
> Thomas, I would use validating semantic predicate
>
> readNchars
> : NUM
>   (b+=CHAR)+ {$b.size()<=Integer.parseInt($NUM.text)}?
> ;
>
> The idea is from Ter's book The Definitive ANTLR Reference (ANTLR v3)
>
> Gruß Claus-Dieter
>
>




More information about the antlr-interest mailing list