[antlr-interest] Generic parser class
Sam Harwell
sharwell at pixelminegames.com
Tue Mar 31 10:06:46 PDT 2009
One possibility is you could derive a generic class from your parser, and place your action code in it. Create empty virtual functions in the parser itself as the placeholder for the actions. Does that cover what you need?
Sam
-----Original Message-----
From: Michael Sperber [mailto:sperber at deinprogramm.de]
Sent: Tuesday, March 31, 2009 11:58 AM
To: Sam Harwell
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] Generic parser class
"Sam Harwell" <sharwell at pixelminegames.com> writes:
> It doesn't currently support that. However, I've spent a fair bit of
> time looking into the possibilities of it. Can you give an idea of
> specifically what you're trying to accomplish with the generics, and
> if it falls into one of the areas I've worked on I can give some ideas
> on how to progress. :)
I just need a type parameter for the class. Currently, I have a sed
script replacing
public class XXXParser extends Parser { ... }
with
public class XXXParser<P extends Foo> extends Parser { ... }
That's exactly what I need done: The Java action code refers to that
type parameter.
--
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla
More information about the antlr-interest
mailing list