/** * Attempts to parse a function call expression from token stream, given the first operand of the * expression. If parsing fails the stream is reset to its initial position. * * @param firstOperand preparsed function expression * @param tokens source token stream * @return FunctionCallExpression object or null if tokens don't form a valid function call * expression */ public static FunctionCallExpression parse(Expression firstOperand, TokenStream tokens) { FunctionCallExpression expr = null; ArgumentList argList = ArgumentList.parse(tokens); if (argList != null) expr = new FunctionCallExpression(firstOperand, argList, firstOperand.getPosition()); return expr; }
public ArrayLiteralExpression(Position position, final List<Expression> exprs) { super(position); this.exprs = exprs; this.exprGets = new ArrayList<>(); for (Expression each : exprs) { if (each != null) { this.exprGets.add(DynJSBootstrapper.factory().createGet(each.getPosition())); } else { this.exprGets.add(null); } } /* if (this.exprs.size() > 1 && (this.exprs.get(this.exprs.size() - 1) == null)) { this.exprs.remove(this.exprs.size() - 1); } */ }