mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 14:58:10 -05:00
Adjust further code formatting
This commit is contained in:
@ -133,21 +133,23 @@ const OperationType* const OperationType::OPERATION_OR = new OperationType("||",
|
||||
return op1 > 0 || op2 > 0 ? 1 : 0;
|
||||
});
|
||||
|
||||
const OperationType* const OperationType::ALL_OPERATION_TYPES[]{OPERATION_ADD,
|
||||
OPERATION_SUBTRACT,
|
||||
OPERATION_MULTIPLY,
|
||||
OPERATION_DIVIDE,
|
||||
OPERATION_REMAINDER,
|
||||
OPERATION_BITWISE_AND,
|
||||
OPERATION_BITWISE_XOR,
|
||||
OPERATION_BITWISE_OR,
|
||||
OPERATION_SHIFT_LEFT,
|
||||
OPERATION_SHIFT_RIGHT,
|
||||
OPERATION_GREATER_THAN,
|
||||
OPERATION_GREATER_EQUAL_THAN,
|
||||
OPERATION_LESS_THAN,
|
||||
OPERATION_LESS_EQUAL_THAN,
|
||||
OPERATION_EQUALS,
|
||||
OPERATION_NOT_EQUAL,
|
||||
OPERATION_AND,
|
||||
OPERATION_OR};
|
||||
const OperationType* const OperationType::ALL_OPERATION_TYPES[]{
|
||||
OPERATION_ADD,
|
||||
OPERATION_SUBTRACT,
|
||||
OPERATION_MULTIPLY,
|
||||
OPERATION_DIVIDE,
|
||||
OPERATION_REMAINDER,
|
||||
OPERATION_BITWISE_AND,
|
||||
OPERATION_BITWISE_XOR,
|
||||
OPERATION_BITWISE_OR,
|
||||
OPERATION_SHIFT_LEFT,
|
||||
OPERATION_SHIFT_RIGHT,
|
||||
OPERATION_GREATER_THAN,
|
||||
OPERATION_GREATER_EQUAL_THAN,
|
||||
OPERATION_LESS_THAN,
|
||||
OPERATION_LESS_EQUAL_THAN,
|
||||
OPERATION_EQUALS,
|
||||
OPERATION_NOT_EQUAL,
|
||||
OPERATION_AND,
|
||||
OPERATION_OR,
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -19,7 +19,10 @@ HeaderBlockType HeaderBlockEnum::GetType()
|
||||
|
||||
const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockEnum::GetTestsForBlock()
|
||||
{
|
||||
static std::vector<sequence_t*> tests({new SequenceCloseBlock(true), new SequenceEnumMember()});
|
||||
static std::vector<sequence_t*> tests({
|
||||
new SequenceCloseBlock(true),
|
||||
new SequenceEnumMember(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -20,13 +20,15 @@ HeaderBlockType HeaderBlockNamespace::GetType()
|
||||
|
||||
const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNamespace::GetTestsForBlock()
|
||||
{
|
||||
static std::vector<sequence_t*> tests({new SequenceCloseBlock(false),
|
||||
new SequenceEnum(),
|
||||
new SequenceForwardDecl(),
|
||||
new SequenceNamespace(),
|
||||
new SequenceStruct(),
|
||||
new SequenceTypedef(),
|
||||
new SequenceUnion()});
|
||||
static std::vector<sequence_t*> tests({
|
||||
new SequenceCloseBlock(false),
|
||||
new SequenceEnum(),
|
||||
new SequenceForwardDecl(),
|
||||
new SequenceNamespace(),
|
||||
new SequenceStruct(),
|
||||
new SequenceTypedef(),
|
||||
new SequenceUnion(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -14,8 +14,14 @@ HeaderBlockType HeaderBlockNone::GetType()
|
||||
|
||||
const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockNone::GetTestsForBlock()
|
||||
{
|
||||
static std::vector<sequence_t*> tests(
|
||||
{new SequenceEnum(), new SequenceForwardDecl(), new SequenceNamespace(), new SequenceStruct(), new SequenceTypedef(), new SequenceUnion()});
|
||||
static std::vector<sequence_t*> tests({
|
||||
new SequenceEnum(),
|
||||
new SequenceForwardDecl(),
|
||||
new SequenceNamespace(),
|
||||
new SequenceStruct(),
|
||||
new SequenceTypedef(),
|
||||
new SequenceUnion(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -24,8 +24,13 @@ HeaderBlockType HeaderBlockStruct::GetType()
|
||||
|
||||
const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockStruct::GetTestsForBlock()
|
||||
{
|
||||
static std::vector<sequence_t*> tests(
|
||||
{new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()});
|
||||
static std::vector<sequence_t*> tests({
|
||||
new SequenceCloseBlock(true),
|
||||
new SequenceEnum(),
|
||||
new SequenceStruct(),
|
||||
new SequenceUnion(),
|
||||
new SequenceVariable(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -24,8 +24,13 @@ HeaderBlockType HeaderBlockUnion::GetType()
|
||||
|
||||
const std::vector<IHeaderBlock::sequence_t*>& HeaderBlockUnion::GetTestsForBlock()
|
||||
{
|
||||
static std::vector<sequence_t*> tests(
|
||||
{new SequenceCloseBlock(true), new SequenceEnum(), new SequenceStruct(), new SequenceUnion(), new SequenceVariable()});
|
||||
static std::vector<sequence_t*> tests({
|
||||
new SequenceCloseBlock(true),
|
||||
new SequenceEnum(),
|
||||
new SequenceStruct(),
|
||||
new SequenceUnion(),
|
||||
new SequenceVariable(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -9,32 +9,50 @@ std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Align(con
|
||||
{
|
||||
const HeaderMatcherFactory create(labelSupplier);
|
||||
|
||||
return create.Or({create
|
||||
.And({create.Type(HeaderParserValueType::DECLSPEC),
|
||||
create.Char('('),
|
||||
create.Type(HeaderParserValueType::ALIGN),
|
||||
create.Char('('),
|
||||
create.Integer(),
|
||||
create.Char(')'),
|
||||
create.Char(')')})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue());
|
||||
}),
|
||||
create.And({create.Type(HeaderParserValueType::ALIGNAS), create.Char('('), create.Integer(), create.Char(')')})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue());
|
||||
})});
|
||||
return create.Or({
|
||||
create
|
||||
.And({
|
||||
create.Type(HeaderParserValueType::DECLSPEC),
|
||||
create.Char('('),
|
||||
create.Type(HeaderParserValueType::ALIGN),
|
||||
create.Char('('),
|
||||
create.Integer(),
|
||||
create.Char(')'),
|
||||
create.Char(')'),
|
||||
})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
return HeaderParserValue::Integer(values[4].get().GetPos(), values[4].get().IntegerValue());
|
||||
}),
|
||||
create
|
||||
.And({
|
||||
create.Type(HeaderParserValueType::ALIGNAS),
|
||||
create.Char('('),
|
||||
create.Integer(),
|
||||
create.Char(')'),
|
||||
})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
return HeaderParserValue::Integer(values[2].get().GetPos(), values[2].get().IntegerValue());
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::ArrayDef(const supplier_t* labelSupplier)
|
||||
{
|
||||
const HeaderMatcherFactory 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(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
@ -53,40 +71,56 @@ std::unique_ptr<HeaderCommonMatchers::matcher_t> HeaderCommonMatchers::Typename(
|
||||
|
||||
const HeaderMatcherFactory create(labelSupplier);
|
||||
|
||||
return create.Or(
|
||||
{create
|
||||
.And({create.Optional(create.Type(HeaderParserValueType::UNSIGNED)),
|
||||
create.Or({create.Type(HeaderParserValueType::CHAR),
|
||||
create.Type(HeaderParserValueType::SHORT),
|
||||
create.Type(HeaderParserValueType::INT),
|
||||
create.And({create.Type(HeaderParserValueType::LONG), create.Optional(create.Type(HeaderParserValueType::LONG))})})})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
std::ostringstream str;
|
||||
auto first = true;
|
||||
return create.Or({
|
||||
create
|
||||
.And({
|
||||
create.Optional(create.Type(HeaderParserValueType::UNSIGNED)),
|
||||
create.Or({
|
||||
create.Type(HeaderParserValueType::CHAR),
|
||||
create.Type(HeaderParserValueType::SHORT),
|
||||
create.Type(HeaderParserValueType::INT),
|
||||
create.And({
|
||||
create.Type(HeaderParserValueType::LONG),
|
||||
create.Optional(create.Type(HeaderParserValueType::LONG)),
|
||||
}),
|
||||
}),
|
||||
})
|
||||
.Transform(
|
||||
[](HeaderMatcherFactory::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>(HeaderParserValueType::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>(HeaderParserValueType::BUILT_IN_FIRST)];
|
||||
}
|
||||
|
||||
return HeaderParserValue::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(
|
||||
[](HeaderMatcherFactory::token_list_t& values)
|
||||
{
|
||||
std::ostringstream str;
|
||||
str << values[0].get().IdentifierValue();
|
||||
return HeaderParserValue::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(
|
||||
[](HeaderMatcherFactory::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 HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
|
||||
})});
|
||||
return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str()));
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
@ -9,8 +9,13 @@ SequenceCloseBlock::SequenceCloseBlock(const bool semicolonRequired)
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS),
|
||||
create.Optional(create.And({create.Optional(create.Identifier().Capture(CAPTURE_NAME)), create.Char(';').Tag(TAG_SEMICOLON)}))});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_CLOSING_PARENTHESIS),
|
||||
create.Optional(create.And({
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Char(';').Tag(TAG_SEMICOLON),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceCloseBlock::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -9,11 +9,16 @@ SequenceEnum::SequenceEnum()
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME);
|
||||
AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Type(HeaderParserValueType::ENUM),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Type(HeaderParserValueType::ENUM),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({
|
||||
create.Char(':'),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE),
|
||||
})),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceEnum::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -8,10 +8,20 @@ SequenceEnumMember::SequenceEnumMember()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
AddMatchers(
|
||||
{create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Optional(create.And({create.Char('='), create.Or({create.Identifier().Capture(CAPTURE_VALUE), create.Integer().Capture(CAPTURE_VALUE)})})),
|
||||
create.Or({create.Char(','), create.Char('}').NoConsume()})});
|
||||
AddMatchers({
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('='),
|
||||
create.Or({
|
||||
create.Identifier().Capture(CAPTURE_VALUE),
|
||||
create.Integer().Capture(CAPTURE_VALUE),
|
||||
}),
|
||||
})),
|
||||
create.Or({
|
||||
create.Char(','),
|
||||
create.Char('}').NoConsume(),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceEnumMember::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -7,13 +7,17 @@ SequenceForwardDecl::SequenceForwardDecl()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create
|
||||
.Or({create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM),
|
||||
create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT),
|
||||
create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION)})
|
||||
.Capture(CAPTURE_TYPE),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(';')});
|
||||
AddMatchers({
|
||||
create
|
||||
.Or({
|
||||
create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM),
|
||||
create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT),
|
||||
create.Type(HeaderParserValueType::UNION).Tag(TAG_UNION),
|
||||
})
|
||||
.Capture(CAPTURE_TYPE),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceForwardDecl::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -7,7 +7,11 @@ SequenceNamespace::SequenceNamespace()
|
||||
{
|
||||
const HeaderMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Type(HeaderParserValueType::NAMESPACE), create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Type(HeaderParserValueType::NAMESPACE),
|
||||
create.Type(HeaderParserValueType::IDENTIFIER).Capture(CAPTURE_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceNamespace::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -10,13 +10,18 @@ SequenceStruct::SequenceStruct()
|
||||
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN);
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME);
|
||||
AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST)),
|
||||
create.Type(HeaderParserValueType::STRUCT),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST)),
|
||||
create.Type(HeaderParserValueType::STRUCT),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({
|
||||
create.Char(':'),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE),
|
||||
})),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceStruct::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -13,28 +13,38 @@ SequenceTypedef::SequenceTypedef()
|
||||
AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF);
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME);
|
||||
|
||||
AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';')},
|
||||
LABEL_ARRAY_OF_POINTERS);
|
||||
AddLabeledMatchers(
|
||||
{
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';'),
|
||||
},
|
||||
LABEL_ARRAY_OF_POINTERS);
|
||||
|
||||
AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.Char('('),
|
||||
create.Loop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(')'),
|
||||
create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';')},
|
||||
LABEL_POINTER_TO_ARRAY);
|
||||
AddLabeledMatchers(
|
||||
{
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.Char('('),
|
||||
create.Loop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(')'),
|
||||
create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';'),
|
||||
},
|
||||
LABEL_POINTER_TO_ARRAY);
|
||||
|
||||
AddMatchers(
|
||||
{create.Type(HeaderParserValueType::TYPEDEF),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)})});
|
||||
AddMatchers({
|
||||
create.Type(HeaderParserValueType::TYPEDEF),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Or({
|
||||
create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS),
|
||||
create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceTypedef::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const
|
||||
|
@ -10,13 +10,18 @@ SequenceUnion::SequenceUnion()
|
||||
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Align(this), HeaderCommonMatchers::LABEL_ALIGN);
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME);
|
||||
AddMatchers({create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST)),
|
||||
create.Type(HeaderParserValueType::UNION),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({create.Char(':'), create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE)})),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Optional(create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)),
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST)),
|
||||
create.Type(HeaderParserValueType::UNION),
|
||||
create.Optional(create.Label(HeaderCommonMatchers::LABEL_ALIGN).Capture(CAPTURE_ALIGN)),
|
||||
create.Optional(create.Identifier().Capture(CAPTURE_NAME)),
|
||||
create.Optional(create.And({
|
||||
create.Char(':'),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_PARENT_TYPE),
|
||||
})),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceUnion::ProcessMatch(HeaderParserState* state, SequenceResult<HeaderParserValue>& result) const
|
||||
|
@ -14,26 +14,38 @@ SequenceVariable::SequenceVariable()
|
||||
AddLabeledMatchers(HeaderCommonMatchers::ArrayDef(this), HeaderCommonMatchers::LABEL_ARRAY_DEF);
|
||||
AddLabeledMatchers(HeaderCommonMatchers::Typename(this), HeaderCommonMatchers::LABEL_TYPENAME);
|
||||
|
||||
AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Optional(create.And({create.Char(':'), create.Integer().Capture(CAPTURE_BIT_SIZE)})),
|
||||
create.Char(';')},
|
||||
LABEL_ARRAY_OF_POINTERS);
|
||||
AddLabeledMatchers(
|
||||
{
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.OptionalLoop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.OptionalLoop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Optional(create.And({
|
||||
create.Char(':'),
|
||||
create.Integer().Capture(CAPTURE_BIT_SIZE),
|
||||
})),
|
||||
create.Char(';'),
|
||||
},
|
||||
LABEL_ARRAY_OF_POINTERS);
|
||||
|
||||
AddLabeledMatchers({create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.Char('('),
|
||||
create.Loop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(')'),
|
||||
create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';')},
|
||||
LABEL_POINTER_TO_ARRAY);
|
||||
AddLabeledMatchers(
|
||||
{
|
||||
create.Optional(create.Type(HeaderParserValueType::CONST).Tag(TAG_CONST)),
|
||||
create.Label(HeaderCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
|
||||
create.Char('('),
|
||||
create.Loop(create.Char('*').Tag(TAG_POINTER)),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char(')'),
|
||||
create.Loop(create.Label(HeaderCommonMatchers::LABEL_ARRAY_DEF).Capture(CAPTURE_ARRAY)),
|
||||
create.Char(';'),
|
||||
},
|
||||
LABEL_POINTER_TO_ARRAY);
|
||||
|
||||
AddMatchers(create.Or({create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS), create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY)}));
|
||||
AddMatchers(create.Or({
|
||||
create.Label(LABEL_ARRAY_OF_POINTERS).Tag(TAG_ARRAY_OF_POINTERS),
|
||||
create.Label(LABEL_POINTER_TO_ARRAY).Tag(TAG_POINTER_TO_ARRAY),
|
||||
}));
|
||||
}
|
||||
|
||||
void SequenceVariable::AddPointerDeclarationModifiers(SequenceResult<HeaderParserValue>& result, TypeDeclaration* typeDeclaration) const
|
||||
|
Reference in New Issue
Block a user