Skip to content
GitLab
Menu
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
ddcc40d0
Commit
ddcc40d0
authored
Mar 25, 2010
by
Roberto Raggi
Browse files
Accepts `...' when parsing declarator-ids in C++0x.
parent
a52b8266
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/shared/cplusplus/AST.cpp
View file @
ddcc40d0
...
...
@@ -760,12 +760,22 @@ unsigned DeclarationStatementAST::lastToken() const
unsigned
DeclaratorIdAST
::
firstToken
()
const
{
if
(
dot_dot_dot_token
)
return
dot_dot_dot_token
;
return
name
->
firstToken
();
}
unsigned
DeclaratorIdAST
::
lastToken
()
const
{
return
name
->
lastToken
();
if
(
name
)
return
name
->
lastToken
();
else
if
(
dot_dot_dot_token
)
return
dot_dot_dot_token
+
1
;
// assert?
return
0
;
}
unsigned
DeleteExpressionAST
::
firstToken
()
const
...
...
src/shared/cplusplus/AST.h
View file @
ddcc40d0
...
...
@@ -1368,11 +1368,13 @@ protected:
class
CPLUSPLUS_EXPORT
DeclaratorIdAST
:
public
CoreDeclaratorAST
{
public:
unsigned
dot_dot_dot_token
;
NameAST
*
name
;
public:
DeclaratorIdAST
()
:
name
(
0
)
:
dot_dot_dot_token
(
0
)
,
name
(
0
)
{}
virtual
DeclaratorIdAST
*
asDeclaratorId
()
{
return
this
;
}
...
...
src/shared/cplusplus/ASTClone.cpp
View file @
ddcc40d0
...
...
@@ -447,6 +447,7 @@ DeclarationStatementAST *DeclarationStatementAST::clone(MemoryPool *pool) const
DeclaratorIdAST
*
DeclaratorIdAST
::
clone
(
MemoryPool
*
pool
)
const
{
DeclaratorIdAST
*
ast
=
new
(
pool
)
DeclaratorIdAST
;
ast
->
dot_dot_dot_token
=
dot_dot_dot_token
;
if
(
name
)
ast
->
name
=
name
->
clone
(
pool
);
return
ast
;
...
...
src/shared/cplusplus/ASTMatcher.cpp
View file @
ddcc40d0
...
...
@@ -731,6 +731,8 @@ bool ASTMatcher::match(DeclaratorIdAST *node, DeclaratorIdAST *pattern)
(
void
)
node
;
(
void
)
pattern
;
pattern
->
dot_dot_dot_token
=
node
->
dot_dot_dot_token
;
if
(
!
pattern
->
name
)
pattern
->
name
=
node
->
name
;
else
if
(
!
AST
::
match
(
node
->
name
,
pattern
->
name
,
this
))
...
...
src/shared/cplusplus/Parser.cpp
View file @
ddcc40d0
...
...
@@ -1218,11 +1218,18 @@ bool Parser::parseCoreDeclarator(DeclaratorAST *&node)
while
(
parsePtrOperator
(
*
ptr_operators_tail
))
ptr_operators_tail
=
&
(
*
ptr_operators_tail
)
->
next
;
if
(
LA
()
==
T_COLON_COLON
||
LA
()
==
T_IDENTIFIER
||
LA
()
==
T_TILDE
||
LA
()
==
T_OPERATOR
)
{
if
(
LA
()
==
T_COLON_COLON
||
LA
()
==
T_IDENTIFIER
||
LA
()
==
T_TILDE
||
LA
()
==
T_OPERATOR
||
(
_cxx0xEnabled
&&
LA
()
==
T_DOT_DOT_DOT
&&
(
LA
(
2
)
==
T_COLON_COLON
||
LA
(
2
)
==
T_IDENTIFIER
)))
{
unsigned
dot_dot_dot_token
=
0
;
if
(
LA
()
==
T_DOT_DOT_DOT
)
dot_dot_dot_token
=
consumeToken
();
NameAST
*
name
=
0
;
if
(
parseName
(
name
))
{
DeclaratorIdAST
*
declarator_id
=
new
(
_pool
)
DeclaratorIdAST
;
declarator_id
->
dot_dot_dot_token
=
dot_dot_dot_token
;
declarator_id
->
name
=
name
;
DeclaratorAST
*
ast
=
new
(
_pool
)
DeclaratorAST
;
ast
->
attribute_list
=
attributes
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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