Skip to content

Commit

Permalink
Adjust further code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Laupetin committed Nov 19, 2023
1 parent 46e8c58 commit f5720f5
Show file tree
Hide file tree
Showing 96 changed files with 4,085 additions and 2,290 deletions.
8 changes: 7 additions & 1 deletion src/ObjLoading/ObjLoading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

ObjLoading::Configuration_t ObjLoading::Configuration;

const IObjLoader* const OBJ_LOADERS[]{new IW3::ObjLoader(), new IW4::ObjLoader(), new IW5::ObjLoader(), new T5::ObjLoader(), new T6::ObjLoader()};
const IObjLoader* const OBJ_LOADERS[]{
new IW3::ObjLoader(),
new IW4::ObjLoader(),
new IW5::ObjLoader(),
new T5::ObjLoader(),
new T6::ObjLoader(),
};

void ObjLoading::LoadReferencedContainersForZone(ISearchPath* searchPath, Zone* zone)
{
Expand Down
25 changes: 16 additions & 9 deletions src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
80 changes: 49 additions & 31 deletions src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

for (const auto& token : tokens)
{
ss << token.get().StringValue();
}

return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str()));
}),
String()});
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();
}

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)
Expand Down
Loading

0 comments on commit f5720f5

Please sign in to comment.