From: <bl...@us...> - 2003-04-26 21:11:34
|
Update of /cvsroot/cpptool/rfta/src/rftaparser In directory sc8-pr-cvs1:/tmp/cvs-serv9532/src/rftaparser Modified Files: Parser.cpp Log Message: * added functionalities to use CStringView & CStringEnumerator Index: Parser.cpp =================================================================== RCS file: /cvsroot/cpptool/rfta/src/rftaparser/Parser.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Parser.cpp 26 Apr 2003 10:51:59 -0000 1.7 --- Parser.cpp 26 Apr 2003 21:11:30 -0000 1.8 *************** *** 9,12 **** --- 9,14 ---- #include <rfta/parser/Parser.h> #include <rfta/parser/ParserError.h> + #include <rfta/parser/ParserTools.h> + #include <xtl/CStringView.h> *************** *** 78,81 **** --- 80,96 ---- + void + Parser::throwFailure( const ParserTools::ParseError &error ) + { + std::string message = error.what(); + message += "\n- Current position: "; + message += Xtl::CStringView( error.context_ ).getSubString(0, 60).str(); + message += "\n- While analyzing:\n"; + message += error.context_.getString().str(); + + throw ParserError( message, context_ ); + } + + const ASTNodeWeakPtr & Parser::getParentNode() const *************** *** 301,306 **** int ! Parser::getIndexOf( const char *pos ) { return pos - context_.getSourceNode()->getBlankedSourceStart(); --- 316,333 ---- + ASTNodePtr + Parser::createASTNode( const ASTNodeType &type, + const ASTNodeWeakPtr &parentNode, + const Xtl::CStringView &string ) const + { + return createASTNode( type, + parentNode, + getIndexOf( string.getStart() ), + string.getLength() ); + } + + int ! Parser::getIndexOf( const char *pos ) const { return pos - context_.getSourceNode()->getBlankedSourceStart(); |