You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(37) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(26) |
Mar
(97) |
Apr
(224) |
May
(226) |
Jun
|
Jul
(3) |
Aug
(22) |
Sep
(48) |
Oct
|
Nov
|
Dec
(38) |
2004 |
Jan
(28) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(37) |
Jul
|
Aug
(73) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <bl...@us...> - 2003-05-03 20:40:28
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv22545/src/rftaparser Modified Files: EnumBodyParserTest.cpp Log Message: * changed RFTA_ASSERT_NODE_HAS to support variable argument count and source range. Index: EnumBodyParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/EnumBodyParserTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** EnumBodyParserTest.cpp 3 May 2003 17:43:44 -0000 1.1 --- EnumBodyParserTest.cpp 3 May 2003 20:40:22 -0000 1.2 *************** *** 83,87 **** SourceASTNodePtr source_Node = RFTA_ASSERT_PARSER_PASS2( EnumBodyParser, source_, source_.length() ); ASTNodePtr bodyNode = source_Node->getChildAt(0); ! RFTA_ASSERT_NODE_HAS( bodyNode, ASTNodeTypes::enumBody, 0, builder_->getSource().length() ); RFTA_ASSERT_EQUAL( constantCount, bodyNode->getChildCount() ); for ( int index =0; index < constantCount; ++index ) --- 83,91 ---- SourceASTNodePtr source_Node = RFTA_ASSERT_PARSER_PASS2( EnumBodyParser, source_, source_.length() ); ASTNodePtr bodyNode = source_Node->getChildAt(0); ! RFTA_ASSERT_NODE_HAS( bodyNode, ! ASTNodeTypes::enumBody, ! 0, ! builder_->getSource().length(), ! "enum-body node" ); RFTA_ASSERT_EQUAL( constantCount, bodyNode->getChildCount() ); for ( int index =0; index < constantCount; ++index ) *************** *** 102,111 **** ASTNodeTypes::enumConstant, builder_->getStartIndex(constantKey), ! builder_->getLength(constantKey) ); ASTNodePtr identifierNode = constantNode->getProperty( ASTNodeProperties::variableNameProperty ); RFTA_ASSERT_NODE_HAS( identifierNode, ASTNodeTypes::variableIdentifier, builder_->getStartIndex(identifierKey), ! builder_->getLength(identifierKey) ); if ( !builder_->hasKey( initializerKey ) ) CPPUNIT_ASSERT( !constantNode->hasProperty( ASTNodeProperties::variableInitializerProperty ) ); --- 106,117 ---- ASTNodeTypes::enumConstant, builder_->getStartIndex(constantKey), ! builder_->getLength(constantKey), ! constantKey ); ASTNodePtr identifierNode = constantNode->getProperty( ASTNodeProperties::variableNameProperty ); RFTA_ASSERT_NODE_HAS( identifierNode, ASTNodeTypes::variableIdentifier, builder_->getStartIndex(identifierKey), ! builder_->getLength(identifierKey), ! identifierKey ); if ( !builder_->hasKey( initializerKey ) ) CPPUNIT_ASSERT( !constantNode->hasProperty( ASTNodeProperties::variableInitializerProperty ) ); *************** *** 117,121 **** ASTNodeTypes::assignVariableInitializerExpression, builder_->getStartIndex( initializerKey ), ! builder_->getLength( initializerKey ) ); ASTNodePtr valueNode = initializerNode->getProperty( ASTNodeProperties::valueProperty ); --- 123,128 ---- ASTNodeTypes::assignVariableInitializerExpression, builder_->getStartIndex( initializerKey ), ! builder_->getLength( initializerKey ), ! initializerKey ); ASTNodePtr valueNode = initializerNode->getProperty( ASTNodeProperties::valueProperty ); *************** *** 124,128 **** ASTNodeTypes::valueExpression, builder_->getStartIndex( valueKey ), ! builder_->getLength( valueKey ) ); } } --- 131,136 ---- ASTNodeTypes::valueExpression, builder_->getStartIndex( valueKey ), ! builder_->getLength( valueKey ), ! valueKey ); } } |
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv22456/src/rftaparser Modified Files: ForStatementParserTest.cpp ParserTesting.h UnparsedDeclarationListMutatorTest.cpp UnparsedDeclarationMutatorTest.cpp Log Message: * changed RFTA_ASSERT_NODE_HAS to support variable argument count and source range. Index: ForStatementParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ForStatementParserTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForStatementParserTest.cpp 25 Apr 2003 08:19:31 -0000 1.3 --- ForStatementParserTest.cpp 3 May 2003 20:40:06 -0000 1.4 *************** *** 144,148 **** ASTNodeTypes::forStatement, startIndex, ! endIndex-startIndex ); RFTA_ASSERT_NODE_PROPERTY_HAS( forAST, --- 144,149 ---- ASTNodeTypes::forStatement, startIndex, ! endIndex-startIndex, ! "for-statement node" ); RFTA_ASSERT_NODE_PROPERTY_HAS( forAST, Index: ParserTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserTesting.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ParserTesting.h 1 May 2003 18:53:20 -0000 1.5 --- ParserTesting.h 3 May 2003 20:40:06 -0000 1.6 *************** *** 17,41 **** }; ! struct NodeTypeAsserter : public Asserter<NodeTypeAsserter> { ! void operator()( const ASTNodePtr &node, ! const ASTNodeType &expectedType, ! const std::string &whichNode = "node" ) { ! failIf( !node, "invalid node: " + whichNode ); checkEquals( expectedType.getName(), node->getType().getName(), whichNode + ": bad node type." ); } - }; ! struct NodeAsserter : public Asserter<NodeAsserter> ! { ! void operator()( const ASTNodePtr &node, ! const ASTNodeType &type, ! int index, ! int length, ! const std::string &whichNode = "node" ) { ! NodeTypeAsserter().chain( *this )( node, type, whichNode ); checkEquals( type.getName(), node->getType().getName(), --- 17,38 ---- }; ! struct NodeAsserter : public Asserter<NodeAsserter> { ! void checkNodeType( const ASTNodePtr &node, ! const ASTNodeType &expectedType, ! const std::string &whichNode = "node" ) { ! failIf( !node, "invalid node (NULL): " + whichNode ); checkEquals( expectedType.getName(), node->getType().getName(), whichNode + ": bad node type." ); } ! void checkNode( const ASTNodePtr &node, ! const ASTNodeType &type, ! int index, ! int length, ! const std::string &whichNode = "node" ) { ! checkNodeType( node, type, whichNode ); checkEquals( type.getName(), node->getType().getName(), *************** *** 46,59 **** whichNode + ": bad node length." ); } - }; ! struct NodePropertyAsserter : public Asserter<NodePropertyAsserter> ! { ! void operator()( const ASTNodePtr &node, ! const ASTNodeProperty &property, ! const ASTNodeType &type, ! int index, ! int length, ! const std::string &whichNode ) { std::string what = whichNode + ", property=" + property.getName(); --- 43,63 ---- whichNode + ": bad node length." ); } ! ! void checkNode( const ASTNodePtr &node, ! const ASTNodeType &type, ! const SourceRange &range, ! const std::string &whichNode = "node" ) ! { ! checkNode( node, type, range.getStartIndex(), range.getLength(), whichNode ); ! } ! ! ! void checkNodeProperty( const ASTNodePtr &node, ! const ASTNodeProperty &property, ! const ASTNodeType &type, ! int index, ! int length, ! const std::string &whichNode = "node" ) { std::string what = whichNode + ", property=" + property.getName(); *************** *** 61,65 **** fail( what + ": does not exist" ); ! NodeAsserter().chain(*this)( node->getProperty( property ), type, index, length, what ); } }; --- 65,79 ---- fail( what + ": does not exist" ); ! checkNode( node->getProperty( property ), type, index, length, what ); ! } ! ! ! void checkNodeProperty( const ASTNodePtr &node, ! const ASTNodeProperty &property, ! const ASTNodeType &type, ! const SourceRange &range, ! const std::string &whichNode = "node" ) ! { ! checkNodeProperty( node, property, type, range.getStartIndex(), range.getLength(), whichNode ); } }; *************** *** 258,271 **** } ! #define RFTA_ASSERT_NODE_TYPE( node, expectedType ) \ ! RFTA_CUSTOM_ASSERT( ::Refactoring::Testing::NodeTypeAsserter )( node, expectedType, #node ) ! #define RFTA_ASSERT_NODE_HAS( node, type, index, length ) \ ! RFTA_CUSTOM_ASSERT( Refactoring::Testing::NodeAsserter )( node, type, index, length, #node ) ! #define RFTA_ASSERT_NODE_PROPERTY_HAS( node, property, type, index, length ) \ ! RFTA_CUSTOM_ASSERT( Refactoring::Testing::NodePropertyAsserter )( \ ! node, property, type, index, length, \ ! #node ) #define RFTA_ASSERT_PARSER_FAIL( ParserType, source ) \ --- 272,283 ---- } ! #define RFTA_ASSERT_NODE_TYPE \ ! RFTA_CUSTOM_ASSERT( ::Refactoring::Testing::NodeAsserter ).checkNodeType ! #define RFTA_ASSERT_NODE_HAS \ ! RFTA_CUSTOM_ASSERT( Refactoring::Testing::NodeAsserter ).checkNode ! #define RFTA_ASSERT_NODE_PROPERTY_HAS \ ! RFTA_CUSTOM_ASSERT( Refactoring::Testing::NodeAsserter ).checkNodeProperty #define RFTA_ASSERT_PARSER_FAIL( ParserType, source ) \ Index: UnparsedDeclarationListMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationListMutatorTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UnparsedDeclarationListMutatorTest.cpp 1 May 2003 21:13:29 -0000 1.4 --- UnparsedDeclarationListMutatorTest.cpp 3 May 2003 20:40:06 -0000 1.5 *************** *** 145,149 **** // check parsing results: // check post condition: ! RFTA_ASSERT_NODE_TYPE( classBody, ASTNodeTypes::declarationList ); RFTA_ASSERT_EQUAL( 3, classBody->getChildCount() ); RFTA_ASSERT_NODE_HAS( classBody->getChildAt(0), --- 145,149 ---- // check parsing results: // check post condition: ! RFTA_ASSERT_NODE_TYPE( classBody, ASTNodeTypes::declarationList, "class" ); RFTA_ASSERT_EQUAL( 3, classBody->getChildCount() ); RFTA_ASSERT_NODE_HAS( classBody->getChildAt(0), Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** UnparsedDeclarationMutatorTest.cpp 3 May 2003 18:06:37 -0000 1.10 --- UnparsedDeclarationMutatorTest.cpp 3 May 2003 20:40:06 -0000 1.11 *************** *** 179,188 **** ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(1), ASTNodeTypes::simpleTypeSpecifier); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(2), ASTNodeTypes::simpleTypeSpecifier); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator ); } --- 179,188 ---- ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(1), ASTNodeTypes::simpleTypeSpecifier, "specifier-1"); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(2), ASTNodeTypes::simpleTypeSpecifier, "specifier-2"); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 202,209 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator ); } --- 202,209 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 227,231 **** ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ASTNodePtr specifier = specifierList->getChildAt(1); ! RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier ); // CHECK CLASS BODY PROPERTY !! --- 227,231 ---- ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ASTNodePtr specifier = specifierList->getChildAt(1); ! RFTA_ASSERT_NODE_TYPE( specifier, ASTNodeTypes::classSpecifier, "class-specifier" ); // CHECK CLASS BODY PROPERTY !! *************** *** 238,242 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator ); } --- 238,242 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 255,259 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier ); } --- 255,259 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier, "class-specifier" ); } *************** *** 266,270 **** ASTNodePtr classNode = sourceNode->getChildAt(0); ! RFTA_ASSERT_NODE_TYPE( classNode, ASTNodeTypes::declaration ); } --- 266,270 ---- ASTNodePtr classNode = sourceNode->getChildAt(0); ! RFTA_ASSERT_NODE_TYPE( classNode, ASTNodeTypes::declaration, "class" ); } *************** *** 284,288 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::enumSpecifier ); } --- 284,288 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::enumSpecifier, "enum-specifier" ); } *************** *** 303,307 **** ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ASTNodePtr enumSpecifier = specifierList->getChildAt(0); - RFTA_ASSERT_NODE_TYPE( enumSpecifier, ASTNodeTypes::enumSpecifier ); RFTA_ASSERT_NODE_HAS( enumSpecifier, ASTNodeTypes::enumSpecifier, source.getKeyedIndex(SPECIFIER,0), --- 303,306 ---- *************** *** 325,332 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 324,331 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 346,353 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 345,352 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 368,375 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 367,374 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 390,397 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 389,396 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 412,419 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 411,418 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 447,454 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 446,453 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 468,475 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::elaboratedTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 467,474 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::elaboratedTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 489,493 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::elaboratedTypeSpecifier ); } --- 488,492 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::elaboratedTypeSpecifier, "specifier-0" ); } *************** *** 507,514 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 506,513 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::classSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 528,535 **** // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 527,534 ---- // check specifier types: ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); ! RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::simpleTypeSpecifier, "specifier-0" ); // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 547,551 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 546,550 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 564,568 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 563,567 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 581,585 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 580,584 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 598,602 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 597,601 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator" ); } *************** *** 616,620 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 615,619 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 633,637 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 632,636 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 651,655 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 650,654 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 670,674 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 669,673 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 688,692 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 687,691 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 705,709 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 704,708 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 723,727 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 722,726 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 741,745 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 740,744 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 761,765 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 760,764 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 780,784 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 779,783 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 798,802 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 797,801 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } *************** *** 816,820 **** // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } --- 815,819 ---- // check declarator types: ! RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator, "declarator"); } |
From: <bl...@us...> - 2003-05-03 18:06:40
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv9891/src/rftaparser Modified Files: DeclarationDetailsParser.cpp UnparsedDeclarationMutatorTest.cpp UnparsedDeclarationMutatorTest.h Log Message: * bug fix: parsing error if there was a space between '~' and the destructor name. Index: DeclarationDetailsParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DeclarationDetailsParser.cpp 3 May 2003 17:41:38 -0000 1.5 --- DeclarationDetailsParser.cpp 3 May 2003 18:06:37 -0000 1.6 *************** *** 584,587 **** --- 584,588 ---- if ( tryNextIs( '~' ) ) { // handle destructor (buggy, need to ensure not followed by const or volatile) + skipSpaces(); } Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** UnparsedDeclarationMutatorTest.cpp 3 May 2003 17:43:12 -0000 1.9 --- UnparsedDeclarationMutatorTest.cpp 3 May 2003 18:06:37 -0000 1.10 *************** *** 728,731 **** --- 728,749 ---- void + UnparsedDeclarationMutatorTest::testVirtualDestructorMemberWithSpace() + { + Testing::KeyedString source; + source.addKeyed(SPECIFIER , "virtual" ) << " "; + source.addKeyed(DECLARATOR, "~ Destructor()" ) << ";"; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + ASTNodePtr node = sourceAST->getChildAt(0); + + // check AST: + RFTA_ASSERT_DECLARATION( source, sourceAST ); + + // check declarator types: + RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); + } + + + void UnparsedDeclarationMutatorTest::testMemberPure() { Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UnparsedDeclarationMutatorTest.h 3 May 2003 17:43:13 -0000 1.6 --- UnparsedDeclarationMutatorTest.h 3 May 2003 18:06:37 -0000 1.7 *************** *** 48,51 **** --- 48,52 ---- CPPUNIT_TEST( testDestructorMember ); CPPUNIT_TEST( testVirtualDestructorMember ); + CPPUNIT_TEST( testVirtualDestructorMemberWithSpace ); CPPUNIT_TEST( testMemberPure ); CPPUNIT_TEST( testMemberConstInit ); *************** *** 92,95 **** --- 93,97 ---- void testDestructorMember(); void testVirtualDestructorMember(); + void testVirtualDestructorMemberWithSpace(); void testMemberPure(); void testMemberConstInit(); |
From: <bl...@us...> - 2003-05-03 17:52:31
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv4695/src/rfta Modified Files: SourceBasedTestBase.h Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest Index: SourceBasedTestBase.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/SourceBasedTestBase.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SourceBasedTestBase.h 6 Mar 2003 22:18:41 -0000 1.6 --- SourceBasedTestBase.h 3 May 2003 17:52:24 -0000 1.7 *************** *** 6,14 **** #define RFTA_SOURCEBASEDTESTBASE_H - #include "SourceBuilder.h" #include "UnitTesting.h" #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include <rfta/parser/SourceASTNode.h> namespace Refactoring --- 6,14 ---- #define RFTA_SOURCEBASEDTESTBASE_H #include "UnitTesting.h" #include <boost/shared_ptr.hpp> #include <boost/utility.hpp> #include <rfta/parser/SourceASTNode.h> + #include <rfta/test/SourceBuilder.h> namespace Refactoring |
From: <bl...@us...> - 2003-05-03 17:47:50
|
Update of /cvsroot/cpptool/rfta/bug In directory sc8-pr-cvs1:/tmp/cvs-serv3121a/bug Modified Files: List.txt Log Message: * fixed enum parsing bug Index: List.txt =================================================================== RCS file: /cvsroot/cpptool/rfta/bug/List.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** List.txt 2 May 2003 06:22:25 -0000 1.3 --- List.txt 3 May 2003 17:47:47 -0000 1.4 *************** *** 25,42 **** --- - unamed enum: (audacity\freqwindow.cpp.html) - enum { - FirstID = 7000, - - FreqCloseButtonID, - FreqExportButtonID, - FreqAlgChoiceID, - FreqSizeChoiceID, - FreqFuncChoiceID, - FreqAxisChoiceID - }; - ==> parse failure - - --- MFC macros (dc++\hubframe.h.html) BEGIN_MSG_MAP(HubFrame) --- 25,28 ---- |
From: <bl...@us...> - 2003-05-03 17:45:41
|
Update of /cvsroot/cpptool/rfta/doc In directory sc8-pr-cvs1:/tmp/cvs-serv2432/doc Modified Files: AbstractSyntaxSTreeStructure.txt Log Message: * updated structure for the enum specifier Index: AbstractSyntaxSTreeStructure.txt =================================================================== RCS file: /cvsroot/cpptool/rfta/doc/AbstractSyntaxSTreeStructure.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** AbstractSyntaxSTreeStructure.txt 26 Apr 2003 10:47:56 -0000 1.8 --- AbstractSyntaxSTreeStructure.txt 3 May 2003 17:45:38 -0000 1.9 *************** *** 90,93 **** --- 90,104 ---- [elaborated-type-specifier] // something like "class xxx", "struct y" or simply "UserTypePtr" + [enum-specifier] + enumeration-body-property => [enum-body] + ... ? // some other stuffs ? + + [enum-body] + n [enum-constant] + + [enum-constant] + variable-name-property => [#variable-identifier-expression] + ?variable-initializer-property => [assign-variable-initializer] + [ptr-declarator] ?ptr-declarator-property => [#unparsed] |
From: <bl...@us...> - 2003-05-03 17:45:16
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv2327/include/rfta/parser Modified Files: ASTNodes.h Log Message: * added a link at the top of the generated page to jump to the ast Index: ASTNodes.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ASTNodes.h,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** ASTNodes.h 29 Apr 2003 10:29:16 -0000 1.19 --- ASTNodes.h 3 May 2003 17:45:13 -0000 1.20 *************** *** 57,60 **** --- 57,66 ---- static const ASTNodeType functionImplementation; + // body for an enum, e.g. "{ x = 3, ... }" + static const ASTNodeType enumBody; + + // const declaration in an enum body for an enum, e.g. "x = 3" + static const ASTNodeType enumConstant; + // declaration level: // ////////////////// |
From: <bl...@us...> - 2003-05-03 17:45:16
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv2327/src/rftaparser Modified Files: ASTNodes.cpp Log Message: * added a link at the top of the generated page to jump to the ast Index: ASTNodes.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ASTNodes.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** ASTNodes.cpp 29 Apr 2003 22:00:53 -0000 1.22 --- ASTNodes.cpp 3 May 2003 17:45:13 -0000 1.23 *************** *** 34,37 **** --- 34,39 ---- const ASTNodeType ASTNodeTypes::elaboratedTypeSpecifier ( "elaborated-type-specifier" , 0 ); const ASTNodeType ASTNodeTypes::unparsedDeclarator ( "unparsed-declarator" , 0 ); + const ASTNodeType ASTNodeTypes::enumBody( "enum-body" , 0 ); + const ASTNodeType ASTNodeTypes::enumConstant( "enum-constant" , 0 ); const ASTNodeType ASTNodeTypes::unparsedCompoundStatement( "unparsed-compound-statement", isCompositeStatement | needMutation ); |
From: <bl...@us...> - 2003-05-03 17:45:15
|
Update of /cvsroot/cpptool/rfta/src/astdumper In directory sc8-pr-cvs1:/tmp/cvs-serv2327/src/astdumper Modified Files: ASTDumper.cpp Log Message: * added a link at the top of the generated page to jump to the ast Index: ASTDumper.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ASTDumper.cpp 1 May 2003 09:08:08 -0000 1.8 --- ASTDumper.cpp 3 May 2003 17:45:12 -0000 1.9 *************** *** 144,150 **** --- 144,158 ---- HTMLWriter writer( stream ); writer.writeHeader( title ); + + HTMLWriter::Tagger linkTagger( "A", writer.getStream(), + "HREF=\"#AST\"", HTMLWriter::newLine ); + writer.write( "Jump to abstract syntax tree" ); + linkTagger.end(); writer.writeH2( "Source:" ); writer.writePreformated( source ); + HTMLWriter::Tagger anchorTagger( "A", writer.getStream(), + "NAME=\"#AST\"", HTMLWriter::newLine ); + anchorTagger.end(); writer.writeH2( "Abstract syntax tree:" ); bool succeed = writeAST( source, writer ); |
From: <bl...@us...> - 2003-05-03 17:43:48
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv1937/src/rftaparser Added Files: EnumBodyParser.cpp EnumBodyParser.h EnumBodyParserTest.cpp EnumBodyParserTest.h Log Message: * new parser for enum body. Start at the { --- NEW FILE: EnumBodyParser.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2003/05/02 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "EnumBodyParser.h" #include <rfta/parser/ASTNodes.h> #include <rfta/parser/ParseContext.h> #include <rfta/parser/ParserTools.h> namespace Refactoring { EnumBodyParser::EnumBodyParser( ParseContext &context, const char *start, const char *end ) : Parser( context, start, end ) { } EnumBodyParser::~EnumBodyParser() { } void EnumBodyParser::parse() { Tracker tracker( "EnumBodyParser::tryParse", *this ); Xtl::CStringView body( findBodyRange() ); ASTNodePtr bodyNode = createASTNode( ASTNodeTypes::enumBody, getParentNode(), body ); Xtl::CStringEnumerator current( body.getStart()+1, body.getEnd()-1 ); while ( current.hasNext() ) { ParserTools::skipSpaces( current ); Xtl::CStringView identifier = ParserTools::readNextIdentifier( current ); ASTNodePtr enumConstantNode = makeEnumConstantNode( bodyNode, identifier ); parseConstantInitializer( enumConstantNode, current ); enumConstantNode->setEndIndex( getIndexOf(current) ); bodyNode->addChild( enumConstantNode ); } context_.addNode( bodyNode ); current_ = body.getEnd(); } Xtl::CStringView EnumBodyParser::findBodyRange() { skipSpaces(); Xtl::CStringView body( current_, end_ ); expect('{'); findNextBalanced('{','}'); body.setEnd( current_ ); return body; } ASTNodePtr EnumBodyParser::makeEnumConstantNode( const ASTNodePtr &bodyNode, const Xtl::CStringView &identifier ) { ASTNodePtr constantNode = createASTNode( ASTNodeTypes::enumConstant, bodyNode, identifier ); ASTNodePtr identifierNode = createASTNode( ASTNodeTypes::variableIdentifier, constantNode, identifier ); constantNode->setPropertyNode( ASTNodeProperties::variableNameProperty, identifierNode ); return constantNode; } void EnumBodyParser::parseConstantInitializer( const ASTNodePtr &enumConstantNode, Xtl::CStringEnumerator ¤t ) { Xtl::CStringView initializer( current ); if ( isInitializerEnd( current ) ) return; Xtl::CStringView value = parseInitializerValue( current, initializer ); addInitializerNodes( enumConstantNode, initializer, value ); } bool EnumBodyParser::isInitializerEnd( Xtl::CStringEnumerator ¤t ) { ParserTools::skipSpaces( current ); if ( !current.hasNext() ) return true; if ( *current != ',' ) return false; ++current; return true; } Xtl::CStringView EnumBodyParser::parseInitializerValue( Xtl::CStringEnumerator ¤t, Xtl::CStringView &initializer ) { if ( *current != '=' ) throw ParserTools::ParseError( "syntax error in enum constant declaration.", current ); ParserTools::skipSpaces( ++current ); Xtl::CStringView value( current ); Xtl::CStringBackEnumerator valueEnum; if ( !ParserTools::trySkipUntil( current, ',', ParserTools::SkipExpressionPolicy() ) ) { current.setCurrent( current.getString().getEnd() ); valueEnum = current; } else valueEnum = current - 1; initializer.setEnd( current ); ParserTools::skipSpaces( valueEnum ); value.setEnd( valueEnum ); return value; } void EnumBodyParser::addInitializerNodes( const ASTNodePtr &enumConstantNode, const Xtl::CStringView &initializer, const Xtl::CStringView &value ) { ASTNodePtr initializerNode = createASTNode( ASTNodeTypes::assignVariableInitializerExpression, enumConstantNode, initializer ); ASTNodePtr valueNode = createASTNode( ASTNodeTypes::valueExpression, initializerNode, value ); initializerNode->setPropertyNode( ASTNodeProperties::valueProperty, valueNode ); enumConstantNode->setPropertyNode( ASTNodeProperties::variableInitializerProperty, initializerNode ); } } // namespace Refactoring --- NEW FILE: EnumBodyParser.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2003/05/02 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_ENUMBODYPARSER_H #define RFTA_ENUMBODYPARSER_H #include <rfta/parser/Parser.h> #include <xtl/Forwards.h> namespace Refactoring { /// This class represents class RFTAPARSER_API EnumBodyParser : public Parser { public: /*! Constructs a EnumBodyParser object. */ EnumBodyParser( ParseContext &context, const char *start, const char *end ); virtual ~EnumBodyParser(); void parse(); private: Xtl::CStringView findBodyRange(); ASTNodePtr makeEnumConstantNode( const ASTNodePtr &bodyNode, const Xtl::CStringView &identifier ); void parseConstantInitializer( const ASTNodePtr &enumConstantNode, Xtl::CStringEnumerator ¤t ); Xtl::CStringView parseInitializerValue( Xtl::CStringEnumerator ¤t, Xtl::CStringView &initializer ); void addInitializerNodes( const ASTNodePtr &enumConstantNode, const Xtl::CStringView &initializer, const Xtl::CStringView &value ); bool isInitializerEnd( Xtl::CStringEnumerator ¤t ); }; // Inlines methods for EnumBodyParser: // ----------------------------------- } // namespace Refactoring #endif // RFTA_ENUMBODYPARSER_H --- NEW FILE: EnumBodyParserTest.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2003/05/02 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "EnumBodyParserTest.h" #include "EnumBodyParser.h" #include <xtl/Type.h> #include <rfta/parser/ASTNodes.h> #include <boost/lexical_cast.hpp> namespace Refactoring { namespace Testing { struct ParserAsserter : Asserter<ParserAsserter> { template<typename ParserType> SourceASTNodePtr checkParse( const std::string &source, int endIndex, Xtl::Type<ParserType> ) { SourceASTNodePtr sourceNode = SourceASTNode::create( source, source ); ParseContext context( sourceNode ); ParserType parser( context, sourceNode->getBlankedSourceStart(), sourceNode->getBlankedSourceEnd() ); parser.parse(); CppUnit::Message message( "parsing did not stop at the expected position", std::string( "using parser: " ) + typeid(ParserType).name(), "Source:\n" + source ); checkEquals( endIndex, parser.getCurrentIndex(), message ); return sourceNode; } }; #define RFTA_ASSERT_PARSER_PASS2( ParserType, source, endIndex ) \ RFTA_CUSTOM_INIT_ASSERT( ::Refactoring::Testing::ParserAsserter() ).checkParse( \ source, endIndex, Xtl::Type<ParserType>() ); } // namespace Testing RFTAPARSER_TEST_SUITE_REGISTRATION( EnumBodyParserTest ); EnumBodyParserTest::EnumBodyParserTest() { } EnumBodyParserTest::~EnumBodyParserTest() { } void EnumBodyParserTest::setUp() { source_ = ""; builder_.reset( new Testing::SourceBuilder( source_ ) ); constantNumber_ = -1; } void EnumBodyParserTest::tearDown() { source_ = ""; } void EnumBodyParserTest::checkConstants( int constantCount ) { SourceASTNodePtr source_Node = RFTA_ASSERT_PARSER_PASS2( EnumBodyParser, source_, source_.length() ); ASTNodePtr bodyNode = source_Node->getChildAt(0); RFTA_ASSERT_NODE_HAS( bodyNode, ASTNodeTypes::enumBody, 0, builder_->getSource().length() ); RFTA_ASSERT_EQUAL( constantCount, bodyNode->getChildCount() ); for ( int index =0; index < constantCount; ++index ) checkConstant( index, bodyNode->getChildAt(index) ); } void EnumBodyParserTest::checkConstant( int index, const ASTNodePtr &constantNode ) { std::string number = boost::lexical_cast<std::string>( index ); std::string constantKey = "CONSTANT" + number; std::string identifierKey = "IDENTIFIER" + number; std::string initializerKey = "INITIALIZER" + number; std::string valueKey = "VALUE" + number; RFTA_ASSERT_NODE_HAS( constantNode, ASTNodeTypes::enumConstant, builder_->getStartIndex(constantKey), builder_->getLength(constantKey) ); ASTNodePtr identifierNode = constantNode->getProperty( ASTNodeProperties::variableNameProperty ); RFTA_ASSERT_NODE_HAS( identifierNode, ASTNodeTypes::variableIdentifier, builder_->getStartIndex(identifierKey), builder_->getLength(identifierKey) ); if ( !builder_->hasKey( initializerKey ) ) CPPUNIT_ASSERT( !constantNode->hasProperty( ASTNodeProperties::variableInitializerProperty ) ); else { ASTNodePtr initializerNode = constantNode->getProperty( ASTNodeProperties::variableInitializerProperty ); CPPUNIT_ASSERT( initializerNode ); RFTA_ASSERT_NODE_HAS( initializerNode, ASTNodeTypes::assignVariableInitializerExpression, builder_->getStartIndex( initializerKey ), builder_->getLength( initializerKey ) ); ASTNodePtr valueNode = initializerNode->getProperty( ASTNodeProperties::valueProperty ); CPPUNIT_ASSERT( valueNode ); RFTA_ASSERT_NODE_HAS( valueNode, ASTNodeTypes::valueExpression, builder_->getStartIndex( valueKey ), builder_->getLength( valueKey ) ); } } void EnumBodyParserTest::beginEnumBody() { builder_->addKeyed( "{", "BODY" ); } void EnumBodyParserTest::endEnumBody() { builder_->add( "}" ); builder_->extend( "BODY" ); } std::string EnumBodyParserTest::makeKey( const std::string &prefix ) { return prefix + boost::lexical_cast<std::string>( constantNumber_ ); } void EnumBodyParserTest::addConstant( const std::string &name, bool addComma ) { ++constantNumber_; std::string constantKey = makeKey( "CONSTANT" ); builder_->mark( constantKey ); builder_->addKeyed( name, makeKey( "IDENTIFIER" ) ); if ( addComma ) builder_->add( "," ); builder_->extend( constantKey ); } void EnumBodyParserTest::addConstantValue( const std::string &name, const std::string &spacer, const std::string &value, bool addComma ) { addConstant( name, false ); std::string initializerKey = makeKey( "INITIALIZER" ); builder_->addKeyed( spacer, initializerKey ); builder_->addKeyed( value, makeKey( "VALUE" ) ); if ( addComma ) builder_->add( "," ); builder_->extend( initializerKey ); builder_->extend( makeKey( "CONSTANT" ) ); } void EnumBodyParserTest::testParseEmptyEnumBody() { source_ = "{}"; checkConstants( 0 ); } void EnumBodyParserTest::testParseOneConstant() { beginEnumBody(); addConstant( "first", false ); endEnumBody(); checkConstants( 1 ); } void EnumBodyParserTest::testParseOneConstantWithValue() { beginEnumBody(); addConstantValue( "first", " = ", "1234", false ); endEnumBody(); checkConstants( 1 ); } void EnumBodyParserTest::testParseOneConstantSkipTrailingComma() { beginEnumBody(); addConstantValue( "first", " = ", "1234" ); endEnumBody(); checkConstants( 1 ); } void EnumBodyParserTest::testParseTwoConstantWithSpaces() { beginEnumBody(); addConstant( "first" ); source_ += " "; addConstant( "two", false ); endEnumBody(); checkConstants( 2 ); } void EnumBodyParserTest::testParseThreeConstant() { beginEnumBody(); addConstant( "one" ); addConstant( "two" ); addConstant( "three", false ); endEnumBody(); checkConstants( 3 ); } void EnumBodyParserTest::testParseThreeConstantWithValue() { beginEnumBody(); addConstantValue( "one", " =", "1234" ); addConstant( "two" ); addConstantValue( "three", " = ", "one +4", false ); endEnumBody(); checkConstants( 3 ); } void EnumBodyParserTest::testParseTemplatedValue() { beginEnumBody(); addConstantValue( "value", " = ", "boost::is_convertible<int,T>::value", false ); endEnumBody(); checkConstants( 1 ); } void EnumBodyParserTest::testParseLeftShitOperatorValue() { beginEnumBody(); addConstant( "first" ); addConstantValue( "two", "=", "first << 1", false ); endEnumBody(); checkConstants( 1 ); } } // namespace Refactoring --- NEW FILE: EnumBodyParserTest.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2003/05/02 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_ENUMBODYPARSERTEST_H #define RFTA_ENUMBODYPARSERTEST_H #include "ParserTesting.h" #include <rfta/test/SourceBuilder.h> #include <boost/shared_ptr.hpp> namespace Refactoring { /// Unit tests for EnumBodyParserTest class EnumBodyParserTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE( EnumBodyParserTest ); CPPUNIT_TEST( testParseEmptyEnumBody ); CPPUNIT_TEST( testParseOneConstant ); CPPUNIT_TEST( testParseOneConstantWithValue ); CPPUNIT_TEST( testParseOneConstantSkipTrailingComma ); CPPUNIT_TEST( testParseTwoConstantWithSpaces ); CPPUNIT_TEST( testParseThreeConstant ); CPPUNIT_TEST( testParseThreeConstantWithValue ); CPPUNIT_TEST( testParseTemplatedValue ); // CPPUNIT_TEST( testParseLeftShitOperatorValue ); CPPUNIT_TEST_SUITE_END(); public: /*! Constructs a EnumBodyParserTest object. */ EnumBodyParserTest(); /// Destructor. virtual ~EnumBodyParserTest(); void setUp(); void tearDown(); void testParseEmptyEnumBody(); void testParseOneConstant(); void testParseOneConstantWithValue(); void testParseOneConstantSkipTrailingComma(); void testParseTwoConstantWithSpaces(); void testParseThreeConstant(); void testParseThreeConstantWithValue(); void testParseTemplatedValue(); void testParseLeftShitOperatorValue(); private: void checkConstants( int constantCount ); void checkConstant( int index, const ASTNodePtr &constantNode ); void beginEnumBody(); void endEnumBody(); void addConstant( const std::string &name, bool addComma = true ); void addValue( const std::string &spacer, const std::string &value, bool addComma = true ); void addConstantValue( const std::string &name, const std::string &spacer, const std::string &value, bool addComma = true ); std::string makeKey( const std::string &prefix ); std::string source_; boost::shared_ptr<Testing::SourceBuilder> builder_; int constantNumber_; }; // Inlines methods for EnumBodyParserTest: // --------------------------------------- } // namespace Refactoring #endif // RFTA_ENUMBODYPARSERTEST_H |
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv1782/src/rftaparser Modified Files: CPPParserTest.cpp CPPParserTest.h DeclarationListParserTest.cpp DeclarationListParserTest.h UnparsedDeclarationMutatorTest.cpp UnparsedDeclarationMutatorTest.h Log Message: * added test for unnamed enum & enum body parsing bug. Index: CPPParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CPPParserTest.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CPPParserTest.cpp 29 Apr 2003 22:04:28 -0000 1.1 --- CPPParserTest.cpp 3 May 2003 17:43:12 -0000 1.2 *************** *** 108,110 **** --- 108,122 ---- + void + CPPParserTest::testParseAllEnumDeclaration() + { + const std::string source( + "enum X {\n" + " FirstID = 7000\n" + "};" ); + + CPPParser parser( source ); + parser.parseAll(); + } + } // namespace Refactoring Index: CPPParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CPPParserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CPPParserTest.h 29 Apr 2003 22:04:29 -0000 1.1 --- CPPParserTest.h 3 May 2003 17:43:12 -0000 1.2 *************** *** 22,25 **** --- 22,26 ---- CPPUNIT_TEST( testParseFunctionInNestedNamespace ); CPPUNIT_TEST( testParseFunctionInClassDeclaration ); + CPPUNIT_TEST( testParseAllEnumDeclaration ); CPPUNIT_TEST_SUITE_END(); *************** *** 39,42 **** --- 40,45 ---- void testParseFunctionInNestedNamespace(); void testParseFunctionInClassDeclaration(); + + void testParseAllEnumDeclaration(); private: Index: DeclarationListParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationListParserTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationListParserTest.cpp 15 Apr 2003 19:05:16 -0000 1.3 --- DeclarationListParserTest.cpp 3 May 2003 17:43:12 -0000 1.4 *************** *** 9,12 **** --- 9,13 ---- #include <rfta/parser/ASTNodes.h> #include <rfta/parser/DeclarationListParser.h> + #include "KeyedString.h" *************** *** 66,69 **** --- 67,90 ---- endIndex+1, 6 ); + } + + + void + DeclarationListParserTest::testUnamedEnumDeclaration() + { + const std::string source( + " enum { a, b, c = 3 }; " ); + int startIndex = 2; + int endIndex = source.length()-1; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_PARSER_PASS( DeclarationListParser, + source, + source.length() ); + RFTA_ASSERT_EQUAL( 1, sourceAST->getChildCount() ); + RFTA_ASSERT_NODE_HAS( sourceAST->getChildAt(0), + ASTNodeTypes::unparsedDeclaration, + startIndex, + endIndex-startIndex ); + } Index: DeclarationListParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationListParserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeclarationListParserTest.h 12 Apr 2003 19:08:40 -0000 1.1 --- DeclarationListParserTest.h 3 May 2003 17:43:12 -0000 1.2 *************** *** 19,22 **** --- 19,23 ---- CPPUNIT_TEST_SUITE( DeclarationListParserTest ); CPPUNIT_TEST( testTemplateFuntionFollowedByDecl ); + CPPUNIT_TEST( testUnamedEnumDeclaration ); CPPUNIT_TEST_SUITE_END(); *************** *** 33,36 **** --- 34,38 ---- void testTemplateFuntionFollowedByDecl(); + void testUnamedEnumDeclaration(); private: Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** UnparsedDeclarationMutatorTest.cpp 1 May 2003 21:54:40 -0000 1.8 --- UnparsedDeclarationMutatorTest.cpp 3 May 2003 17:43:12 -0000 1.9 *************** *** 285,290 **** --- 285,312 ---- ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); RFTA_ASSERT_NODE_TYPE( specifierList->getChildAt(0), ASTNodeTypes::enumSpecifier ); + } + + + void + UnparsedDeclarationMutatorTest::testUnamedEnumDeclaration() + { + Testing::KeyedString source; + source.addKeyed(SPECIFIER , "enum { a = 0, b, c }" ) << ";"; + + SourceASTNodePtr sourceAST = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + ASTNodePtr node = sourceAST->getChildAt(0); + // check AST: + RFTA_ASSERT_DECLARATION( source, sourceAST ); + + // check specifier types: + ASTNodePtr specifierList = node->getProperty( ASTNodeProperties::declarationSpecifiersProperty ); + ASTNodePtr enumSpecifier = specifierList->getChildAt(0); + RFTA_ASSERT_NODE_TYPE( enumSpecifier, ASTNodeTypes::enumSpecifier ); + RFTA_ASSERT_NODE_HAS( enumSpecifier, ASTNodeTypes::enumSpecifier, + source.getKeyedIndex(SPECIFIER,0), + source.getKeyedLen(SPECIFIER,0) ); } + void Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** UnparsedDeclarationMutatorTest.h 1 May 2003 21:54:40 -0000 1.5 --- UnparsedDeclarationMutatorTest.h 3 May 2003 17:43:13 -0000 1.6 *************** *** 25,28 **** --- 25,29 ---- CPPUNIT_TEST( testClassForwardDeclaration ); CPPUNIT_TEST( testEnumDeclaration ); + CPPUNIT_TEST( testUnamedEnumDeclaration ); CPPUNIT_TEST( testPointerDecl ); CPPUNIT_TEST( testFctPointer ); *************** *** 69,72 **** --- 70,74 ---- void testClassForwardDeclaration(); void testEnumDeclaration(); + void testUnamedEnumDeclaration(); void testPointerDecl(); void testFctPointer(); |
From: <bl...@us...> - 2003-05-03 17:41:41
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv1395/src/rftaparser Modified Files: DeclarationDetailsParser.cpp DeclarationDetailsParser.h Log Message: * fixed enum body parsing bug (was looking for a ';' during parsing). Now using a specific parser: EnumBodyParser Index: DeclarationDetailsParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DeclarationDetailsParser.cpp 1 May 2003 21:54:40 -0000 1.4 --- DeclarationDetailsParser.cpp 3 May 2003 17:41:38 -0000 1.5 *************** *** 10,13 **** --- 10,14 ---- #include <rfta/parser/ParseContext.h> #include <rfta/parser/DeclarationListParser.h> + #include "EnumBodyParser.h" *************** *** 403,420 **** } void DeclarationDetailsParser::readClassOrEnumSpecifier( const ASTNodePtr& specifier, std::string keyword ) { - ASTNodePtr body; - if ( keyword == "class" || keyword == "struct" || keyword == "union" ) ! body = readClassSpecifierBodySkippingInheritance( specifier ); ! else ! body = readEnumSpecifierBody( specifier ); ! findNextBalanced('{','}'); ! body->setEndIndex( getCurrentIndex() ); // do not count the last '}' } --- 404,424 ---- } + void DeclarationDetailsParser::readClassOrEnumSpecifier( const ASTNodePtr& specifier, std::string keyword ) { if ( keyword == "class" || keyword == "struct" || keyword == "union" ) ! { ! ASTNodePtr body = readClassSpecifierBodySkippingInheritance( specifier ); ! findNextBalanced('{','}'); ! body->setEndIndex( getCurrentIndex() ); // do not count the last '}' ! } ! else ! { ! readEnumSpecifierBody( specifier ); ! } } *************** *** 435,442 **** ! ASTNodePtr DeclarationDetailsParser::readEnumSpecifierBody( const ASTNodePtr& specifier ) { specifier->mutateType( ASTNodeTypes::enumSpecifier ); expect('{'); --- 439,450 ---- ! void DeclarationDetailsParser::readEnumSpecifierBody( const ASTNodePtr& specifier ) { specifier->mutateType( ASTNodeTypes::enumSpecifier ); + context_.bindNextNodeToProperty( specifier, ASTNodeProperties::enumBodyProperty ); + EnumBodyParser bodyParser( context_, current_, end_ ); + subParse( bodyParser ); + /* expect('{'); *************** *** 447,450 **** --- 455,459 ---- specifier->setPropertyNode( ASTNodeProperties::enumBodyProperty , body ); return body; + */ } Index: DeclarationDetailsParser.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeclarationDetailsParser.h 1 May 2003 20:54:10 -0000 1.2 --- DeclarationDetailsParser.h 3 May 2003 17:41:38 -0000 1.3 *************** *** 54,58 **** std::string keyword ); ASTNodePtr readClassSpecifierBodySkippingInheritance( const ASTNodePtr &specifier ); ! ASTNodePtr readEnumSpecifierBody( const ASTNodePtr &specifier ); // --- 54,58 ---- std::string keyword ); ASTNodePtr readClassSpecifierBodySkippingInheritance( const ASTNodePtr &specifier ); ! void readEnumSpecifierBody( const ASTNodePtr &specifier ); // |
From: <bl...@us...> - 2003-05-03 17:39:22
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv663/src/rftaparser Modified Files: ParserToolsTest.cpp ParserToolsTest.h Log Message: * added expression skipper and makeComposite(). Index: ParserToolsTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserToolsTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ParserToolsTest.cpp 2 May 2003 06:22:25 -0000 1.3 --- ParserToolsTest.cpp 3 May 2003 17:39:18 -0000 1.4 *************** *** 37,40 **** --- 37,47 ---- + Xtl::CStringView + ParserToolsTest::makeString( const char *text ) + { + return Xtl::CStringView( text, text + std::string(text).length() ); + } + + void ParserToolsTest::testTryReadIdentifier() *************** *** 121,124 **** --- 128,161 ---- // :::: // ... + + + namespace Testing { + struct ExpressionSkipperAsserter : public Asserter<ExpressionSkipperAsserter> + { + void checkExpressionSkipper( std::string source, + int startIndex ) + { + source += ','; + Xtl::CStringView s( source.c_str(), source.c_str() + source.length() ); + Xtl::CStringEnumerator e( s ); + e += startIndex; + ParserTools::skipUntil( e, ',', ParserTools::SkipExpressionPolicy() ); + checkEquals( source.length(), e.getCurrentIndex(), "current: " + + Xtl::CStringView(e).str() ); + } + }; + + #define RFTA_TEMPLATE_SKIPPER_ASSERT \ + RFTA_CUSTOM_ASSERT( ::Refactoring::Testing::ExpressionSkipperAsserter ).checkExpressionSkipper + } + + + void + ParserToolsTest::testExpressionSkipper() + { + RFTA_TEMPLATE_SKIPPER_ASSERT( "T<A,B>::value", 0 ); + RFTA_TEMPLATE_SKIPPER_ASSERT( "x << 1", 0 ); + RFTA_TEMPLATE_SKIPPER_ASSERT( "sizeof(x)<3", 0 ); + } Index: ParserToolsTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserToolsTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ParserToolsTest.h 29 Apr 2003 09:46:07 -0000 1.2 --- ParserToolsTest.h 3 May 2003 17:39:19 -0000 1.3 *************** *** 21,25 **** CPPUNIT_TEST( testTryReadKeyword ); CPPUNIT_TEST( testBacktrackSkippingOverIdentifier ); ! CPPUNIT_TEST_SUITE_END(); --- 21,25 ---- CPPUNIT_TEST( testTryReadKeyword ); CPPUNIT_TEST( testBacktrackSkippingOverIdentifier ); ! CPPUNIT_TEST( testExpressionSkipper ); CPPUNIT_TEST_SUITE_END(); *************** *** 38,50 **** void testTryReadKeyword(); void testBacktrackSkippingOverIdentifier(); private: ! /// Prevents the use of the copy constructor. ! ParserToolsTest( const ParserToolsTest &other ); ! ! /// Prevents the use of the copy operator. ! void operator =( const ParserToolsTest &other ); ! ! private: }; --- 38,45 ---- void testTryReadKeyword(); void testBacktrackSkippingOverIdentifier(); + void testExpressionSkipper(); private: ! Xtl::CStringView makeString( const char *text ); }; |
From: <bl...@us...> - 2003-05-03 17:39:22
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv663/include/rfta/parser Modified Files: ParserTools.h Log Message: * added expression skipper and makeComposite(). Index: ParserTools.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ParserTools.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ParserTools.h 2 May 2003 06:22:26 -0000 1.7 --- ParserTools.h 3 May 2003 17:39:18 -0000 1.8 *************** *** 62,74 **** struct SkipNonePolicy { ! static void handleSkip( Xtl::CStringEnumerator &enumerator ) { } ! static void handleSkip( Xtl::CStringBackEnumerator &enumerator ) { } }; template<typename Enumerator> static void --- 62,212 ---- struct SkipNonePolicy { ! static bool handleSkip( Xtl::CStringEnumerator &enumerator ) { + return false; } ! static bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) ! { ! return false; ! } ! }; ! ! ! ! ! template<typename Policy1 ! ,typename Policy2> ! struct Skip2Policy ! { ! Skip2Policy( Policy1 policy1, Policy2 policy2 ) ! : policy1_( policy1 ) ! , policy2_( policy2 ) ! { ! } ! ! bool handleSkip( Xtl::CStringEnumerator &enumerator ) const ! { ! return policy1_.handleSkip( enumerator ) || policy2_.handleSkip( enumerator ); ! } ! ! void handleSkip( Xtl::CStringBackEnumerator &enumerator ) const ! { ! return policy1_.handleSkip( enumerator ) || policy2_.handleSkip( enumerator ); ! } ! ! Policy1 policy1_; ! Policy2 policy2_; ! }; ! ! ! template<typename Policy1 ! ,typename Policy2 ! ,typename Policy3> ! struct Skip3Policy ! { ! Skip3Policy( Policy1 policy1, Policy2 policy2, Policy3 policy3 ) ! : policy1_( policy1 ) ! , policy2_( policy2 ) ! , policy3_( policy3 ) ! { ! } ! ! bool handleSkip( Xtl::CStringEnumerator &enumerator ) const { + return policy1_.handleSkip( enumerator ) + || policy2_.handleSkip( enumerator ); + || policy3_.handleSkip( enumerator ); } + + bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) const + { + return policy1_.handleSkip( enumerator ) + || policy2_.handleSkip( enumerator ); + || policy3_.handleSkip( enumerator ); + } + + Policy1 policy1_; + Policy2 policy2_; + Policy3 policy3_; }; + + template<typename Policy1 + ,typename Policy2 + ,typename Policy3 + ,typename Policy4> + struct Skip4Policy + { + Skip4Policy( Policy1 policy1, Policy2 policy2, Policy3 policy3, Policy4 policy4 ) + : policy1_( policy1 ) + , policy2_( policy2 ) + , policy3_( policy3 ) + , policy4_( policy4 ) + { + } + + bool handleSkip( Xtl::CStringEnumerator &enumerator ) const + { + return policy1_.handleSkip( enumerator ) + || policy2_.handleSkip( enumerator ) + || policy3_.handleSkip( enumerator ) + || policy4_.handleSkip( enumerator ); + } + + bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) const + { + return policy1_.handleSkip( enumerator ) + || policy2_.handleSkip( enumerator ) + || policy3_.handleSkip( enumerator ) + || policy4_.handleSkip( enumerator ); + } + + Policy1 policy1_; + Policy2 policy2_; + Policy3 policy3_; + Policy4 policy4_; + }; + + + template<typename Policy1 + ,typename Policy2> + Skip2Policy<Policy1,Policy2> + makePolicy( Policy1 policy1, Policy2 policy2 ) + { + return Skip2Policy<Policy1,Policy2>( policy1, policy2 ); + } + + + template<typename Policy1 + ,typename Policy2 + ,typename Policy3> + Skip3Policy<Policy1,Policy2,Policy3> + makePolicy( Policy1 policy1, Policy2 policy2, Policy3 policy3 ) + { + return Skip3Policy<Policy1,Policy2,Policy3>( policy1, policy2, policy3 ); + } + + + template<typename Policy1 + ,typename Policy2 + ,typename Policy3 + ,typename Policy4> + Skip4Policy<Policy1,Policy2,Policy3,Policy4> + makePolicy( Policy1 policy1, Policy2 policy2, Policy3 policy3, Policy4 policy4 ) + { + return Skip4Policy<Policy1,Policy2,Policy3,Policy4>( policy1, policy2, policy3, policy4 ); + } + + + template<typename EnumeratorType + ,typename SkipPolicy> + void skip( EnumeratorType &enumerator, SkipPolicy policy ) + { + while ( policy.handleSkip( enumerator ) ) + ; + } + + template<typename Enumerator> static void *************** *** 89,93 **** while ( enumerator.hasNext() ) { ! skipPolicy.handleSkip( enumerator ); if ( *enumerator++ == charToFind ) return; --- 227,231 ---- while ( enumerator.hasNext() ) { ! skip( enumerator, skipPolicy ); if ( *enumerator++ == charToFind ) return; *************** *** 98,101 **** --- 236,258 ---- + template<typename Enumerator + ,typename SkipPolicy> + static bool + trySkipUntil( Enumerator &enumerator, + char charToFind, + const SkipPolicy &skipPolicy = SkipPolicy() ) + { + Enumerator start = enumerator; + while ( enumerator.hasNext() ) + { + skip( enumerator, skipPolicy ); + if ( *enumerator++ == charToFind ) + return true; + } + + enumerator = start; + return false; + } + template<typename Enumerator> static void *************** *** 128,132 **** } else ! skipPolicy.handleSkip( enumerator ); ++enumerator; --- 285,289 ---- } else ! skip( enumerator, skipPolicy ); ++enumerator; *************** *** 149,216 **** struct SkipBalancingBracePolicy { ! static void handleSkip( Xtl::CStringEnumerator &enumerator ) { if ( *enumerator == '(' ) findNextBalanced( ++enumerator, '(', ')' ); } ! static void handleSkip( Xtl::CStringBackEnumerator &enumerator ) { if ( *enumerator == ')' ) findNextBalanced( ++enumerator, ')', '(' ); } }; ! struct SkipScopeOperatorPolicy { ! static void handleSkip( Xtl::CStringEnumerator &enumerator ) { ! if ( enumerator[0] == ':' && enumerator[1] == ':' ) enumerator += 2; } ! static void handleSkip( Xtl::CStringBackEnumerator &enumerator ) { ! if ( enumerator[0] == ':' && enumerator[-1] == ':' ) enumerator += 2; } }; ! template<typename Policy1 ! ,typename Policy2> ! struct Skip2Policy { ! Skip2Policy( Policy1 policy1, Policy2 policy2 ) ! : policy1_( policy1 ) ! , policy2_( policy2 ) { ! } ! void handleSkip( Xtl::CStringEnumerator &enumerator ) const ! { ! policy1_.handleSkip( enumerator ); ! policy2_.handleSkip( enumerator ); } ! void handleSkip( Xtl::CStringBackEnumerator &enumerator ) const { ! policy1_.handleSkip( enumerator ); ! policy2_.handleSkip( enumerator ); ! } ! Policy1 policy1_; ! Policy2 policy2_; }; ! template<typename Policy1 ! ,typename Policy2> ! Skip2Policy<Policy1,Policy2> ! makePolicy( Policy1 policy1, Policy2 policy2 ) ! { ! return Skip2Policy<Policy1,Policy2>( policy1, policy2 ); ! } bool RFTAPARSER_API tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ); --- 306,415 ---- struct SkipBalancingBracePolicy { ! static bool handleSkip( Xtl::CStringEnumerator &enumerator ) { if ( *enumerator == '(' ) + { findNextBalanced( ++enumerator, '(', ')' ); + return true; + } + return false; } ! static bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) { if ( *enumerator == ')' ) + { findNextBalanced( ++enumerator, ')', '(' ); + return true; + } + return false; } }; ! template<const char symbol1 ! ,const char symbol2 = symbol1> ! struct SkipDoubleSymbolPolicy { ! static bool handleSkip( Xtl::CStringEnumerator &enumerator ) { ! if ( enumerator[0] == symbol1 && enumerator[1] == symbol2 ) ! { enumerator += 2; + return true; + } + return false; } ! static bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) { ! if ( enumerator[0] == symbol2 && enumerator[-1] == symbol1 ) ! { enumerator += 2; + return true; + } + return false; } }; ! typedef SkipDoubleSymbolPolicy<':'> SkipScopeOperatorPolicy; ! typedef SkipDoubleSymbolPolicy<'<'> SkipLeftShiftOperatorPolicy; ! typedef SkipDoubleSymbolPolicy<'>'> SkipRightShiftOperatorPolicy; ! typedef SkipDoubleSymbolPolicy<'-', '>'> SkipArrowOperatorPolicy; ! ! ! struct SkipExpressionPolicy { ! static bool handleSkip( Xtl::CStringEnumerator &enumerator ) { ! if ( *enumerator != '<' ) ! return false; ! if ( enumerator[1] == '<' ) // << ! { ! enumerator += 2; ! return true; ! } ! ! if ( !isIdentifierLetter( enumerator[-1] ) ) // 1 < 2 ! { ! ++enumerator; ! return true; ! } ! ! ++enumerator; ! ! findNextBalanced( enumerator, '<', '>', makePolicy( SkipLeftShiftOperatorPolicy(), ! SkipRightShiftOperatorPolicy(), ! SkipBalancingBracePolicy(), ! SkipArrowOperatorPolicy() ) ); ! return true; } ! static bool handleSkip( Xtl::CStringBackEnumerator &enumerator ) { ! if ( *enumerator != '>' ) ! return false; ! if ( enumerator[-1] == '>' || enumerator[-1] == '->' ) // >> or -> ! { ! enumerator += 2; ! return true; ! } ! ! ++enumerator; ! ! findNextBalanced( enumerator, '>', '<', makePolicy( SkipLeftShiftOperatorPolicy(), ! SkipRightShiftOperatorPolicy(), ! SkipBalancingBracePolicy(), ! SkipArrowOperatorPolicy() ) ); ! return true; ! } }; ! Xtl::CStringView RFTAPARSER_API readNextIdentifier( Xtl::CStringEnumerator &enumerator ); ! bool RFTAPARSER_API tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ); |
From: <bl...@us...> - 2003-05-03 17:39:22
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv663/src/rfta Modified Files: ParserTools.cpp Log Message: * added expression skipper and makeComposite(). Index: ParserTools.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/ParserTools.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ParserTools.cpp 29 Apr 2003 09:46:10 -0000 1.5 --- ParserTools.cpp 3 May 2003 17:39:18 -0000 1.6 *************** *** 55,59 **** } ! bool RFTAPARSER_API tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ) { --- 55,74 ---- } ! ! Xtl::CStringView ! readNextIdentifier( Xtl::CStringEnumerator &enumerator ) ! { ! Xtl::CStringEnumerator identifierStart = enumerator; ! if ( !isValidIdentifierFirstLetter( *enumerator ) ) ! throw ParseError( "expected identifier", enumerator ); ! ! while ( isIdentifierLetter( *enumerator ) ) ! ++enumerator; ! ! return Xtl::CStringView( identifierStart, enumerator ); ! } ! ! ! bool tryReadIdentifier( Xtl::CStringEnumerator &enumerator, Xtl::CStringView& identifier ) { *************** *** 75,79 **** } ! std::string RFTAPARSER_API tryReadKeyword( Xtl::CStringEnumerator &enumerator, std::set< std::string > keywords ) --- 90,94 ---- } ! std::string tryReadKeyword( Xtl::CStringEnumerator &enumerator, std::set< std::string > keywords ) |
From: <bl...@us...> - 2003-05-03 17:38:49
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv425/src/rftaparser Modified Files: rftaparser.dsp Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest * added EnumBodyParser Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** rftaparser.dsp 1 May 2003 21:16:55 -0000 1.48 --- rftaparser.dsp 3 May 2003 17:38:45 -0000 1.49 *************** *** 793,796 **** --- 793,804 ---- # Begin Source File + SOURCE=.\EnumBodyParserTest.cpp + # End Source File + # Begin Source File + + SOURCE=.\EnumBodyParserTest.h + # End Source File + # Begin Source File + SOURCE=.\ForStatementParserTest.cpp *************** *** 1218,1221 **** --- 1226,1258 ---- SOURCE=.\KeyedString.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\rftatest\SourceBuilder.cpp + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + + # End Source File + # Begin Source File + + SOURCE=..\..\include\rfta\test\SourceBuilder.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File *************** *** 1236,1243 **** --- 1273,1298 ---- SOURCE=.\CPPParserTest.cpp + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File SOURCE=.\CPPParserTest.h + + !IF "$(CFG)" == "rftaparser - Win32 Release" + + # PROP Exclude_From_Build 1 + + !ELSEIF "$(CFG)" == "rftaparser - Win32 Debug" + + !ENDIF + # End Source File # Begin Source File *************** *** 1375,1378 **** --- 1430,1437 ---- # Begin Source File + SOURCE=..\..\bug\List.txt + # End Source File + # Begin Source File + SOURCE=..\..\doc\SourcesSamplesResources.txt # End Source File *************** *** 1449,1452 **** --- 1508,1519 ---- SOURCE=..\..\include\rfta\parser\Config.h + # End Source File + # Begin Source File + + SOURCE=.\EnumBodyParser.cpp + # End Source File + # Begin Source File + + SOURCE=.\EnumBodyParser.h # End Source File # Begin Source File |
From: <bl...@us...> - 2003-05-03 17:38:48
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv425/src/rfta Modified Files: rfta.dsp Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest * added EnumBodyParser Index: rfta.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/rfta.dsp,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** rfta.dsp 26 Apr 2003 12:08:24 -0000 1.45 --- rfta.dsp 3 May 2003 17:38:45 -0000 1.46 *************** *** 896,900 **** # Begin Source File ! SOURCE=.\SourceBuilder.cpp !IF "$(CFG)" == "rfta - Win32 Release" --- 896,900 ---- # Begin Source File ! SOURCE=..\rftatest\SourceBuilder.cpp !IF "$(CFG)" == "rfta - Win32 Release" *************** *** 909,913 **** # Begin Source File ! SOURCE=.\SourceBuilder.h !IF "$(CFG)" == "rfta - Win32 Release" --- 909,913 ---- # Begin Source File ! SOURCE=..\..\include\rfta\test\SourceBuilder.h !IF "$(CFG)" == "rfta - Win32 Release" |
From: <bl...@us...> - 2003-05-03 17:38:06
|
Update of /cvsroot/cpptool/rfta/include/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv32686/include/rfta Modified Files: Config.h Log Message: * removed warning 4800 (true or false conversion performance warning) Index: Config.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/Config.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Config.h 22 Dec 2002 11:43:47 -0000 1.1 --- Config.h 3 May 2003 17:38:02 -0000 1.2 *************** *** 2,6 **** #define RFTA_ALL_CONFIG_H_INCLUDED ! #pragma warning( disable : 4786 4275 4251 ) #define RFTA_ASSERT_INDEX_IN_RANGE( sequence, index ) \ --- 2,6 ---- #define RFTA_ALL_CONFIG_H_INCLUDED ! #pragma warning( disable : 4786 4275 4251 4800 ) #define RFTA_ASSERT_INDEX_IN_RANGE( sequence, index ) \ |
From: <bl...@us...> - 2003-05-03 17:36:48
|
Update of /cvsroot/cpptool/rfta/include/rfta/test In directory sc8-pr-cvs1:/tmp/cvs-serv32224/include/rfta/test Modified Files: UnitTesting.h Log Message: * added RFTA_CUSTOM_INIT_ASSERT Index: UnitTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/test/UnitTesting.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnitTesting.h 1 May 2003 18:53:18 -0000 1.1 --- UnitTesting.h 3 May 2003 17:36:43 -0000 1.2 *************** *** 110,115 **** #define RFTA_CUSTOM_ASSERT( AsserterType ) \ ! AsserterType().setAssertLocation( CPPUNIT_SOURCELINE() ) --- 110,118 ---- + #define RFTA_CUSTOM_INIT_ASSERT( asserter ) \ + (asserter).setAssertLocation( CPPUNIT_SOURCELINE() ) + #define RFTA_CUSTOM_ASSERT( AsserterType ) \ ! RFTA_CUSTOM_INIT_ASSERT( AsserterType() ) |
From: <bl...@us...> - 2003-05-03 17:35:49
|
Update of /cvsroot/cpptool/rfta/include/rfta/test In directory sc8-pr-cvs1:/tmp/cvs-serv31944/include/rfta/test Added Files: SourceBuilder.h Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest --- NEW FILE: SourceBuilder.h --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2002/11/27 // ////////////////////////////////////////////////////////////////////////// #ifndef RFTA_SOURCEBUILDER_H #define RFTA_SOURCEBUILDER_H #include <rfta/test/UnitTesting.h> #include <rfta/parser/SourceRange.h> #include <map> #include <string> namespace Refactoring { namespace Testing { class SourceBuilder { public: SourceBuilder( std::string &source ); SourceRange mark( const std::string &key ); SourceRange add( const std::string &source ); SourceRange addKeyed( const std::string &source, const std::string &key ); SourceRange addKeyingMid( const std::string &addedSource1, const std::string &keyedSource, const std::string &addedSource2, const std::string &key ); SourceRange extend( const std::string &key ); const SourceRange &getRange( const std::string &key ) const; int getStartIndex( const std::string &key ) const; int getEndIndex( const std::string &key ) const; int getLength( const std::string &key ) const; bool hasKey( const std::string &key ) const; const std::string &getSource() const; private: typedef std::map<std::string,SourceRange> Ranges; Ranges ranges_; std::string &source_; }; } // namespace Testing } // namespace Refactoring #endif // RFTA_SOURCEBUILDER_H |
From: <bl...@us...> - 2003-05-03 17:35:49
|
Update of /cvsroot/cpptool/rfta/src/rftatest In directory sc8-pr-cvs1:/tmp/cvs-serv31944/src/rftatest Added Files: SourceBuilder.cpp Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest --- NEW FILE: SourceBuilder.cpp --- // ////////////////////////////////////////////////////////////////////////// // (c)Copyright 2002, Baptiste Lepilleur. // Created: 2002/11/27 // ////////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include <rfta/test/SourceBuilder.h> namespace Refactoring { namespace Testing { SourceBuilder::SourceBuilder( std::string &source ) : source_( source ) { } SourceRange SourceBuilder::mark( const std::string &key ) { return addKeyed( "", key ); } SourceRange SourceBuilder::add( const std::string &source ) { int startIndex = source_.length(); source_ += source; int endIndex = source_.length(); return SourceRange( startIndex, endIndex - startIndex ); } SourceRange SourceBuilder::addKeyed( const std::string &source, const std::string &key ) { CPPUNIT_ASSERT_MESSAGE( "SourceBuilder::add(), key already exists: " + key, ranges_.count(key) == 0 ); SourceRange range( add( source ) ); ranges_[ key ] = range; return range; } SourceRange SourceBuilder::addKeyingMid( const std::string &addedSource1, const std::string &keyedSource, const std::string &addedSource2, const std::string &key ) { source_ += addedSource1; SourceRange range = addKeyed( keyedSource, key ); source_ += addedSource2; return range; } SourceRange SourceBuilder::extend( const std::string &key ) { Ranges::iterator it = ranges_.find( key ); CPPUNIT_ASSERT_MESSAGE( "SourceBuilder::extend(), key does not exits: " + key, it != ranges_.end() ); SourceRange &range = it->second; int endIndex = source_.length(); range.setLength( endIndex - range.getStartIndex() ); return range; } const SourceRange & SourceBuilder::getRange( const std::string &key ) const { Ranges::const_iterator it = ranges_.find( key ); CPPUNIT_ASSERT_MESSAGE( "SourceBuilder::getRange(), key does not exits: " + key, it != ranges_.end() ); return it->second; } int SourceBuilder::getStartIndex( const std::string &key ) const { return getRange(key).getStartIndex(); } int SourceBuilder::getEndIndex( const std::string &key ) const { return getRange(key).getEndIndex(); } int SourceBuilder::getLength( const std::string &key ) const { return getRange(key).getLength(); } bool SourceBuilder::hasKey( const std::string &key ) const { return ranges_.count( key ) > 0; } const std::string & SourceBuilder::getSource() const { return source_; } } // namespace Testing } // namespace Refactoring |
From: <bl...@us...> - 2003-05-03 17:35:48
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv31944/src/rfta Removed Files: SourceBuilder.cpp SourceBuilder.h Log Message: * moved SourceBuilder to include/rfta/test and src/rftatest --- SourceBuilder.cpp DELETED --- --- SourceBuilder.h DELETED --- |
From: <bl...@us...> - 2003-05-03 17:34:57
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv31638/src/rftaparser Modified Files: ExpressionOperationMutatorTest.cpp Log Message: * fixed suite the test was registered in Index: ExpressionOperationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ExpressionOperationMutatorTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExpressionOperationMutatorTest.cpp 30 Dec 2002 13:57:53 -0000 1.3 --- ExpressionOperationMutatorTest.cpp 3 May 2003 17:34:55 -0000 1.4 *************** *** 16,20 **** { ! CPPUNIT_TEST_SUITE_REGISTRATION( ExpressionOperationMutatorTest ); --- 16,20 ---- { ! RFTAPARSER_TEST_SUITE_REGISTRATION( ExpressionOperationMutatorTest ); |
From: <bl...@us...> - 2003-05-03 17:34:05
|
Update of /cvsroot/cpptool/rfta/include/xtl In directory sc8-pr-cvs1:/tmp/cvs-serv31339/include/xtl Modified Files: CStringView.h Log Message: * fixed bug for enumerator construction with an empty string Index: CStringView.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/xtl/CStringView.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CStringView.h 29 Apr 2003 22:02:14 -0000 1.4 --- CStringView.h 3 May 2003 17:34:01 -0000 1.5 *************** *** 240,244 **** const char *end ) : CStringEnumeratorBase( CStringView( current, end ), ! string_.isEmpty() ? 0 : current ) { } --- 240,244 ---- const char *end ) : CStringEnumeratorBase( CStringView( current, end ), ! current ) { } |
From: <bl...@us...> - 2003-05-03 17:34:04
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv31339/src/rftaparser Modified Files: CStringEnumeratorTest.cpp CStringEnumeratorTest.h Log Message: * fixed bug for enumerator construction with an empty string Index: CStringEnumeratorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CStringEnumeratorTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CStringEnumeratorTest.cpp 26 Apr 2003 13:13:37 -0000 1.2 --- CStringEnumeratorTest.cpp 3 May 2003 17:34:01 -0000 1.3 *************** *** 61,64 **** --- 61,74 ---- void + CStringEnumeratorTest::testStartEndConstructor() + { + Xtl::CStringEnumerator e( string_.getStart(), string_.getEnd() ); + CPPUNIT_ASSERT( e.getString() == string_ ); + CPPUNIT_ASSERT( e.getCurrentPos() == string_.getStart() ); + RFTA_ASSERT_EQUAL( '1', *e ); + } + + + void CStringEnumeratorTest::testIncrement() { *************** *** 171,174 **** --- 181,196 ---- CPPUNIT_ASSERT( enumEnd > enumText_); CPPUNIT_ASSERT( enumEnd > enum2); + } + + + void + CStringEnumeratorTest::testHasNext() + { + Xtl::CStringView empty( string_.getSlice(0, 0) ); + Xtl::CStringEnumerator enumEmpty( empty ); + CPPUNIT_ASSERT( !enumEmpty.hasNext() ); + + Xtl::CStringEnumerator enumEmpty2( empty.getStart(), empty.getEnd() ); + CPPUNIT_ASSERT( !enumEmpty2.hasNext() ); } Index: CStringEnumeratorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CStringEnumeratorTest.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CStringEnumeratorTest.h 26 Apr 2003 13:13:37 -0000 1.2 --- CStringEnumeratorTest.h 3 May 2003 17:34:01 -0000 1.3 *************** *** 20,23 **** --- 20,24 ---- CPPUNIT_TEST( testDefaultConstructor ); CPPUNIT_TEST( testStringConstructor ); + CPPUNIT_TEST( testStartEndConstructor ); CPPUNIT_TEST( testIncrement ); CPPUNIT_TEST( testIndex ); *************** *** 28,31 **** --- 29,33 ---- CPPUNIT_TEST( testEquality ); CPPUNIT_TEST( testComparable ); + CPPUNIT_TEST( testHasNext ); CPPUNIT_TEST( testBackEnumerator ); CPPUNIT_TEST_SUITE_END(); *************** *** 44,47 **** --- 46,50 ---- void testDefaultConstructor(); void testStringConstructor(); + void testStartEndConstructor(); void testIncrement(); *************** *** 55,58 **** --- 58,63 ---- void testEquality(); void testComparable(); + + void testHasNext(); void testBackEnumerator(); |