|
@ -26,26 +26,14 @@ |
|
|
#include <vector> |
|
|
#include <vector> |
|
|
#include <memory> |
|
|
#include <memory> |
|
|
|
|
|
|
|
|
|
|
|
#include <libsolidity/ASTForward.h> |
|
|
#include <libsolidity/BaseTypes.h> |
|
|
#include <libsolidity/BaseTypes.h> |
|
|
#include <libsolidity/Token.h> |
|
|
#include <libsolidity/Token.h> |
|
|
|
|
|
|
|
|
namespace dev { |
|
|
namespace dev { |
|
|
namespace solidity { |
|
|
namespace solidity { |
|
|
|
|
|
|
|
|
// Used as pointers to AST nodes, to be replaced by more clever pointers, e.g. pointers which do
|
|
|
class ASTVisitor; |
|
|
// not do reference counting but point to a special memory area that is completely released
|
|
|
|
|
|
// explicitly.
|
|
|
|
|
|
template <class T> |
|
|
|
|
|
using ptr = std::shared_ptr<T>; |
|
|
|
|
|
template <class T> |
|
|
|
|
|
using vecptr = std::vector<ptr<T>>; |
|
|
|
|
|
|
|
|
|
|
|
class VariableDeclaration; |
|
|
|
|
|
class StructDefinition; |
|
|
|
|
|
class FunctionDefinition; |
|
|
|
|
|
class TypeName; |
|
|
|
|
|
class Block; |
|
|
|
|
|
class Expression; |
|
|
|
|
|
|
|
|
|
|
|
class ASTNode |
|
|
class ASTNode |
|
|
{ |
|
|
{ |
|
@ -56,7 +44,13 @@ public: |
|
|
|
|
|
|
|
|
virtual ~ASTNode() {} |
|
|
virtual ~ASTNode() {} |
|
|
|
|
|
|
|
|
Location getLocation() const { return m_location; } |
|
|
virtual void accept(ASTVisitor& _visitor) = 0; |
|
|
|
|
|
template <class T> |
|
|
|
|
|
static void listAccept(vecptr<T>& _list, ASTVisitor& _visitor) { |
|
|
|
|
|
for (ptr<T>& element : _list) element->accept(_visitor); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Location const& getLocation() const { return m_location; } |
|
|
private: |
|
|
private: |
|
|
Location m_location; |
|
|
Location m_location; |
|
|
}; |
|
|
}; |
|
@ -65,7 +59,7 @@ class ContractDefinition : public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
ContractDefinition(Location const& _location, |
|
|
ContractDefinition(Location const& _location, |
|
|
std::string const& _name, |
|
|
ptr<ASTString> const& _name, |
|
|
vecptr<StructDefinition> const& _definedStructs, |
|
|
vecptr<StructDefinition> const& _definedStructs, |
|
|
vecptr<VariableDeclaration> const& _stateVariables, |
|
|
vecptr<VariableDeclaration> const& _stateVariables, |
|
|
vecptr<FunctionDefinition> const& _definedFunctions) |
|
|
vecptr<FunctionDefinition> const& _definedFunctions) |
|
@ -75,8 +69,11 @@ public: |
|
|
m_definedFunctions(_definedFunctions) |
|
|
m_definedFunctions(_definedFunctions) |
|
|
{} |
|
|
{} |
|
|
|
|
|
|
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
const ASTString& getName() const { return *m_name; } |
|
|
private: |
|
|
private: |
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
vecptr<StructDefinition> m_definedStructs; |
|
|
vecptr<StructDefinition> m_definedStructs; |
|
|
vecptr<VariableDeclaration> m_stateVariables; |
|
|
vecptr<VariableDeclaration> m_stateVariables; |
|
|
vecptr<FunctionDefinition> m_definedFunctions; |
|
|
vecptr<FunctionDefinition> m_definedFunctions; |
|
@ -86,12 +83,15 @@ class StructDefinition : public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
StructDefinition(Location const& _location, |
|
|
StructDefinition(Location const& _location, |
|
|
std::string const& _name, |
|
|
ptr<ASTString> const& _name, |
|
|
vecptr<VariableDeclaration> const& _members) |
|
|
vecptr<VariableDeclaration> const& _members) |
|
|
: ASTNode(_location), m_name(_name), m_members(_members) |
|
|
: ASTNode(_location), m_name(_name), m_members(_members) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
const ASTString& getName() const { return *m_name; } |
|
|
private: |
|
|
private: |
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
vecptr<VariableDeclaration> m_members; |
|
|
vecptr<VariableDeclaration> m_members; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -104,6 +104,7 @@ public: |
|
|
ParameterList(Location const& _location, vecptr<VariableDeclaration> const& _parameters) |
|
|
ParameterList(Location const& _location, vecptr<VariableDeclaration> const& _parameters) |
|
|
: ASTNode(_location), m_parameters(_parameters) |
|
|
: ASTNode(_location), m_parameters(_parameters) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
vecptr<VariableDeclaration> m_parameters; |
|
|
vecptr<VariableDeclaration> m_parameters; |
|
|
}; |
|
|
}; |
|
@ -111,7 +112,7 @@ private: |
|
|
class FunctionDefinition : public ASTNode |
|
|
class FunctionDefinition : public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
FunctionDefinition(Location const& _location, std::string const& _name, bool _isPublic, |
|
|
FunctionDefinition(Location const& _location, ptr<ASTString> const& _name, bool _isPublic, |
|
|
ptr<ParameterList> const& _parameters, |
|
|
ptr<ParameterList> const& _parameters, |
|
|
bool _isDeclaredConst, |
|
|
bool _isDeclaredConst, |
|
|
ptr<ParameterList> const& _returnParameters, |
|
|
ptr<ParameterList> const& _returnParameters, |
|
@ -120,8 +121,13 @@ public: |
|
|
m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters), |
|
|
m_isDeclaredConst(_isDeclaredConst), m_returnParameters(_returnParameters), |
|
|
m_body(_body) |
|
|
m_body(_body) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
const ASTString& getName() const { return *m_name; } |
|
|
|
|
|
bool isPublic() const { return m_isPublic; } |
|
|
|
|
|
bool isDeclaredConst() const { return m_isDeclaredConst; } |
|
|
private: |
|
|
private: |
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
bool m_isPublic; |
|
|
bool m_isPublic; |
|
|
ptr<ParameterList> m_parameters; |
|
|
ptr<ParameterList> m_parameters; |
|
|
bool m_isDeclaredConst; |
|
|
bool m_isDeclaredConst; |
|
@ -134,12 +140,15 @@ class VariableDeclaration : public ASTNode |
|
|
public: |
|
|
public: |
|
|
VariableDeclaration(Location const& _location, |
|
|
VariableDeclaration(Location const& _location, |
|
|
ptr<TypeName> const& _type, |
|
|
ptr<TypeName> const& _type, |
|
|
std::string const& _name) |
|
|
ptr<ASTString> const& _name) |
|
|
: ASTNode(_location), m_type(_type), m_name(_name) |
|
|
: ASTNode(_location), m_type(_type), m_name(_name) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
const ASTString& getName() const { return *m_name; } |
|
|
private: |
|
|
private: |
|
|
ptr<TypeName> m_type; ///< can be empty ("var")
|
|
|
ptr<TypeName> m_type; ///< can be empty ("var")
|
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/// types
|
|
|
/// types
|
|
@ -149,6 +158,7 @@ class TypeName : public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit TypeName(Location const& _location) : ASTNode(_location) {} |
|
|
explicit TypeName(Location const& _location) : ASTNode(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/// any pre-defined type that is not a mapping
|
|
|
/// any pre-defined type that is not a mapping
|
|
@ -158,6 +168,9 @@ public: |
|
|
explicit ElementaryTypeName(Location const& _location, Token::Value _type) |
|
|
explicit ElementaryTypeName(Location const& _location, Token::Value _type) |
|
|
: TypeName(_location), m_type(_type) |
|
|
: TypeName(_location), m_type(_type) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getType() const { return m_type; } |
|
|
private: |
|
|
private: |
|
|
Token::Value m_type; |
|
|
Token::Value m_type; |
|
|
}; |
|
|
}; |
|
@ -165,11 +178,14 @@ private: |
|
|
class UserDefinedTypeName : public TypeName |
|
|
class UserDefinedTypeName : public TypeName |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
UserDefinedTypeName(Location const& _location, std::string const& _name) |
|
|
UserDefinedTypeName(Location const& _location, ptr<ASTString> const& _name) |
|
|
: TypeName(_location), m_name(_name) |
|
|
: TypeName(_location), m_name(_name) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
const ASTString& getName() const { return *m_name; } |
|
|
private: |
|
|
private: |
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class Mapping : public TypeName |
|
|
class Mapping : public TypeName |
|
@ -179,6 +195,7 @@ public: |
|
|
ptr<TypeName> const& _valueType) |
|
|
ptr<TypeName> const& _valueType) |
|
|
: TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) |
|
|
: TypeName(_location), m_keyType(_keyType), m_valueType(_valueType) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<ElementaryTypeName> m_keyType; |
|
|
ptr<ElementaryTypeName> m_keyType; |
|
|
ptr<TypeName> m_valueType; |
|
|
ptr<TypeName> m_valueType; |
|
@ -193,6 +210,7 @@ class Statement : public ASTNode |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
explicit Statement(Location const& _location) : ASTNode(_location) {} |
|
|
explicit Statement(Location const& _location) : ASTNode(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class Block : public Statement |
|
|
class Block : public Statement |
|
@ -201,6 +219,7 @@ public: |
|
|
Block(Location const& _location, vecptr<Statement> const& _statements) |
|
|
Block(Location const& _location, vecptr<Statement> const& _statements) |
|
|
: Statement(_location), m_statements(_statements) |
|
|
: Statement(_location), m_statements(_statements) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
vecptr<Statement> m_statements; |
|
|
vecptr<Statement> m_statements; |
|
|
}; |
|
|
}; |
|
@ -213,16 +232,18 @@ public: |
|
|
: Statement(_location), m_condition(_condition), |
|
|
: Statement(_location), m_condition(_condition), |
|
|
m_trueBody(_trueBody), m_falseBody(_falseBody) |
|
|
m_trueBody(_trueBody), m_falseBody(_falseBody) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_condition; |
|
|
ptr<Expression> m_condition; |
|
|
ptr<Statement> m_trueBody; |
|
|
ptr<Statement> m_trueBody; |
|
|
ptr<Statement> m_falseBody; |
|
|
ptr<Statement> m_falseBody; //< "else" part, optional
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class BreakableStatement : public Statement |
|
|
class BreakableStatement : public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
BreakableStatement(Location const& _location) : Statement(_location) {} |
|
|
BreakableStatement(Location const& _location) : Statement(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class WhileStatement : public BreakableStatement |
|
|
class WhileStatement : public BreakableStatement |
|
@ -232,6 +253,7 @@ public: |
|
|
ptr<Statement> const& _body) |
|
|
ptr<Statement> const& _body) |
|
|
: BreakableStatement(_location), m_condition(_condition), m_body(_body) |
|
|
: BreakableStatement(_location), m_condition(_condition), m_body(_body) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_condition; |
|
|
ptr<Expression> m_condition; |
|
|
ptr<Statement> m_body; |
|
|
ptr<Statement> m_body; |
|
@ -241,12 +263,14 @@ class Continue : public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Continue(Location const& _location) : Statement(_location) {} |
|
|
Continue(Location const& _location) : Statement(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class Break : public Statement |
|
|
class Break : public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Break(Location const& _location) : Statement(_location) {} |
|
|
Break(Location const& _location) : Statement(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class Return : public Statement |
|
|
class Return : public Statement |
|
@ -255,8 +279,9 @@ public: |
|
|
Return(Location const& _location, ptr<Expression> _expression) |
|
|
Return(Location const& _location, ptr<Expression> _expression) |
|
|
: Statement(_location), m_expression(_expression) |
|
|
: Statement(_location), m_expression(_expression) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_expression; |
|
|
ptr<Expression> m_expression; //< value to return, optional
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class VariableDefinition : public Statement |
|
|
class VariableDefinition : public Statement |
|
@ -266,6 +291,7 @@ public: |
|
|
ptr<Expression> _value) |
|
|
ptr<Expression> _value) |
|
|
: Statement(_location), m_variable(_variable), m_value(_value) |
|
|
: Statement(_location), m_variable(_variable), m_value(_value) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<VariableDeclaration> m_variable; |
|
|
ptr<VariableDeclaration> m_variable; |
|
|
ptr<Expression> m_value; ///< can be missing
|
|
|
ptr<Expression> m_value; ///< can be missing
|
|
@ -275,6 +301,7 @@ class Expression : public Statement |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Expression(Location const& _location) : Statement(_location) {} |
|
|
Expression(Location const& _location) : Statement(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/// @}
|
|
|
/// @}
|
|
@ -290,6 +317,9 @@ public: |
|
|
: Expression(_location), m_leftHandSide(_leftHandSide), |
|
|
: Expression(_location), m_leftHandSide(_leftHandSide), |
|
|
m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) |
|
|
m_assigmentOperator(_assignmentOperator), m_rightHandSide(_rightHandSide) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getAssignmentOperator() const { return m_assigmentOperator; } |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_leftHandSide; |
|
|
ptr<Expression> m_leftHandSide; |
|
|
Token::Value m_assigmentOperator; |
|
|
Token::Value m_assigmentOperator; |
|
@ -304,7 +334,10 @@ public: |
|
|
: Expression(_location), m_operator(_operator), |
|
|
: Expression(_location), m_operator(_operator), |
|
|
m_subExpression(_subExpression), m_isPrefix(_isPrefix) |
|
|
m_subExpression(_subExpression), m_isPrefix(_isPrefix) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getOperator() const { return m_operator; } |
|
|
|
|
|
bool isPrefixOperation() const { return m_isPrefix; } |
|
|
private: |
|
|
private: |
|
|
Token::Value m_operator; |
|
|
Token::Value m_operator; |
|
|
ptr<Expression> m_subExpression; |
|
|
ptr<Expression> m_subExpression; |
|
@ -318,6 +351,9 @@ public: |
|
|
Token::Value _operator, ptr<Expression> const& _right) |
|
|
Token::Value _operator, ptr<Expression> const& _right) |
|
|
: Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) |
|
|
: Expression(_location), m_left(_left), m_operator(_operator), m_right(_right) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getOperator() const { return m_operator; } |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_left; |
|
|
ptr<Expression> m_left; |
|
|
Token::Value m_operator; |
|
|
Token::Value m_operator; |
|
@ -332,6 +368,7 @@ public: |
|
|
vecptr<Expression> const& _arguments) |
|
|
vecptr<Expression> const& _arguments) |
|
|
: Expression(_location), m_expression(_expression), m_arguments(_arguments) |
|
|
: Expression(_location), m_expression(_expression), m_arguments(_arguments) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_expression; |
|
|
ptr<Expression> m_expression; |
|
|
vecptr<Expression> m_arguments; |
|
|
vecptr<Expression> m_arguments; |
|
@ -341,12 +378,14 @@ class MemberAccess : public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
MemberAccess(Location const& _location, ptr<Expression> _expression, |
|
|
MemberAccess(Location const& _location, ptr<Expression> _expression, |
|
|
std::string const& _memberName) |
|
|
ptr<ASTString> const& _memberName) |
|
|
: Expression(_location), m_expression(_expression), m_memberName(_memberName) |
|
|
: Expression(_location), m_expression(_expression), m_memberName(_memberName) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
const ASTString& getMemberName() const { return *m_memberName; } |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_expression; |
|
|
ptr<Expression> m_expression; |
|
|
std::string m_memberName; |
|
|
ptr<ASTString> m_memberName; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class IndexAccess : public Expression |
|
|
class IndexAccess : public Expression |
|
@ -356,6 +395,7 @@ public: |
|
|
ptr<Expression> const& _index) |
|
|
ptr<Expression> const& _index) |
|
|
: Expression(_location), m_base(_base), m_index(_index) |
|
|
: Expression(_location), m_base(_base), m_index(_index) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
private: |
|
|
private: |
|
|
ptr<Expression> m_base; |
|
|
ptr<Expression> m_base; |
|
|
ptr<Expression> m_index; |
|
|
ptr<Expression> m_index; |
|
@ -365,15 +405,19 @@ class PrimaryExpression : public Expression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
PrimaryExpression(Location const& _location) : Expression(_location) {} |
|
|
PrimaryExpression(Location const& _location) : Expression(_location) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class Identifier : public PrimaryExpression |
|
|
class Identifier : public PrimaryExpression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Identifier(Location const& _location, std::string const& _name) |
|
|
Identifier(Location const& _location, ptr<ASTString> const& _name) |
|
|
: PrimaryExpression(_location), m_name(_name) {} |
|
|
: PrimaryExpression(_location), m_name(_name) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
ASTString const& getName() const { return *m_name; } |
|
|
private: |
|
|
private: |
|
|
std::string m_name; |
|
|
ptr<ASTString> m_name; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class ElementaryTypeNameExpression : public PrimaryExpression |
|
|
class ElementaryTypeNameExpression : public PrimaryExpression |
|
@ -381,6 +425,9 @@ class ElementaryTypeNameExpression : public PrimaryExpression |
|
|
public: |
|
|
public: |
|
|
ElementaryTypeNameExpression(Location const& _location, Token::Value _type) |
|
|
ElementaryTypeNameExpression(Location const& _location, Token::Value _type) |
|
|
: PrimaryExpression(_location), m_type(_type) {} |
|
|
: PrimaryExpression(_location), m_type(_type) {} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getType() const { return m_type; } |
|
|
private: |
|
|
private: |
|
|
Token::Value m_type; |
|
|
Token::Value m_type; |
|
|
}; |
|
|
}; |
|
@ -388,15 +435,18 @@ private: |
|
|
class Literal : public PrimaryExpression |
|
|
class Literal : public PrimaryExpression |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
Literal(Location const& _location, Token::Value _token, std::string const& _value) |
|
|
Literal(Location const& _location, Token::Value _token, ptr<ASTString> const& _value) |
|
|
: PrimaryExpression(_location), m_token(_token), m_value(_value) |
|
|
: PrimaryExpression(_location), m_token(_token), m_value(_value) |
|
|
{} |
|
|
{} |
|
|
|
|
|
virtual void accept(ASTVisitor& _visitor) override; |
|
|
|
|
|
|
|
|
|
|
|
Token::Value getToken() const { return m_token; } |
|
|
|
|
|
ASTString const& getValue() const { return *m_value; } |
|
|
private: |
|
|
private: |
|
|
Token::Value m_token; |
|
|
Token::Value m_token; |
|
|
std::string m_value; |
|
|
ptr<ASTString> m_value; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
/// @}
|
|
|
/// @}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} } |
|
|
} } |
|
|