コード例 #1
0
 public boolean parse(
     int level, Source source, boolean parentNot, boolean caseSensitive, boolean receive) {
   data.pushDefaultSyntaxError();
   boolean match = element.parse(level, source, parentNot, caseSensitive, receive);
   data.popDefaultSyntaxError();
   return match;
 }
コード例 #2
0
  // parse
  public ParsingResult parse(Source source) throws ParserException {
    net.sf.laja.parser.engine2.element.Element element = getGrammar1();

    boolean match = element.parse(0, source, false, true, false);
    int bestIndex = source.getBestIndex();

    if (match && source.reachedEnd()) {
      source.reset();
      element = getGrammar2();
      match = element.parse(0, source, false, true, true);
      if (!match) {
        throw new IllegalStateException(
            "The parsing result was true in phase 1, but false in phase 2.");
      }
      return new ParsingResult(true, source, syntaxErrorHandler);
    } else if (sourceRecorderLogWriter != null) {
      source.reset();
      source.getRecorder().setLogging(sourceRecorderLogWriter, bestIndex);
      element.parse(0, source, false, true, false);
    }

    return new ParsingResult(false, source, element, syntaxErrorHandler);
  }
コード例 #3
0
 public boolean isTerminal() {
   return element.isTerminal();
 }
コード例 #4
0
 public String getIdName() {
   return element.getIdName();
 }
コード例 #5
0
 public String getString() {
   return element.getString();
 }
コード例 #6
0
 public int getId() {
   return element.getId();
 }