Rule composition() { return binary( selection(), FirstOf( functionWithBrackets(), variable() ), COMPOSITION ); }
Rule composition() { return binary( selection(), FirstOf( functionWithBrackets(), variable() ), COMPOSITION ); }
Rule selection() { return binary( isOperation(), FirstOf( functionWithBrackets(), mapEntry(), variable() ), SELECTION ); }
Rule selection() { return binary( isOperation(), FirstOf( functionWithBrackets(), mapEntry(), variable() ), SELECTION ); }
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 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 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 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 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 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") ) ); }
Rule block() { return Sequence( openCode(), keyword(BLOCK), mandatory( Sequence( expressionParser.variable(), push(new Block(((Variable) expressionParser.pop()).getIdentifier())), closeCode(), content(), (((Block) peek(1)).setContent(pop())), openCode(), keyword(ENDBLOCK), Optional( expressionParser.variable(), assertEqual( ((Block)peek()).getName(), ((Variable) expressionParser.pop()).getIdentifier() ) ), closeCode() ), new ParseException("Wrong block syntax") ) ); }
Rule block() { return Sequence( openCode(), keyword(BLOCK), mandatory( Sequence( expressionParser.variable(), push(new Block(((Variable) expressionParser.pop()).getIdentifier())), closeCode(), content(), (((Block) peek(1)).setContent(pop())), openCode(), keyword(ENDBLOCK), Optional( expressionParser.variable(), assertEqual( ((Block)peek()).getName(), ((Variable) expressionParser.pop()).getIdentifier() ) ), closeCode() ), new ParseException("Wrong block syntax") ) ); }