From: <bl...@us...> - 2003-07-31 18:31:53
|
Update of /cvsroot/cpptool/rfta/src/pyrfta/test/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv11700/rfta Modified Files: parser.py parsertest.py Log Message: * fixed class body parsing Index: parser.py =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/test/rfta/parser.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** parser.py 31 Jul 2003 08:00:06 -0000 1.1 --- parser.py 31 Jul 2003 18:31:50 -0000 1.2 *************** *** 708,714 **** | function_decl_p \ | friend_decl_p # enum, nested_class/struct, how ? - ! class_inheritance_and_body_decl = symbol_p( ":" ) >> anyuntil_p( "{" ) >> class_body_statements_p >> "}" template_instantiation_param_p3 = anyuntil_p( symbol_p(">") ) --- 708,715 ---- | function_decl_p \ | friend_decl_p # enum, nested_class/struct, how ? ! class_inheritance_p = maybe_p( (symbol_p( ":" ) >> anyuntil_p( "{" ))['inheritance'] ) ! ! class_inheritance_and_body_decl_p = class_inheritance_p >> "{" >> maybe_p(class_body_statements_p) >> "}" template_instantiation_param_p3 = anyuntil_p( symbol_p(">") ) *************** *** 720,724 **** class_decl_p = (symbol_p("class") | "struct") >> nested_id_p >> maybe_p(class_specialization_p) \ ! >> maybe_p( class_inheritance_and_body_decl ) >> eos_p statements = end_p \ --- 721,725 ---- class_decl_p = (symbol_p("class") | "struct") >> nested_id_p >> maybe_p(class_specialization_p) \ ! >> maybe_p( class_inheritance_and_body_decl_p ) >> eos_p statements = end_p \ Index: parsertest.py =================================================================== RCS file: /cvsroot/cpptool/rfta/src/pyrfta/test/rfta/parsertest.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** parsertest.py 31 Jul 2003 08:00:06 -0000 1.1 --- parsertest.py 31 Jul 2003 18:31:50 -0000 1.2 *************** *** 128,131 **** --- 128,132 ---- self.checkParser( "int **myVar[7][12]", parser.type_p >> parser.type_suffix_p >> parser.id_p >> parser.array_type_p ) self.checkParser( "::NameSpace::MyClass::myVar", parser.nested_id_p ) + self.checkParser( "class MyClass : public MyParent<MyClass,simple_traits> { };", parser.class_decl_p ) def checkParser( self, text, tested_parser ): *************** *** 133,137 **** scanner = parser.TokenProvider( tokens ) match = tested_parser.parse( scanner ) ! self.assert_( match, "nested_id_p should have matched source" ) remaining_tokens = [] while scanner.hasMoreToken() : --- 134,138 ---- scanner = parser.TokenProvider( tokens ) match = tested_parser.parse( scanner ) ! self.assert_( match, "parser should have matched source" ) remaining_tokens = [] while scanner.hasMoreToken() : |