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 |