def check(target): class Config: cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(target, None, Config()) ast, isShorthand = parser.parse_xref_object() parser.assert_end()
def parse(name, string): class Config(object): cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(string, None, Config()) ast = parser.parse_declaration(name) parser.assert_end() # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): parser = DefinitionParser(string, None) ast = parser.parse_declaration(name) if not parser.eof: print("Parsing stopped at", parser.pos) print(string) print('-' * parser.pos + '^') raise DefinitionError("") # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): parser = DefinitionParser(string, None) ast = parser.parse_declaration(name) if not parser.eof: print("Parsing stopped at", parser.pos) print(string) print('-'*parser.pos + '^') raise DefinitionError("") # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): class Config(object): cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(string, None, Config()) ast = parser.parse_declaration(name) if not parser.eof: print("Parsing stopped at", parser.pos) print(string) print('-' * parser.pos + '^') raise DefinitionError("") # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): class Config(object): cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(string, None, Config()) ast = parser.parse_declaration(name) if not parser.eof: print("Parsing stopped at", parser.pos) print(string) print('-'*parser.pos + '^') raise DefinitionError("") # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): parser = DefinitionParser(string) res = getattr(parser, "parse_" + name + "_object")() if not parser.eof: print("Parsing stopped at", parser.pos) print(string) print('-' * parser.pos + '^') raise DefinitionError("") return res
def exprCheck(expr, id, id4=None): ids = 'IE1CIA%s_1aE' idDict = {2: ids % expr, 3: ids % id} if id4 is not None: idDict[4] = ids % id4 check('class', 'template<> C<a[%s]>' % expr, idDict) class Config: cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(expr, location=None, config=Config()) parser.allowFallbackExpressionParsing = False ast = parser.parse_expression() res = str(ast) if res != expr: print("") print("Input: ", expr) print("Result: ", res) raise DefinitionError("")
def parse(name, string): class Config: cpp_id_attributes = ["id_attr"] cpp_paren_attributes = ["paren_attr"] parser = DefinitionParser(string, location=None, config=Config()) parser.allowFallbackExpressionParsing = False ast = parser.parse_declaration(name, name) parser.assert_end() # The scopedness would usually have been set by CPPEnumObject if name == "enum": ast.scoped = None # simulate unscoped enum return ast
def parse(name, string): return getattr(DefinitionParser(string), 'parse_' + name)()