Пример #1
0
	def import_dcl(self, pt):
		ast = Node(None, None, source = pt)
		ast.type = "cimport" #pt.leaf
		"""
		if pt.leaf == 'import':
			#imported_scope
			child = pt.the('imported_scope').children[0]
		elif pt.leaf == 'cimport':
			child = pt.the('anglequoted_scope').children[0]
		"""
		
		child = pt.children[0].children[0]
		assert child is not None
		
			
		
		if child.type == 'string_literal':
			ast.leaf = child.leaf
		elif child.type == 'scoped_name':
			ast.leaf = self.scoped_name(child)
		elif child.type == 'anglequoted_string_literal':
			ast.leaf = child.leaf
		else:
			ast = Node(None, child, source = pt)
			ast.type = 'import'
		return ast
Пример #2
0
	def member_list(self, ast, pt):
		members = Node(ast, None, source = pt)
		members.type = 'members'
		for child in pt.children:
			if child.type == 'member':
				typeref, new_type = self.type_spec(members, child.the('type_spec'))
				if new_type:
					if isinstance(typeref, str):
						pass
					else:
						members.add_child(typeref)
				members.add_children(self.create_instance_list(members, typeref, child.the('declarators').children))
			else:
				print 'memberlist_unknown' + child.type
		return [members]