[antlr-interest] Fragment rules inside parser rules

Ben Corne ben.corne at gmail.com
Wed May 18 06:00:28 PDT 2011


Hello

Do I really need to make LKU in the example below a normal token rule or is
there a way to get this to work for the input '&foo;' not using literals
inside the parser rule or real tokens.
============================
grammar Foo;

program
: (LKU NAME ';')+
 ;
fragment LKU
: '&'
 ;
NAME
: ('a'..'z')*
 ;
=============================

Regards
Ben C.


More information about the antlr-interest mailing list