Exemple #1
0
 def _var_dcl_array_init_node(self, type_, args):
     root = None
     if type_ == 'field':
         root = nodes.FieldDclAssignNode()
     elif type_ == 'local':
         root = nodes.VarDclAssignNode()
     root.add_child(args[0])
     assign_node = nodes.AssignNode()
     array_node = None
     try:
         array_node = nodes.create_array_dcl(args[1].attr, args[2])
     except AttributeError:
         array_node = nodes.create_array_dcl(args[2].attr, args[1])
     assign_node.add_child(array_node)
     assign_node.add_child(args[4])
     root.add_child(assign_node)
     return root
Exemple #2
0
 def p_var_dcl_array2(self, args):
     """ var_dcl ::= type ID array_brackets ; """
     root = nodes.VarDclNode()
     root.add_child(args[0])
     root.add_child(nodes.create_array_dcl(args[1].attr, args[2]))
     return root
Exemple #3
0
 def p_param_list_array_base1(self, args):
     """ param_list ::= type array_brackets ID """
     root = nodes.ParamDclNode()
     root.add_child(args[0])
     root.add_child(nodes.create_array_dcl(args[2].attr, args[1]))
     return [root]
Exemple #4
0
 def p_param_list_array2(self, args):
     """ param_list ::= param_list , type ID array_brackets """
     root = nodes.ParamDclNode()
     root.add_child(args[2])
     root.add_child(nodes.create_array_dcl(args[3].attr, args[4]))
     return args[0] + [root]
Exemple #5
0
 def p_field_dcl_array2_rest(self, args):
     """ field_dcl_rest ::= type ID array_brackets ; """
     root = nodes.FieldDclNode()
     root.add_child(args[0])
     root.add_child(nodes.create_array_dcl(args[1].attr, args[2]))
     return root