[antlr-interest] setTokenStream() on grammar with imports + feature request

Bill Andersen andersen at highfleet.com
Tue Feb 8 13:16:09 PST 2011


Folks

Can anyone tell me quick if this makes sense...  I have grammar A that imports B.  I want to reuse the A parser so I call

	AParser.setTokenStream(input);

Thing is setTokenStream() is inherited from Parser and by default does not communicate with delegate parsers.  Should I override in AParser with

	public void setTokenStream(TokenStream input) {
		super.setTokenStream(input);
		gB.setTokenStream(input);
	}

where gB is the delegate parser in AParser?

And a feature request...  I use grammar imports quite extensively and have already run into an issue where I needed a method in a parser to get its delegate parsers.  Is there some fundamental barrier to providing such a method on Lexer, Parser, and TreeParser that would return some collection of delegate parsers/lexers/tree parsers?


Bill Andersen 
Highfleet, Inc. (www.highfleet.com)
3600 O'Donnell Street, Suite 600
Baltimore, MD 21224
Office: +1.410.675.1201
Cell: +1.443.858.6444
Fax: +1.410.675.1204







More information about the antlr-interest mailing list