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 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 elementar() { return FirstOf( mapEntry(), function(), map(), list(), variable(), constant(), Sequence( symbol(OPEN_PARENT), expression(), symbol(CLOSE_PARENT) ) ); }
Rule elementar() { return FirstOf( mapEntry(), function(), map(), list(), variable(), constant(), Sequence( symbol(OPEN_PARENT), expression(), symbol(CLOSE_PARENT) ) ); }
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 map() { return Sequence( symbol(OPEN_CURLY_BRACKET), push(new ValueMap()), mandatory( Sequence( Optional( variable(), symbol(DIV), expression(), ((ValueMap) peek(2)).add(popVariableName(1), pop()), ZeroOrMore( symbol(COMMA), variable(), symbol(DIV), expression(), ((ValueMap) peek(2)).add(popVariableName(1), pop()) ) ), symbol(CLOSE_CURLY_BRACKET) ), new ParseException("Wrong map syntax") ) ); }
Rule map() { return Sequence( symbol(OPEN_CURLY_BRACKET), push(new ValueMap()), mandatory( Sequence( Optional( variable(), symbol(DIV), expression(), ((ValueMap) peek(2)).add(popVariableName(1), pop()), ZeroOrMore( symbol(COMMA), variable(), symbol(DIV), expression(), ((ValueMap) peek(2)).add(popVariableName(1), pop()) ) ), symbol(CLOSE_CURLY_BRACKET) ), new ParseException("Wrong map 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 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") ) ); }
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") ) ); }
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") ) ); }
Rule enumeratedList() { return Sequence( symbol(OPEN_BRACKET), push(new ValueList()), mandatory( Sequence( Optional( expression(), ((ValueList) peek(1)).add(pop()), ZeroOrMore( symbol(COMMA), expression(), ((ValueList) peek(1)).add(pop()) ) ), symbol(CLOSE_BRACKET) ), new ParseException("Wrong list syntax") ) ); }
Rule enumeratedList() { return Sequence( symbol(OPEN_BRACKET), push(new ValueList()), mandatory( Sequence( Optional( expression(), ((ValueList) peek(1)).add(pop()), ZeroOrMore( symbol(COMMA), expression(), ((ValueList) peek(1)).add(pop()) ) ), symbol(CLOSE_BRACKET) ), new ParseException("Wrong list syntax") ) ); }
Rule functionWithBrackets() { return Sequence( variable(), symbol(OPEN_PARENT), push(new FunctionElement(popVariableName())), mandatory( Sequence( expression(), ((FunctionElement) peek(1)).add(pop()), ZeroOrMore( symbol(COMMA), expression(), ((FunctionElement) peek(1)).add(pop()) ), symbol(CLOSE_PARENT) ), new ParseException("Wrong function syntax") ) ); }
Rule functionWithBrackets() { return Sequence( variable(), symbol(OPEN_PARENT), push(new FunctionElement(popVariableName())), mandatory( Sequence( expression(), ((FunctionElement) peek(1)).add(pop()), ZeroOrMore( symbol(COMMA), expression(), ((FunctionElement) peek(1)).add(pop()) ), symbol(CLOSE_PARENT) ), new ParseException("Wrong function syntax") ) ); }