[antlr-interest] Java annotations on generated parser code

Dave Rodgman dav1dr at eml.cc
Wed Dec 12 02:51:34 PST 2007


Hi,
        
I'd like the files ANTLR generates to contain annotations, so that I can
do something like (in Java, at least):

@parser::header {
    package ...;

    import ...Autogenerated;

    @Autogenerated
}

so that my ant scripts can identify autogenerated java files and delete
them as part of their clean target.

Unfortunately, ant puts some imports after the inserted header code, so
this fails.

Would it be possible for antlr to guarantee that the header code will be
inserted immediately before the class definition? Alternatively, the
java target could just split the annotations out and insert them further
down (though I can understand that that's a road you might not want to
go down).

thanks

Dave



More information about the antlr-interest mailing list