Update of /cvsroot/cpptool/rfta/src/rftaparser
In directory sc8-pr-cvs1:/tmp/cvs-serv2595/src/rftaparser
Modified Files:
DeclarationParser.cpp
Log Message:
-- bugfix function declaration detect
Index: DeclarationParser.cpp
===================================================================
RCS file: /cvsroot/cpptool/rfta/src/rftaparser/DeclarationParser.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** DeclarationParser.cpp 28 Apr 2003 20:40:13 -0000 1.5
--- DeclarationParser.cpp 29 Apr 2003 10:03:30 -0000 1.6
***************
*** 6,10 ****
#include "stdafx.h"
- #include <rfta/parser/DeclarationParser.h>
#include "NamespaceParser.h"
#include "UsingNamespaceParser.h"
--- 6,9 ----
***************
*** 13,16 ****
--- 12,17 ----
#include "TemplateDeclarationParser.h"
+ #include <rfta/parser/DeclarationParser.h>
+ #include <rfta/parser/ParserTools.h>
#include <rfta/parser/ASTNodes.h>
#include <rfta/parser/ParseContext.h>
***************
*** 81,98 ****
backtrackSkippingSpaces();
current_--;
! if (*current_=='y') // special case 'try-function-body'
! {
! if (hasPrevious() && current_[-1]=='r')
! {
! current_--;
! if (hasPrevious() && current_[-1]=='t')
! {
! // TODO: Handle the case of a try-catch-function-body
! throwFailure( "Handling of try-catch-function-body's not yet implemented.");
! }
! }
! // restore position:
! current_ = start_of_curl;
! }
if (*current_==')') // check for parameter declaration of a function
{
--- 82,86 ----
backtrackSkippingSpaces();
current_--;
! backtrackSkippingKeywordsAndSpace();
if (*current_==')') // check for parameter declaration of a function
{
***************
*** 201,204 ****
--- 189,240 ----
return parseCommonDeclaration();
+ }
+
+ /**
+ * function does backtrack skipping over keywords "const", "try" and white spaces
+ */
+ void
+ DeclarationParser::backtrackSkippingKeywordsAndSpace()
+ {
+ Xtl::CStringView cv(start_, current_+1);
+ Xtl::CStringBackEnumerator backEnumerator = cv.backEnumerate() - cv.getLength();
+
+ do
+ {
+ if (*backEnumerator==' ')
+ {
+ backEnumerator++;
+ current_ = backEnumerator.getCurrentPos()-1;
+ continue;
+ }
+
+ Xtl::CStringBackEnumerator saveEnumerator = backEnumerator;
+ if (!ParserTools::backtrackSkippingOverIdentifier(backEnumerator))
+ break;
+
+ Xtl::CStringView help(backEnumerator.getCurrentPos(),saveEnumerator.getCurrentPos());
+ std::string ident = help.str();
+ if (ident == "const" || ident == "try" )
+ current_ = backEnumerator.getCurrentPos()-1;
+ else
+ break;
+
+ } while (1);
+ /*
+ if (*current_=='y') // special case 'try-function-body'
+ {
+ if (hasPrevious() && current_[-1]=='r')
+ {
+ current_--;
+ if (hasPrevious() && current_[-1]=='t')
+ {
+ // TODO: Handle the case of a try-catch-function-body
+ throwFailure( "Handling of try-catch-function-body's not yet implemented.");
+ }
+ }
+ // restore position:
+ current_ = start_of_curl;
+ }
+ */
}
|