Rule constant() { return Sequence( constants.anyConstant(), push(constants.pop()), basic.spacing() ); }
public Rule expression() { return Sequence( specificJtwigOperators(), push(simplify(pop())) ); }
Rule constant() { return Sequence( constants.anyConstant(), push(constants.pop()), basic.spacing() ); }
public Rule expression() { return Sequence( specificJtwigOperators(), push(simplify(pop())) ); }
Rule keywordAsVariable(JtwigKeyword keyword) { return Sequence( basic.keyword(keyword), push(new Variable(basic.match())), basic.spacing() ); }
Rule variable() { return Sequence( basic.identifier(), push(new Variable(match())), basic.spacing() ); }
Rule variable() { return Sequence( basic.identifier(), push(new Variable(match())), basic.spacing() ); }
Rule keywordAsVariable(JtwigKeyword keyword) { return Sequence( basic.keyword(keyword), push(new Variable(basic.match())), basic.spacing() ); }
Rule comprehensionList() { return Sequence( constants.anyConstant(), basic.symbol(TWO_DOTS), constants.anyConstant(), push(ValueList.create(constants.pop(1), constants.pop())), basic.spacing() ); }
Rule comprehensionList() { return Sequence( constants.anyConstant(), basic.symbol(TWO_DOTS), constants.anyConstant(), push(ValueList.create(constants.pop(1), constants.pop())), basic.spacing() ); }
Rule functionWithoutBrackets() { return Sequence( variable(), TestNot( basic.spacing(), basic.terminal(SUB.toString()) ), expression(), push(new FunctionElement(popVariableName(1), pop())) ); }
Rule functionWithoutBrackets() { return Sequence( variable(), TestNot( basic.spacing(), basic.terminal(SUB.toString()) ), expression(), push(new FunctionElement(popVariableName(1), pop())) ); }
Rule mapEntry() { return Sequence( variable(), symbol(OPEN_BRACKET), mandatory( Sequence( expression(), symbol(CLOSE_BRACKET), push(new MapSelection((Variable) pop(1), pop())) ), new ParseException("Wring map selection syntax") ) ); }
Rule mapEntry() { return Sequence( variable(), symbol(OPEN_BRACKET), mandatory( Sequence( expression(), symbol(CLOSE_BRACKET), push(new MapSelection((Variable) pop(1), pop())) ), new ParseException("Wring map selection syntax") ) ); }
Rule unary(Rule innerRule, Operator... operators) { return Sequence( firstOperatorOf(operators), push(new OperationUnary(((Constant<Operator>) pop()).getValue())), mandatory( Sequence( innerRule, ((OperationUnary) peek(1)).setOperand(simplify(pop())) ), new ParseException("Wrong unary operator syntax") ) ); }
Rule unary(Rule innerRule, Operator... operators) { return Sequence( firstOperatorOf(operators), push(new OperationUnary(((Constant<Operator>) pop()).getValue())), mandatory( Sequence( innerRule, ((OperationUnary) peek(1)).setOperand(simplify(pop())) ), new ParseException("Wrong unary operator syntax") ) ); }
Rule functionWithTwoWordsAsName() { return Sequence( variable(), variable(), push(new FunctionElement(popVariableName(1)+" "+popVariableName())), mandatory( Sequence( expression(), ((FunctionElement) peek(1)).add(pop()) ), new ParseException("Wrong function named with two words syntax") ) ); }
Rule functionWithTwoWordsAsName() { return Sequence( variable(), variable(), push(new FunctionElement(popVariableName(1)+" "+popVariableName())), mandatory( Sequence( expression(), ((FunctionElement) peek(1)).add(pop()) ), new ParseException("Wrong function named with two words syntax") ) ); }
Rule binary(Rule first, Rule rest, Operator... operators) { return Sequence( first, push(new OperationBinary(simplify(pop()))), ZeroOrMore( firstOperatorOf(operators), ((OperationBinary) peek(1)).addOperator(((Constant<Operator>) pop()).getValue()), mandatory( Sequence( rest, ((OperationBinary) peek(1)).add(simplify(pop())) ), new ParseException("Wrong binary operation syntax") ) ) ); }
Rule ternaryOperation() { return Sequence( elementar(), push(new OperationTernary(pop())), symbol(QUESTION), mandatory( Sequence( expression(), ((OperationTernary) peek(1)).setIfTrueExpression(pop()), symbol(DIV), expression(), ((OperationTernary) peek(1)).setIfFalseExpression(pop()) ), new ParseException("Wring ternary operation syntax") ) ); }