[antlr-interest] Collecting a string of tokens...

Alan Lehotsky qsmgmt at earthlink.net
Mon Aug 23 17:23:27 PDT 2010


I'm working with the PLSQL.g grammar present on the antlr website.

It has a production that looks like


swallow_to_semi :  { ^ SEMI }+;

The parser that this generates ends up producing a series of tokens representing everything after (say) a SELECT statement.  I would rather have a single TOKEN containing all the characters in the body of the select.

I tried variations on


SQL_BODY : { ^ SEMI }+;


but that just leads to a variety of conflicts; and a fragment rule did not end up helping me either.  I've looked in both the Antlr Book and in the Compiler Patterns book without finding anything that seemed relevant....

Thanks,




More information about the antlr-interest mailing list