Package net.sf.lapg.test.oldparser.LapgParser

Examples of net.sf.lapg.test.oldparser.LapgParser.ParseException


  }

  private void setDefined(String ntype, boolean nisterm, String ninput, int nline) throws ParseException {
    if (isDefined) {
      if (nisterm != isTerm) {
        throw new ParseException((isTerm ? "redeclaring terminal `" + name + "` as non-terminal"
            : "redeclaring non-terminal `" + name + "` as terminal")
            + " at line " + nline + " (previously declared at " + this.line + ")");
      }
      if (this.type != null && ntype != null && !this.type.equals(ntype)) {
        throw new ParseException("redeclaring type for `" + name + "` at line " + nline
            + " (previously declared at line " + this.line + ")");
      }
    } else {
      if (line != 0) {
        input = ninput;
View Full Code Here


    }
  }

  void setTerminal(String type, boolean hasRegExp, String input, int line) throws ParseException {
    if (name.equals(CSyntax.INPUT)) {
      throw new ParseException("cannot declare terminal with name `" + name
          + "` (reserved non-terminal) at line " + line);
    }
    if (name.equals(CSyntax.ERROR) && hasRegExp) {
      throw new ParseException("cannot have regexp for symbol with name `" + name
          + "` (reserved non-terminal) at line " + line);
    }
    if (name.endsWith(CSyntax.OPTSUFFIX)) {
      throw new ParseException("cannot declare terminal with name `" + name + "` (" + CSyntax.OPTSUFFIX
          + " suffix is reserved for non-terms) at line " + line);
    }
    setDefined(type, true, input, line);
  }
View Full Code Here

    setDefined(type, true, input, line);
  }

  void setNonTerminal(String type, String input, int line) throws ParseException {
    if (name.endsWith(CSyntax.OPTSUFFIX) && line != 0) {
      throw new ParseException("cannot declare non-terminal with name `" + name + "` (" + CSyntax.OPTSUFFIX
          + " suffix symbols are generated automatically) at line " + line);
    }
    setDefined(type, false, input, line);
  }
View Full Code Here

TOP

Related Classes of net.sf.lapg.test.oldparser.LapgParser.ParseException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.