[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
Thu Dec 20 00:39:06 PST 2007


Hi Jim,

thanks a lot for your help:  Splitting my rule into a lexer token and a smaller parser rule perfectly solved my problem.  :-)

Ralf

> This sounds more like something you should do in the lexer to be honest 
> (assuming it does not cause a context issue). The use of '.' in a parser 
> is a bit tricky as it just matches any token of course and in the 
> construct you have will match to EOF I think.
> 
> Also note that you cannot use both '!' and AST rewrites. If you are 
> using rewrites, then just don't mention the APOSTROPHE tokens ;-).
> 
> You would have more surety by creating a parser rule that contains all 
> the tokens other than APOSTROPHE. Then you could do:
> 
> rule:
> 	APOSTROPHE
> 		(stuff += notanapostrophe)*
> 	APOSTROPHE
> 
> 	-> ^(APOSTROPHE $stuff*)
> ;
> 
> Jim
______________________________________________________________________________
Jetzt neu! Im riesigen WEB.DE Club SmartDrive Dateien freigeben und mit 
Freunden teilen! http://www.freemail.web.de/club/smartdrive_ttc.htm/?mc=021134



More information about the antlr-interest mailing list