mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2026-09-09 23:47:07 +00:00
Adjust further code formatting
This commit is contained in:
@@ -30,15 +30,22 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> MenuExpressionMatchers::Par
|
||||
{
|
||||
const MenuMatcherFactory create(labelSupplier);
|
||||
|
||||
return create.Or({create
|
||||
.And({create.Identifier().Capture(CAPTURE_FUNCTION_NAME),
|
||||
create.Char('('),
|
||||
create.Optional(create.And({
|
||||
create.Label(LABEL_EXPRESSION),
|
||||
create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_EXPRESSION)})),
|
||||
})),
|
||||
create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END)})
|
||||
.Tag(TAG_EXPRESSION_FUNCTION_CALL)});
|
||||
return create.Or({
|
||||
create
|
||||
.And({
|
||||
create.Identifier().Capture(CAPTURE_FUNCTION_NAME),
|
||||
create.Char('('),
|
||||
create.Optional(create.And({
|
||||
create.Label(LABEL_EXPRESSION),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char(','),
|
||||
create.Label(LABEL_EXPRESSION),
|
||||
})),
|
||||
})),
|
||||
create.Char(')').Tag(TAG_EXPRESSION_FUNCTION_CALL_END),
|
||||
})
|
||||
.Tag(TAG_EXPRESSION_FUNCTION_CALL),
|
||||
});
|
||||
}
|
||||
|
||||
const std::map<std::string, size_t>& MenuExpressionMatchers::GetBaseFunctionMapForFeatureLevel(const FeatureLevel featureLevel)
|
||||
|
||||
@@ -13,57 +13,75 @@ MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier<SimplePars
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::StringChain() const
|
||||
{
|
||||
return Or({And({String(), Loop(String())})
|
||||
.Transform(
|
||||
[](const token_list_t& tokens) -> SimpleParserValue
|
||||
{
|
||||
std::ostringstream ss;
|
||||
return Or({
|
||||
And({
|
||||
String(),
|
||||
Loop(String()),
|
||||
})
|
||||
.Transform(
|
||||
[](const token_list_t& tokens) -> SimpleParserValue
|
||||
{
|
||||
std::ostringstream ss;
|
||||
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
ss << token.get().StringValue();
|
||||
}
|
||||
for (const auto& token : tokens)
|
||||
{
|
||||
ss << token.get().StringValue();
|
||||
}
|
||||
|
||||
return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str()));
|
||||
}),
|
||||
String()});
|
||||
return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str()));
|
||||
}),
|
||||
String(),
|
||||
});
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Text() const
|
||||
{
|
||||
return MatcherFactoryWrapper(Or({StringChain(), Identifier()}));
|
||||
return MatcherFactoryWrapper(Or({
|
||||
StringChain(),
|
||||
Identifier(),
|
||||
}));
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::TextNoChain() const
|
||||
{
|
||||
return MatcherFactoryWrapper(Or({String(), Identifier()}));
|
||||
return MatcherFactoryWrapper(Or({
|
||||
String(),
|
||||
Identifier(),
|
||||
}));
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Numeric() const
|
||||
{
|
||||
return MatcherFactoryWrapper(Or({FloatingPoint(), Integer()}));
|
||||
return MatcherFactoryWrapper(Or({
|
||||
FloatingPoint(),
|
||||
Integer(),
|
||||
}));
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::IntExpression() const
|
||||
{
|
||||
return MatcherFactoryWrapper(Or({Integer().Tag(TAG_INT).Capture(CAPTURE_INT),
|
||||
And({
|
||||
Char('(').Capture(CAPTURE_FIRST_TOKEN),
|
||||
Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
Char(')'),
|
||||
})
|
||||
.Tag(TAG_EXPRESSION)}));
|
||||
return MatcherFactoryWrapper(Or({
|
||||
Integer().Tag(TAG_INT).Capture(CAPTURE_INT),
|
||||
And({
|
||||
Char('(').Capture(CAPTURE_FIRST_TOKEN),
|
||||
Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
Char(')'),
|
||||
})
|
||||
.Tag(TAG_EXPRESSION),
|
||||
}));
|
||||
}
|
||||
|
||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::NumericExpression() const
|
||||
{
|
||||
return MatcherFactoryWrapper(Or({Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC),
|
||||
And({
|
||||
Char('(').Capture(CAPTURE_FIRST_TOKEN),
|
||||
Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
Char(')'),
|
||||
})
|
||||
.Tag(TAG_EXPRESSION)}));
|
||||
return MatcherFactoryWrapper(Or({
|
||||
Numeric().Tag(TAG_NUMERIC).Capture(CAPTURE_NUMERIC),
|
||||
And({
|
||||
Char('(').Capture(CAPTURE_FIRST_TOKEN),
|
||||
Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
Char(')'),
|
||||
})
|
||||
.Tag(TAG_EXPRESSION),
|
||||
}));
|
||||
}
|
||||
|
||||
int MenuMatcherFactory::TokenNumericIntValue(const SimpleParserValue& value)
|
||||
|
||||
Reference in New Issue
Block a user