def p_formula_where_clause(t): """formula_where_clause : '[' LVALUE '.' QSTRING ']' | '[' formula ']' | ALL | QSTRING | """ if len(t) == 6: t[0] = formula(ast.leafmaker(stream.get_operator("w", ([t[2], t[4]], {}))), [(t[2], t[4])]) elif len(t) == 4: t[0] = t[2] elif len(t) == 2 and t[1] == "all": t[0] = formula(ast.leafmaker(stream.get_operator("w", (["uuid", ".*"], {}))), []) elif len(t) == 2: t[0] = formula(ast.leafmaker(stream.get_operator("w", (["x", t[1]], {}))), [("x", t[1])]) else: t[0] = formula(ast.leafmaker(stream.get_operator("null", ([], {}))), [])
def p_formula_where_clause(t): """formula_where_clause : '[' LVALUE '.' QSTRING ']' | '[' formula ']' | ALL | QSTRING | """ if len(t) == 6: t[0] = formula(ast.leafmaker(stream.get_operator('w', ([t[2], t[4]], {}))), [(t[2], t[4])]) elif len(t) == 4: t[0] = t[2] elif len(t) == 2 and t[1] == 'all': t[0] = formula(ast.leafmaker(stream.get_operator('w', (['uuid', '.*'], {}))), []) elif len(t) == 2: t[0] = formula(ast.leafmaker(stream.get_operator('w', (['x', t[1]], {}))), [('x', t[1])]) else: t[0] = formula(ast.leafmaker(stream.get_operator('null', ([], {}))), [])
def p_formula_comparator(t): """formula_comparator : formula comparator NUMBER | NUMBER comparator formula """ if is_number(t[1]): pass else: # have to initialize the comparison operator with an # appropriate inner AST node. usually this is done by the # parser... cmp = ast.nodemaker(stream.get_operator(cmp_names[t[2]], ([t[3]], {})), ast.leafmaker(stream.get_operator('null', ([], {})))) t[0] = formula(ast.nodemaker(stream.get_operator('nonzero', ([cmp], {})), t[1].ast), t[1].restrict)