refactor: remove name sequence from zcg commands

This commit is contained in:
Jan Laupetin 2025-04-28 17:23:39 +02:00
parent 0103e4631f
commit 68ee502c72
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
4 changed files with 0 additions and 52 deletions

View File

@ -35,5 +35,4 @@ public:
std::unique_ptr<CustomAction> m_post_load_action;
const FastFileBlock* m_block;
std::vector<MemberInformation*> m_name_chain;
};

View File

@ -11,7 +11,6 @@
#include "Parsing/Commands/Sequence/SequenceCondition.h"
#include "Parsing/Commands/Sequence/SequenceCount.h"
#include "Parsing/Commands/Sequence/SequenceGame.h"
#include "Parsing/Commands/Sequence/SequenceName.h"
#include "Parsing/Commands/Sequence/SequenceReorder.h"
#include "Parsing/Commands/Sequence/SequenceReusable.h"
#include "Parsing/Commands/Sequence/SequenceScriptString.h"
@ -39,7 +38,6 @@ const std::vector<CommandsParser::sequence_t*>& CommandsParser::GetTestsForState
new SequenceCondition(),
new SequenceCount(),
new SequenceGame(),
new SequenceName(),
new SequenceReorder(),
new SequenceReusable(),
new SequenceScriptString(),

View File

@ -1,37 +0,0 @@
#include "SequenceName.h"
#include "Parsing/Commands/Matcher/CommandsCommonMatchers.h"
#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h"
namespace
{
static constexpr auto CAPTURE_TYPE = 1;
}
SequenceName::SequenceName()
{
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers({
create.Keyword("set"),
create.Keyword("name"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Char(';'),
});
}
void SequenceName::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const
{
const auto& typeNameToken = result.NextCapture(CAPTURE_TYPE);
StructureInformation* type;
std::vector<MemberInformation*> members;
if (!state->GetTypenameAndMembersFromTypename(typeNameToken.TypeNameValue(), type, members))
throw ParsingException(typeNameToken.GetPos(), "Unknown type");
if (members.empty())
throw ParsingException(typeNameToken.GetPos(), "Need to specify a member when trying to set to a structure name.");
type->m_name_chain = std::move(members);
}

View File

@ -1,12 +0,0 @@
#pragma once
#include "Parsing/Commands/Impl/CommandsParser.h"
class SequenceName final : public CommandsParser::sequence_t
{
public:
SequenceName();
protected:
void ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const override;
};