mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-05 08:17:25 +00:00
Implement sequence matcher and parser magic
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#include "HeaderParser.h"
|
||||
|
||||
#include "Parsing/Header/Sequence/SequenceNamespace.h"
|
||||
|
||||
HeaderParser::HeaderParser(HeaderLexer* lexer, IDataRepository* targetRepository)
|
||||
: AbstractParser(lexer, std::make_unique<HeaderParserState>()),
|
||||
m_repository(targetRepository)
|
||||
{
|
||||
auto sequenceNamespace = std::make_unique<SequenceNamespace>();
|
||||
m_normal_tests.push_back(sequenceNamespace.get());
|
||||
m_tests.emplace_back(std::move(sequenceNamespace));
|
||||
}
|
||||
|
||||
const std::vector<HeaderParser::sequence_t*>& HeaderParser::GetTestsForState()
|
||||
{
|
||||
return m_normal_tests;
|
||||
}
|
||||
|
@@ -1,6 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
class HeaderParser
|
||||
{
|
||||
#include "HeaderLexer.h"
|
||||
#include "HeaderParserState.h"
|
||||
#include "Parsing/AbstractParser.h"
|
||||
#include "Persistence/IDataRepository.h"
|
||||
|
||||
};
|
||||
class HeaderParser final : public AbstractParser<HeaderParserValue, HeaderParserState>
|
||||
{
|
||||
IDataRepository* m_repository;
|
||||
|
||||
std::vector<std::unique_ptr<sequence_t>> m_tests;
|
||||
std::vector<sequence_t*> m_normal_tests;
|
||||
|
||||
protected:
|
||||
const std::vector<sequence_t*>& GetTestsForState() override;
|
||||
|
||||
public:
|
||||
HeaderParser(HeaderLexer* lexer, IDataRepository* targetRepository);
|
||||
};
|
||||
|
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
class HeaderParserState
|
||||
{
|
||||
public:
|
||||
|
||||
};
|
@@ -149,6 +149,16 @@ HeaderParserValue& HeaderParserValue::operator=(HeaderParserValue&& other) noexc
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool HeaderParserValue::IsEof() const
|
||||
{
|
||||
return m_type == HeaderParserValueType::END_OF_FILE;
|
||||
}
|
||||
|
||||
const TokenPos& HeaderParserValue::GetPos() const
|
||||
{
|
||||
return m_pos;
|
||||
}
|
||||
|
||||
char HeaderParserValue::CharacterValue() const
|
||||
{
|
||||
assert(m_type == HeaderParserValueType::CHARACTER);
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
#include "Parsing/IParserValue.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
#include "Parsing/TokenPos.h"
|
||||
|
||||
@@ -48,7 +50,7 @@ enum class HeaderParserValueType
|
||||
MAX
|
||||
};
|
||||
|
||||
class HeaderParserValue
|
||||
class HeaderParserValue final : public IParserValue
|
||||
{
|
||||
public:
|
||||
TokenPos m_pos;
|
||||
@@ -83,12 +85,15 @@ private:
|
||||
HeaderParserValue(TokenPos pos, HeaderParserValueType type);
|
||||
|
||||
public:
|
||||
~HeaderParserValue();
|
||||
~HeaderParserValue() override;
|
||||
HeaderParserValue(const HeaderParserValue& other) = delete;
|
||||
HeaderParserValue(HeaderParserValue&& other) noexcept;
|
||||
HeaderParserValue& operator=(const HeaderParserValue& other) = delete;
|
||||
HeaderParserValue& operator=(HeaderParserValue&& other) noexcept;
|
||||
|
||||
_NODISCARD bool IsEof() const override;
|
||||
_NODISCARD const TokenPos& GetPos() const override;
|
||||
|
||||
_NODISCARD char CharacterValue() const;
|
||||
_NODISCARD int IntegerValue() const;
|
||||
_NODISCARD double FloatingPointValue() const;
|
||||
|
Reference in New Issue
Block a user