[antlr-interest] Is it possible to capture the input of a wildcard for tree construction inside a block of multiple occurrences?

Ralf Cremerius ralf_c at web.de
Wed Dec 19 06:09:33 PST 2007


Hi,

I just have a question about some detail in ANTLR v3:

I'm writing a parser grammar generating an AST. In one specific rule, I need to use the wildcard (.) inside some block of multiple occurrences, but I also need the matched input to construct a tree from it. Can this be done somehow? I tried to use a label but this didn't work.

rule:	     (
	       APOSTROPHE!
	       (options {greedy=false;} : .  )* 
	       APOSTROPHE!
	       )+
	       -> ^( ----?---- );

Or am I just asking for too much and this is conceptually forbidden?

Thanks in advance for reading,
  Ralf Cremerius
_________________________________________________________________________
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114



More information about the antlr-interest mailing list