From: <net...@us...> - 2003-04-28 20:41:19
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv27192/src/rftaparser Modified Files: DeclarationListParser.cpp Log Message: -- extensions for class body parsing Index: DeclarationListParser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationListParser.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DeclarationListParser.cpp 14 Apr 2003 19:46:11 -0000 1.3 --- DeclarationListParser.cpp 28 Apr 2003 20:41:15 -0000 1.4 *************** *** 11,14 **** --- 11,16 ---- #include <rfta/parser/ParseContext.h> #include <stdexcept> + #include <rfta/parser/ParserTools.h> + #include <set> *************** *** 39,48 **** Tracker tracker( "DeclarationListParser::tryParse", *this ); do { skipSpaces(); if (!hasNext()) break; DeclarationParser parser(context_, current_ , end_ ); ! if (!parser.tryParse()) break; current_ = parser.getCurrent(); --- 41,73 ---- Tracker tracker( "DeclarationListParser::tryParse", *this ); + std::set< std::string > keywords; + + keywords.insert( "public" ); + keywords.insert( "private" ); + keywords.insert( "protected" ); + keywords.insert( "signal" ); + do { skipSpaces(); if (!hasNext()) break; + Xtl::CStringEnumerator en(Xtl::CStringView( current_, end_ ).enumerate() ); + std::string ident; + + ident = ParserTools::tryReadKeyword(en,keywords); + if (!ident.empty()) + { + ParserTools::skipUntil(en,':'); + // @todo: store information on visibility + current_ = en.getCurrentPos(); + skipSpaces(); + } + DeclarationParser parser(context_, current_ , end_ ); ! if (!parser.tryParse()) ! { ! current_ = parser.getCurrent(); ! break; // no more declaration, stop parsing here ! } current_ = parser.getCurrent(); *************** *** 50,54 **** } while ( current_ < end_ ); ! return true; } --- 75,79 ---- } while ( current_ < end_ ); ! return current_ == end_; } |