문제

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?

도움이 되었습니까?

해결책

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)
....
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top