def p_assignment_expr_nobf(self, p): """ assignment_expr_nobf \ : conditional_expr_nobf | left_hand_side_expr_nobf assignment_operator assignment_expr """ if len(p) == 2: p[0] = p[1] else: p[0] = ast.Assign(left=p[1], op=p[2], right=p[3])
def p_assignment_expr_noin(self, p): """ assignment_expr_noin \ : conditional_expr_noin | left_hand_side_expr assignment_operator assignment_expr_noin """ if len(p) == 2: p[0] = p[1] else: p[0] = ast.Assign(left=p[1], op=p[2], right=p[3], lineno=p.lineno(1))
def p_property_assignment(self, p): """property_assignment \ : property_name COLON assignment_expr | GETPROP property_name LPAREN RPAREN LBRACE function_body RBRACE | SETPROP property_name LPAREN formal_parameter_list RPAREN \ LBRACE function_body RBRACE """ if len(p) == 4: p[0] = ast.Assign(left=p[1], op=p[2], right=p[3]) elif len(p) == 8: p[0] = ast.GetPropAssign(prop_name=p[2], elements=p[6]) else: p[0] = ast.SetPropAssign(prop_name=p[2], parameters=p[4], elements=p[7])
def p_property_assignment(self, p): """property_assignment : property_name COLON assignment_expr""" if len(p) == 4: p[0] = ast.Assign(left=p[1], op=p[2], right=p[3])