[antlr-interest] [v3] parser rules are final

Wincent Colaiuta win at wincent.com
Fri Jun 8 03:38:37 PDT 2007


El 8/6/2007, a las 11:38, Johannes Luber escribió:

> Wincent Colaiuta wrote:
>>
>> ANTLR's output is generated using StringTemplate. If you dare, you  
>> could
>> try tweaking the Java template to tailor the output as you desire,  
>> then
>> rebuilding ANTLR. I believe this is the template that you'd need  
>> to modify:
>>
>> <http://fisheye2.cenqua.com/browse/antlr/src/org/antlr/codegen/ 
>> templates/Java/Java.stg?r=3682>
>>
>>
>> But I imagine it's a non-trivial task, and any change to the template
>> could have unanticipated ripple effects, so is not to be taken  
>> lightly...
>
> It isn't necessary to rebuild ANTLR. The StringTemplate files are
> entirely independent (with the exception of the data model) from  
> ANTLR.
> I suppose that it is only necessary to find in Java.stg the template
> which is responsible for the parser code and remove there the final
> keyword. A simple search for final in Java.stg should show the  
> suitable one.

But that file is inside the antlr-3.0.jar, isn't it? Don't you have  
to at the very least unpack the jar, modify the template, and then  
repackage the jar? That's what I meant when I said "rebuild"... but  
do you mean there's an easier way which doesn't require manipulation  
of the jar?

Cheers,
Wincent




More information about the antlr-interest mailing list