Pergunta

I am trying to build a application that can handle different language parsers and was wondering if there is a way to generate a common interface for all parsers that javacc generates. I have a PHPParser, ScalaParser etc.. and they each extend PHPConstants and ScalaConstants by default, is there a way to have them extend a common interface?

Foi útil?

Solução

You can have each of your parsers implement a common interface. However, no interface is generated. It's up to you to write the interface

For example:

PARSER_BEGIN(ScalaParser)
package parsers.scalaParsing;

import parsers.CommonInterface;

public class ScalaParser implements CommonInterface
{
  ...
}
PARSER_END(ScalaParser)
....
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top