[antlr-interest] Passing information from main program to lexer, parser and tree walker

Cameron Esfahani dirty at apple.com
Tue Jun 5 16:28:59 PDT 2007


So, for example, I could create an InformationBuffer class, and then  
add a setInformationBuffer/getInformationBuffer pair of routines to  
the lexer, parser and tree walker.

After creating the lexer, parser and tree walker, I can call  
setInformationBuffer() to pass them the relevant information:

		ANTLRInputStream		input = new ANTLRInputStream( System.in );

		// create a lexer that feeds off of input CharStream
		TLexer					lexer = new TLexer( input );

		.....
		lexer.setInformationBuffer( info );

Something like that?

On Jun 5, 2007, at 4:24 PM, Alexandre Porcelli wrote:

> You can create some set and get methods using the members directive
> (http://www.antlr.org/wiki/display/ANTLR3/Migrating+from+ANTLR+2+to 
> +ANTLR+3#MigratingfromANTLR2toANTLR3- 
> Codesectionformembersmustnowbelabelled).
> So... using the get and sets you can pass data from a class to other.

Cameron Esfahani
dirty at apple.com

"You only live once, and the way I live, once is enough"

Frank Sinatra



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070605/47ef87c8/attachment-0001.html 


More information about the antlr-interest mailing list