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
4089c906
Commit
4089c906
authored
Nov 10, 2009
by
Roberto Raggi
Browse files
Removed the ExpressionListAST node.
Done with Erik Verbruggen
parent
9e7ff046
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/CheckUndefinedSymbols.cpp
View file @
4089c906
...
...
@@ -380,15 +380,8 @@ bool CheckUndefinedSymbols::visit(BaseSpecifierAST *base)
resolvedBaseClassName
=
true
;
}
if
(
!
resolvedBaseClassName
)
{
const
char
*
token
=
"after `:'"
;
if
(
base
->
comma_token
)
token
=
"after `,'"
;
translationUnit
()
->
warning
(
nameAST
->
firstToken
(),
"expected class-name %s token"
,
token
);
}
if
(
!
resolvedBaseClassName
)
translationUnit
()
->
warning
(
nameAST
->
firstToken
(),
"expected class-name"
);
}
return
true
;
...
...
src/libs/cplusplus/ResolveExpression.cpp
View file @
4089c906
...
...
@@ -118,12 +118,6 @@ void ResolveExpression::addResult(const Result &r)
QList
<
Scope
*>
ResolveExpression
::
visibleScopes
(
const
Result
&
result
)
const
{
return
_context
.
visibleScopes
(
result
);
}
bool
ResolveExpression
::
visit
(
ExpressionListAST
*
)
{
// nothing to do.
return
false
;
}
bool
ResolveExpression
::
visit
(
BinaryExpressionAST
*
ast
)
{
accept
(
ast
->
left_expression
);
...
...
src/libs/cplusplus/ResolveExpression.h
View file @
4089c906
...
...
@@ -72,7 +72,6 @@ protected:
using
ASTVisitor
::
visit
;
virtual
bool
visit
(
ExpressionListAST
*
ast
);
virtual
bool
visit
(
BinaryExpressionAST
*
ast
);
virtual
bool
visit
(
CastExpressionAST
*
ast
);
virtual
bool
visit
(
ConditionAST
*
ast
);
...
...
src/shared/cplusplus/AST.cpp
View file @
4089c906
...
...
@@ -100,10 +100,9 @@ unsigned AttributeAST::lastToken() const
if
(
rparen_token
)
return
rparen_token
+
1
;
for
(
ExpressionListAST
*
it
=
expression_list
;
it
->
expression
&&
it
->
next
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
expression
)
{
return
it
->
expression
->
lastToken
();
for
(
ExpressionListAST
*
it
=
expression_list
;
it
->
value
&&
it
->
next
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
value
)
{
return
it
->
value
->
lastToken
();
}
}
...
...
@@ -174,8 +173,8 @@ unsigned ArrayInitializerAST::lastToken() const
return
rbrace_token
+
1
;
for
(
ExpressionListAST
*
it
=
expression_list
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
expression
)
return
it
->
expression
->
lastToken
();
if
(
!
it
->
next
&&
it
->
value
)
return
it
->
value
->
lastToken
();
}
return
lbrace_token
+
1
;
...
...
@@ -304,8 +303,8 @@ unsigned CallAST::lastToken() const
if
(
rparen_token
)
return
rparen_token
+
1
;
for
(
ExpressionListAST
*
it
=
expression_list
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
expression
)
return
it
->
expression
->
lastToken
();
if
(
!
it
->
next
&&
it
->
value
)
return
it
->
value
->
lastToken
();
}
return
lparen_token
+
1
;
}
...
...
@@ -643,9 +642,6 @@ unsigned DeclaratorIdAST::lastToken() const
unsigned
DeclaratorListAST
::
firstToken
()
const
{
if
(
comma_token
)
return
comma_token
;
return
declarator
->
firstToken
();
}
...
...
@@ -655,8 +651,6 @@ unsigned DeclaratorListAST::lastToken() const
if
(
!
it
->
next
)
{
if
(
it
->
declarator
)
return
it
->
declarator
->
lastToken
();
else
if
(
it
->
comma_token
)
return
it
->
comma_token
+
1
;
}
}
...
...
@@ -818,8 +812,8 @@ unsigned ExceptionSpecificationAST::lastToken() const
return
rparen_token
+
1
;
for
(
ExpressionListAST
*
it
=
type_ids
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
it
->
expression
)
return
it
->
expression
->
lastToken
();
if
(
!
it
->
next
&&
it
->
value
)
return
it
->
value
->
lastToken
();
}
if
(
dot_dot_dot_token
)
...
...
@@ -830,22 +824,6 @@ unsigned ExceptionSpecificationAST::lastToken() const
return
throw_token
+
1
;
}
unsigned
ExpressionListAST
::
firstToken
()
const
{
return
expression
->
firstToken
();
}
unsigned
ExpressionListAST
::
lastToken
()
const
{
for
(
const
ExpressionListAST
*
it
=
this
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
)
return
it
->
expression
->
lastToken
();
}
return
0
;
}
unsigned
ExpressionOrDeclarationStatementAST
::
firstToken
()
const
{
return
declaration
->
firstToken
();
...
...
@@ -1908,8 +1886,8 @@ unsigned IdentifierListAST::firstToken() const
{
if
(
name
)
return
name
->
firstToken
();
else
return
comma_token
;
// ### assert?
return
0
;
}
unsigned
IdentifierListAST
::
lastToken
()
const
...
...
@@ -2264,8 +2242,6 @@ unsigned ObjCPropertyAttributeListAST::firstToken() const
{
if
(
attr
)
return
attr
->
firstToken
();
else
if
(
comma_token
)
return
comma_token
;
else
if
(
next
)
return
next
->
lastToken
();
else
...
...
@@ -2276,12 +2252,8 @@ unsigned ObjCPropertyAttributeListAST::firstToken() const
unsigned
ObjCPropertyAttributeListAST
::
lastToken
()
const
{
for
(
const
ObjCPropertyAttributeListAST
*
it
=
this
;
it
;
it
=
it
->
next
)
{
if
(
!
it
->
next
&&
(
comma_token
||
it
->
attr
))
{
if
(
comma_token
)
return
comma_token
+
1
;
else
return
it
->
attr
->
lastToken
();
}
if
(
!
it
->
next
&&
it
->
attr
)
return
it
->
attr
->
lastToken
();
}
// ### assert?
return
0
;
...
...
@@ -2407,8 +2379,8 @@ unsigned ObjCSynthesizedPropertyListAST::firstToken() const
{
if
(
synthesized_property
)
return
synthesized_property
->
firstToken
();
else
return
comma_token
;
// ### assert?
return
0
;
}
unsigned
ObjCSynthesizedPropertyListAST
::
lastToken
()
const
...
...
src/shared/cplusplus/AST.h
View file @
4089c906
...
...
@@ -53,11 +53,10 @@
#include
"ASTfwd.h"
#include
"MemoryPool.h"
namespace
CPlusPlus
{
template
<
typename
_Tp
>
class
List
:
public
Managed
class
CPLUSPLUS_EXPORT
List
:
public
Managed
{
List
(
const
List
&
other
);
void
operator
=
(
const
List
&
other
);
...
...
@@ -67,6 +66,28 @@ public:
:
value
(
_Tp
()),
next
(
0
)
{
}
unsigned
firstToken
()
const
{
if
(
value
)
return
value
->
firstToken
();
// ### assert(0);
return
0
;
}
unsigned
lastToken
()
const
{
unsigned
token
=
0
;
for
(
const
List
*
it
=
this
;
it
;
it
=
it
->
next
)
{
if
(
it
->
value
)
token
=
it
->
value
->
lastToken
();
}
// assert(token != 0);
return
token
;
}
_Tp
value
;
List
*
next
;
};
...
...
@@ -85,6 +106,13 @@ public:
static
void
accept
(
AST
*
ast
,
ASTVisitor
*
visitor
)
{
if
(
ast
)
ast
->
accept
(
visitor
);
}
template
<
typename
_Tp
>
static
void
accept
(
List
<
_Tp
>
*
it
,
ASTVisitor
*
visitor
)
{
for
(;
it
;
it
=
it
->
next
)
accept
(
it
->
value
,
visitor
);
}
virtual
unsigned
firstToken
()
const
=
0
;
virtual
unsigned
lastToken
()
const
=
0
;
...
...
@@ -129,7 +157,6 @@ public:
virtual
ExceptionDeclarationAST
*
asExceptionDeclaration
()
{
return
0
;
}
virtual
ExceptionSpecificationAST
*
asExceptionSpecification
()
{
return
0
;
}
virtual
ExpressionAST
*
asExpression
()
{
return
0
;
}
virtual
ExpressionListAST
*
asExpressionList
()
{
return
0
;
}
virtual
ExpressionOrDeclarationStatementAST
*
asExpressionOrDeclarationStatement
()
{
return
0
;
}
virtual
ExpressionStatementAST
*
asExpressionStatement
()
{
return
0
;
}
virtual
ForStatementAST
*
asForStatement
()
{
return
0
;
}
...
...
@@ -288,7 +315,6 @@ public:
ExpressionListAST
*
expression_list
;
unsigned
rparen_token
;
AttributeAST
*
next
;
unsigned
comma_token
;
public:
virtual
AttributeAST
*
asAttribute
()
{
return
this
;
}
...
...
@@ -322,21 +348,18 @@ class CPLUSPLUS_EXPORT StatementAST: public AST
{
public:
virtual
StatementAST
*
asStatement
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
ExpressionAST
:
public
AST
{
public:
virtual
ExpressionAST
*
asExpression
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
DeclarationAST
:
public
AST
{
public:
virtual
DeclarationAST
*
asDeclaration
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
DeclarationListAST
:
public
AST
...
...
@@ -359,7 +382,6 @@ class CPLUSPLUS_EXPORT CoreDeclaratorAST: public AST
{
public:
virtual
CoreDeclaratorAST
*
asCoreDeclarator
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
PostfixDeclaratorAST
:
public
AST
...
...
@@ -369,7 +391,6 @@ public:
public:
virtual
PostfixDeclaratorAST
*
asPostfixDeclarator
()
{
return
this
;
}
};
class
CPLUSPLUS_EXPORT
DeclaratorAST
:
public
AST
...
...
@@ -393,23 +414,6 @@ protected:
virtual
void
accept0
(
ASTVisitor
*
visitor
);
};
class
CPLUSPLUS_EXPORT
ExpressionListAST
:
public
AST
{
public:
unsigned
comma_token
;
ExpressionAST
*
expression
;
ExpressionListAST
*
next
;
public:
virtual
ExpressionListAST
*
asExpressionList
()
{
return
this
;
}
virtual
unsigned
firstToken
()
const
;
virtual
unsigned
lastToken
()
const
;
protected:
virtual
void
accept0
(
ASTVisitor
*
visitor
);
};
class
CPLUSPLUS_EXPORT
SimpleDeclarationAST
:
public
DeclarationAST
{
public:
...
...
@@ -487,7 +491,6 @@ protected:
class
CPLUSPLUS_EXPORT
BaseSpecifierAST
:
public
AST
{
public:
unsigned
comma_token
;
unsigned
virtual_token
;
unsigned
access_specifier_token
;
NameAST
*
name
;
...
...
@@ -818,7 +821,6 @@ protected:
class
CPLUSPLUS_EXPORT
DeclaratorListAST
:
public
AST
{
public:
unsigned
comma_token
;
DeclaratorAST
*
declarator
;
DeclaratorListAST
*
next
;
...
...
@@ -925,7 +927,6 @@ protected:
class
CPLUSPLUS_EXPORT
EnumeratorAST
:
public
AST
{
public:
unsigned
comma_token
;
unsigned
identifier_token
;
unsigned
equal_token
;
ExpressionAST
*
expression
;
...
...
@@ -1178,7 +1179,6 @@ protected:
class
CPLUSPLUS_EXPORT
MemInitializerAST
:
public
AST
{
public:
unsigned
comma_token
;
NameAST
*
name
;
unsigned
lparen_token
;
ExpressionAST
*
expression
;
...
...
@@ -1902,7 +1902,6 @@ protected:
class
CPLUSPLUS_EXPORT
TemplateArgumentListAST
:
public
AST
{
public:
unsigned
comma_token
;
ExpressionAST
*
template_argument
;
TemplateArgumentListAST
*
next
;
...
...
@@ -2155,7 +2154,6 @@ class CPLUSPLUS_EXPORT IdentifierListAST: public AST
{
public:
NameAST
*
name
;
unsigned
comma_token
;
IdentifierListAST
*
next
;
public:
...
...
@@ -2525,7 +2523,6 @@ class CPLUSPLUS_EXPORT ObjCPropertyAttributeListAST: public AST
{
public:
ObjCPropertyAttributeAST
*
attr
;
unsigned
comma_token
;
ObjCPropertyAttributeListAST
*
next
;
public:
...
...
@@ -2655,7 +2652,6 @@ class CPLUSPLUS_EXPORT ObjCSynthesizedPropertyListAST: public AST
{
public:
ObjCSynthesizedPropertyAST
*
synthesized_property
;
unsigned
comma_token
;
ObjCSynthesizedPropertyListAST
*
next
;
public:
...
...
src/shared/cplusplus/ASTVisit.cpp
View file @
4089c906
...
...
@@ -90,14 +90,6 @@ void DeclaratorAST::accept0(ASTVisitor *visitor)
visitor
->
endVisit
(
this
);
}
void
ExpressionListAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
accept
(
expression
,
visitor
);
}
visitor
->
endVisit
(
this
);
}
void
SimpleDeclarationAST
::
accept0
(
ASTVisitor
*
visitor
)
{
if
(
visitor
->
visit
(
this
))
{
...
...
src/shared/cplusplus/ASTVisitor.h
View file @
4089c906
...
...
@@ -131,7 +131,6 @@ public:
virtual
bool
visit
(
EnumeratorAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ExceptionDeclarationAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ExceptionSpecificationAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ExpressionListAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ExpressionOrDeclarationStatementAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ExpressionStatementAST
*
)
{
return
true
;
}
virtual
bool
visit
(
ForeachStatementAST
*
)
{
return
true
;
}
...
...
@@ -269,7 +268,6 @@ public:
virtual
void
endVisit
(
EnumeratorAST
*
)
{
}
virtual
void
endVisit
(
ExceptionDeclarationAST
*
)
{
}
virtual
void
endVisit
(
ExceptionSpecificationAST
*
)
{
}
virtual
void
endVisit
(
ExpressionListAST
*
)
{
}
virtual
void
endVisit
(
ExpressionOrDeclarationStatementAST
*
)
{
}
virtual
void
endVisit
(
ExpressionStatementAST
*
)
{
}
virtual
void
endVisit
(
ForeachStatementAST
*
)
{
}
...
...
src/shared/cplusplus/ASTfwd.h
View file @
4089c906
...
...
@@ -53,6 +53,8 @@
namespace
CPlusPlus
{
template
<
typename
_Tp
>
class
List
;
class
AST
;
class
ASTVisitor
;
...
...
@@ -97,7 +99,6 @@ class EnumeratorAST;
class
ExceptionDeclarationAST
;
class
ExceptionSpecificationAST
;
class
ExpressionAST
;
class
ExpressionListAST
;
class
ExpressionOrDeclarationStatementAST
;
class
ExpressionStatementAST
;
class
ForStatementAST
;
...
...
@@ -200,6 +201,9 @@ class UsingAST;
class
UsingDirectiveAST
;
class
WhileStatementAST
;
typedef
List
<
ExpressionAST
*>
ExpressionListAST
;
}
// end of namespace CPlusPlus
...
...
src/shared/cplusplus/CheckExpression.cpp
View file @
4089c906
...
...
@@ -100,14 +100,6 @@ Scope *CheckExpression::switchScope(Scope *scope)
return
previousScope
;
}
bool
CheckExpression
::
visit
(
ExpressionListAST
*
ast
)
{
for
(
ExpressionListAST
*
it
=
ast
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
}
return
false
;
}
bool
CheckExpression
::
visit
(
BinaryExpressionAST
*
ast
)
{
FullySpecifiedType
leftExprTy
=
semantic
()
->
check
(
ast
->
left_expression
,
_scope
);
...
...
@@ -161,7 +153,7 @@ bool CheckExpression::visit(DeleteExpressionAST *ast)
bool
CheckExpression
::
visit
(
ArrayInitializerAST
*
ast
)
{
for
(
ExpressionListAST
*
it
=
ast
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
}
return
false
;
}
...
...
@@ -206,7 +198,7 @@ bool CheckExpression::visit(NewExpressionAST *ast)
{
if
(
ast
->
new_placement
)
{
for
(
ExpressionListAST
*
it
=
ast
->
new_placement
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
}
}
...
...
@@ -239,7 +231,7 @@ bool CheckExpression::visit(TypenameCallExpressionAST *ast)
(
void
)
semantic
()
->
check
(
ast
->
name
,
_scope
);
for
(
ExpressionListAST
*
it
=
ast
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
(
void
)
exprTy
;
}
return
false
;
...
...
@@ -249,7 +241,7 @@ bool CheckExpression::visit(TypeConstructorCallAST *ast)
{
FullySpecifiedType
typeSpecTy
=
semantic
()
->
check
(
ast
->
type_specifier
,
_scope
);
for
(
ExpressionListAST
*
it
=
ast
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
}
return
false
;
}
...
...
@@ -350,7 +342,7 @@ bool CheckExpression::visit(CompoundLiteralAST *ast)
bool
CheckExpression
::
visit
(
CallAST
*
ast
)
{
for
(
ExpressionListAST
*
it
=
ast
->
expression_list
;
it
;
it
=
it
->
next
)
{
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
expression
,
_scope
);
FullySpecifiedType
exprTy
=
semantic
()
->
check
(
it
->
value
,
_scope
);
}
return
false
;
}
...
...
src/shared/cplusplus/CheckExpression.h
View file @
4089c906
...
...
@@ -71,7 +71,6 @@ protected:
using
ASTVisitor
::
visit
;
virtual
bool
visit
(
ExpressionListAST
*
ast
);
virtual
bool
visit
(
BinaryExpressionAST
*
ast
);
virtual
bool
visit
(
CastExpressionAST
*
ast
);
virtual
bool
visit
(
ConditionAST
*
ast
);
...
...
src/shared/cplusplus/Parser.cpp
View file @
4089c906
...
...
@@ -719,11 +719,10 @@ bool Parser::parseTemplateArgumentList(TemplateArgumentListAST *&node)
(
*
template_argument_ptr
)
->
template_argument
=
template_argument
;
template_argument_ptr
=
&
(
*
template_argument_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
if
(
parseTemplateArgument
(
template_argument
))
{
*
template_argument_ptr
=
new
(
_pool
)
TemplateArgumentListAST
;
(
*
template_argument_ptr
)
->
comma_token
=
comma_token
;
(
*
template_argument_ptr
)
->
template_argument
=
template_argument
;
template_argument_ptr
=
&
(
*
template_argument_ptr
)
->
next
;
}
...
...
@@ -1320,7 +1319,6 @@ bool Parser::parseEnumSpecifier(SpecifierAST *&node)
}
if
(
parseEnumerator
(
*
enumerator_ptr
))
{
(
*
enumerator_ptr
)
->
comma_token
=
comma_token
;
enumerator_ptr
=
&
(
*
enumerator_ptr
)
->
next
;
}
...
...
@@ -1791,12 +1789,10 @@ bool Parser::parseBaseClause(BaseSpecifierAST *&node)
ast
=
&
(
*
ast
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
if
(
parseBaseSpecifier
(
*
ast
))
{
(
*
ast
)
->
comma_token
=
comma_token
;
if
(
parseBaseSpecifier
(
*
ast
))
ast
=
&
(
*
ast
)
->
next
;
}
}
}
...
...
@@ -1825,12 +1821,10 @@ bool Parser::parseMemInitializerList(MemInitializerAST *&node)
if
(
parseMemInitializer
(
*
initializer
))
{
initializer
=
&
(
*
initializer
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
if
(
parseMemInitializer
(
*
initializer
))
{
(
*
initializer
)
->
comma_token
=
comma_token
;
if
(
parseMemInitializer
(
*
initializer
))
initializer
=
&
(
*
initializer
)
->
next
;
}
}
return
true
;
}
...
...
@@ -1861,14 +1855,14 @@ bool Parser::parseTypeIdList(ExpressionListAST *&node)
ExpressionAST
*
typeId
=
0
;
if
(
parseTypeId
(
typeId
))
{
*
expression_list_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
expression_list_ptr
)
->
expression
=
typeId
;
(
*
expression_list_ptr
)
->
value
=
typeId
;
expression_list_ptr
=
&
(
*
expression_list_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
consumeToken
();
if
(
parseTypeId
(
typeId
))
{
*
expression_list_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
expression_list_ptr
)
->
expression
=
typeId
;
(
*
expression_list_ptr
)
->
value
=
typeId
;
expression_list_ptr
=
&
(
*
expression_list_ptr
)
->
next
;
}
}
...
...
@@ -1885,15 +1879,14 @@ bool Parser::parseExpressionList(ExpressionListAST *&node)
ExpressionAST
*
expression
=
0
;
if
(
parseAssignmentExpression
(
expression
))
{
*
expression_list_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
expression_list_ptr
)
->
expression
=
expression
;
(
*
expression_list_ptr
)
->
value
=
expression
;
expression_list_ptr
=
&
(
*
expression_list_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
if
(
parseExpression
(
expression
))
{
*
expression_list_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
expression_list_ptr
)
->
comma_token
=
comma_token
;
(
*
expression_list_ptr
)
->
expression
=
expression
;
(
*
expression_list_ptr
)
->
value
=
expression
;
expression_list_ptr
=
&
(
*
expression_list_ptr
)
->
next
;
}
}
...
...
@@ -1936,15 +1929,14 @@ bool Parser::parseInitializerList(ExpressionListAST *&node)
ExpressionAST
*
initializer
=
0
;
if
(
parseInitializerClause
(
initializer
))
{
*
initializer_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
initializer_ptr
)
->
expression
=
initializer
;
(
*
initializer_ptr
)
->
value
=
initializer
;
initializer_ptr
=
&
(
*
initializer_ptr
)
->
next
;
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
initializer
=
0
;
parseInitializerClause
(
initializer
);
*
initializer_ptr
=
new
(
_pool
)
ExpressionListAST
;
(
*
initializer_ptr
)
->
comma_token
=
comma_token
;
(
*
initializer_ptr
)
->
expression
=
initializer
;
(
*
initializer_ptr
)
->
value
=
initializer
;
initializer_ptr
=
&
(
*
initializer_ptr
)
->
next
;
}
}
...
...
@@ -2695,10 +2687,8 @@ bool Parser::parseAttributeList(AttributeAST *&node)
ast
->
lparen_token
=
consumeToken
();
if
(
LA
()
==
T_IDENTIFIER
&&
(
LA
(
2
)
==
T_COMMA
||
LA
(
2
)
==
T_RPAREN
))
{
ast
->
tag_token
=
consumeToken
();
if
(
LA
()
==
T_COMMA
)
{
ast
->
comma_token
=
consumeToken
();
if
(
LA
()
==
T_COMMA
)
parseExpressionList
(
ast
->
expression_list
);
}
}
else
{
parseExpressionList
(
ast
->
expression_list
);
}
...
...
@@ -2865,11 +2855,11 @@ bool Parser::parseSimpleDeclaration(DeclarationAST *&node,
if
(
LA
()
==
T_COMMA
||
LA
()
==
T_SEMICOLON
||
has_complex_type_specifier
)
{
while
(
LA
()
==
T_COMMA
)
{
unsigned
comma_token
=
consumeToken
();
consumeToken
();
// consume T_COMMA
declarator
=
0
;
if
(
parseInitDeclarator
(
declarator
,
acceptStructDeclarator
))
{
*
declarator_ptr
=
new
(
_pool
)
DeclaratorListAST
;
(
*
declarator_ptr
)
->
comma_token
=
comma_token
;
(
*
declarator_ptr
)
->
declarator
=
declarator
;
declarator_ptr
=
&
(
*
declarator_ptr
)
->
next
;