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 17:32:35
|
Update of /cvsroot/cpptool/rfta/src/rftatest In directory sc8-pr-cvs1:/tmp/cvs-serv30850/rftatest Log Message: Directory /cvsroot/cpptool/rfta/src/rftatest added to the repository |
From: <bl...@us...> - 2003-05-02 06:22:28
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv5042/include/rfta/parser Modified Files: ParserTools.h Log Message: * added support for nested constant in case ( case X::value:). * added ParserTools::makeComposite() to create composite skip policy Index: ParserTools.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ParserTools.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ParserTools.h 29 Apr 2003 09:46:09 -0000 1.6 --- ParserTools.h 2 May 2003 06:22:26 -0000 1.7 *************** *** 149,153 **** struct SkipBalancingBracePolicy { - static void handleSkip( Xtl::CStringEnumerator &enumerator ) { --- 149,152 ---- *************** *** 161,166 **** --- 160,216 ---- 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 ); |
From: <bl...@us...> - 2003-05-02 06:22:28
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv5042/src/rftaparser Modified Files: CaseStatementParser.cpp CaseStatementParserTest.cpp CaseStatementParserTest.h ParserToolsTest.cpp Log Message: * added support for nested constant in case ( case X::value:). * added ParserTools::makeComposite() to create composite skip policy Index: CaseStatementParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CaseStatementParser.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CaseStatementParser.cpp 26 Apr 2003 21:12:36 -0000 1.4 --- CaseStatementParser.cpp 2 May 2003 06:22:25 -0000 1.5 *************** *** 41,45 **** Xtl::CStringView constant( current ); ! ParserTools::skipUntil( current, ':', ParserTools::SkipBalancingBracePolicy() ); Xtl::CStringView caseStatement( start_, current.getCurrentPos() ); --- 41,47 ---- Xtl::CStringView constant( current ); ! ParserTools::skipUntil( current, ':', ! ParserTools::makePolicy( ParserTools::SkipBalancingBracePolicy(), ! ParserTools::SkipScopeOperatorPolicy() ) ); Xtl::CStringView caseStatement( start_, current.getCurrentPos() ); Index: CaseStatementParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CaseStatementParserTest.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CaseStatementParserTest.cpp 20 Dec 2002 08:30:50 -0000 1.4 --- CaseStatementParserTest.cpp 2 May 2003 06:22:25 -0000 1.5 *************** *** 96,99 **** --- 96,126 ---- void + CaseStatementParserTest::testConstantWithScopeOperator() + { + std::string source( "case " ); + int constantIndex = source.length(); + source += "Constant::initialStatus"; + int constantEnd = source.length(); + source += ":"; + int startIndex = 0; + int endIndex = source.length(); + SourceASTNodePtr sourceNode = RFTA_ASSERT_KEYWORD_PARSER_PASS( + CaseStatementParser, + source, + endIndex, + "case" ); + RFTA_ASSERT_NODE_HAS( sourceNode->getChildAt(0), + ASTNodeTypes::caseStatement, + startIndex, + endIndex-startIndex ); + RFTA_ASSERT_NODE_PROPERTY_HAS( sourceNode->getChildAt(0), + ASTNodeProperties::constantValueProperty, + ASTNodeTypes::constantExpression, + constantIndex, + constantEnd - constantIndex ); + } + + + void CaseStatementParserTest::testFail() { Index: CaseStatementParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/CaseStatementParserTest.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CaseStatementParserTest.h 24 Oct 2002 19:10:58 -0000 1.1 --- CaseStatementParserTest.h 2 May 2003 06:22:25 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- CPPUNIT_TEST( testConstantCharPass ); CPPUNIT_TEST( testConstantWithBracesPass ); + CPPUNIT_TEST( testConstantWithScopeOperator ); CPPUNIT_TEST( testFail ); CPPUNIT_TEST_SUITE_END(); *************** *** 36,39 **** --- 37,41 ---- void testConstantCharPass(); void testConstantWithBracesPass(); + void testConstantWithScopeOperator(); void testFail(); Index: ParserToolsTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserToolsTest.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ParserToolsTest.cpp 29 Apr 2003 09:46:08 -0000 1.2 --- ParserToolsTest.cpp 2 May 2003 06:22:25 -0000 1.3 *************** *** 116,119 **** --- 116,126 ---- } + // add test for the following case: + // => skip following is repeated twice: + // ()() + // :::: + // ... + + } // namespace Refactoring |
From: <bl...@us...> - 2003-05-02 06:22:28
|
Update of /cvsroot/cpptool/rfta/bug In directory sc8-pr-cvs1:/tmp/cvs-serv5042/bug Modified Files: List.txt Log Message: * added support for nested constant in case ( case X::value:). * added ParserTools::makeComposite() to create composite skip policy Index: List.txt =================================================================== RCS file: /cvsroot/cpptool/rfta/bug/List.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** List.txt 1 May 2003 21:54:41 -0000 1.2 --- List.txt 2 May 2003 06:22:25 -0000 1.3 *************** *** 39,46 **** --- - case constant containing '::' (dc++\hubframe.cpp.html) - case ClientListener::FAILED: - => parse failure - --- MFC macros (dc++\hubframe.h.html) BEGIN_MSG_MAP(HubFrame) --- 39,42 ---- |
From: <bl...@us...> - 2003-05-01 21:54:45
|
Update of /cvsroot/cpptool/rfta/bug In directory sc8-pr-cvs1:/tmp/cvs-serv9187/bug Modified Files: List.txt Log Message: * added support for destructor declaration in class (not very clean, it is too tolerant) Index: List.txt =================================================================== RCS file: /cvsroot/cpptool/rfta/bug/List.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** List.txt 1 May 2003 21:20:32 -0000 1.1 --- List.txt 1 May 2003 21:54:41 -0000 1.2 *************** *** 49,57 **** MESSAGE_HANDLER(WM_NCACTIVATE, onActivate) --- - destructor (dc++\mainfrm.h.html) - virtual ~MainFrame(); - ~CWebServer(void); - => parse failure - --- bad variable declaration (emule\archiverecovery.cpp.html) CTypedPtrList<CPtrList, Gap_Struct*> *filled = new CTypedPtrList<CPtrList, Gap_Struct*>; --- 49,52 ---- |
From: <bl...@us...> - 2003-05-01 21:54:44
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv9187/src/rftaparser Modified Files: DeclarationDetailsParser.cpp UnparsedDeclarationMutatorTest.cpp UnparsedDeclarationMutatorTest.h Log Message: * added support for destructor declaration in class (not very clean, it is too tolerant) Index: DeclarationDetailsParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationDetailsParser.cpp 1 May 2003 20:54:10 -0000 1.3 --- DeclarationDetailsParser.cpp 1 May 2003 21:54:40 -0000 1.4 *************** *** 526,531 **** do { skipSpaces(); ! if (tryNextIs('*')) continue; ! if (tryNextIs('&')) continue; if (tryNextIs('(')) { --- 526,535 ---- do { skipSpaces(); ! if (tryNextIs('*')) ! continue; ! ! if (tryNextIs('&')) ! continue; ! if (tryNextIs('(')) { *************** *** 569,607 **** } std::string identifier; if (!tryReadNextIdentifier(identifier)) - { throwFailure( boost::format("unexpected character: '%1%'.") % *current_ ); - } else - { - if (identifier=="const") continue; - if (identifier=="volatile") continue; - identifierFound = true; ! // read fully qualified name: ! nestedName.append(identifier); ! if (tryReadNext("::")) ! { ! nestedName.append("::"); ! readNestedName(nestedName); ! } ! // check for operator keyword: ! if (isOperatorIdentifier(nestedName)) ! { ! parseOperator(declaratorStartIndex); ! return; ! } ! // check for bitfield expression ! if (tryNextIs(':')) ! { ! if (!skipOverAssignmentInitializer()) ! throwFailure("Constant expression is not well formed."); ! // @todo: store bit field expression ! } ! continue; } } while (hasNext() && !declaratorEndReached); --- 573,615 ---- } + if ( tryNextIs( '~' ) ) + { // handle destructor (buggy, need to ensure not followed by const or volatile) + } + std::string identifier; if (!tryReadNextIdentifier(identifier)) throwFailure( boost::format("unexpected character: '%1%'.") % *current_ ); ! if (identifier=="const") ! continue; ! if (identifier=="volatile") ! continue; ! identifierFound = true; ! // read fully qualified name: ! nestedName.append(identifier); ! if (tryReadNext("::")) ! { ! nestedName.append("::"); ! readNestedName(nestedName); } + + // check for operator keyword: + if (isOperatorIdentifier(nestedName)) + { + parseOperator(declaratorStartIndex); + return; + } + + // check for bitfield expression + if (tryNextIs(':')) + { + if (!skipOverAssignmentInitializer()) + throwFailure("Constant expression is not well formed."); + // @todo: store bit field expression + } + continue; } while (hasNext() && !declaratorEndReached); Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** UnparsedDeclarationMutatorTest.cpp 1 May 2003 21:12:15 -0000 1.7 --- UnparsedDeclarationMutatorTest.cpp 1 May 2003 21:54:40 -0000 1.8 *************** *** 258,261 **** --- 258,273 ---- } + + void + UnparsedDeclarationMutatorTest::testClassForwardDeclaration() + { + const std::string source( "class X;" ); + SourceASTNodePtr sourceNode = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + + ASTNodePtr classNode = sourceNode->getChildAt(0); + RFTA_ASSERT_NODE_TYPE( classNode, ASTNodeTypes::declaration ); + } + + void UnparsedDeclarationMutatorTest::testEnumDeclaration() *************** *** 657,660 **** --- 669,708 ---- } + + void + UnparsedDeclarationMutatorTest::testDestructorMember() + { + Testing::KeyedString source; + 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::testVirtualDestructorMember() + { + 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() *************** *** 729,743 **** // check declarator types: RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); - } - - - void - UnparsedDeclarationMutatorTest::testClassForwardDeclaration() - { - const std::string source( "class X;" ); - SourceASTNodePtr sourceNode = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); - - ASTNodePtr classNode = sourceNode->getChildAt(0); - RFTA_ASSERT_NODE_TYPE( classNode, ASTNodeTypes::declaration ); } --- 777,780 ---- Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UnparsedDeclarationMutatorTest.h 1 May 2003 21:12:16 -0000 1.4 --- UnparsedDeclarationMutatorTest.h 1 May 2003 21:54:40 -0000 1.5 *************** *** 45,48 **** --- 45,50 ---- CPPUNIT_TEST( testOperatorMember ); /* class member extensions */ + CPPUNIT_TEST( testDestructorMember ); + CPPUNIT_TEST( testVirtualDestructorMember ); CPPUNIT_TEST( testMemberPure ); CPPUNIT_TEST( testMemberConstInit ); *************** *** 86,89 **** --- 88,93 ---- void testStructTypedef(); void testTypedefDeclaration(); + void testDestructorMember(); + void testVirtualDestructorMember(); void testMemberPure(); void testMemberConstInit(); |
From: <bl...@us...> - 2003-05-01 21:20:36
|
Update of /cvsroot/cpptool/rfta/bug In directory sc8-pr-cvs1:/tmp/cvs-serv26988/bug Added Files: List.txt Log Message: * added, quick list of bugs found with the first test run of lister.py on reall code. --- NEW FILE: List.txt --- ---- KeyedString.h: inline std::vector<int> KeyedString::getKeyedLen(std::string key) const { std::map<std::string,std::vector<int> >::const_iterator it; it = wordLen_.find(key); if (it == wordLen_.end()) return std::vector<int>(); return (*it).second; } variable-decl-expression node has a bad range (extend beyond the node range) ---- ASTDumper.cpp: ASTDumpVisitor::ASTDumpVisitor( HTMLWriter &writer, const SourceASTNodePtr &source ) : writer_( writer ) , sourceAST_( source ) { } => header include members initializer. --- unamed enum: (audacity\freqwindow.cpp.html) enum { FirstID = 7000, FreqCloseButtonID, FreqExportButtonID, FreqAlgChoiceID, FreqSizeChoiceID, FreqFuncChoiceID, FreqAxisChoiceID }; ==> parse failure --- case constant containing '::' (dc++\hubframe.cpp.html) case ClientListener::FAILED: => parse failure --- MFC macros (dc++\hubframe.h.html) BEGIN_MSG_MAP(HubFrame) MESSAGE_HANDLER(WM_CLOSE, onClose) MESSAGE_HANDLER(WM_MDIACTIVATE, onActivate) MESSAGE_HANDLER(WM_NCACTIVATE, onActivate) --- destructor (dc++\mainfrm.h.html) virtual ~MainFrame(); ~CWebServer(void); => parse failure --- bad variable declaration (emule\archiverecovery.cpp.html) CTypedPtrList<CPtrList, Gap_Struct*> *filled = new CTypedPtrList<CPtrList, Gap_Struct*>; => parse failure (think there is 2 variables) --- wrong variable declaration k<dd->getVideoModeList()->count(); for( unsigned k = 0; k<dd->getVideoModeList()->count(); k++ ) => parse failure * '->' should not be allowed as an end of template * should not attempt to parse for a variable declaration in for condition expression. |
From: <bl...@us...> - 2003-05-01 21:17:02
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv25404 Modified Files: rftaparser.dsp Log Message: * removed useless UT Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** rftaparser.dsp 1 May 2003 18:53:21 -0000 1.47 --- rftaparser.dsp 1 May 2003 21:16:55 -0000 1.48 *************** *** 1452,1463 **** # Begin Source File - SOURCE=.\DeclarationDetailsParserTest.cpp - # End Source File - # Begin Source File - - SOURCE=.\DeclarationDetailsParserTest.h - # End Source File - # Begin Source File - SOURCE=.\Makefile.am # End Source File --- 1452,1455 ---- |
From: <bl...@us...> - 2003-05-01 21:13:32
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv23887/src/rftaparser Modified Files: UnparsedDeclarationListMutatorTest.cpp Log Message: * fixed some assertions Index: UnparsedDeclarationListMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationListMutatorTest.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UnparsedDeclarationListMutatorTest.cpp 29 Apr 2003 09:56:21 -0000 1.3 --- UnparsedDeclarationListMutatorTest.cpp 1 May 2003 21:13:29 -0000 1.4 *************** *** 97,103 **** source << "private: "; source.addKeyed("MEMBER", "int fc2() { return 0; }") << " "; ! source << "protected: signal:"; source.setKeyEnd("CLASS-BODY"); ! source << "};"; SourceASTNodePtr sourceNode = SourceASTNode::create( source, source ); --- 97,105 ---- source << "private: "; source.addKeyed("MEMBER", "int fc2() { return 0; }") << " "; ! source << "protected: "; ! source << "signals: "; ! source << "}"; source.setKeyEnd("CLASS-BODY"); ! source << ";"; SourceASTNodePtr sourceNode = SourceASTNode::create( source, source ); *************** *** 106,110 **** ParseContext context(sourceNode); DeclarationParser parser(context, sourceNode->getBlankedSourceStart(), sourceNode->getBlankedSourceEnd()); ! parser.tryParse(); // mutate declaration: --- 108,112 ---- ParseContext context(sourceNode); DeclarationParser parser(context, sourceNode->getBlankedSourceStart(), sourceNode->getBlankedSourceEnd()); ! CPPUNIT_ASSERT( parser.tryParse() ); // mutate declaration: *************** *** 116,122 **** sourceNode ); ! CppUnit::Message message( "Parser failed", ! "Source:\n" + source.asString() ); ! CppUnit::Asserter::failIf( !detailsparser.tryParse(), message, CPPUNIT_SOURCELINE() ); --- 118,122 ---- sourceNode ); ! CPPUNIT_ASSERT( detailsparser.tryParse() ); *************** *** 147,151 **** RFTA_ASSERT_NODE_TYPE( classBody, ASTNodeTypes::declarationList ); RFTA_ASSERT_EQUAL( 3, classBody->getChildCount() ); - RFTA_ASSERT_NODE_HAS( classBody->getChildAt(0), ASTNodeTypes::unparsedDeclaration, --- 147,150 ---- *************** *** 156,165 **** source.getKeyedIndex("MEMBER",1), source.getKeyedLen("MEMBER",1) ); RFTA_ASSERT_NODE_HAS( classBody->getChildAt(2), ASTNodeTypes::functionImplementation, source.getKeyedIndex("MEMBER",2), source.getKeyedLen("MEMBER",2) ); - - } --- 155,163 ---- source.getKeyedIndex("MEMBER",1), source.getKeyedLen("MEMBER",1) ); + RFTA_ASSERT_NODE_HAS( classBody->getChildAt(2), ASTNodeTypes::functionImplementation, source.getKeyedIndex("MEMBER",2), source.getKeyedLen("MEMBER",2) ); } |
From: <bl...@us...> - 2003-05-01 21:12:19
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv23397/src/rftaparser Modified Files: UnparsedDeclarationMutatorTest.cpp UnparsedDeclarationMutatorTest.h Log Message: * added support for class forward declaration 'class X;' * fixed class body range (was before } unlike namespace, which caused a bug since the mutator do --end). Index: UnparsedDeclarationMutatorTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UnparsedDeclarationMutatorTest.cpp 29 Apr 2003 09:57:01 -0000 1.6 --- UnparsedDeclarationMutatorTest.cpp 1 May 2003 21:12:15 -0000 1.7 *************** *** 214,218 **** source.addKeyed(SPECIFIER,"const") << " "; source.setKeyStart(SPECIFIER) << "class x {"; ! source.addKeyed("CLASS-BODY" , " public: int x() { } " ) << "}" ; source.setKeyEnd(SPECIFIER) << " "; source.addKeyed(DECLARATOR, "y" ) << ";"; --- 214,218 ---- source.addKeyed(SPECIFIER,"const") << " "; source.setKeyStart(SPECIFIER) << "class x {"; ! source.addKeyed("CLASS-BODY" , " public: int x() { } }" ); source.setKeyEnd(SPECIFIER) << " "; source.addKeyed(DECLARATOR, "y" ) << ";"; *************** *** 730,733 **** --- 730,745 ---- RFTA_ASSERT_NODE_TYPE( node->getChildAt(0), ASTNodeTypes::unparsedDeclarator); } + + + void + UnparsedDeclarationMutatorTest::testClassForwardDeclaration() + { + const std::string source( "class X;" ); + SourceASTNodePtr sourceNode = RFTA_ASSERT_DECLARATION_MUTATOR_PASS( source ); + + ASTNodePtr classNode = sourceNode->getChildAt(0); + RFTA_ASSERT_NODE_TYPE( classNode, ASTNodeTypes::declaration ); + } + } // namespace Refactoring Index: UnparsedDeclarationMutatorTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclarationMutatorTest.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UnparsedDeclarationMutatorTest.h 29 Apr 2003 09:57:01 -0000 1.3 --- UnparsedDeclarationMutatorTest.h 1 May 2003 21:12:16 -0000 1.4 *************** *** 23,26 **** --- 23,27 ---- CPPUNIT_TEST( testClassDeclaration ); CPPUNIT_TEST( testClassDeclarationWithInheritance ); + CPPUNIT_TEST( testClassForwardDeclaration ); CPPUNIT_TEST( testEnumDeclaration ); CPPUNIT_TEST( testPointerDecl ); *************** *** 64,67 **** --- 65,69 ---- void testClassDeclaration(); void testClassDeclarationWithInheritance(); + void testClassForwardDeclaration(); void testEnumDeclaration(); void testPointerDecl(); |
From: <bl...@us...> - 2003-05-01 21:10:06
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv22298/src/rftaparser Modified Files: DeclarationParser.cpp Log Message: * added tryReadUntilNextOf(). readUntilNextOf() now throw if no token found. Previous behavior caused silent failures. Index: DeclarationParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DeclarationParser.cpp 30 Apr 2003 22:15:49 -0000 1.7 --- DeclarationParser.cpp 1 May 2003 21:09:59 -0000 1.8 *************** *** 47,52 **** int startIndex = getCurrentIndex(); const char * rollback = current_; ! readUntilNextOf(";={"); ! if (current_ == end_) return false; --- 47,51 ---- int startIndex = getCurrentIndex(); const char * rollback = current_; ! if ( !tryReadUntilNextOf(";={") ) return false; |
From: <bl...@us...> - 2003-05-01 21:09:02
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv21870/src/rftaparser Modified Files: DeclarationListParser.cpp Log Message: * fixed bug: can now handle multiple access declaration 'class x{ protected: public: }' Index: DeclarationListParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationListParser.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DeclarationListParser.cpp 29 Apr 2003 22:06:57 -0000 1.5 --- DeclarationListParser.cpp 1 May 2003 21:08:58 -0000 1.6 *************** *** 61,65 **** // @todo: store information on visibility current_ = current.getCurrentPos(); ! skipSpaces(); } --- 61,65 ---- // @todo: store information on visibility current_ = current.getCurrentPos(); ! continue; } |
From: <bl...@us...> - 2003-05-01 21:07:35
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv21227/src/rftaparser Modified Files: Parser.cpp Log Message: * added tryReadUntilNextOf(). readUntilNextOf() now throw if no token found. Previous behavior caused silent failures. Index: Parser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/Parser.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Parser.cpp 28 Apr 2003 20:39:14 -0000 1.9 --- Parser.cpp 1 May 2003 21:07:29 -0000 1.10 *************** *** 162,167 **** } void ! Parser::readUntilNextOf( std::string charset ) { Tracker tracker( "Parser::readUntilNextOf", *this ); --- 162,168 ---- } + void ! Parser::readUntilNextOf( const std::string &charset ) { Tracker tracker( "Parser::readUntilNextOf", *this ); *************** *** 173,177 **** current_++; } ! return; } --- 174,197 ---- current_++; } ! ! throwFailure( "Expected one character of '" + charset + "', but found none" ); ! } ! ! ! bool ! Parser::tryReadUntilNextOf( const std::string &charset ) ! { ! const char *start = current_; ! Tracker tracker( "Parser::tryReadUntilNextOf", *this ); ! ! while ( hasNext() ) ! { ! if ( charset.find(*current_) != std::string::npos ) ! return true; ! current_++; ! } ! ! current_ = start; ! return false; } *************** *** 220,241 **** } bool ! Parser::tryReadNext( std::string s) { ! int idx = 0; ! if (s.empty()) return true; const char * rollback = current_; ! while ( hasNext() && idx<s.length() && *current_ == s[idx] ) { ! ++idx; ++current_; } ! if (idx!=s.length()) ! { ! current_=rollback; ! return false; ! } else ! return true; } bool --- 240,266 ---- } + bool ! Parser::tryReadNext( const std::string &s ) { ! if ( s.empty() ) ! return true; ! const char * rollback = current_; ! int index = 0; ! while ( hasNext() && index < s.length() && *current_ == s[index] ) { ! ++index; ! ++current_; } ! ! if ( index == s.length() ) ! return true; ! ! current_ = rollback; ! return false; } + bool |
From: <bl...@us...> - 2003-05-01 21:06:48
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv15003/src/rftaparser Modified Files: DeclarationDetailsParser.cpp DeclarationDetailsParser.h Log Message: * refactored some * added support for class forward declaration 'class X;' * fixed class body range (was before } unlike namespace, which caused a bug since the mutator do --end). Index: DeclarationDetailsParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DeclarationDetailsParser.cpp 29 Apr 2003 10:29:56 -0000 1.2 --- DeclarationDetailsParser.cpp 1 May 2003 20:54:10 -0000 1.3 *************** *** 227,231 **** specifierList->addChild(specifier); ! readClassOrEnumSpecifier(specifier, specifierIdent, secondIdent); // set real length after completed parsing --- 227,235 ---- specifierList->addChild(specifier); ! if ( !tryNextIs(';') ) // this is not a forward declaration ! { ! // read the complete specifier: ! readClassOrEnumSpecifier( specifier, specifierIdent ); ! } // set real length after completed parsing *************** *** 237,241 **** // HERE we come only in case where the type is followed by a colon. "e.g. class x:" // check if it is only a single colon (which means inheritance information e.g. "class x: public y ") ! if (!tryNextIs(':')) { // yes it's - so parse the class specifier --- 241,245 ---- // HERE we come only in case where the type is followed by a colon. "e.g. class x:" // check if it is only a single colon (which means inheritance information e.g. "class x: public y ") ! if ( !tryNextIs(':') ) { // yes it's - so parse the class specifier *************** *** 254,258 **** // read the complete specifier: ! readClassOrEnumSpecifier(specifier, specifierIdent, secondIdent); // set real length after completed parsing --- 258,262 ---- // read the complete specifier: ! readClassOrEnumSpecifier( specifier, specifierIdent ); // set real length after completed parsing *************** *** 262,266 **** // FINISH HERE (the class specifier ends here !) } ! throwFailure( "Expected a double colon => '::'." ); } --- 266,270 ---- // FINISH HERE (the class specifier ends here !) } ! throwFailure( "unknown specifier type: " + specifierIdent ); } *************** *** 400,437 **** void ! DeclarationDetailsParser::readClassOrEnumSpecifier(ASTNodePtr& specifier, std::string keyword, std::string name) { ASTNodePtr body; - int startIndex; ! if (keyword == "class" || keyword == "struct" || keyword == "union") ! { ! // read over possible inheritance information ! readUntilNextOf("{"); ! current_++; ! ! body = createASTNode( ! ASTNodeTypes::unparsedDeclarationList, ! specifier, ! startIndex = getCurrentIndex(), ! getCurrentLength() ! ); ! specifier->setPropertyNode( ASTNodeProperties::classBodyProperty , body ); ! } else ! { ! specifier->mutateType( ASTNodeTypes::enumSpecifier ); ! expect('{'); - body = createASTNode( - ASTNodeTypes::unparsedDeclarationList, - specifier, - startIndex = getCurrentIndex(), - getCurrentLength() - ); - specifier->setPropertyNode( ASTNodeProperties::enumBodyProperty , body ); - } findNextBalanced('{','}'); ! body->setLength(getCurrentIndex() - startIndex - 1 ); // do not count the last '}' } bool --- 404,452 ---- 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 '}' } + + + ASTNodePtr + DeclarationDetailsParser::readClassSpecifierBodySkippingInheritance( const ASTNodePtr &specifier ) + { + readUntilNextOf("{"); + current_++; + + ASTNodePtr body = createASTNode( ASTNodeTypes::unparsedDeclarationList, + specifier, + getCurrentIndex(), + 0 ); + specifier->setPropertyNode( ASTNodeProperties::classBodyProperty , body ); + return body; + } + + + ASTNodePtr + DeclarationDetailsParser::readEnumSpecifierBody( const ASTNodePtr& specifier ) + { + specifier->mutateType( ASTNodeTypes::enumSpecifier ); + expect('{'); + + ASTNodePtr body = createASTNode( ASTNodeTypes::unparsedDeclarationList, + specifier, + getCurrentIndex(), + 0 ); + specifier->setPropertyNode( ASTNodeProperties::enumBodyProperty , body ); + return body; + } + bool Index: DeclarationDetailsParser.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationDetailsParser.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeclarationDetailsParser.h 29 Apr 2003 09:55:39 -0000 1.1 --- DeclarationDetailsParser.h 1 May 2003 20:54:10 -0000 1.2 *************** *** 51,55 **** void readNestedName(std::string& nestedname); ! void readClassOrEnumSpecifier(ASTNodePtr& specifier, std::string keyword, std::string name); // --- 51,58 ---- void readNestedName(std::string& nestedname); ! void readClassOrEnumSpecifier( const ASTNodePtr& specifier, ! std::string keyword ); ! ASTNodePtr readClassSpecifierBodySkippingInheritance( const ASTNodePtr &specifier ); ! ASTNodePtr readEnumSpecifierBody( const ASTNodePtr &specifier ); // |
From: <bl...@us...> - 2003-05-01 20:50:47
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv13392/include/rfta/parser Modified Files: Parser.h Log Message: * added tryReadUntilNextOf(). readUntilNextOf() now throw if no token found. Previous behavior caused silent failures. Index: Parser.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/Parser.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Parser.h 26 Apr 2003 21:11:29 -0000 1.7 --- Parser.h 1 May 2003 20:50:44 -0000 1.8 *************** *** 92,96 **** void readUntilNext( char c ); ! void readUntilNextOf( std::string charset ); bool tryReadNextIdentifier( std::string &identifier ); --- 92,97 ---- void readUntilNext( char c ); ! void readUntilNextOf( const std::string &charset ); ! bool tryReadUntilNextOf( const std::string &charset ); bool tryReadNextIdentifier( std::string &identifier ); *************** *** 101,105 **** void expect( char c ); bool tryNextIs( char c ); ! bool tryReadNext( std::string s); void readUntilNextSemiColonSkippingOverCurlyBraces(); --- 102,106 ---- void expect( char c ); bool tryNextIs( char c ); ! bool tryReadNext( const std::string &s); void readUntilNextSemiColonSkippingOverCurlyBraces(); |
From: <bl...@us...> - 2003-05-01 20:48:08
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv12033/src/rftaparser Modified Files: ASTNode.cpp SourceRange.cpp Log Message: * added setEndIndex() Index: ASTNode.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ASTNode.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ASTNode.cpp 25 Dec 2002 22:39:02 -0000 1.13 --- ASTNode.cpp 1 May 2003 20:48:05 -0000 1.14 *************** *** 106,109 **** --- 106,116 ---- + void + ASTNode::setEndIndex( int index ) + { + range_.setEndIndex( index ); + } + + const SourceRange & ASTNode::getRange() const Index: SourceRange.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/SourceRange.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SourceRange.cpp 6 Apr 2003 15:09:58 -0000 1.2 --- SourceRange.cpp 1 May 2003 20:48:05 -0000 1.3 *************** *** 63,66 **** --- 63,73 ---- + void + SourceRange::setEndIndex( int index ) + { + length_ = index - startIndex_; + } + + bool SourceRange::isEmpty() const |
From: <bl...@us...> - 2003-05-01 20:48:08
|
Update of /cvsroot/cpptool/rfta/include/rfta/parser In directory sc8-pr-cvs1:/tmp/cvs-serv12033/include/rfta/parser Modified Files: ASTNode.h SourceRange.h Log Message: * added setEndIndex() Index: ASTNode.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/ASTNode.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ASTNode.h 25 Dec 2002 22:39:03 -0000 1.15 --- ASTNode.h 1 May 2003 20:48:04 -0000 1.16 *************** *** 56,59 **** --- 56,61 ---- void setLength( int length ); + void setEndIndex( int index ); + const SourceRange &getRange() const; Index: SourceRange.h =================================================================== RCS file: /cvsroot/cpptool/rfta/include/rfta/parser/SourceRange.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SourceRange.h 22 Dec 2002 16:03:50 -0000 1.1 --- SourceRange.h 1 May 2003 20:48:04 -0000 1.2 *************** *** 34,37 **** --- 34,39 ---- void setLength( int length ); + void setEndIndex( int index ); + bool isEmpty() const; |
From: <bl...@us...> - 2003-05-01 19:05:41
|
Update of /cvsroot/cpptool/rfta/bin/testdata/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv31797/bin/testdata/rfta Modified Files: DeclarativeCondition.cpp ForDeclaration.cpp Log Message: * fixed test file for correct processing (added function header) Index: DeclarativeCondition.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/testdata/rfta/DeclarativeCondition.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DeclarativeCondition.cpp 30 Apr 2003 22:22:38 -0000 1.1 --- DeclarativeCondition.cpp 1 May 2003 19:05:37 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + void f() { if ( int x = 3 ) Index: ForDeclaration.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/testdata/rfta/ForDeclaration.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ForDeclaration.cpp 30 Apr 2003 22:22:38 -0000 1.1 --- ForDeclaration.cpp 1 May 2003 19:05:38 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + void f() { for ( int a, b;; ) //int a, b;; ) |
From: <bl...@us...> - 2003-05-01 19:04:36
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv31200/src/rftaparser Modified Files: DeclarationParserTest.cpp DeclarationParserTest.h Log Message: * added test for class forward declaration Index: DeclarationParserTest.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DeclarationParserTest.cpp 30 Apr 2003 22:13:59 -0000 1.6 --- DeclarationParserTest.cpp 1 May 2003 19:04:31 -0000 1.7 *************** *** 233,236 **** --- 233,253 ---- } + + void + DeclarationParserTest::testClassForwardDeclaration() + { + const std::string source( " class X; " ); + int startIndex = 1; + int endIndex = source.length()-1; + SourceASTNodePtr sourceAST = RFTA_ASSERT_PARSER_PASS( DeclarationParser, + source, + source.length()-1 ); + RFTA_ASSERT_NODE_HAS( sourceAST->getChildAt(0), + ASTNodeTypes::unparsedDeclaration, + startIndex, + endIndex-startIndex ); + } + + void DeclarationParserTest::testTemplateClass() Index: DeclarationParserTest.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParserTest.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DeclarationParserTest.h 30 Apr 2003 22:13:59 -0000 1.4 --- DeclarationParserTest.h 1 May 2003 19:04:32 -0000 1.5 *************** *** 28,31 **** --- 28,32 ---- CPPUNIT_TEST( testFunctionbody ); CPPUNIT_TEST( testClassDeclaration ); + CPPUNIT_TEST( testClassForwardDeclaration ); CPPUNIT_TEST( testTemplateClass ); CPPUNIT_TEST( testTemplateFuntion ); *************** *** 55,58 **** --- 56,60 ---- void testFunctionbody(); void testClassDeclaration(); + void testClassForwardDeclaration(); void testTemplateClass(); void testTemplateFuntion(); |
From: <bl...@us...> - 2003-05-01 18:53:25
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv24787/src/rftaparser Modified Files: ParserTesting.h rftaparser.dsp UnitTesting.h Log Message: * introduced RFTA_CUSTOM_ASSERT * moved common UnitTesting.h parts to include/rfta/test/UnitTesting.h Index: ParserTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/ParserTesting.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ParserTesting.h 26 Apr 2003 10:50:58 -0000 1.4 --- ParserTesting.h 1 May 2003 18:53:20 -0000 1.5 *************** *** 17,20 **** --- 17,69 ---- }; + 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(), + whichNode + ": bad node type." ); + checkEquals( index, node->getStartIndex(), + whichNode + ": bad node start index." ); + checkEquals( length, node->getLength(), + 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(); + if ( !node->hasProperty( property ) ) + fail( what + ": does not exist" ); + + NodeAsserter().chain(*this)( node->getProperty( property ), type, index, length, what ); + } + }; + + inline void checkASTNodeType( const ASTNodePtr &node, const ASTNodeType &type, *************** *** 26,30 **** whichNode + ": bad node type." ); } ! inline void checkASTNodeHas( const ASTNodePtr &node, --- 75,79 ---- whichNode + ": bad node type." ); } ! inline void checkASTNodeHas( const ASTNodePtr &node, *************** *** 65,68 **** --- 114,118 ---- + template<typename ParserType> void checkParserFail( const std::string &source, *************** *** 208,225 **** } ! #define RFTA_ASSERT_NODE_TYPE( node, type ) \ ! Refactoring::Testing::checkASTNodeType( node, type, \ ! CPPUNIT_SOURCELINE(), \ ! #node ) #define RFTA_ASSERT_NODE_HAS( node, type, index, length ) \ ! Refactoring::Testing::checkASTNodeHas( node, type, index, length, \ ! CPPUNIT_SOURCELINE(), \ ! #node ) #define RFTA_ASSERT_NODE_PROPERTY_HAS( node, property, type, index, length ) \ ! Refactoring::Testing::checkASTNodePropertyHas( \ node, property, type, index, length, \ - CPPUNIT_SOURCELINE(), \ #node ) --- 258,270 ---- } ! #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 ) Index: rftaparser.dsp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/rftaparser.dsp,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** rftaparser.dsp 29 Apr 2003 22:03:43 -0000 1.46 --- rftaparser.dsp 1 May 2003 18:53:21 -0000 1.47 *************** *** 1438,1444 **** --- 1438,1460 ---- # End Source File # End Group + # Begin Group "RftaTest" + + # PROP Default_Filter "" + # Begin Source File + + SOURCE=..\..\include\rfta\test\UnitTesting.h + # End Source File + # End Group # Begin Source File SOURCE=..\..\include\rfta\parser\Config.h + # End Source File + # Begin Source File + + SOURCE=.\DeclarationDetailsParserTest.cpp + # End Source File + # Begin Source File + + SOURCE=.\DeclarationDetailsParserTest.h # End Source File # Begin Source File Index: UnitTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnitTesting.h,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** UnitTesting.h 27 Oct 2002 16:59:36 -0000 1.3 --- UnitTesting.h 1 May 2003 18:53:21 -0000 1.4 *************** *** 1,60 **** ! #ifndef RFTA_UNITTESTING_H ! #define RFTA_UNITTESTING_H ! ! #include <cppunit/extensions/HelperMacros.h> ! #include <sstream> ! ! namespace Refactoring ! { ! namespace Testing ! { ! template<typename FirstType ! ,typename SecondType ! > ! void checkEquals( const FirstType &expected, ! const SecondType &actual, ! const CppUnit::AdditionalMessage &message, ! const CppUnit::SourceLine &sourceLine ) ! { ! if ( expected == actual ) ! return; ! ! std::ostringstream sExpected; ! sExpected << expected; ! std::ostringstream sActual; ! sActual << actual; ! ! CppUnit::Message fixedMessage; ! if ( !message.shortDescription().empty() ) ! fixedMessage.addDetail( message.shortDescription() ); ! for ( int index =0; index < message.detailCount(); ++index ) ! fixedMessage.addDetail( message.detailAt( index ) ); ! ! CppUnit::Asserter::failNotEqual( sExpected.str(), ! sActual.str(), ! sourceLine, ! fixedMessage ); ! } ! } ! } ! ! ! #define RFTA_ASSERT_EQUAL( x, y ) \ ! Refactoring::Testing::checkEquals( x, y, "", CPPUNIT_SOURCELINE() ) ! #define RFTA_ASSERTM_EQUAL( x, y, message ) \ ! Refactoring::Testing::checkEquals( x, y, message, CPPUNIT_SOURCELINE() ) - #define RFTA_ASSERT_THROW( expression, ExceptionType ) \ - try { \ - expression; \ - { \ - CPPUNIT_NS::Message message( "excepted exception of type " \ - #ExceptionType " not thrown.", \ - "Expression: " #expression ); \ - CPPUNIT_NS::Asserter::fail( message, CPPUNIT_SOURCELINE() ); \ - } \ - } catch ( ExceptionType & ) { \ - } #define RFTAPARSER_TEST_SUITE_REGISTRATION( FixtureType ) \ --- 1,7 ---- ! #ifndef RFTAPARSER_UNITTESTING_H ! #define RFTAPARSER_UNITTESTING_H ! #include <rfta/test/UnitTesting.h> #define RFTAPARSER_TEST_SUITE_REGISTRATION( FixtureType ) \ *************** *** 63,66 **** ! #endif // RFTA_UNITTESTING_H --- 10,13 ---- ! #endif // RFTAPARSER_UNITTESTING_H |
From: <bl...@us...> - 2003-05-01 18:53:23
|
Update of /cvsroot/cpptool/rfta/include/rfta/test In directory sc8-pr-cvs1:/tmp/cvs-serv24787/include/rfta/test Added Files: UnitTesting.h Log Message: * introduced RFTA_CUSTOM_ASSERT * moved common UnitTesting.h parts to include/rfta/test/UnitTesting.h --- NEW FILE: UnitTesting.h --- #ifndef RFTATEST_UNITTESTING_H #define RFTATEST_UNITTESTING_H #include <cppunit/extensions/HelperMacros.h> #include <sstream> #include <typeinfo> namespace Refactoring { namespace Testing { template<typename FirstType ,typename SecondType > void checkEquals( const FirstType &expected, const SecondType &actual, const CppUnit::AdditionalMessage &message, const CppUnit::SourceLine &sourceLine ) { if ( expected == actual ) return; std::ostringstream sExpected; sExpected << expected; std::ostringstream sActual; sActual << actual; CppUnit::Message fixedMessage; if ( !message.shortDescription().empty() ) fixedMessage.addDetail( message.shortDescription() ); for ( int index =0; index < message.detailCount(); ++index ) fixedMessage.addDetail( message.detailAt( index ) ); CppUnit::Asserter::failNotEqual( sExpected.str(), sActual.str(), sourceLine, fixedMessage ); } inline void checkType( const std::type_info &expectedType, const std::type_info &actualType, const std::string &expression, const CppUnit::SourceLine &sourceLine ) { if ( expectedType == actualType ) return; CppUnit::Message message( "expression is not of the expected type" ); message.addDetail( std::string("Expected type: ") + expectedType.name() ); message.addDetail( std::string("Actual type: ") + actualType.name() ); if ( !expression.empty() ) message.addDetail( "Expression: " + expression ); CppUnit::Asserter::fail( message, sourceLine ); } struct AsserterBase { AsserterBase &setAssertLocation( const CppUnit::SourceLine &location ) { location_ = location; return *this; } AsserterBase &chain( const AsserterBase ¤tAsserter ) { location_ = currentAsserter.location_; return *this; } void fail( const CppUnit::AdditionalMessage &message = "" ) const { CppUnit::Asserter::fail( message, location_ ); } void failIf( bool condition, const CppUnit::AdditionalMessage &message = "" ) const { CppUnit::Asserter::failIf( condition, message, location_ ); } template<typename FirstType ,typename SecondType> void checkEquals( const FirstType &expected, const SecondType &actual, const CppUnit::AdditionalMessage &message = "") { ::Refactoring::Testing::checkEquals( expected, actual, message, location_ ); } CppUnit::SourceLine location_; }; template<typename DerivedType> struct Asserter : public AsserterBase { DerivedType &setAssertLocation( const CppUnit::SourceLine &location ) { return static_cast<DerivedType &>( AsserterBase::setAssertLocation( location ) ); } DerivedType &chain( const AsserterBase ¤tAsserter ) { return static_cast<DerivedType &>( AsserterBase::chain( currentAsserter ) ); } }; } } #define RFTA_CUSTOM_ASSERT( AsserterType ) \ AsserterType().setAssertLocation( CPPUNIT_SOURCELINE() ) #define RFTA_ASSERT_EQUAL( x, y ) \ Refactoring::Testing::checkEquals( x, y, "", CPPUNIT_SOURCELINE() ) #define RFTA_ASSERTM_EQUAL( x, y, message ) \ Refactoring::Testing::checkEquals( x, y, message, CPPUNIT_SOURCELINE() ) #define RFTA_ASSERT_THROW( expression, ExceptionType ) \ try { \ expression; \ { \ CPPUNIT_NS::Message message( "excepted exception of type " \ #ExceptionType " not thrown.", \ "Expression: " #expression ); \ CPPUNIT_NS::Asserter::fail( message, CPPUNIT_SOURCELINE() ); \ } \ } catch ( ExceptionType & ) { \ } #define RFTA_ASSERT_TYPE_IS( expectedType, expression ) \ Refactoring::Testing::checkType( typeid(expectedType), \ typeid(expression), \ #expression, \ CPPUNIT_SOURCELINE() ) #endif // RFTATEST_UNITTESTING_H |
From: <bl...@us...> - 2003-05-01 18:53:23
|
Update of /cvsroot/cpptool/rfta/src/rfta In directory sc8-pr-cvs1:/tmp/cvs-serv24787/src/rfta Modified Files: UnitTesting.h Log Message: * introduced RFTA_CUSTOM_ASSERT * moved common UnitTesting.h parts to include/rfta/test/UnitTesting.h Index: UnitTesting.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rfta/UnitTesting.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** UnitTesting.h 8 Mar 2003 13:11:42 -0000 1.4 --- UnitTesting.h 1 May 2003 18:53:19 -0000 1.5 *************** *** 2,89 **** #define RFTA_UNITTESTING_H ! #include <cppunit/extensions/HelperMacros.h> ! #include <sstream> ! #include <typeinfo> ! ! namespace Refactoring ! { ! namespace Testing ! { ! template<typename FirstType ! ,typename SecondType ! > ! void checkEquals( const FirstType &expected, ! const SecondType &actual, ! const CppUnit::AdditionalMessage &message, ! const CppUnit::SourceLine &sourceLine ) ! { ! if ( expected == actual ) ! return; ! ! std::ostringstream sExpected; ! sExpected << expected; ! std::ostringstream sActual; ! sActual << actual; ! ! CppUnit::Message fixedMessage; ! if ( !message.shortDescription().empty() ) ! fixedMessage.addDetail( message.shortDescription() ); ! for ( int index =0; index < message.detailCount(); ++index ) ! fixedMessage.addDetail( message.detailAt( index ) ); ! ! CppUnit::Asserter::failNotEqual( sExpected.str(), ! sActual.str(), ! sourceLine, ! fixedMessage ); ! } ! ! ! inline void checkType( const std::type_info &expectedType, ! const std::type_info &actualType, ! const std::string &expression, ! const CppUnit::SourceLine &sourceLine ) ! { ! if ( expectedType == actualType ) ! return; ! ! CppUnit::Message message( "expression is not of the expected type" ); ! message.addDetail( std::string("Expected type: ") + expectedType.name() ); ! message.addDetail( std::string("Actual type: ") + actualType.name() ); ! if ( !expression.empty() ) ! message.addDetail( "Expression: " + expression ); ! ! CppUnit::Asserter::fail( message, sourceLine ); ! } ! ! } ! } ! ! ! #define RFTA_ASSERT_EQUAL( x, y ) \ ! Refactoring::Testing::checkEquals( x, y, "", CPPUNIT_SOURCELINE() ) ! ! #define RFTA_ASSERTM_EQUAL( x, y, message ) \ ! Refactoring::Testing::checkEquals( x, y, message, CPPUNIT_SOURCELINE() ) ! ! #define RFTA_ASSERT_THROW( expression, ExceptionType ) \ ! try { \ ! expression; \ ! { \ ! CPPUNIT_NS::Message message( "excepted exception of type " \ ! #ExceptionType " not thrown.", \ ! "Expression: " #expression ); \ ! CPPUNIT_NS::Asserter::fail( message, CPPUNIT_SOURCELINE() ); \ ! } \ ! } catch ( ExceptionType & ) { \ ! } #define RFTA_TEST_SUITE_REGISTRATION( FixtureType ) \ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FixtureType, "Refactoring" ) - #define RFTA_ASSERT_TYPE_IS( expectedType, expression ) \ - Refactoring::Testing::checkType( typeid(expectedType), \ - typeid(expression), \ - #expression, \ - CPPUNIT_SOURCELINE() ) #endif // RFTA_UNITTESTING_H --- 2,10 ---- #define RFTA_UNITTESTING_H ! #include <rfta/test/UnitTesting.h> #define RFTA_TEST_SUITE_REGISTRATION( FixtureType ) \ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FixtureType, "Refactoring" ) #endif // RFTA_UNITTESTING_H |
From: <bl...@us...> - 2003-05-01 18:28:19
|
Update of /cvsroot/cpptool/rfta/include/rfta/test In directory sc8-pr-cvs1:/tmp/cvs-serv11049/test Log Message: Directory /cvsroot/cpptool/rfta/include/rfta/test added to the repository |
From: <bl...@us...> - 2003-05-01 09:56:26
|
Update of /cvsroot/cpptool/rfta/bin In directory sc8-pr-cvs1:/tmp/cvs-serv21655/bin Modified Files: lister.py Log Message: * fixed astdump, parser failure was not indicated by error code * correctly define output html filename (was stripping .cpp/.h extension) Index: lister.py =================================================================== RCS file: /cvsroot/cpptool/rfta/bin/lister.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lister.py 1 May 2003 08:12:30 -0000 1.2 --- lister.py 1 May 2003 09:08:08 -0000 1.3 *************** *** 139,142 **** --- 139,151 ---- self.output_path = output_path + def __cmp__( self, other ): + x = self.source_path + y = other.source_path + if x < y: + return -1 + elif x > y: + return 1 + return 0 + class ASTGenerator: def __init__( self, source_dir, output_dir ): *************** *** 147,158 **** def generate( self, source_path ): relative_source_path = Path(source_path).make_relative_to( self.source_dir ) ! output_filename = Path( relative_source_path ).change_extension( "html" ) output_path = os.path.join( self.output_dir, output_filename ) ! print "Generating AST for ", source_path, " in ", output_path Path(output_path).ensure_dir_exists() exit_code = os.spawnl( os.P_WAIT, "astdump", "astdump", source_path, output_path ) ! self.parse_result[ source_path ] = ParseResult( self.convertParseExitCode(exit_code), ! source_path, ! output_path ) def convertParseExitCode( self, code ): --- 156,167 ---- def generate( self, source_path ): relative_source_path = Path(source_path).make_relative_to( self.source_dir ) ! output_filename = relative_source_path + ".html" output_path = os.path.join( self.output_dir, output_filename ) ! print "Generating AST for ", source_path, " in ", output_path, Path(output_path).ensure_dir_exists() exit_code = os.spawnl( os.P_WAIT, "astdump", "astdump", source_path, output_path ) ! status = self.convertParseExitCode(exit_code) ! self.parse_result[ source_path ] = ParseResult( status, source_path, output_path ) ! print ': ', status def convertParseExitCode( self, code ): *************** *** 205,209 **** table_tag = Tag( 'TABLE' ).setAttributes( { 'WIDTH' : '100%', 'BORDER' : '0', 'COLS' : '2' } ) tags.append( table_tag ) ! for test in self.parse_result.itervalues(): row_tag = Tag( 'TR' ).setAttribute( 'ALIGN', 'left' ) relative_url = Path( test.output_path ).make_relative_to( self.output_dir ) --- 214,220 ---- table_tag = Tag( 'TABLE' ).setAttributes( { 'WIDTH' : '100%', 'BORDER' : '0', 'COLS' : '2' } ) tags.append( table_tag ) ! sorted_tests = self.parse_result.values() ! sorted_tests.sort() ! for test in sorted_tests: row_tag = Tag( 'TR' ).setAttribute( 'ALIGN', 'left' ) relative_url = Path( test.output_path ).make_relative_to( self.output_dir ) |
From: <bl...@us...> - 2003-05-01 09:38:29
|
Update of /cvsroot/cpptool/rfta/src/astdumper In directory sc8-pr-cvs1:/tmp/cvs-serv21655/src/astdumper Modified Files: ASTDumper.cpp ASTDumper.h Main.cpp Log Message: * fixed astdump, parser failure was not indicated by error code * correctly define output html filename (was stripping .cpp/.h extension) Index: ASTDumper.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ASTDumper.cpp 30 Apr 2003 22:10:48 -0000 1.7 --- ASTDumper.cpp 1 May 2003 09:08:08 -0000 1.8 *************** *** 133,137 **** ! void ASTDumper::dump( const std::string &source, const boost::filesystem::path &filePath, --- 133,137 ---- ! bool ASTDumper::dump( const std::string &source, const boost::filesystem::path &filePath, *************** *** 148,159 **** writer.writeH2( "Abstract syntax tree:" ); ! writeAST( source, writer ); writer.writeFooter(); stream.close(); } ! void ASTDumper::writeAST( const std::string &source, HTMLWriter &writer ) --- 148,160 ---- writer.writeH2( "Abstract syntax tree:" ); ! bool succeed = writeAST( source, writer ); writer.writeFooter(); stream.close(); + return succeed; } ! bool ASTDumper::writeAST( const std::string &source, HTMLWriter &writer ) *************** *** 170,173 **** --- 171,175 ---- sourceAST->getBlankedSourceEnd() ); + bool succeed = true; try { *************** *** 182,189 **** --- 184,193 ---- writer.writeError( "Parsing failed:" ); writer.writePreformated( e.what() ); + succeed = false; } ASTDumpVisitor visitor( writer, sourceAST ); visitor.visitNode( sourceAST ); + return succeed; } Index: ASTDumper.h =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/ASTDumper.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ASTDumper.h 30 Apr 2003 22:10:49 -0000 1.2 --- ASTDumper.h 1 May 2003 09:08:09 -0000 1.3 *************** *** 27,36 **** virtual ~ASTDumper(); ! void dump( const std::string &source, const boost::filesystem::path &logDir, const std::string &title ); private: ! void writeAST( const std::string &source, HTMLWriter &writer ); }; --- 27,36 ---- virtual ~ASTDumper(); ! bool dump( const std::string &source, const boost::filesystem::path &logDir, const std::string &title ); private: ! bool writeAST( const std::string &source, HTMLWriter &writer ); }; Index: Main.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/astdumper/Main.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Main.cpp 30 Apr 2003 22:14:50 -0000 1.3 --- Main.cpp 1 May 2003 09:08:09 -0000 1.4 *************** *** 59,63 **** Refactoring::ASTDumper dumper; ! dumper.dump( source, outputPath, path.string() ); } catch ( std::exception &e ) --- 59,63 ---- Refactoring::ASTDumper dumper; ! return dumper.dump( source, outputPath, path.string() ) ? 0 : 2; } catch ( std::exception &e ) *************** *** 70,74 **** } } - - return 0; } --- 70,72 ---- |