dcsimg
How to make my parser implement an interface?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sivakumar_Ekambaram
Posted On:   Friday, March 15, 2002 09:11 PM

I would like to make my parser implement an interface like
"class MyParser extends Parser implements MyInterface;".

Unfortunately ANTLR does not allow this. I do not want to go
and change the generated code(MyParser.java), instead try
to specify in the grammar(.g) file itself.

Is there any solution?

Thanks in advance for any replies.

Re: How to make my parser implement an interface?

Posted By:   Ian_Warner  
Posted On:   Monday, March 25, 2002 07:07 AM


The generated code extends the antlr.Parser class because you've declared so in the grammar file.



You could create own antlr.Parser sub-class (abstract if you wish) implementing your interface and declare in your grammar file:



class MyClass extends ParserImpl;


That should do the trick.

About | Sitemap | Contact