Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv32351/src/rftaparser
Modified Files:
Parser.cpp
Log Message:
* added tryReadNextIdentifier for a CStringView
Index: Parser.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/Parser.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** Parser.cpp 1 May 2003 21:07:29 -0000 1.10
--- Parser.cpp 4 May 2003 06:55:25 -0000 1.11
***************
*** 53,66 ****
Parser::throwFailure( const std::string &message )
{
! std::string currentContext;
! if ( current_ < end_ && current_ >= start_ )
! {
! int length = end_ - current_;
! currentContext.assign( current_, length > 60 ? 60 : length );
! }
!
! const std::string extendedMessage = message + "\nCurrent Context: " + currentContext;
!
! throw ParserError( extendedMessage, context_ );
}
--- 53,59 ----
Parser::throwFailure( const std::string &message )
{
! Xtl::CStringEnumerator enumerator( start_, end_ );
! enumerator.setCurrent( current_ );
! throwFailure( ParserTools::ParseError( message, enumerator ) );
}
***************
*** 198,218 ****
bool
! Parser::tryReadNextIdentifier( std::string &identifier )
{
! if ( !hasNext() )
! return false;
! const char *identifierStart = current_;
! if ( isValidIdentifierFirstLetter( *current_ ) )
! {
! ++current_;
! while ( hasNext() && isIdentifierLetter( *current_ ) )
! ++current_;
! }
! int identifierLength = current_ - identifierStart;
! identifier.assign( identifierStart, identifierLength );
! return identifierLength != 0;
}
--- 191,213 ----
bool
! Parser::tryReadNextIdentifier( Xtl::CStringView &identifier )
{
! Xtl::CStringEnumerator current( Xtl::CStringView( start_, end_ ) );
! current.setCurrent( current_ );
! bool identifierFound = ParserTools::tryReadIdentifier( current, identifier );
! current_ = current;
! return identifierFound;
! }
!
! bool
! Parser::tryReadNextIdentifier( std::string &identifier )
! {
! Xtl::CStringView identifierString;
! bool identifierFound = tryReadNextIdentifier( identifierString );
! identifier = identifierString.str();
! return identifierFound;
}
|