[antlr-interest] ANTLR 3: Problem with static DFA class generation

Terence Parr parrt at cs.usfca.edu
Mon Sep 19 07:48:02 PDT 2005


On Sep 19, 2005, at 2:22 AM, Oliver Zeigermann wrote:
>>>
>>> class XMLLexer extends Lexer {
>>>
>>> ...
>>>
>>> private dfa10 = new DFA10();
>>>
>>> ...
>>>
>>> alt10 = dfa10.predict(input);
>>>
>>> ...
>>>
>>> }
>>>
>>
> Yes, that's right! My patch does not include the above single
> construction, as this would have required a bit more than changing a
> template, though. But I am pretty sure that you know how to do this...

Actually, should only require a template chnage.  The list of DFAs is  
known to the overall lexer template and so it can apply a small  
template to each DFA, generating the private reused instance. :)

Hooray.

Ter


More information about the antlr-interest mailing list