Ejemplo n.º 1
0
 def nonterminal(self, type, args):
     #
     #  Flatten AST a bit by not making nodes if there's only
     #  one child.
     #
     if len(args) == 1:
         return args[0]
     return GenericASTBuilder.nonterminal(self, type, args)
Ejemplo n.º 2
0
	def nonterminal(self, type, args):
		#
		#  Flatten AST a bit by not making nodes if there's only
		#  one child.
		#
		if len(args) == 1:
			return args[0]
		return GenericASTBuilder.nonterminal(self, type, args)
Ejemplo n.º 3
0
	def nonterminal(self, nt, args):
		collect = ('stmts', 'exprlist', 'kvlist')
		if nt in collect and len(args) > 1:
			rv = args[0]
			rv.append(args[1])
		else:
			rv = GenericASTBuilder.nonterminal(self, nt, args)
		return rv
Ejemplo n.º 4
0
    def nonterminal(self, nt, args):
        collect = ('stmts', 'exprlist', 'kvlist', '_stmts', 'print_items')

        if nt in collect and len(args) > 1:
            #
            #  Collect iterated thingies together.
            #
            rv = args[0]
            rv.append(args[1])
        else:
            rv = GenericASTBuilder.nonterminal(self, nt, args)
        return rv
Ejemplo n.º 5
0
    def nonterminal(self, nt, args):
        collect = ("stmts", "exprlist", "kvlist", "_stmts", "print_items")

        if nt in collect and len(args) > 1:
            #
            #  Collect iterated thingies together.
            #
            rv = args[0]
            rv.append(args[1])
        else:
            rv = GenericASTBuilder.nonterminal(self, nt, args)
        return rv
Ejemplo n.º 6
0
    def nonterminal(self, nt, args):
        collect = ('stmts', 'exprlist', 'kvlist')

        if nt in collect and len(args) > 1:
            #
            #  Collect iterated thingies together.
            #
            rv = args[0]
            rv.append(args[1])
        else:
            rv = GenericASTBuilder.nonterminal(self, nt, args)
        return rv
Ejemplo n.º 7
0
 def nonterminal(self, type, args):
     if len(args) == 1:
         return args[0]
     return GenericASTBuilder.nonterminal(self, type, args)