سؤال

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