Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
83e35eb9
Commit
83e35eb9
authored
Jul 29, 2009
by
Erik Verbruggen
Browse files
Another fix for ObjC fast-enum parsing.
parent
123e2f63
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/Parser.cpp
View file @
83e35eb9
...
...
@@ -56,7 +56,7 @@
#include
<cstdlib>
#include
<cstring>
#include
<cassert>
#include
<QDebug>
CPLUSPLUS_BEGIN_NAMESPACE
Parser
::
Parser
(
TranslationUnit
*
unit
)
...
...
@@ -2189,6 +2189,15 @@ bool Parser::parseForStatement(StatementAST *&node)
if
(
parseTypeSpecifier
(
ast
->
type_specifiers
))
parseDeclarator
(
ast
->
declarator
);
if
((
ast
->
type_specifiers
||
ast
->
declarator
)
&&
!
peekAtObjCContextKeyword
(
Token_in
))
{
// woops, probably parsed too much: "in" got parsed as a declarator. Let's redo it:
ast
->
type_specifiers
=
0
;
ast
->
declarator
=
0
;
rewind
(
startOfTypeSpecifier
);
parseDeclarator
(
ast
->
declarator
);
}
if
(
!
ast
->
type_specifiers
||
!
ast
->
declarator
)
{
ast
->
type_specifiers
=
0
;
ast
->
declarator
=
0
;
...
...
@@ -4635,17 +4644,24 @@ bool Parser::parseObjCTypeQualifiers(unsigned &type_qualifier)
return
true
;
}
bool
Parser
::
p
arse
ObjCContextKeyword
(
int
kind
,
unsigned
&
in_token
)
bool
Parser
::
p
eekAt
ObjCContextKeyword
(
int
kind
)
{
if
(
LA
()
!=
T_IDENTIFIER
)
return
false
;
Identifier
*
id
=
tok
().
identifier
;
const
int
k
=
classifyObjectiveCTypeQualifiers
(
id
->
chars
(),
id
->
size
());
if
(
k
!=
kind
)
return
k
==
kind
;
}
bool
Parser
::
parseObjCContextKeyword
(
int
kind
,
unsigned
&
in_token
)
{
if
(
peekAtObjCContextKeyword
(
kind
))
{
in_token
=
consumeToken
();
return
true
;
}
else
{
return
false
;
in_token
=
consumeToken
();
return
true
;
}
}
CPLUSPLUS_END_NAMESPACE
src/shared/cplusplus/Parser.h
View file @
83e35eb9
...
...
@@ -244,6 +244,7 @@ public:
bool
parseObjCSelector
(
unsigned
&
selector_token
);
bool
parseObjCKeywordDeclaration
(
ObjCSelectorArgumentAST
*&
argument
,
ObjCMessageArgumentDeclarationAST
*&
node
);
bool
parseObjCTypeQualifiers
(
unsigned
&
type_qualifier
);
bool
peekAtObjCContextKeyword
(
int
kind
);
bool
parseObjCContextKeyword
(
int
kind
,
unsigned
&
in_token
);
bool
lookAtObjCSelector
()
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment