From: <net...@us...> - 2003-09-15 09:14:04
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv5144/rfta/src/rftaparser Modified Files: UnparsedDeclaratorMutator.cpp Log Message: -- declarator mutator splits scope identifier Index: UnparsedDeclaratorMutator.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/UnparsedDeclaratorMutator.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** UnparsedDeclaratorMutator.cpp 6 Sep 2003 21:34:00 -0000 1.1 --- UnparsedDeclaratorMutator.cpp 15 Sep 2003 09:14:01 -0000 1.2 *************** *** 43,80 **** if (!isalpha(*current) && *current!=':') { current++; continue; } ! if (*current==':' && *(current+1) != ':') { current++; continue; } ! ! // read the identifier: Xtl::CStringEnumerator en( Xtl::CStringView( start, end ) ); ! en.setCurrent( current ); ! int identStartOfs = en.getCurrentIndex(); ParserTools::skip(en,ParserTools::SkipScopeOperatorPolicy()); while (current!=end) ! { Xtl::CStringView identifier; ParserTools::tryReadIdentifier( en, identifier ); current=en.getCurrentPos(); ! // check scope operator: ! if (*current==':') ! { ! if (*(current+1)==':') ! { ! ParserTools::skip(en,ParserTools::SkipScopeOperatorPolicy()); ! continue; ! } ! } ! break; ! } ! identifierNode = ASTNode::create( ASTNodeTypes::localScopeIdentifier, node, node->getStartIndex() + identStartOfs, (current-start)-identStartOfs, sourceNode); identFound = true; ! } ! node->addChild(identifierNode); node->mutateType(ASTNodeTypes::declarator); } --- 43,84 ---- if (!isalpha(*current) && *current!=':') { current++; continue; } ! if (*current==':' && *(current+1) != ':') { current++; continue; } ! ! // setup enumerator for identifier reading: Xtl::CStringEnumerator en( Xtl::CStringView( start, end ) ); ! en.setCurrent( current ); + // skip possible "root" scope operator ParserTools::skip(en,ParserTools::SkipScopeOperatorPolicy()); while (current!=end) ! { ! int identStartOfs = en.getCurrentIndex(); Xtl::CStringView identifier; ParserTools::tryReadIdentifier( en, identifier ); current=en.getCurrentPos(); ! if ( identStartOfs == en.getCurrentIndex() ) ! break; ! ! identifierNode = ASTNode::create( ASTNodeTypes::localScopeIdentifier, node, node->getStartIndex() + identStartOfs, (current-start)-identStartOfs, sourceNode); + node->addChild(identifierNode); + + // skip white spaces: + ParserTools::skipSpaces(en); + + // check for scope-operator: + const char * identend = en.getCurrentPos(); + ParserTools::skip(en,ParserTools::SkipScopeOperatorPolicy()); + if ( identend == en.getCurrentPos() ) + break; // no scope resolution found ... + } + identFound = true; ! } node->mutateType(ASTNodeTypes::declarator); } |