Make Lexer use constant Tokens
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2019-06-13 18:49:38 +02:00
parent 5910cbbfa9
commit 3e00f750ef
10 changed files with 162 additions and 137 deletions

View File

@@ -73,7 +73,7 @@ public:
}
explicit LiteralIntegerExpression(IntegerToken* token)
: ParsedExpression(token -> GetStartPosition(), token -> GetLength()),
_value(token -> Value)
_value(token -> GetValue())
{
}
@@ -90,7 +90,7 @@ public:
}
explicit LiteralFloatExpression(FloatToken* token)
: ParsedExpression(token -> GetStartPosition(), token -> GetLength()),
_value(token -> Value)
_value(token -> GetValue())
{
}
@@ -107,7 +107,7 @@ public:
}
explicit LiteralStringExpression(StringToken* token)
: ParsedExpression(token -> GetStartPosition(), token -> GetLength()),
_value(std::move(token -> Value))
_value(std::move(token -> GetValue()))
{
}
@@ -122,7 +122,7 @@ public:
const ParsedExpressionKind GetKind() const final{
return ParsedExpressionKind::LiteralBool;
}
explicit LiteralBoolExpression(IToken* token)
explicit LiteralBoolExpression(const IToken* token)
: ParsedExpression(token -> GetStartPosition(), token -> GetLength()),
_value(token -> GetKind() == TokenKind::TrueKeyword)
{
@@ -140,7 +140,7 @@ public:
return ParsedExpressionKind::Variable;
}
explicit VariableExpression(IdentifierToken* token) : ParsedExpression(token -> GetStartPosition(), token -> GetLength())
, _value(HashedString(token -> Value))
, _value(HashedString(token -> GetValue()))
{
}