Ejemplo n.º 1
0
 def p_argument_expression_list(self, p):
     """ argument_expression_list    : assignment_expression
                                     | argument_expression_list COMMA assignment_expression
     """
     if len(p) == 2:
         p[0] = c_ast.ExprList([p[1]], p[1].coord)
     else:
         p[1].exprs.append(p[3])
         p[0] = p[1]
Ejemplo n.º 2
0
 def p_initializer_list(self, p):
     """ initializer_list    : initializer
                             | initializer_list COMMA initializer
     """
     if len(p) == 2: # single initializer
         p[0] = c_ast.ExprList([p[1]], p[1].coord)
     else:
         p[1].exprs.append(p[3])
         p[0] = p[1]
Ejemplo n.º 3
0
 def p_expression(self, p):
     """ expression  : assignment_expression
                     | expression COMMA assignment_expression
     """
     if len(p) == 2:
         p[0] = p[1]
     else:
         if not isinstance(p[1], c_ast.ExprList):
             p[1] = c_ast.ExprList([p[1]], p[1].coord)
         p[1].exprs.append(p[3])
         p[0] = p[1]