Package fasp.parser.tokenizer

Examples of fasp.parser.tokenizer.SymbolToken


    // Now parse the rule operator
    Token bodyOpTok = st.getNext();
    if(!bodyOpTok.getType().equals(Token.Type.SYMBOL))
      throw new ParseException(bodyOpTok.getLocation(),"body operator",bodyOpTok.toString());

    SymbolToken bodyOpSym = (SymbolToken)bodyOpTok;

    if(!BODYOPERATORS.containsKey(bodyOpSym.getSymbol()))
      throw new ParseException(st,unsupportedBodyOp(),bodyOpSym.getSymbol());

    MultiOperator bodyOp = BODYOPERATORS.get(bodyOpSym.getSymbol());

    // Parse the rule body
    ArrayList<Groundable> body = new BetweenParser<ArrayList<Groundable>,Token,Token>(
        new RuleBodyParser(),new TokenParser(Token.Type.OB),new TokenParser(Token.Type.CB)).parse(st);
View Full Code Here


      naf = true;
      Token negOpTok = st.getNext();
      if(!negOpTok.getType().equals(Token.Type.SYMBOL))
        throw new ParseException(negOpTok.getLocation(),"naf operator",negOpTok.toString());

      SymbolToken negOpSym = (SymbolToken)negOpTok;

      if(!NEGATIONOPERATORS.containsKey(negOpSym.getSymbol()))
        throw new ParseException(st,unsupportedNegationOp(),negOpSym.getSymbol());

      negOp = NEGATIONOPERATORS.get(negOpSym.getSymbol());
    }
    if(negSym.tryParse(st))
      neg = true;
    try {
      NonGroundPredicate p = new PredicateParser().parse(st);
View Full Code Here

  @Override
  public FaspConstant parse(TokenState st) throws ParseException {
    if (getResult() == null) {
      Token lookahead = st.lookahead();
      if(lookahead.getType().equals(Token.Type.SYMBOL)) {
        SymbolToken sym = (SymbolToken)lookahead;
        if(Character.isLowerCase(sym.getSymbol().charAt(0))) {
          st.eat();
          return new FaspConstant(sym.getSymbol());
        } else {
          throw new ParseException(st,"constant","variable");
        }
      } else {
        throw new ParseException(st,"constant",st.lookahead().toString());
View Full Code Here

  @Override
  public FaspVariable parse(TokenState st) throws ParseException {
    if (getResult() == null) {
      Token lookahead = st.lookahead();
      if(lookahead.getType().equals(Token.Type.SYMBOL)) {
        SymbolToken sym = (SymbolToken)lookahead;
        if(Character.isUpperCase(sym.getSymbol().charAt(0))) {
          st.eat();
          return new FaspVariable(sym.getSymbol());
        } else {
          throw new ParseException(st,"variable","constant");
        }
      } else {
        throw new ParseException(st,"variable",st.lookahead().toString());
View Full Code Here

TOP

Related Classes of fasp.parser.tokenizer.SymbolToken

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.