diff --git a/src/Parser/Token.hpp b/src/Parser/Token.hpp index 354f3d3..60b5e01 100644 --- a/src/Parser/Token.hpp +++ b/src/Parser/Token.hpp @@ -14,21 +14,21 @@ namespace Porygon::Parser { const unsigned int _position; const unsigned int _length; public: - virtual const TokenKind GetKind() const = 0; + [[nodiscard]] virtual TokenKind GetKind() const = 0; Token(unsigned int position, unsigned int length) : _position(position), _length(length) { } - 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; } @@ -44,7 +44,7 @@ namespace Porygon::Parser { _kind(kind) { } - inline const TokenKind GetKind() const final { + [[nodiscard]] inline TokenKind GetKind() const final { return _kind; } }; @@ -58,11 +58,11 @@ namespace Porygon::Parser { _value(value) { } - inline const TokenKind GetKind() const final { + [[nodiscard]] inline TokenKind GetKind() const final { return TokenKind::Integer; } - inline const long GetValue() const { + [[nodiscard]] inline long GetValue() const { return _value; } }; @@ -76,11 +76,11 @@ namespace Porygon::Parser { _value(value) { } - inline const TokenKind GetKind() const final { + [[nodiscard]] inline TokenKind GetKind() const final { return TokenKind::Float; } - inline const double GetValue() const { + [[nodiscard]] inline double GetValue() const { return _value; } }; @@ -94,11 +94,11 @@ namespace Porygon::Parser { _value(std::move(value)) { } - inline const TokenKind GetKind() const final { + [[nodiscard]] inline TokenKind GetKind() const final { return TokenKind::String; } - inline const u16string &GetValue() const { + [[nodiscard]] inline const u16string &GetValue() const { return _value; } }; @@ -107,16 +107,16 @@ namespace Porygon::Parser { const Utilities::HashedString _value; public: - explicit IdentifierToken(const HashedString value, unsigned int position, unsigned int length) + explicit IdentifierToken(const HashedString& value, unsigned int position, unsigned int length) : Token(position, length), _value(value) { } - inline const TokenKind GetKind() const final { + [[nodiscard]] inline TokenKind GetKind() const final { return TokenKind::Identifier; } - inline const HashedString GetValue() const { + [[nodiscard]] inline HashedString GetValue() const { return _value; } };