[antlr-interest] Re: Constructors

Pete Forman pete.forman at westerngeco.com
Mon Jul 8 05:46:30 PDT 2002

At 2002-07-08 12:26 +0200, Ric Klaren wrote:
>Or are you trying to add a new parameter less constructor? For that
>we would need an option to suppress the default constructors.. but
>you are more likely to run into trouble when upgrading antlr

Yes.  It might be done by adding an ANTLR specification that
constructors will generate code like this.

public MyParser() {
public void antlrMyParser() {

Then in the .g file the user could write a constructor that included a
call to the ANTLR-generated antlrMyParser().  ANTLR would then have to
recognize constructors (perhaps by an option) and suppress its
generation of them.

But overall I don't think that this complexity is justified.  I've
reorganized my code to avoid this problem.  Another solution would
have been to edit the generated code.

Pete Forman                -./\.-  Disclaimer: This post is originated
WesternGeco                  -./\.-   by myself and does not represent
pete.forman at westerngeco.com    -./\.-   opinion of Schlumberger, Baker
http://petef.port5.com           -./\.-   Hughes or their divisions.


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list