Exemple #1
0
 def p_atom3(self, p):
     """atom : LPAR testlist_comp RPAR"""
     info = p[2]
     if isinstance(info, CommaSeparatedList):
         node = myast.Tuple(info.values, lineno=p.lineno(2))
     else:
         node = info
     p[0] = node
Exemple #2
0
 def p_fplist4(self, p):
     """fplist : fpdef fplist_list COMMA"""
     p[0] = myast.Tuple([p[1]] + p[2], lineno=p.lineno(2))
Exemple #3
0
 def p_fplist2(self, p):
     """fplist : fpdef COMMA"""
     p[0] = myast.Tuple([p[1]], lineno=p.lineno(1))
Exemple #4
0
 def p_atom1(self, p):
     """atom : LPAR RPAR"""
     p[0] = myast.Tuple()
Exemple #5
0
 def _ast_for_testlist(self, testlist):
     if isinstance(testlist, list):
         value = myast.Tuple()
     else:
         value = testlist
     return value