def p_greater_equals(production): """expression : expression GREATER_EQUALS expression""" production[0] = GreaterEqualsOperatorNode( Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_less_equals(production): """expression : expression LESS_EQUALS expression""" production[0] = LessEqualsOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_less_than(production): """expression : expression LESS_THAN expression""" production[0] = LessThanOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_string_literal(production): """expression : STRING_LITERAL""" production[0] = StringNode(Metadata(production.lineno(1)), QLString, QLString([1]))
def p_question_computed(production): """question : STRING_LITERAL IDENTIFIER COLON type ASSIGN expression""" production[0] = QuestionNode(Metadata(production.lineno(1)), production[1], production[2], production[4], production[6], True)
def p_date_literal(production): """expression : DATE_LITERAL""" day, month, year = production[1] production[0] = DateNode(Metadata(production.lineno(1)), QLDate, QLDate(day, month, year))
def p_decimal_literal(production): """expression : DECIMAL_LITERAL""" production[0] = DecimalNode(Metadata(production.lineno(1)), QLDecimal, QLDecimal(production[1]))
def p_or(production): """expression : expression OR expression""" production[0] = OrOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_plus(production): """expression : expression PLUS expression""" production[0] = AdditionOperatorNode(Metadata(production.lineno(2)), QLUndefined, production[1], production[3], QLUndefined())
def p_negative(production): """expression : MINUS expression""" production[0] = NegativeOperatorNode(Metadata(production.lineno(1)), QLUndefined, production[2], QLUndefined())
def p_and(production): """expression : expression AND expression""" production[0] = AndOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_not(production): """expression : NOT expression""" production[0] = NegationOperatorNode(Metadata(production.lineno(1)), QLBoolean, production[2], QLUndefined())
def p_variable(production): """expression : IDENTIFIER""" production[0] = VariableNode(Metadata(production.lineno(1)), QLUndefined, production[1], QLUndefined())
def p_if(production): """if : IF condition block""" production[0] = IfNode(Metadata(production.lineno(1)), production[3], production[2])
def p_greater_than(production): """expression : expression GREATER_THAN expression""" production[0] = GreaterThanOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_minus(production): """expression : expression MINUS expression""" production[0] = SubtractionOperatorNode(Metadata(production.lineno(2)), QLUndefined, production[1], production[3], QLUndefined())
def p_boolean_literal(production): """expression : FALSE | TRUE""" production[0] = BooleanNode(Metadata(production.lineno(1)), QLBoolean, QLBoolean(production[1]))
def p_times(production): """expression : expression TIMES expression""" production[0] = MultiplicationOperatorNode( Metadata(production.lineno(2)), QLUndefined, production[1], production[3], QLUndefined())
def p_integer_literal(production): """expression : INTEGER_LITERAL""" production[0] = IntegerNode(Metadata(production.lineno(1)), QLInteger, QLInteger(production[1]))
def p_divide(production): """expression : expression DIVIDE expression""" production[0] = DivisionOperatorNode(Metadata(production.lineno(2)), QLUndefined, production[1], production[3], QLUndefined())
def p_money_literal(production): """expression : currency DECIMAL_LITERAL | currency INTEGER_LITERAL""" production[0] = MoneyNode(Metadata(production.lineno(1)), QLMoney, QLMoney(production[2], production[1]))
def p_not_equals(production): """expression : expression NOT_EQUALS expression""" production[0] = NotEqualsOperatorNode(Metadata(production.lineno(2)), QLBoolean, production[1], production[3], QLUndefined())
def p_form(production): """form : FORM IDENTIFIER block""" production[0] = FormNode(Metadata(production.lineno(1)), production[3], production[2])
def p_question(production): """question : STRING_LITERAL IDENTIFIER COLON type""" production[0] = QuestionNode( Metadata(production.lineno(1)), production[1], production[2], production[4], production[4].get_literal_node(production[4]()), False)