boolean popValue() { pop(); return true; } }
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") ) ); }
boolean popValue() { pop(); return true; } }
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") ) ); }
protected String popVariableName (int i) { return ((Variable) pop(i)).getIdentifier(); }
Rule functionWithoutBrackets() { return Sequence( variable(), TestNot( basic.spacing(), basic.terminal(SUB.toString()) ), expression(), push(new FunctionElement(popVariableName(1), pop())) ); }
protected String popVariableName (int i) { return ((Variable) pop(i)).getIdentifier(); }
Rule functionWithoutBrackets() { return Sequence( variable(), TestNot( basic.spacing(), basic.terminal(SUB.toString()) ), expression(), push(new FunctionElement(popVariableName(1), pop())) ); }
public Rule expression() { return Sequence( specificJtwigOperators(), push(simplify(pop())) ); }
public Rule expression() { return Sequence( specificJtwigOperators(), push(simplify(pop())) ); }
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 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 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 output() { return Sequence( symbol(OPEN_OUTPUT), mandatory( Sequence( expressionParser.expression(), push(new Output(expressionParser.pop())), basicParser.symbol(JtwigSymbol.CLOSE_OUTPUT) ), new ParseException("Wrong output syntax") ) ); }
Rule output() { return Sequence( symbol(OPEN_OUTPUT), mandatory( Sequence( expressionParser.expression(), push(new Output(expressionParser.pop())), basicParser.symbol(JtwigSymbol.CLOSE_OUTPUT) ), new ParseException("Wrong output syntax") ) ); }
Rule set() { return Sequence( openCode(), keyword(SET), mandatory( Sequence( expressionParser.variable(), push(new SetVariable((Variable) expressionParser.pop())), symbol(ATTR), expressionParser.expression(), ((SetVariable) peek(1)).setAssignment(expressionParser.pop()), closeCode() ), new ParseException("Wrong set syntax") ) ); }
Rule set() { return Sequence( openCode(), keyword(SET), mandatory( Sequence( expressionParser.variable(), push(new SetVariable((Variable) expressionParser.pop())), symbol(ATTR), expressionParser.expression(), ((SetVariable) peek(1)).setAssignment(expressionParser.pop()), closeCode() ), new ParseException("Wrong set syntax") ) ); }