mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-19 19:27:52 -05:00
Extract commonly used Parser code to new Parser component
This commit is contained in:
26
src/Parser/Parsing/ILexer.h
Normal file
26
src/Parser/Parsing/ILexer.h
Normal file
@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include "IParserLineStream.h"
|
||||
#include "Parsing/IParserValue.h"
|
||||
|
||||
template<typename TokenType>
|
||||
class ILexer
|
||||
{
|
||||
// TokenType must inherit IParserValue
|
||||
static_assert(std::is_base_of<IParserValue, TokenType>::value);
|
||||
|
||||
public:
|
||||
ILexer() = default;
|
||||
virtual ~ILexer() = default;
|
||||
ILexer(const ILexer& other) = default;
|
||||
ILexer(ILexer&& other) noexcept = default;
|
||||
ILexer& operator=(const ILexer& other) = default;
|
||||
ILexer& operator=(ILexer&& other) noexcept = default;
|
||||
|
||||
virtual const TokenType& GetToken(unsigned index) = 0;
|
||||
virtual void PopTokens(int amount) = 0;
|
||||
|
||||
_NODISCARD virtual bool IsEof() = 0;
|
||||
_NODISCARD virtual const TokenPos& GetPos() = 0;
|
||||
_NODISCARD virtual ParserLine GetLineForPos(const TokenPos& pos) const = 0;
|
||||
};
|
Reference in New Issue
Block a user