superclass fred;
class fred extends Parser implements MyInterface ....
Or you may find it easier to just have the superclass implement ANTLR
things like error message handling and have it contain an instance of
myInterface, which you can then call from the grammar as a helper class.
You can then use different implementations of the helper interface to do
different things:
class fred extends Parser {
MyInterface visitor;
void setVisitor(MyInterface visitor) { this.visitor = visitor; }
...
Jim
> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of krithika sridhar
> Sent: Tuesday, May 24, 2011 10:09 PM
> To: [email protected]
> Subject: [antlr-interest] parser to implement an interface
>
> Hi everybody..
>
> I am using ANTLRS plugin with eclipse n i have a combined grammar.I
> want my parser to implement an interface that i have written.I
> understand that the solution to this is to extend a class (using
> superClass option) which implements the required interface.BUT,using
> the "superClass= someClass"
> option overrides the default behaviour,which is, to extend the
> org.antlr.runtime base class Parser.So this approach,gives errors in
> the generated code.I want to extend the Parser base class, at the same
> time implement some other interface.
>
> Is that possible ?
> Thanks in advance
>
> cheers
> Krithika
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.