2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-05 08:17:25 +00:00

Adjust further code formatting

This commit is contained in:
Clang Format
2023-11-19 21:59:57 +01:00
committed by Jan
parent d5f881be04
commit c858695f0c
96 changed files with 4036 additions and 2241 deletions

View File

@@ -26,23 +26,25 @@ CommandsParser::CommandsParser(CommandsLexer* lexer, IDataRepository* targetRepo
const std::vector<CommandsParser::sequence_t*>& CommandsParser::GetTestsForState()
{
static std::vector<sequence_t*> tests({new SequenceAction(),
new SequenceAllocAlign(),
new SequenceArchitecture(),
new SequenceArrayCount(),
new SequenceArraySize(),
new SequenceAsset(),
new SequenceBlock(),
new SequenceCondition(),
new SequenceCount(),
new SequenceGame(),
new SequenceName(),
new SequenceReorder(),
new SequenceReusable(),
new SequenceScriptString(),
new SequenceSetBlock(),
new SequenceString(),
new SequenceUse()});
static std::vector<sequence_t*> tests({
new SequenceAction(),
new SequenceAllocAlign(),
new SequenceArchitecture(),
new SequenceArrayCount(),
new SequenceArraySize(),
new SequenceAsset(),
new SequenceBlock(),
new SequenceCondition(),
new SequenceCount(),
new SequenceGame(),
new SequenceName(),
new SequenceReorder(),
new SequenceReusable(),
new SequenceScriptString(),
new SequenceSetBlock(),
new SequenceString(),
new SequenceUse(),
});
return tests;
}

View File

@@ -12,55 +12,85 @@
std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Typename(const supplier_t* labelSupplier)
{
static constexpr const char* BUILT_IN_TYPE_NAMES[]{"unsigned", "char", "short", "int", "long"};
static constexpr const char* BUILT_IN_TYPE_NAMES[]{
"unsigned",
"char",
"short",
"int",
"long",
};
static_assert(std::extent<decltype(BUILT_IN_TYPE_NAMES)>::value
== static_cast<int>(CommandsParserValueType::BUILT_IN_LAST) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST) + 1);
const CommandsMatcherFactory create(labelSupplier);
return create.Or(
{create
.And({create.Optional(create.Type(CommandsParserValueType::UNSIGNED)),
create.Or({create.Type(CommandsParserValueType::CHAR),
create.Type(CommandsParserValueType::SHORT),
create.Type(CommandsParserValueType::INT),
create.And({create.Type(CommandsParserValueType::LONG), create.Optional(create.Type(CommandsParserValueType::LONG))})})})
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
std::ostringstream str;
auto first = true;
return create.Or({
create
.And({
create.Optional(create.Type(CommandsParserValueType::UNSIGNED)),
create.Or({
create.Type(CommandsParserValueType::CHAR),
create.Type(CommandsParserValueType::SHORT),
create.Type(CommandsParserValueType::INT),
create.And({
create.Type(CommandsParserValueType::LONG),
create.Optional(create.Type(CommandsParserValueType::LONG)),
}),
}),
})
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
std::ostringstream str;
auto first = true;
for (const auto& token : values)
{
if (first)
first = false;
else
str << " ";
str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)];
}
for (const auto& token : values)
{
if (first)
first = false;
else
str << " ";
str << BUILT_IN_TYPE_NAMES[static_cast<int>(token.get().m_type) - static_cast<int>(CommandsParserValueType::BUILT_IN_FIRST)];
}
return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
}),
create.And({create.Identifier(), create.OptionalLoop(create.And({create.Char(':'), create.Char(':'), create.Identifier()}))})
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
std::ostringstream str;
str << values[0].get().IdentifierValue();
return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
}),
create
.And({
create.Identifier(),
create.OptionalLoop(create.And({
create.Char(':'),
create.Char(':'),
create.Identifier(),
})),
})
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
std::ostringstream str;
str << values[0].get().IdentifierValue();
for (auto i = 3u; i < values.size(); i += 3)
str << "::" << values[i].get().IdentifierValue();
for (auto i = 3u; i < values.size(); i += 3)
str << "::" << values[i].get().IdentifierValue();
return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
})});
return CommandsParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
}),
});
}
std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ArrayDef(const supplier_t* labelSupplier)
{
const CommandsMatcherFactory create(labelSupplier);
return create.And({create.Char('['), create.Or({create.Integer(), create.Identifier()}), create.Char(']')})
return create
.And({
create.Char('['),
create.Or({
create.Integer(),
create.Identifier(),
}),
create.Char(']'),
})
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
@@ -91,7 +121,13 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse
{
const CommandsMatcherFactory create(labelSupplier);
return create.And({create.Char('['), create.Label(LABEL_EVALUATION), create.Char(']').Tag(TAG_OPERAND_ARRAY_END)}).Tag(TAG_OPERAND_ARRAY);
return create
.And({
create.Char('['),
create.Label(LABEL_EVALUATION),
create.Char(']').Tag(TAG_OPERAND_ARRAY_END),
})
.Tag(TAG_OPERAND_ARRAY);
}
std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::ParseOperand(const supplier_t* labelSupplier)
@@ -99,11 +135,15 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse
const CommandsMatcherFactory create(labelSupplier);
return create
.Or({create
.And({create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME),
create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY))})
.Tag(TAG_OPERAND_TYPENAME),
create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER)})
.Or({
create
.And({
create.Label(LABEL_TYPENAME).Capture(CAPTURE_OPERAND_TYPENAME),
create.OptionalLoop(MatcherFactoryWrapper<CommandsParserValue>(ParseOperandArray(labelSupplier)).Capture(CAPTURE_OPERAND_ARRAY)),
})
.Tag(TAG_OPERAND_TYPENAME),
create.Integer().Tag(TAG_OPERAND_INTEGER).Capture(CAPTURE_OPERAND_INTEGER),
})
.Tag(TAG_OPERAND);
}
@@ -112,104 +152,106 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Parse
const CommandsMatcherFactory create(labelSupplier);
return create
.Or({create.Char('+').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD);
}),
create.Char('-').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT);
}),
create.Char('*').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY);
}),
create.Char('/').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE);
}),
create.Char('%').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER);
}),
create.Char('&').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND);
}),
create.Char('^').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR);
}),
create.Char('|').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR);
}),
create.Type(CommandsParserValueType::SHIFT_LEFT)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT);
}),
create.Type(CommandsParserValueType::SHIFT_RIGHT)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT);
}),
create.Char('>').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN);
}),
create.Type(CommandsParserValueType::GREATER_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN);
}),
create.Char('<').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN);
}),
create.Type(CommandsParserValueType::LESS_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN);
}),
create.Type(CommandsParserValueType::EQUALS)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS);
}),
create.Type(CommandsParserValueType::NOT_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL);
}),
create.Type(CommandsParserValueType::LOGICAL_AND)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND);
}),
create.Type(CommandsParserValueType::LOGICAL_OR)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR);
})})
.Or({
create.Char('+').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_ADD);
}),
create.Char('-').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SUBTRACT);
}),
create.Char('*').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_MULTIPLY);
}),
create.Char('/').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_DIVIDE);
}),
create.Char('%').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_REMAINDER);
}),
create.Char('&').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_AND);
}),
create.Char('^').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_XOR);
}),
create.Char('|').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_BITWISE_OR);
}),
create.Type(CommandsParserValueType::SHIFT_LEFT)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_LEFT);
}),
create.Type(CommandsParserValueType::SHIFT_RIGHT)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_SHIFT_RIGHT);
}),
create.Char('>').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_THAN);
}),
create.Type(CommandsParserValueType::GREATER_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_GREATER_EQUAL_THAN);
}),
create.Char('<').Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_THAN);
}),
create.Type(CommandsParserValueType::LESS_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_LESS_EQUAL_THAN);
}),
create.Type(CommandsParserValueType::EQUALS)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_EQUALS);
}),
create.Type(CommandsParserValueType::NOT_EQUAL)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_NOT_EQUAL);
}),
create.Type(CommandsParserValueType::LOGICAL_AND)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_AND);
}),
create.Type(CommandsParserValueType::LOGICAL_OR)
.Transform(
[](CommandsMatcherFactory::token_list_t& values)
{
return CommandsParserValue::OpType(values[0].get().GetPos(), OperationType::OPERATION_OR);
}),
})
.Capture(CAPTURE_BINARY_OPERATION_TYPE);
}
@@ -218,14 +260,25 @@ std::unique_ptr<CommandsCommonMatchers::matcher_t> CommandsCommonMatchers::Evalu
const CommandsMatcherFactory create(labelSupplier);
return create
.And({create.Or({create
.And({create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)),
create.Char('('),
create.Label(LABEL_EVALUATION),
create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END)})
.Tag(TAG_EVALUATION_PARENTHESIS),
ParseOperand(labelSupplier)}),
create.Optional(create.And({ParseOperationType(labelSupplier), create.Label(LABEL_EVALUATION)}).Tag(TAG_EVALUATION_OPERATION))})
.And({
create.Or({
create
.And({
create.Optional(create.Char('!').Tag(TAG_EVALUATION_NOT)),
create.Char('('),
create.Label(LABEL_EVALUATION),
create.Char(')').Tag(TAG_EVALUATION_PARENTHESIS_END),
})
.Tag(TAG_EVALUATION_PARENTHESIS),
ParseOperand(labelSupplier),
}),
create.Optional(create
.And({
ParseOperationType(labelSupplier),
create.Label(LABEL_EVALUATION),
})
.Tag(TAG_EVALUATION_OPERATION)),
})
.Tag(TAG_EVALUATION);
}

View File

@@ -9,20 +9,32 @@ SequenceAction::SequenceAction()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(
{create.Char('('),
create.Optional(
create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE),
create.OptionalLoop(create.And({create.Char(','), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE)}))})),
create.Char(')')},
{
create.Char('('),
create.Optional(create.And({
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE),
create.OptionalLoop(create.And({
create.Char(','),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_ARG_TYPE),
})),
})),
create.Char(')'),
},
LABEL_ACTION_ARGS);
AddMatchers(
{create.Keyword("set"),
create.Keyword("action"),
create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Identifier().Capture(CAPTURE_ACTION_NAME)}),
create.Identifier().Capture(CAPTURE_ACTION_NAME)}),
create.Label(LABEL_ACTION_ARGS),
create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("action"),
create.Or({
create.And({
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Identifier().Capture(CAPTURE_ACTION_NAME),
}),
create.Identifier().Capture(CAPTURE_ACTION_NAME),
}),
create.Label(LABEL_ACTION_ARGS),
create.Char(';'),
});
}
void SequenceAction::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -9,11 +9,13 @@ SequenceAllocAlign::SequenceAllocAlign()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddMatchers({create.Keyword("set"),
create.Keyword("allocalign"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("allocalign"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';'),
});
}
void SequenceAllocAlign::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -7,7 +7,11 @@ SequenceArchitecture::SequenceArchitecture()
{
const CommandsMatcherFactory create(this);
AddMatchers({create.Keyword("architecture"), create.Identifier().Capture(CAPTURE_ARCHITECTURE), create.Char(';')});
AddMatchers({
create.Keyword("architecture"),
create.Identifier().Capture(CAPTURE_ARCHITECTURE),
create.Char(';'),
});
m_architecture_mapping["x86"] = Architecture::X86;
m_architecture_mapping["x64"] = Architecture::X64;

View File

@@ -10,11 +10,13 @@ SequenceArrayCount::SequenceArrayCount()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddMatchers({create.Keyword("set"),
create.Keyword("arraycount"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("arraycount"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';'),
});
}
void SequenceArrayCount::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -10,11 +10,13 @@ SequenceArraySize::SequenceArraySize()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddMatchers({create.Keyword("set"),
create.Keyword("arraysize"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION),
create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("arraysize"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Capture(CAPTURE_EVALUATION),
create.Char(';'),
});
}
void SequenceArraySize::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -8,10 +8,12 @@ SequenceAsset::SequenceAsset()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers({create.Keyword("asset"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Identifier().Capture(CAPTURE_ENUM_ENTRY),
create.Char(';')});
AddMatchers({
create.Keyword("asset"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Identifier().Capture(CAPTURE_ENUM_ENTRY),
create.Char(';'),
});
}
void SequenceAsset::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -14,11 +14,13 @@ SequenceBlock::SequenceBlock()
DEFINE_FAST_FILE_BLOCK_TYPE(NORMAL);
#undef DEFINE_FAST_FILE_BLOCK_TYPE
AddMatchers({create.Keyword("block"),
create.Identifier().Capture(CAPTURE_BLOCK_TYPE),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY),
create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)),
create.Char(';')});
AddMatchers({
create.Keyword("block"),
create.Identifier().Capture(CAPTURE_BLOCK_TYPE),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY),
create.Optional(create.Keyword("default").Tag(TAG_DEFAULT)),
create.Char(';'),
});
}
void SequenceBlock::AddFastFileBlockToLookup(std::string name, const FastFileBlockType type)

View File

@@ -10,13 +10,17 @@ SequenceCondition::SequenceCondition()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddMatchers({create.Keyword("set"),
create.Keyword("condition"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Or({create.Keyword("always").Tag(TAG_ALWAYS),
create.Keyword("never").Tag(TAG_NEVER),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION)}),
create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("condition"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Or({
create.Keyword("always").Tag(TAG_ALWAYS),
create.Keyword("never").Tag(TAG_NEVER),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION).Tag(TAG_EVALUATION).Capture(CAPTURE_EVALUATION),
}),
create.Char(';'),
});
}
void SequenceCondition::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -12,13 +12,15 @@ SequenceCount::SequenceCount()
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddLabeledMatchers(CommandsCommonMatchers::ArrayDef(this), CommandsCommonMatchers::LABEL_ARRAY_DEF);
AddMatchers({create.Keyword("set").Capture(CAPTURE_START),
create.Keyword("count"),
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';')});
AddMatchers({
create.Keyword("set").Capture(CAPTURE_START),
create.Keyword("count"),
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER_RESOLVE)),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.OptionalLoop(create.Label(CommandsCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY_INDEX)),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';'),
});
}
void SequenceCount::SetCountByArrayIndex(CommandsParserState* state,

View File

@@ -7,7 +7,11 @@ SequenceGame::SequenceGame()
{
const CommandsMatcherFactory create(this);
AddMatchers({create.Keyword("game"), create.Identifier().Capture(CAPTURE_GAME), create.Char(';')});
AddMatchers({
create.Keyword("game"),
create.Identifier().Capture(CAPTURE_GAME),
create.Char(';'),
});
}
void SequenceGame::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -8,7 +8,12 @@ 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(';')});
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

View File

@@ -10,12 +10,20 @@ SequenceReorder::SequenceReorder()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers({create.Keyword("reorder").Capture(CAPTURE_START),
create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)),
create.Char(':'),
create.Optional(create.And({create.Char('.'), create.Char('.'), create.Char('.')}).Tag(TAG_FIND_FIRST)),
create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)),
create.Char(';')});
AddMatchers({
create.Keyword("reorder").Capture(CAPTURE_START),
create.Optional(create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE)),
create.Char(':'),
create.Optional(create
.And({
create.Char('.'),
create.Char('.'),
create.Char('.'),
})
.Tag(TAG_FIND_FIRST)),
create.Loop(create.Identifier().Capture(CAPTURE_ENTRY)),
create.Char(';'),
});
}
StructureInformation* SequenceReorder::GetType(CommandsParserState* state, SequenceResult<CommandsParserValue>& result)

View File

@@ -8,8 +8,12 @@ SequenceReusable::SequenceReusable()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers(
{create.Keyword("set"), create.Keyword("reusable"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("reusable"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Char(';'),
});
}
void SequenceReusable::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -8,8 +8,12 @@ SequenceScriptString::SequenceScriptString()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers(
{create.Keyword("set"), create.Keyword("scriptstring"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("scriptstring"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Char(';'),
});
}
void SequenceScriptString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -8,12 +8,18 @@ SequenceSetBlock::SequenceSetBlock()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers({create.Keyword("set").Capture(CAPTURE_START),
create.Keyword("block"),
create.Or({create.And({create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY)}),
create.Char(';')});
AddMatchers({
create.Keyword("set").Capture(CAPTURE_START),
create.Keyword("block"),
create.Or({
create.And({
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY),
}),
create.Identifier().Capture(CAPTURE_BLOCK_ENUM_ENTRY),
}),
create.Char(';'),
});
}
void SequenceSetBlock::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -10,8 +10,12 @@ SequenceString::SequenceString()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers(
{create.Keyword("set"), create.Keyword("string"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')});
AddMatchers({
create.Keyword("set"),
create.Keyword("string"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Char(';'),
});
}
void SequenceString::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const

View File

@@ -8,7 +8,11 @@ SequenceUse::SequenceUse()
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddMatchers({create.Keyword("use"), create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE), create.Char(';')});
AddMatchers({
create.Keyword("use"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Char(';'),
});
}
void SequenceUse::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const