Parses the token stream to get the next expression

@param precedence The precedence of the next prefix expression
@return the next expression in the parse
@throws ParseException Something went wrong parsing
192375
public Expression next(int precedence) throws ParseException {
      ParserToken token;
      Expression result;

      do {
         token = tokenStream.consume();
         if (token == null) {
            return null;
         }
         result = grammar.parse(this, token);
      } while (result == null);


      //Consume things that will be skipped
      while (grammar.skip(tokenStream.lookAhead(0))) {
         tokenStream.consume();
      }

      while (precedence < grammar.precedence(tokenStream.lookAhead(0))) {
         token = tokenStream.consume();
         result = grammar.parse(this, result, token);
      }
      return result;
   }
1292260
public ParserToken consume(@NonNull ParserTokenType expectedType) throws ParseException {
      ParserToken next = consume();
      if (next == null || !expectedType.isInstance(next.type)) {
         throw new ParseException("Expected the next token to be of type " + expectedType + ", but found " + (next == null
                                                                                                              ? null
                                                                                                              : next.type));
      }
      return next;
   }
971826
ExprList exprList() {
		List<Expr> exprList = new ArrayList<Expr>();
		while (true) {
			Expr stat = expr();
			if (stat != null) {
				exprList.add(stat);
				if (peek().sym == Sym.COMMA) {
					move();
					if (peek() == EOF) {
						throw new ParseException("Expression error: can not match the char of comma ','", location);
					}
					continue ;
				}
			}
			break ;
		}
		return new ExprList(exprList);
	}
1010223
public static Expression parse(String input) throws ParseException {
        return new Parser(new StringReader(input), new Scope()).parse();
    }
505883
private void parseParenthesizedExpr() throws TTXPathException {

        consume(TokenType.OPEN_BR, true);
        if (!(mToken.getType() == TokenType.CLOSE_BR)) {
            parseExpression();
        }
        consume(TokenType.CLOSE_BR, true);

    }
77238
private ParseTree parseLogicalOR(Expression expressionIn) {
    SourcePosition start = getTreeStartLocation();
    ParseTree left = parseLogicalAND(expressionIn);
    while (peek(TokenType.OR)) {
      Token operator = eat(TokenType.OR);
      ParseTree right = parseLogicalAND(expressionIn);
      left = new BinaryOperatorTree(getTreeLocation(start), left, operator, right);
    }
    return left;
  }
1136525
public OperatorTable<T> infixr(
      Parser<? extends BiFunction<? super T, ? super T, ? extends T>> parser, int precedence) {
    ops.add(new Operator(parser, precedence, Associativity.RASSOC));
    return this;
  }
457807
public Object parse(InputStream in) throws ParseException, UnsupportedEncodingException {
		InputStreamReader i2 = new InputStreamReader(in, "utf8");
		return super.parse(i2);
	}
1000499
Expression XreadBooleanPrimaryOrNull() {

        Expression e = null;
        int        position;

        switch (token.tokenType) {

            case Tokens.EXISTS :
            case Tokens.UNIQUE :
                return XreadPredicate();

            case Tokens.ROW :
                read();
                readThis(Tokens.OPENBRACKET);

                e = XreadRowElementList(true);

                readThis(Tokens.CLOSEBRACKET);
                break;

            default :
                position = getPosition();

                try {
                    e = XreadAllTypesCommonValueExpression(false);
                } catch (HsqlException ex) {
                    ex.setLevel(compileContext.subQueryDepth);

                    if (lastError == null
                            || lastError.getLevel() < ex.getLevel()) {
                        lastError = ex;
                    }

                    rewind(position);
                }
        }

        if (e == null && token.tokenType == Tokens.OPENBRACKET) {
            read();

            position = getPosition();

            try {
                e = XreadRowElementList(true);

                readThis(Tokens.CLOSEBRACKET);
            } catch (HsqlException ex) {
                ex.setLevel(compileContext.subQueryDepth);

                if (lastError == null
                        || lastError.getLevel() < ex.getLevel()) {
                    lastError = ex;
                }

                rewind(position);

                e = XreadBooleanValueExpression();

                readThis(Tokens.CLOSEBRACKET);
            }
        }

        if (e != null) {
            e = XreadPredicateRightPart(e);
        }

        return e;
    }
1244736
public static ParsedExpression parse(String expression) {
        ParsedExpression pe = (ParsedExpression)PARSED_CACHE.get(expression);

        if(pe != null)
            return pe;

        try {
            NetUIELParser learn = new NetUIELParser(new StringReader(expression));

            ParsedExpression expr = learn.parse();
            expr.seal();

            /* infrequent; this should only happen when there is a cache miss */
            synchronized(PARSED_CACHE) {
                PARSED_CACHE.put(expression, expr);
            }

            return expr;
        } catch(ParseException e) {
            String msg = "Error occurred parsing expression \"" + expression + "\".";
            LOGGER.error(msg, e);
            throw new ExpressionParseException(msg, e);
        } catch(TokenMgrError tm) {
            String msg = "Error occurred parsing expression \"" + expression + "\".";
            LOGGER.error(msg, tm);
            throw new ExpressionParseException(msg, tm);
        }
    }
432832
private void parseInstanceOfExpr() throws TTXPathException {

        parseTreatExpr();

        if (is("instance", true)) {
            consume("of", true);

            mPipeBuilder.addInstanceOfExpr(getTransaction(), parseSequenceType());
        }
    }
1185705
public final CALC expression(String expression) throws ParseException {
        detectImplmentedExtension();
        
        if (infixParser == null)
            infixParser = new InfixParser();
        
        CList infix = infixParser.parse(useExtensions, getProperties(), expression);
        expression(infix, false);
        return getThis();
    }
332144
private void parseRangeExpr() throws TTXPathException {

        parseAdditiveExpr();
        if (is("to", true)) {

            mPipeBuilder.addExpressionSingle();

            parseAdditiveExpr();
            mPipeBuilder.addRangeExpr(getTransaction());

        }
    }
1053497
def _parse_next_token(self):
        """"""
        while self._position < self.limit:
            token = self._next_pattern()
            if token:
                return token

        return None
629147
final public void LiteralExpression() throws ParseException {
                                               /*@bgen(jjtree) LiteralExpression */
                                                AstLiteralExpression jjtn000 = new AstLiteralExpression(JJTLITERALEXPRESSION);
                                                boolean jjtc000 = true;
                                                jjtree.openNodeScope(jjtn000);Token t = null;
    try {
      t = jj_consume_token(LITERAL_EXPRESSION);
                             jjtree.closeNodeScope(jjtn000, true);
                             jjtc000 = false;
                             jjtn000.setImage(t.image);
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
1351781
public static List<Token> tokenize(String warpRawText, EvaluatorCompiler compiler) throws ExpressionCompileException {
    ArrayList<Token> tokens = new ArrayList<Token>();

    //simple state machine to iterate the text and break it up into chunks
    char[] characters = warpRawText.toCharArray();

    StringBuilder token = new StringBuilder();
    TokenizerState state = TokenizerState.READING_TEXT;
    for (int i = 0; i < characters.length; i++) {

      //test for start of an expression
      if (TokenizerState.READING_TEXT.equals(state)) {
        if ('$' == characters[i]) {
          if ('{' == characters[i + 1]) {
            //YES it is the start of an expr, so close up the existing token & start a new one
            if (token.length() > 0) {
              tokens.add(CompiledToken.text(token.toString()));
              token = new StringBuilder();
            }

            state = TokenizerState.READING_EXPRESSION;
          }
        }
      }

      //test for end of an expr
      if (TokenizerState.READING_EXPRESSION.equals(state)) {
        if ('}' == characters[i]) {
          //YES it is the end of the expr, so close it up and start a new token
          token.append(characters[i]);

          tokens.add(CompiledToken.expression(token.toString(), compiler));
          token = new StringBuilder();

          state = TokenizerState.READING_TEXT;
          continue;   //dont add the trailing } to the new text field
        }
      }

      //add characters to the token normally
      token.append(characters[i]);
    }

    //should never be in reading expr mode at this point
    if (TokenizerState.READING_EXPRESSION.equals(state))
      throw new IllegalStateException("Error. Expression was not terminated properly: " + token.toString());

    //add last token read if it has any content (is always text)
    if (token.length() > 0)
      tokens.add(CompiledToken.text(token.toString()));

    // Pack list capacity to size (saves memory).
    tokens.trimToSize();

    return tokens;
  }
199432
public CList parse(String infixExpression, Object... values) throws ParseException {
        // get variable names
        LinkedHashMap<String, Num> vNames = mapValues(infixExpression, values);

        return parse(infixExpression, vNames);
    }