mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-03-07 05:23:02 +00:00
chore: update ZoneCodeGenerator code style
This commit is contained in:
@@ -7,18 +7,12 @@
|
||||
#include "IHeaderBlockVariableDefining.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class HeaderBlockEnum final : public IHeaderBlock, public IHeaderBlockNameHolder, public IHeaderBlockVariableDefining
|
||||
{
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
const BaseTypeDefinition* m_parent_type;
|
||||
bool m_is_typedef;
|
||||
std::vector<std::unique_ptr<EnumMember>> m_members;
|
||||
int m_next_value;
|
||||
EnumDefinition* m_enum_definition;
|
||||
|
||||
std::string m_variable_name;
|
||||
|
||||
public:
|
||||
HeaderBlockEnum(std::string typeName, const BaseTypeDefinition* parentType, bool isTypeDef);
|
||||
|
||||
@@ -29,11 +23,22 @@ public:
|
||||
void OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) override;
|
||||
|
||||
void AddEnumMember(std::unique_ptr<EnumMember> enumMember);
|
||||
_NODISCARD EnumMember* GetEnumMember(const std::string& name) const;
|
||||
_NODISCARD int GetNextEnumMemberValue() const;
|
||||
[[nodiscard]] EnumMember* GetEnumMember(const std::string& name) const;
|
||||
[[nodiscard]] int GetNextEnumMemberValue() const;
|
||||
|
||||
void SetBlockName(const TokenPos& nameTokenPos, std::string name) override;
|
||||
bool IsDefiningVariable() override;
|
||||
DataDefinition* GetVariableType() override;
|
||||
std::string GetVariableName() override;
|
||||
|
||||
private:
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
const BaseTypeDefinition* m_parent_type;
|
||||
bool m_is_typedef;
|
||||
std::vector<std::unique_ptr<EnumMember>> m_members;
|
||||
int m_next_value;
|
||||
EnumDefinition* m_enum_definition;
|
||||
|
||||
std::string m_variable_name;
|
||||
};
|
||||
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
#include "IHeaderBlock.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class HeaderBlockNamespace final : public IHeaderBlock
|
||||
{
|
||||
std::string m_namespace_name;
|
||||
|
||||
public:
|
||||
explicit HeaderBlockNamespace(std::string namespaceName);
|
||||
|
||||
@@ -14,4 +15,6 @@ public:
|
||||
void OnOpen(HeaderParserState* state) override;
|
||||
void OnClose(HeaderParserState* state) override;
|
||||
void OnChildBlockClose(HeaderParserState* state, IHeaderBlock* block) override;
|
||||
|
||||
std::string m_namespace_name;
|
||||
};
|
||||
|
||||
@@ -7,23 +7,12 @@
|
||||
#include "IHeaderBlockVariableDefining.h"
|
||||
#include "IHeaderBlockVariableHolder.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class HeaderBlockStruct final : public IHeaderBlock, public IHeaderBlockNameHolder, public IHeaderBlockVariableDefining, public IHeaderBlockVariableHolder
|
||||
{
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
StructDefinition* m_struct_definition;
|
||||
|
||||
int m_custom_alignment;
|
||||
|
||||
bool m_is_typedef;
|
||||
bool m_has_custom_align;
|
||||
bool m_is_anonymous;
|
||||
|
||||
std::string m_variable_name;
|
||||
|
||||
public:
|
||||
HeaderBlockStruct(std::string name, bool isTypedef);
|
||||
|
||||
@@ -41,4 +30,18 @@ public:
|
||||
bool IsDefiningVariable() override;
|
||||
DataDefinition* GetVariableType() override;
|
||||
std::string GetVariableName() override;
|
||||
|
||||
private:
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
StructDefinition* m_struct_definition;
|
||||
|
||||
int m_custom_alignment;
|
||||
|
||||
bool m_is_typedef;
|
||||
bool m_has_custom_align;
|
||||
bool m_is_anonymous;
|
||||
|
||||
std::string m_variable_name;
|
||||
};
|
||||
|
||||
@@ -5,21 +5,12 @@
|
||||
#include "IHeaderBlockVariableDefining.h"
|
||||
#include "IHeaderBlockVariableHolder.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class HeaderBlockUnion final : public IHeaderBlock, public IHeaderBlockNameHolder, public IHeaderBlockVariableDefining, public IHeaderBlockVariableHolder
|
||||
{
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
UnionDefinition* m_union_definition;
|
||||
|
||||
int m_custom_alignment;
|
||||
|
||||
bool m_is_typedef;
|
||||
bool m_has_custom_align;
|
||||
bool m_is_anonymous;
|
||||
|
||||
std::string m_variable_name;
|
||||
|
||||
public:
|
||||
HeaderBlockUnion(std::string name, bool isTypedef);
|
||||
|
||||
@@ -37,4 +28,18 @@ public:
|
||||
bool IsDefiningVariable() override;
|
||||
DataDefinition* GetVariableType() override;
|
||||
std::string GetVariableName() override;
|
||||
|
||||
private:
|
||||
std::string m_namespace;
|
||||
std::string m_type_name;
|
||||
std::vector<std::shared_ptr<Variable>> m_members;
|
||||
UnionDefinition* m_union_definition;
|
||||
|
||||
int m_custom_alignment;
|
||||
|
||||
bool m_is_typedef;
|
||||
bool m_has_custom_align;
|
||||
bool m_is_anonymous;
|
||||
|
||||
std::string m_variable_name;
|
||||
};
|
||||
|
||||
@@ -13,8 +13,15 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr const char* ZONE_CODE_GENERATOR_DEFINE_NAME = "__zonecodegenerator";
|
||||
static constexpr const char* ZONE_CODE_GENERATOR_DEFINE_VALUE = "1";
|
||||
} // namespace
|
||||
|
||||
HeaderFileReader::HeaderFileReader(const ZoneCodeGeneratorArguments* args, std::string filename)
|
||||
: m_args(args),
|
||||
m_filename(std::move(filename)),
|
||||
@@ -29,7 +36,7 @@ bool HeaderFileReader::OpenBaseStream()
|
||||
auto stream = std::make_unique<ParserFilesystemStream>(m_filename);
|
||||
if (!stream->IsOpen())
|
||||
{
|
||||
std::cout << "Could not open header file\n";
|
||||
std::cerr << "Could not open header file\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -65,9 +72,7 @@ void HeaderFileReader::SetupPostProcessors()
|
||||
bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
|
||||
{
|
||||
if (m_args->m_verbose)
|
||||
{
|
||||
std::cout << "Reading header file: " << m_filename << "\n";
|
||||
}
|
||||
std::cout << std::format("Reading header file: {}\n", m_filename);
|
||||
|
||||
if (!OpenBaseStream())
|
||||
return false;
|
||||
@@ -84,9 +89,7 @@ bool HeaderFileReader::ReadHeaderFile(IDataRepository* repository)
|
||||
const auto end = std::chrono::steady_clock::now();
|
||||
|
||||
if (m_args->m_verbose)
|
||||
{
|
||||
std::cout << "Processing header took " << std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count() << "ms\n";
|
||||
}
|
||||
std::cout << std::format("Processing header took {}ms\n", std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count());
|
||||
|
||||
if (!result)
|
||||
return false;
|
||||
|
||||
@@ -10,8 +10,15 @@
|
||||
|
||||
class HeaderFileReader
|
||||
{
|
||||
static constexpr const char* ZONE_CODE_GENERATOR_DEFINE_NAME = "__zonecodegenerator";
|
||||
static constexpr const char* ZONE_CODE_GENERATOR_DEFINE_VALUE = "1";
|
||||
public:
|
||||
HeaderFileReader(const ZoneCodeGeneratorArguments* args, std::string filename);
|
||||
|
||||
bool ReadHeaderFile(IDataRepository* repository);
|
||||
|
||||
private:
|
||||
bool OpenBaseStream();
|
||||
void SetupStreamProxies();
|
||||
void SetupPostProcessors();
|
||||
|
||||
const ZoneCodeGeneratorArguments* m_args;
|
||||
std::string m_filename;
|
||||
@@ -21,13 +28,4 @@ class HeaderFileReader
|
||||
IParserLineStream* m_stream;
|
||||
|
||||
std::vector<std::unique_ptr<IPostProcessor>> m_post_processors;
|
||||
|
||||
bool OpenBaseStream();
|
||||
void SetupStreamProxies();
|
||||
void SetupPostProcessors();
|
||||
|
||||
public:
|
||||
HeaderFileReader(const ZoneCodeGeneratorArguments* args, std::string filename);
|
||||
|
||||
bool ReadHeaderFile(IDataRepository* repository);
|
||||
};
|
||||
|
||||
@@ -3,17 +3,19 @@
|
||||
#include "HeaderParserValue.h"
|
||||
#include "Parsing/Impl/AbstractLexer.h"
|
||||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
class HeaderLexer final : public AbstractLexer<HeaderParserValue>
|
||||
{
|
||||
std::unordered_map<std::string, HeaderParserValueType> m_keywords;
|
||||
|
||||
void PrepareKeywords();
|
||||
public:
|
||||
explicit HeaderLexer(IParserLineStream* stream);
|
||||
|
||||
protected:
|
||||
HeaderParserValue GetNextToken() override;
|
||||
|
||||
public:
|
||||
explicit HeaderLexer(IParserLineStream* stream);
|
||||
private:
|
||||
void PrepareKeywords();
|
||||
|
||||
std::unordered_map<std::string, HeaderParserValueType> m_keywords;
|
||||
};
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
class HeaderParser final : public AbstractParser<HeaderParserValue, HeaderParserState>
|
||||
{
|
||||
protected:
|
||||
const std::vector<sequence_t*>& GetTestsForState() override;
|
||||
|
||||
public:
|
||||
HeaderParser(HeaderLexer* lexer, const IPackValueSupplier* packValueSupplier);
|
||||
|
||||
bool SaveToRepository(IDataRepository* repository) const;
|
||||
|
||||
protected:
|
||||
const std::vector<sequence_t*>& GetTestsForState() override;
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Domain/Definition/EnumDefinition.h"
|
||||
#include "Parsing/Header/Block/HeaderBlockNone.h"
|
||||
|
||||
#include <format>
|
||||
#include <iostream>
|
||||
|
||||
HeaderParserState::HeaderParserState(const IPackValueSupplier* packValueSupplier)
|
||||
@@ -96,7 +97,7 @@ bool HeaderParserState::ResolveForwardDeclarations()
|
||||
|
||||
if (dataDefinition == nullptr)
|
||||
{
|
||||
std::cout << "Forward declaration \"" << forwardDeclaration->GetFullName() << "\" was not defined\n";
|
||||
std::cerr << std::format("Forward declaration \"{}\" was not defined\n", forwardDeclaration->GetFullName());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,31 +12,15 @@
|
||||
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
class IHeaderBlock;
|
||||
|
||||
class HeaderParserState
|
||||
{
|
||||
std::vector<std::unique_ptr<DataDefinition>> m_header_definitions;
|
||||
|
||||
std::stack<std::unique_ptr<IHeaderBlock>> m_blocks;
|
||||
std::unordered_map<std::string, const DataDefinition*> m_definitions;
|
||||
std::unordered_map<std::string, EnumMember*> m_enum_members;
|
||||
std::unordered_map<std::string, std::unique_ptr<ForwardDeclaration>> m_forward_declarations;
|
||||
|
||||
void AddBaseDataType(const BaseTypeDefinition* baseType);
|
||||
bool ResolveForwardDeclarations();
|
||||
static bool ReplaceForwardDeclarationsInStruct(StructDefinition* structDefinition);
|
||||
static bool ReplaceForwardDeclarationsInTypedef(TypedefDefinition* typedefDefinition);
|
||||
static bool ReplaceForwardDeclarationsInUnion(UnionDefinition* unionDefinition);
|
||||
bool ReplaceForwardDeclarationsInDefinitions();
|
||||
bool MoveDefinitionsToRepository(IDataRepository* repository);
|
||||
|
||||
public:
|
||||
const IPackValueSupplier* const m_pack_value_supplier;
|
||||
NamespaceBuilder m_namespace;
|
||||
|
||||
explicit HeaderParserState(const IPackValueSupplier* packValueSupplier);
|
||||
|
||||
_NODISCARD IHeaderBlock* GetBlock() const;
|
||||
@@ -50,4 +34,23 @@ public:
|
||||
EnumMember* FindEnumMember(const std::string& enumMemberName);
|
||||
|
||||
bool SaveToRepository(IDataRepository* repository);
|
||||
|
||||
const IPackValueSupplier* const m_pack_value_supplier;
|
||||
NamespaceBuilder m_namespace;
|
||||
|
||||
private:
|
||||
void AddBaseDataType(const BaseTypeDefinition* baseType);
|
||||
bool ResolveForwardDeclarations();
|
||||
static bool ReplaceForwardDeclarationsInStruct(StructDefinition* structDefinition);
|
||||
static bool ReplaceForwardDeclarationsInTypedef(TypedefDefinition* typedefDefinition);
|
||||
static bool ReplaceForwardDeclarationsInUnion(UnionDefinition* unionDefinition);
|
||||
bool ReplaceForwardDeclarationsInDefinitions();
|
||||
bool MoveDefinitionsToRepository(IDataRepository* repository);
|
||||
|
||||
std::vector<std::unique_ptr<DataDefinition>> m_header_definitions;
|
||||
|
||||
std::stack<std::unique_ptr<IHeaderBlock>> m_blocks;
|
||||
std::unordered_map<std::string, const DataDefinition*> m_definitions;
|
||||
std::unordered_map<std::string, EnumMember*> m_enum_members;
|
||||
std::unordered_map<std::string, std::unique_ptr<ForwardDeclaration>> m_forward_declarations;
|
||||
};
|
||||
|
||||
@@ -61,9 +61,6 @@ enum class HeaderParserValueType
|
||||
class HeaderParserValue final : public IParserValue
|
||||
{
|
||||
public:
|
||||
TokenPos m_pos;
|
||||
HeaderParserValueType m_type;
|
||||
|
||||
union ValueType
|
||||
{
|
||||
char char_value;
|
||||
@@ -90,23 +87,25 @@ public:
|
||||
static HeaderParserValue Keyword(TokenPos pos, HeaderParserValueType type);
|
||||
static HeaderParserValue TypeName(TokenPos pos, std::string* typeName);
|
||||
|
||||
private:
|
||||
HeaderParserValue(TokenPos pos, HeaderParserValueType type);
|
||||
|
||||
public:
|
||||
~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]] bool IsEof() const override;
|
||||
[[nodiscard]] const TokenPos& GetPos() const override;
|
||||
|
||||
_NODISCARD char CharacterValue() const;
|
||||
_NODISCARD int IntegerValue() const;
|
||||
_NODISCARD double FloatingPointValue() const;
|
||||
_NODISCARD std::string& StringValue() const;
|
||||
_NODISCARD std::string& IdentifierValue() const;
|
||||
_NODISCARD std::string& TypeNameValue() const;
|
||||
[[nodiscard]] char CharacterValue() const;
|
||||
[[nodiscard]] int IntegerValue() const;
|
||||
[[nodiscard]] double FloatingPointValue() const;
|
||||
[[nodiscard]] std::string& StringValue() const;
|
||||
[[nodiscard]] std::string& IdentifierValue() const;
|
||||
[[nodiscard]] std::string& TypeNameValue() const;
|
||||
|
||||
TokenPos m_pos;
|
||||
HeaderParserValueType m_type;
|
||||
|
||||
private:
|
||||
HeaderParserValue(TokenPos pos, HeaderParserValueType type);
|
||||
};
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
class HeaderMatcherCharacter final : public AbstractMatcher<HeaderParserValue>
|
||||
{
|
||||
char m_char;
|
||||
public:
|
||||
explicit HeaderMatcherCharacter(char c);
|
||||
|
||||
protected:
|
||||
MatcherResult<HeaderParserValue> CanMatch(ILexer<HeaderParserValue>* lexer, unsigned tokenOffset) override;
|
||||
|
||||
public:
|
||||
explicit HeaderMatcherCharacter(char c);
|
||||
private:
|
||||
char m_char;
|
||||
};
|
||||
|
||||
@@ -8,9 +8,9 @@ class HeaderMatcherFactory final : public AbstractMatcherFactory<HeaderParserVal
|
||||
public:
|
||||
explicit HeaderMatcherFactory(const IMatcherForLabelSupplier<HeaderParserValue>* labelSupplier);
|
||||
|
||||
_NODISCARD MatcherFactoryWrapper<HeaderParserValue> Type(HeaderParserValueType type) const;
|
||||
_NODISCARD MatcherFactoryWrapper<HeaderParserValue> Identifier() const;
|
||||
_NODISCARD MatcherFactoryWrapper<HeaderParserValue> Integer() const;
|
||||
_NODISCARD MatcherFactoryWrapper<HeaderParserValue> FloatingPoint() const;
|
||||
_NODISCARD MatcherFactoryWrapper<HeaderParserValue> Char(char c) const;
|
||||
[[nodiscard]] MatcherFactoryWrapper<HeaderParserValue> Type(HeaderParserValueType type) const;
|
||||
[[nodiscard]] MatcherFactoryWrapper<HeaderParserValue> Identifier() const;
|
||||
[[nodiscard]] MatcherFactoryWrapper<HeaderParserValue> Integer() const;
|
||||
[[nodiscard]] MatcherFactoryWrapper<HeaderParserValue> FloatingPoint() const;
|
||||
[[nodiscard]] MatcherFactoryWrapper<HeaderParserValue> Char(char c) const;
|
||||
};
|
||||
|
||||
@@ -5,11 +5,12 @@
|
||||
|
||||
class HeaderMatcherValueType final : public AbstractMatcher<HeaderParserValue>
|
||||
{
|
||||
HeaderParserValueType m_type;
|
||||
public:
|
||||
explicit HeaderMatcherValueType(HeaderParserValueType type);
|
||||
|
||||
protected:
|
||||
MatcherResult<HeaderParserValue> CanMatch(ILexer<HeaderParserValue>* lexer, unsigned tokenOffset) override;
|
||||
|
||||
public:
|
||||
explicit HeaderMatcherValueType(HeaderParserValueType type);
|
||||
private:
|
||||
HeaderParserValueType m_type;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto TAG_SEMICOLON = 1;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_CLOSING_PARENTHESIS = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceCloseBlock::SequenceCloseBlock(const bool semicolonRequired)
|
||||
: m_semicolon_required(semicolonRequired)
|
||||
{
|
||||
|
||||
@@ -7,16 +7,12 @@
|
||||
|
||||
class SequenceCloseBlock final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_SEMICOLON = 1;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_CLOSING_PARENTHESIS = 2;
|
||||
public:
|
||||
explicit SequenceCloseBlock(bool semicolonRequired);
|
||||
|
||||
private:
|
||||
bool m_semicolon_required;
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
explicit SequenceCloseBlock(bool semicolonRequired);
|
||||
};
|
||||
|
||||
@@ -4,6 +4,14 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_PARENT_TYPE = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceEnum::SequenceEnum()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,14 +7,9 @@
|
||||
|
||||
class SequenceEnum final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_PARENT_TYPE = 2;
|
||||
public:
|
||||
SequenceEnum();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceEnum();
|
||||
};
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_VALUE = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceEnumMember::SequenceEnumMember()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,12 +7,9 @@
|
||||
|
||||
class SequenceEnumMember final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_VALUE = 2;
|
||||
public:
|
||||
SequenceEnumMember();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceEnumMember();
|
||||
};
|
||||
|
||||
@@ -3,6 +3,16 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto TAG_ENUM = 1;
|
||||
static constexpr auto TAG_STRUCT = 2;
|
||||
static constexpr auto TAG_UNION = 3;
|
||||
|
||||
static constexpr auto CAPTURE_TYPE = 1;
|
||||
static constexpr auto CAPTURE_NAME = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceForwardDecl::SequenceForwardDecl()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,16 +7,9 @@
|
||||
|
||||
class SequenceForwardDecl final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_ENUM = 1;
|
||||
static constexpr auto TAG_STRUCT = 2;
|
||||
static constexpr auto TAG_UNION = 3;
|
||||
|
||||
static constexpr auto CAPTURE_TYPE = 1;
|
||||
static constexpr auto CAPTURE_NAME = 2;
|
||||
public:
|
||||
SequenceForwardDecl();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceForwardDecl();
|
||||
};
|
||||
|
||||
@@ -3,6 +3,11 @@
|
||||
#include "Parsing/Header/Block/HeaderBlockNamespace.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr int CAPTURE_NAME = 0;
|
||||
}
|
||||
|
||||
SequenceNamespace::SequenceNamespace()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,11 +7,9 @@
|
||||
|
||||
class SequenceNamespace final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr int CAPTURE_NAME = 0;
|
||||
public:
|
||||
SequenceNamespace();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceNamespace();
|
||||
};
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr int TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr int CAPTURE_NAME = 1;
|
||||
static constexpr int CAPTURE_ALIGN = 2;
|
||||
static constexpr int CAPTURE_PARENT_TYPE = 3;
|
||||
} // namespace
|
||||
|
||||
SequenceStruct::SequenceStruct()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,15 +7,9 @@
|
||||
|
||||
class SequenceStruct final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr int TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr int CAPTURE_NAME = 1;
|
||||
static constexpr int CAPTURE_ALIGN = 2;
|
||||
static constexpr int CAPTURE_PARENT_TYPE = 3;
|
||||
public:
|
||||
SequenceStruct();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceStruct();
|
||||
};
|
||||
|
||||
@@ -5,6 +5,22 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto TAG_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto TAG_POINTER_TO_ARRAY = 2;
|
||||
static constexpr auto TAG_CONST = 3;
|
||||
static constexpr auto TAG_POINTER = 4;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_ALIGN = 2;
|
||||
static constexpr auto CAPTURE_TYPE = 3;
|
||||
static constexpr auto CAPTURE_ARRAY = 4;
|
||||
|
||||
static constexpr auto LABEL_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto LABEL_POINTER_TO_ARRAY = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceTypedef::SequenceTypedef()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,25 +7,13 @@
|
||||
|
||||
class SequenceTypedef final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto TAG_POINTER_TO_ARRAY = 2;
|
||||
static constexpr auto TAG_CONST = 3;
|
||||
static constexpr auto TAG_POINTER = 4;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_ALIGN = 2;
|
||||
static constexpr auto CAPTURE_TYPE = 3;
|
||||
static constexpr auto CAPTURE_ARRAY = 4;
|
||||
|
||||
static constexpr auto LABEL_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto LABEL_POINTER_TO_ARRAY = 2;
|
||||
|
||||
void AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
void AddArrayDeclarationModifiers(HeaderParserState* state, SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
public:
|
||||
SequenceTypedef();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceTypedef();
|
||||
private:
|
||||
void AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
void AddArrayDeclarationModifiers(HeaderParserState* state, SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,15 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr int TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr int CAPTURE_NAME = 1;
|
||||
static constexpr int CAPTURE_ALIGN = 2;
|
||||
static constexpr int CAPTURE_PARENT_TYPE = 3;
|
||||
} // namespace
|
||||
|
||||
SequenceUnion::SequenceUnion()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,15 +7,9 @@
|
||||
|
||||
class SequenceUnion final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr int TAG_TYPEDEF = 1;
|
||||
|
||||
static constexpr int CAPTURE_NAME = 1;
|
||||
static constexpr int CAPTURE_ALIGN = 2;
|
||||
static constexpr int CAPTURE_PARENT_TYPE = 3;
|
||||
public:
|
||||
SequenceUnion();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceUnion();
|
||||
};
|
||||
|
||||
@@ -6,6 +6,23 @@
|
||||
#include "Parsing/Header/Matcher/HeaderCommonMatchers.h"
|
||||
#include "Parsing/Header/Matcher/HeaderMatcherFactory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
static constexpr auto TAG_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto TAG_POINTER_TO_ARRAY = 2;
|
||||
static constexpr auto TAG_CONST = 3;
|
||||
static constexpr auto TAG_POINTER = 4;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_ALIGN = 2;
|
||||
static constexpr auto CAPTURE_TYPE = 3;
|
||||
static constexpr auto CAPTURE_ARRAY = 4;
|
||||
static constexpr auto CAPTURE_BIT_SIZE = 5;
|
||||
|
||||
static constexpr auto LABEL_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto LABEL_POINTER_TO_ARRAY = 2;
|
||||
} // namespace
|
||||
|
||||
SequenceVariable::SequenceVariable()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
@@ -7,26 +7,13 @@
|
||||
|
||||
class SequenceVariable final : public HeaderParser::sequence_t
|
||||
{
|
||||
static constexpr auto TAG_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto TAG_POINTER_TO_ARRAY = 2;
|
||||
static constexpr auto TAG_CONST = 3;
|
||||
static constexpr auto TAG_POINTER = 4;
|
||||
|
||||
static constexpr auto CAPTURE_NAME = 1;
|
||||
static constexpr auto CAPTURE_ALIGN = 2;
|
||||
static constexpr auto CAPTURE_TYPE = 3;
|
||||
static constexpr auto CAPTURE_ARRAY = 4;
|
||||
static constexpr auto CAPTURE_BIT_SIZE = 5;
|
||||
|
||||
static constexpr auto LABEL_ARRAY_OF_POINTERS = 1;
|
||||
static constexpr auto LABEL_POINTER_TO_ARRAY = 2;
|
||||
|
||||
void AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
void AddArrayDeclarationModifiers(HeaderParserState* state, SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
public:
|
||||
SequenceVariable();
|
||||
|
||||
protected:
|
||||
void ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const override;
|
||||
|
||||
public:
|
||||
SequenceVariable();
|
||||
private:
|
||||
void AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
void AddArrayDeclarationModifiers(HeaderParserState* state, SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user