Cleanup of Parsed Expression classes
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
b462c1b873
commit
12c55a12ba
|
@ -42,17 +42,17 @@ namespace Porygon::Parser {
|
|||
|
||||
virtual ~ParsedExpression() = default;
|
||||
|
||||
virtual const ParsedExpressionKind GetKind() const = 0;
|
||||
[[nodiscard]] virtual ParsedExpressionKind GetKind() const = 0;
|
||||
|
||||
inline const unsigned int GetStartPosition() const {
|
||||
[[nodiscard]] inline unsigned int GetStartPosition() const {
|
||||
return _position;
|
||||
}
|
||||
|
||||
inline const unsigned int GetEndPosition() const {
|
||||
[[nodiscard]] inline unsigned int GetEndPosition() const {
|
||||
return _position + _length - 1;
|
||||
}
|
||||
|
||||
inline const unsigned int GetLength() const {
|
||||
[[nodiscard]] inline unsigned int GetLength() const {
|
||||
return _length;
|
||||
}
|
||||
};
|
||||
|
@ -61,7 +61,7 @@ namespace Porygon::Parser {
|
|||
public:
|
||||
BadExpression(unsigned int position, unsigned int length) : ParsedExpression(position, length) {}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Bad;
|
||||
}
|
||||
};
|
||||
|
@ -69,7 +69,7 @@ namespace Porygon::Parser {
|
|||
class LiteralIntegerExpression : public ParsedExpression {
|
||||
const int64_t _value;
|
||||
public:
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::LiteralInteger;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace Porygon::Parser {
|
|||
_value(token->GetValue()) {
|
||||
}
|
||||
|
||||
inline const int64_t GetValue() const {
|
||||
[[nodiscard]] inline int64_t GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
@ -86,7 +86,7 @@ namespace Porygon::Parser {
|
|||
class LiteralFloatExpression : public ParsedExpression {
|
||||
const double _value;
|
||||
public:
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::LiteralFloat;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ namespace Porygon::Parser {
|
|||
_value(token->GetValue()) {
|
||||
}
|
||||
|
||||
inline const double GetValue() const {
|
||||
[[nodiscard]] inline double GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
@ -103,7 +103,7 @@ namespace Porygon::Parser {
|
|||
class LiteralStringExpression : public ParsedExpression {
|
||||
const u16string _value;
|
||||
public:
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::LiteralString;
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ namespace Porygon::Parser {
|
|||
_value(token->GetValue()) {
|
||||
}
|
||||
|
||||
inline const u16string &GetValue() const {
|
||||
[[nodiscard]] inline const u16string &GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
@ -120,7 +120,7 @@ namespace Porygon::Parser {
|
|||
class LiteralBoolExpression : public ParsedExpression {
|
||||
const bool _value;
|
||||
public:
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]]inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::LiteralBool;
|
||||
}
|
||||
|
||||
|
@ -129,14 +129,14 @@ namespace Porygon::Parser {
|
|||
_value(token->GetKind() == TokenKind::TrueKeyword) {
|
||||
}
|
||||
|
||||
inline const bool GetValue() const {
|
||||
[[nodiscard]]inline bool GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
||||
class NilExpression : public ParsedExpression {
|
||||
public:
|
||||
[[nodiscard]] inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Nil;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace Porygon::Parser {
|
|||
class VariableExpression : public ParsedExpression {
|
||||
const HashedString _value;
|
||||
public:
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]]inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Variable;
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ namespace Porygon::Parser {
|
|||
_value(HashedString(token->GetValue())) {
|
||||
}
|
||||
|
||||
inline const HashedString GetValue() const {
|
||||
[[nodiscard]]inline HashedString GetValue() const {
|
||||
return _value;
|
||||
}
|
||||
};
|
||||
|
@ -170,7 +170,7 @@ namespace Porygon::Parser {
|
|||
delete _expression;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Parenthesized;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ namespace Porygon::Parser {
|
|||
: ParsedExpression(start, length), _expression(innerExpression) {
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetInnerExpression() const {
|
||||
[[nodiscard]]inline const ParsedExpression *GetInnerExpression() const {
|
||||
return _expression;
|
||||
}
|
||||
};
|
||||
|
@ -191,7 +191,7 @@ namespace Porygon::Parser {
|
|||
delete _operand;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]]inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Unary;
|
||||
}
|
||||
|
||||
|
@ -200,11 +200,11 @@ namespace Porygon::Parser {
|
|||
_kind(kind), _operand(operand) {
|
||||
}
|
||||
|
||||
inline const UnaryOperatorKind GetOperatorKind() const {
|
||||
[[nodiscard]]inline UnaryOperatorKind GetOperatorKind() const {
|
||||
return _kind;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetOperand() const {
|
||||
[[nodiscard]]inline const ParsedExpression *GetOperand() const {
|
||||
return _operand;
|
||||
}
|
||||
};
|
||||
|
@ -219,7 +219,7 @@ namespace Porygon::Parser {
|
|||
delete _right;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]]inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Binary;
|
||||
}
|
||||
|
||||
|
@ -229,15 +229,15 @@ namespace Porygon::Parser {
|
|||
_kind(kind), _left(left), _right(right) {
|
||||
}
|
||||
|
||||
inline const BinaryOperatorKind GetOperatorKind() const {
|
||||
[[nodiscard]]inline BinaryOperatorKind GetOperatorKind() const {
|
||||
return _kind;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetLeft() const {
|
||||
[[nodiscard]]inline const ParsedExpression *GetLeft() const {
|
||||
return _left;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetRight() const {
|
||||
[[nodiscard]]inline const ParsedExpression *GetRight() const {
|
||||
return _right;
|
||||
}
|
||||
};
|
||||
|
@ -258,15 +258,15 @@ namespace Porygon::Parser {
|
|||
}
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::FunctionCall;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetFunction() const {
|
||||
[[nodiscard]] inline const ParsedExpression *GetFunction() const {
|
||||
return _function.get();
|
||||
}
|
||||
|
||||
inline const vector<const ParsedExpression *> *GetParameters() const {
|
||||
[[nodiscard]] inline const vector<const ParsedExpression *> *GetParameters() const {
|
||||
return &_parameters;
|
||||
}
|
||||
};
|
||||
|
@ -285,15 +285,15 @@ namespace Porygon::Parser {
|
|||
delete _indexExpression;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Indexer;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetIndexer() const {
|
||||
[[nodiscard]] inline const ParsedExpression *GetIndexer() const {
|
||||
return _indexerExpression;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetIndex() const {
|
||||
[[nodiscard]] inline const ParsedExpression *GetIndex() const {
|
||||
return _indexExpression;
|
||||
}
|
||||
};
|
||||
|
@ -302,7 +302,7 @@ namespace Porygon::Parser {
|
|||
const ParsedExpression *_indexerExpression;
|
||||
const HashedString _index;
|
||||
public:
|
||||
PeriodIndexExpression(ParsedExpression *indexer, HashedString index, unsigned int start, unsigned int length)
|
||||
PeriodIndexExpression(ParsedExpression *indexer, const HashedString& index, unsigned int start, unsigned int length)
|
||||
: ParsedExpression(start, length),
|
||||
_indexerExpression(indexer), _index(index) {
|
||||
}
|
||||
|
@ -311,15 +311,15 @@ namespace Porygon::Parser {
|
|||
delete _indexerExpression;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::PeriodIndexer;
|
||||
}
|
||||
|
||||
inline const ParsedExpression *GetIndexer() const {
|
||||
[[nodiscard]] inline const ParsedExpression *GetIndexer() const {
|
||||
return _indexerExpression;
|
||||
}
|
||||
|
||||
inline const HashedString &GetIndex() const {
|
||||
[[nodiscard]] inline const HashedString &GetIndex() const {
|
||||
return _index;
|
||||
}
|
||||
};
|
||||
|
@ -339,11 +339,11 @@ namespace Porygon::Parser {
|
|||
}
|
||||
}
|
||||
|
||||
inline const vector<const ParsedExpression *> *GetExpressions() const {
|
||||
[[nodiscard]] inline const vector<const ParsedExpression *> *GetExpressions() const {
|
||||
return &_expressions;
|
||||
}
|
||||
|
||||
inline const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] inline ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::NumericalTable;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,11 +17,11 @@ namespace Porygon::Parser {
|
|||
delete _block;
|
||||
}
|
||||
|
||||
const ParsedBlockStatement *GetBlock() const {
|
||||
[[nodiscard]] const ParsedBlockStatement *GetBlock() const {
|
||||
return _block;
|
||||
}
|
||||
|
||||
const ParsedExpressionKind GetKind() const final {
|
||||
[[nodiscard]] ParsedExpressionKind GetKind() const final {
|
||||
return ParsedExpressionKind::Table;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue