summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus/Parser.cpp
diff options
context:
space:
mode:
authorRoberto Raggi <roberto.raggi@nokia.com>2009-12-03 12:19:50 +0100
committerRoberto Raggi <roberto.raggi@nokia.com>2009-12-03 12:20:31 +0100
commit1c40a4bcd669c8645a4f737a8d0426e82f2c3b39 (patch)
treecf72ad2d1768cb948ecd7ee6ffc9360d7a42ff00 /src/shared/cplusplus/Parser.cpp
parent72ed9b5b5162190c4b555309cd97d47346de3235 (diff)
downloadqt-creator-1c40a4bcd669c8645a4f737a8d0426e82f2c3b39.tar.gz
Improved panic mode error recovery
Diffstat (limited to 'src/shared/cplusplus/Parser.cpp')
-rw-r--r--src/shared/cplusplus/Parser.cpp80
1 files changed, 39 insertions, 41 deletions
diff --git a/src/shared/cplusplus/Parser.cpp b/src/shared/cplusplus/Parser.cpp
index f301963936..9607f7f3aa 100644
--- a/src/shared/cplusplus/Parser.cpp
+++ b/src/shared/cplusplus/Parser.cpp
@@ -163,50 +163,48 @@ bool Parser::skipUntil(int token)
return false;
}
-bool Parser::skipUntilDeclaration()
+void Parser::skipUntilDeclaration()
{
- while (int tk = LA()) {
- switch (tk) {
- case T_SEMICOLON:
- case T_TILDE:
- case T_COLON_COLON:
- case T_IDENTIFIER:
- case T_OPERATOR:
- case T_CHAR:
- case T_WCHAR_T:
- case T_BOOL:
- case T_SHORT:
- case T_INT:
- case T_LONG:
- case T_SIGNED:
- case T_UNSIGNED:
- case T_FLOAT:
- case T_DOUBLE:
- case T_VOID:
- case T_EXTERN:
- case T_NAMESPACE:
- case T_USING:
- case T_TYPEDEF:
- case T_ASM:
- case T_TEMPLATE:
- case T_EXPORT:
- case T_CONST:
- case T_VOLATILE:
- case T_PUBLIC:
- case T_PROTECTED:
- case T_PRIVATE:
- case T_CLASS:
- case T_STRUCT:
- case T_UNION:
- case T_TYPENAME:
- return true;
+ for (; ; consumeToken()) {
+ switch (LA()) {
+ case T_EOF_SYMBOL:
- default:
- consumeToken();
- }
- }
+ // names
+ case T_IDENTIFIER:
+ case T_COLON_COLON:
+ case T_TILDE:
+ case T_OPERATOR:
- return false;
+ // empty declaration
+ case T_SEMICOLON:
+
+ // member specification
+ case T_USING:
+ case T_TEMPLATE:
+ case T_PUBLIC:
+ case T_PROTECTED:
+ case T_PRIVATE:
+ case T_Q_SIGNALS:
+ case T_Q_SLOTS:
+
+ // declarations
+ case T_ENUM:
+ case T_NAMESPACE:
+ case T_ASM:
+ case T_EXPORT:
+ case T_AT_CLASS:
+ case T_AT_INTERFACE:
+ case T_AT_PROTOCOL:
+ case T_AT_IMPLEMENTATION:
+ case T_AT_END:
+ return;
+
+ default:
+ if (lookAtBuiltinTypeSpecifier() || lookAtClassKey() ||
+ lookAtFunctionSpecifier() || lookAtStorageClassSpecifier())
+ return;
+ } // switch
+ }
}
bool Parser::skipUntilStatement()