Parse infix string expression
@param infixExpression
@param values
@return
@throws ParseException
199432
public CList parse(String infixExpression, Object... values) throws ParseException {
        // get variable names
        LinkedHashMap<String, Num> vNames = mapValues(infixExpression, values);

        return parse(infixExpression, vNames);
    }
1083646
public static String getPostfixFromValue(String value) {
    String postfix = "";
    Matcher m = patternPrePostFix.matcher(value);
    if (m.find()) {
      postfix = m.group(2);

    }
    return postfix;
  }
423313
final public Expression ValuePrefix() throws ParseException {
  Expression ret;
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case INTEGER_LITERAL:
    case FLOATING_POINT_LITERAL:
    case STRING_LITERAL:
    case TRUE:
    case FALSE:
    case NULL:
      ret = Literal();
      break;
    case LPAREN:
      jj_consume_token(LPAREN);
      ret = Expression();
      jj_consume_token(RPAREN);
      break;
    default:
      jj_la1[27] = jj_gen;
      if (jj_2_1(2147483647)) {
        ret = FunctionInvocation();
      } else {
        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
        case IDENTIFIER:
          ret = NamedValue();
          break;
        default:
          jj_la1[28] = jj_gen;
          jj_consume_token(-1);
          throw new ParseException();
        }
      }
    }
      {if (true) return ret;}
    throw new Error("Missing return statement in function");
  }
260063
private static long parseExp(char[] in, int offset, int len){
        long exp = 0;
        offset++;
        char c = in[offset];
        len--;
        boolean negexp = (c == '-');
        // optional sign
        if (negexp || c == '+') {
            offset++;
            c = in[offset];
            len--;
        }
        if (len <= 0) // no exponent digits
            throw new NumberFormatException();
        // skip leading zeros in the exponent
        while (len > 10 && (c=='0' || (Character.digit(c, 10) == 0))) {
            offset++;
            c = in[offset];
            len--;
        }
        if (len > 10) // too many nonzero exponent digits
            throw new NumberFormatException();
        // c now holds first digit of exponent
        for (;; len--) {
            int v;
            if (c >= '0' && c <= '9') {
                v = c - '0';
            } else {
                v = Character.digit(c, 10);
                if (v < 0) // not a digit
                    throw new NumberFormatException();
            }
            exp = exp * 10 + v;
            if (len == 1)
                break; // that was final character
            offset++;
            c = in[offset];
        }
        if (negexp) // apply sign
            exp = -exp;
        return exp;
    }
387591
function parseExpression(str) {

  var expMatches = str.match(expressionRegex)

  // get the args from the second match
  // extract options from args using filter with side effect
  var options = {}
  var args = compact((expMatches[2] || '').split(argsRegex))
    .filter(function (arg) {
      var keyValue = arg.split('=')
      return keyValue.length === 1 || (options[keyValue[0]] = keyValue[1], false)
    })

  return {
    expression: expMatches[1] || null,
    args: args,
    options: options
  }
}
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();
    }
1039996
private static List<String> _evaluateValueExpressions(FacesContext context, List<String> values)
    {
        // note that we have to create a new List here, because if we
        // change any value on the given List, it will be changed in the
        // NavigationCase too and the EL expression won't be evaluated again
        List<String> target = new ArrayList<String>(values.size());
        for (String value : values)
        {
            if (_isExpression(value))
            {
                // evaluate the ValueExpression
                value = context.getApplication().evaluateExpressionGet(context, value, String.class);
            }
            target.add(value);
        }
        return target;
    }
449002
public static Set<String> parseParameterList(String values) {
		Set<String> result = new TreeSet<String>();
		if (values != null && values.trim().length() > 0) {
			// the spec says the scope is separated by spaces
			String[] tokens = values.split("[\\s+]");
			result.addAll(Arrays.asList(tokens));
		}
		return result;
	}
333627
final public List SetExpr() throws ParseException {
                   List ans = new ArrayList(); Selector elem;
    jj_consume_token(11);
    elem = Expression();
                              ans.add(elem);
    label_1:
    while (true) {
      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
      case 13:
        ;
        break;
      default:
        jj_la1[14] = jj_gen;
        break label_1;
      }
      jj_consume_token(13);
      elem = Expression();
                                ans.add(elem);
    }
    jj_consume_token(12);
    {if (true) return ans;}
    throw new Error("Missing return statement in function");
  }
833165
private Expression tryToWrapInSoyExpression(Expression expr) {
    switch (expr.resultType().getSort()) {
      case Type.BOOLEAN:
        return SoyExpression.forBool(expr);
      case Type.INT:
        return SoyExpression.forInt(BytecodeUtils.numericConversion(expr, Type.LONG_TYPE));
      case Type.LONG:
        return SoyExpression.forInt(expr);
      case Type.DOUBLE:
        return SoyExpression.forFloat(expr);
      case Type.OBJECT:
        if (expr.resultType().equals(BytecodeUtils.STRING_TYPE)) {
          return SoyExpression.forString(expr);
        }
        break;
      default:
        break;
    }
    // TODO(sameb): Maybe wrap List/SoyValue types too, as 'unknown' parameter types?
    return expr;
  }
1288128
private static int parseLimits(int i, int end, char[] data, int[] limits) throws PatternSyntaxException {
        if (limits.length != LIMITS_LENGTH)
            throw new IllegalArgumentException("limits.length=" + limits.length + ", should be " + LIMITS_LENGTH);
        limits[LIMITS_PARSE_RESULT_INDEX] = LIMITS_OK;
        int ind = 0;
        int v = 0;
        char c;
        while (i < end) {
            c = data[i++];
            switch (c) {
                case ' ':
                    continue;

                case ',':
                    if (ind > 0) throw new PatternSyntaxException("illegal construction: {.. , , ..}");
                    limits[ind++] = v;
                    v = -1;
                    continue;

                case '}':
                    limits[ind] = v;
                    if (ind == 0) limits[1] = v;
                    return i;

                default:
                    if (c > '9' || c < '0') {
                        //throw new PatternSyntaxException("illegal symbol in iterator: '{"+c+"}'");
                        limits[LIMITS_PARSE_RESULT_INDEX] = LIMITS_FAILURE;
                        return i;
                    }
                    if (v < 0) v = 0;
                    v = v * 10 + (c - '0');
            }
        }
        throw new PatternSyntaxException("malformed quantifier");
    }
128166
@NonNull
    public ArrayExpressionSatisfies in(@NonNull Expression expression) {
        if (expression == null) {
            throw new IllegalArgumentException("expression cannot be null.");
        }
        return new ArrayExpressionSatisfies(type, variable, expression);
    }
877722
private PExp readApplicatorExpression() throws ParserException,
			LexException
	{
		PExp exp = readBasicExpression();
		boolean more = true;

		while (more)
		{
			LexToken token = lastToken();

			switch (token.type)
			{
				case BRA:
					// Either sequence(from, ..., to) or func(args) or map(key)
					// or mk_*(), is_*(), mu(), pre_*(), post_*(),
					// init_*() or inv_*()

					if (nextToken().is(VDMToken.KET))
					{
						if (exp instanceof AVariableExp)
						{
							AVariableExp ve = (AVariableExp) exp;
							String name = ve.getName().getName();

							if (name.startsWith("mk_"))
							{
								// a mk_TYPE() with no field values
								exp = readMkExpression(ve);
								break;
							}
						}

						exp = AstFactory.newAApplyExp(exp);
						nextToken();
					} else
					{
						if (exp instanceof AVariableExp)
						{
							AVariableExp ve = (AVariableExp) exp;
							String name = ve.getName().getName();

							if (name.equals("mu"))
							{
								exp = readMuExpression(ve);
								break;
							} else if (name.startsWith("mk_"))
							{
								exp = readMkExpression(ve);
								break;
							} else if (name.startsWith("is_"))
							{
								exp = readIsExpression(ve);
								break;
							} else if (name.equals("pre_"))
							{
								exp = readPreExpression(ve);
								break;
							} else if (name.equals("narrow_"))
							{
								if (Settings.release == Release.CLASSIC)
								{
									throwMessage(2303, "Narrow not available in VDM classic", ve.getName());
								} else
								{
									exp = readNarrowExpression(ve);
								}
								break;
							}
						}

						// So we're a function/operation call, a list subsequence or
						// a map index...

						PExp first = readExpression();

						if (lastToken().is(VDMToken.COMMA))
						{
							reader.push();

							if (nextToken().is(VDMToken.RANGE))
							{
								nextToken();
								checkFor(VDMToken.COMMA, 2120, "Expecting 'e1,...,e2' in subsequence");
								PExp last = readExpression();
								checkFor(VDMToken.KET, 2121, "Expecting ')' after subsequence");
								reader.unpush();
								exp = AstFactory.newASubseqExp(exp, first, last);
								break;
							}

							reader.pop(); // Not a subsequence then...
						}

						// OK, so read a (list, of, arguments)...

						List<PExp> args = new NodeList<PExp>(null);
						args.add(first);

						while (ignore(VDMToken.COMMA))
						{
							args.add(readExpression());
						}

						checkFor(VDMToken.KET, 2122, "Expecting ')' after function args");
						exp = AstFactory.newAApplyExp(exp, args);
					}
					break;

				case SEQ_OPEN:
					// Polymorphic function instantiation
					List<PType> types = new Vector<PType>();
					TypeReader tr = getTypeReader();

					nextToken();
					types.add(tr.readType());

					while (ignore(VDMToken.COMMA))
					{
						types.add(tr.readType());
					}

					checkFor(VDMToken.SEQ_CLOSE, 2123, "Expecting ']' after function instantiation");
					exp = AstFactory.newAFuncInstatiationExp(exp, types);
					break;

				case POINT:
					// Field selection by name or number
					switch (nextToken().type)
					{
						case NAME:
							if (dialect != Dialect.VDM_SL)
							{
								exp = AstFactory.newAFieldExp(exp, lastNameToken());
							} else
							{
								throwMessage(2030, "Expecting simple field identifier");
							}
							break;

						case IDENTIFIER:
							exp = AstFactory.newAFieldExp(exp, lastIdToken());
							break;

						case HASH:
							if (nextToken().isNot(VDMToken.NUMBER))
							{
								throwMessage(2031, "Expecting field number after .#");
							}

							LexIntegerToken num = (LexIntegerToken) lastToken();
							exp = AstFactory.newAFieldNumberExp(exp, num);
							break;

						default:
							throwMessage(2032, "Expecting field name");
					}

					nextToken();
					break;

				default:
					more = false;
					break;
			}
		}

		// If we've collected as many applicators as we can, but we're still
		// just a variable, this is a bare variable expression. In VDM++, these
		// are always qualified (ie. x refers to C`x where it was declared, not
		// an overriding version lower down).

		if (exp instanceof AVariableExp)
		{
			AVariableExp ve = (AVariableExp) exp;
			ve.setName(ve.getName().getExplicit(true));
		}

		// Combinator Family. Right grouping.
		LexToken token = lastToken();

		if (token.is(VDMToken.COMP))
		{
			nextToken();
			return AstFactory.newACompBinaryExp(exp, token, readApplicatorExpression());
		}

		if (token.is(VDMToken.STARSTAR))
		{
			nextToken();
			return AstFactory.newAStarStarBinaryExp(exp, token, readEvaluatorP6Expression());
		}

		return exp;
	}
471376
def visitInlineShapeExpression(self, ctx: ShExDocParser.InlineShapeExpressionContext):
        
        expr_parser = ShexShapeExpressionParser(self.context)
        expr_parser.visitChildren(ctx)
        self.expression.valueExpr = expr_parser.expr
134872
def infix_handle(tokens):
    """"""
    func, args = get_infix_items(tokens, callback=infix_handle)
    return "(" + func + ")(" + ", ".join(args) + ")"
636290
protected function parseExpression($valueExpression)
    {
        // expressions are not longer than 2 characters
        $checkForExpression = substr($valueExpression, 0, 2);

        if (str_contains($checkForExpression, static::$validExpressions)) {
            foreach (static::$validExpressions as $expression) {
                if (substr($valueExpression, 0, strlen($expression)) === $expression) {
                    $this->expression = $expression;
                    $this->value = $this->transformValue(substr($valueExpression, strlen($expression)));

                    return;
                }
            }
        }

        // default to "equal to"
        $this->expression = '=';
        $this->value = $this->transformValue($valueExpression);
    }
723357
function parseExpressionAs(mode, code, tokens, flags, scope, parseMode) {
    var index = code.index,
        length = code.length,
        asToken,
        ch;

    if ( /* as */
        code.codePointAt(index) === 0x0061 &&
        code.codePointAt(index + 1) === 0x0073
    ) {
        index += 3;
    } else {
        return null;
    }

    for (; index < length; index++) {
        ch = code.codePointAt(index);
        if (!utils.isWhitespace(ch)) {
            break;
        }
    }

    if (code.codePointAt(index) !== 0x007c) { /* | */
        throw code.makeError(
            index,
            index + 1,
            'Unexpected Token: ' + JSON.stringify(code.charAt(index))
            .slice(1, -1)
        );
    }
    index++;

    asToken = new AsToken(code);

    code.index = index;

    var vars = [];
    scope.push(asToken);

    flags.asExpression = true;
    parseMode('LOGIC-AS', vars, flags);
    delete flags.asExpression;

    asToken.vars = vars.map(function (item) {
        return item.path[0];
    });

    if (vars.length < 1) {
        throw code.makeError(
            asToken.range[0],
            asToken.range[1],
            'Unexpected token: ' +
            JSON.stringify(
                asToken.source()
            )
            .slice(1, -1)
        );
    }

    return asToken;
}