mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 23:08:05 -05:00
Adjust further code formatting
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,9 @@ namespace menu::function_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_TOKEN),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -11,7 +11,10 @@ GenericBoolPropertySequence::GenericBoolPropertySequence(std::string keywordName
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Integer().Capture(CAPTURE_VALUE)});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Integer().Capture(CAPTURE_VALUE),
|
||||
});
|
||||
}
|
||||
|
||||
void GenericBoolPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const
|
||||
|
@ -18,7 +18,7 @@ GenericColorPropertySequence::GenericColorPropertySequence(std::string keywordNa
|
||||
create.NumericExpression().Tag(TAG_COLOR), // r
|
||||
create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // g
|
||||
create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // b
|
||||
create.Optional(create.NumericExpression().Tag(TAG_COLOR)) // a
|
||||
create.Optional(create.NumericExpression().Tag(TAG_COLOR)), // a
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,11 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ
|
||||
auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback)));
|
||||
|
||||
const MenuMatcherFactory create(result.get());
|
||||
result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';'))});
|
||||
result->AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';')),
|
||||
});
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
@ -36,9 +38,11 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ
|
||||
for (auto keyword : keywords)
|
||||
keywordMatchers.emplace_back(create.KeywordIgnoreCase(std::move(keyword)));
|
||||
|
||||
result->AddMatchers({create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';'))});
|
||||
result->AddMatchers({
|
||||
create.And(std::move(keywordMatchers)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';')),
|
||||
});
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
@ -48,10 +52,12 @@ std::unique_ptr<GenericExpressionPropertySequence> GenericExpressionPropertySequ
|
||||
auto result = std::unique_ptr<GenericExpressionPropertySequence>(new GenericExpressionPropertySequence(std::move(setCallback)));
|
||||
|
||||
const MenuMatcherFactory create(result.get());
|
||||
result->AddMatchers({create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Optional(create.KeywordIgnoreCase("when")),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';'))});
|
||||
result->AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keyword)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Optional(create.KeywordIgnoreCase("when")),
|
||||
create.Label(MenuExpressionMatchers::LABEL_EXPRESSION),
|
||||
create.Optional(create.Char(';')),
|
||||
});
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
|
@ -13,7 +13,10 @@ GenericFloatingPointPropertySequence::GenericFloatingPointPropertySequence(std::
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION);
|
||||
AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.NumericExpression()});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.NumericExpression(),
|
||||
});
|
||||
}
|
||||
|
||||
void GenericFloatingPointPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const
|
||||
|
@ -11,7 +11,10 @@ GenericMenuEventHandlerSetPropertySequence::GenericMenuEventHandlerSetPropertySe
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
void GenericMenuEventHandlerSetPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const
|
||||
|
@ -11,7 +11,10 @@ GenericStringPropertySequence::GenericStringPropertySequence(std::string keyword
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN), create.Text().Capture(CAPTURE_VALUE)});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Text().Capture(CAPTURE_VALUE),
|
||||
});
|
||||
}
|
||||
|
||||
void GenericStringPropertySequence::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const
|
||||
|
@ -14,7 +14,9 @@ namespace menu::global_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}')});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -42,7 +42,7 @@ class ItemScopeOperations
|
||||
CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER
|
||||
CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL
|
||||
CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD
|
||||
CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD
|
||||
CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_PASSWORDFIELD
|
||||
};
|
||||
|
||||
inline static const CommonItemFeatureType IW5_FEATURE_TYPE_BY_TYPE[0x18]{
|
||||
@ -69,7 +69,7 @@ class ItemScopeOperations
|
||||
CommonItemFeatureType::NEWS_TICKER, // ITEM_TYPE_NEWS_TICKER
|
||||
CommonItemFeatureType::NONE, // ITEM_TYPE_TEXT_SCROLL
|
||||
CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_EMAILFIELD
|
||||
CommonItemFeatureType::EDIT_FIELD // ITEM_TYPE_PASSWORDFIELD
|
||||
CommonItemFeatureType::EDIT_FIELD, // ITEM_TYPE_PASSWORDFIELD
|
||||
};
|
||||
|
||||
public:
|
||||
@ -158,7 +158,9 @@ namespace menu::item_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}')});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -175,7 +177,9 @@ namespace menu::item_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -193,12 +197,17 @@ namespace menu::item_scope_sequences
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION);
|
||||
AddMatchers({create.KeywordIgnoreCase("rect"),
|
||||
create.NumericExpression(), // x
|
||||
create.NumericExpression(), // y
|
||||
create.NumericExpression(), // w
|
||||
create.NumericExpression(), // h
|
||||
create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("rect"),
|
||||
create.NumericExpression(), // x
|
||||
create.NumericExpression(), // y
|
||||
create.NumericExpression(), // w
|
||||
create.NumericExpression(), // h
|
||||
create.Optional(create.And({
|
||||
create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL),
|
||||
create.Integer().Capture(CAPTURE_ALIGN_VERTICAL),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -233,7 +242,7 @@ namespace menu::item_scope_sequences
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("origin"),
|
||||
create.NumericExpression(), // x
|
||||
create.NumericExpression() // y
|
||||
create.NumericExpression(), // y
|
||||
});
|
||||
}
|
||||
|
||||
@ -298,8 +307,13 @@ namespace menu::item_scope_sequences
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keyName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
create.Optional(create.And(
|
||||
{create.Text().Capture(CAPTURE_VALUE), create.OptionalLoop(create.And({create.Char(';'), create.Text().Capture(CAPTURE_VALUE)}))})),
|
||||
create.Optional(create.And({
|
||||
create.Text().Capture(CAPTURE_VALUE),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char(';'),
|
||||
create.Text().Capture(CAPTURE_VALUE),
|
||||
})),
|
||||
})),
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
@ -364,15 +378,17 @@ namespace menu::item_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
create.OptionalLoop(create.And({
|
||||
create.TextNoChain().Capture(CAPTURE_STEP_NAME),
|
||||
create.Optional(create.Char(';')),
|
||||
create.TextNoChain().Capture(CAPTURE_STEP_VALUE),
|
||||
create.Optional(create.Char(';')),
|
||||
})),
|
||||
create.Char('}')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("dvarStrList").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
create.OptionalLoop(create.And({
|
||||
create.TextNoChain().Capture(CAPTURE_STEP_NAME),
|
||||
create.Optional(create.Char(';')),
|
||||
create.TextNoChain().Capture(CAPTURE_STEP_VALUE),
|
||||
create.Optional(create.Char(';')),
|
||||
})),
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -402,15 +418,17 @@ namespace menu::item_scope_sequences
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION);
|
||||
AddMatchers({create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Text().Capture(CAPTURE_STEP_NAME),
|
||||
create.Optional(create.Char(';')),
|
||||
create.NumericExpression(),
|
||||
create.Optional(create.Char(';')),
|
||||
})),
|
||||
create.Char('}')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("dvarFloatList").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('{'),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Text().Capture(CAPTURE_STEP_NAME),
|
||||
create.Optional(create.Char(';')),
|
||||
create.NumericExpression(),
|
||||
create.Optional(create.Char(';')),
|
||||
})),
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -485,12 +503,14 @@ namespace menu::item_scope_sequences
|
||||
const auto& listBoxFeatures = state->m_current_item->m_list_box_features;
|
||||
while (result.HasNextCapture(CAPTURE_X_POS))
|
||||
{
|
||||
CommonItemFeaturesListBox::Column column{result.NextCapture(CAPTURE_X_POS).IntegerValue(),
|
||||
state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0,
|
||||
result.NextCapture(CAPTURE_WIDTH).IntegerValue(),
|
||||
state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0,
|
||||
result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(),
|
||||
result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue()};
|
||||
CommonItemFeaturesListBox::Column column{
|
||||
result.NextCapture(CAPTURE_X_POS).IntegerValue(),
|
||||
state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_Y_POS).IntegerValue() : 0,
|
||||
result.NextCapture(CAPTURE_WIDTH).IntegerValue(),
|
||||
state->m_feature_level == FeatureLevel::IW5 ? result.NextCapture(CAPTURE_HEIGHT).IntegerValue() : 0,
|
||||
result.NextCapture(CAPTURE_MAX_CHARS).IntegerValue(),
|
||||
result.NextCapture(CAPTURE_ALIGNMENT).IntegerValue(),
|
||||
};
|
||||
listBoxFeatures->m_columns.emplace_back(column);
|
||||
}
|
||||
}
|
||||
@ -505,7 +525,11 @@ namespace menu::item_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("execKey"),
|
||||
create.StringChain().Capture(CAPTURE_KEY),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -537,7 +561,11 @@ namespace menu::item_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("execKeyInt"),
|
||||
create.Integer().Capture(CAPTURE_KEY),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -28,7 +28,9 @@ namespace menu::menu_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_TOKEN)});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_TOKEN),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -59,7 +61,9 @@ namespace menu::menu_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -75,7 +79,10 @@ namespace menu::menu_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("itemDef"), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Keyword("itemDef"),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -98,12 +105,17 @@ namespace menu::menu_scope_sequences
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION);
|
||||
AddMatchers({create.KeywordIgnoreCase("rect"),
|
||||
create.NumericExpression(), // x
|
||||
create.NumericExpression(), // y
|
||||
create.NumericExpression(), // w
|
||||
create.NumericExpression(), // h
|
||||
create.Optional(create.And({create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL), create.Integer().Capture(CAPTURE_ALIGN_VERTICAL)}))});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("rect"),
|
||||
create.NumericExpression(), // x
|
||||
create.NumericExpression(), // y
|
||||
create.NumericExpression(), // w
|
||||
create.NumericExpression(), // h
|
||||
create.Optional(create.And({
|
||||
create.Integer().Capture(CAPTURE_ALIGN_HORIZONTAL),
|
||||
create.Integer().Capture(CAPTURE_ALIGN_VERTICAL),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -136,7 +148,11 @@ namespace menu::menu_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase("execKey"), create.StringChain().Capture(CAPTURE_KEY), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("execKey"),
|
||||
create.StringChain().Capture(CAPTURE_KEY),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -168,7 +184,11 @@ namespace menu::menu_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.KeywordIgnoreCase("execKeyInt"), create.Integer().Capture(CAPTURE_KEY), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("execKeyInt"),
|
||||
create.Integer().Capture(CAPTURE_KEY),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -14,7 +14,9 @@ namespace menu::no_scope_sequences
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -16,7 +16,10 @@ namespace state_map
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Identifier().Capture(CAPTURE_ENTRY_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -42,7 +45,9 @@ namespace state_map
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_FIRST_TOKEN),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -67,9 +72,13 @@ namespace state_map
|
||||
AddLabeledMatchers(StateMapExpressionMatchers().Expression(this), StateMapExpressionMatchers::LABEL_EXPRESSION);
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers(
|
||||
{create.Or({create.Keyword("default").Tag(TAG_DEFAULT), create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION)}),
|
||||
create.Char(':')});
|
||||
AddMatchers({
|
||||
create.Or({
|
||||
create.Keyword("default").Tag(TAG_DEFAULT),
|
||||
create.Label(StateMapExpressionMatchers::LABEL_EXPRESSION).Tag(TAG_EXPRESSION),
|
||||
}),
|
||||
create.Char(':'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -117,14 +126,29 @@ namespace state_map
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(create.Or({create.Identifier(), create.Integer()}), LABEL_VALUE);
|
||||
AddLabeledMatchers(create.Or({
|
||||
create.Identifier(),
|
||||
create.Integer(),
|
||||
}),
|
||||
LABEL_VALUE);
|
||||
|
||||
AddLabeledMatchers({create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE),
|
||||
create.OptionalLoop(create.And({create.Char(','), create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE)}))},
|
||||
LABEL_VALUE_LIST);
|
||||
AddLabeledMatchers(
|
||||
{
|
||||
create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char(','),
|
||||
create.Label(LABEL_VALUE).Capture(CAPTURE_VALUE),
|
||||
})),
|
||||
},
|
||||
LABEL_VALUE_LIST);
|
||||
|
||||
AddMatchers({create.Or({create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST)}),
|
||||
create.Char(';').Capture(CAPTURE_VALUE_END)});
|
||||
AddMatchers({
|
||||
create.Or({
|
||||
create.Keyword("passthrough").Tag(TAG_PASSTHROUGH),
|
||||
create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST),
|
||||
}),
|
||||
create.Char(';').Capture(CAPTURE_VALUE_END),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -195,11 +219,19 @@ StateMapParser::StateMapParser(SimpleLexer* lexer, std::string stateMapName, con
|
||||
|
||||
const std::vector<StateMapParser::sequence_t*>& StateMapParser::GetTestsForState()
|
||||
{
|
||||
static std::vector<sequence_t*> rootSequences({new SequenceStateMapEntry()});
|
||||
static std::vector<sequence_t*> rootSequences({
|
||||
new SequenceStateMapEntry(),
|
||||
});
|
||||
|
||||
static std::vector<sequence_t*> entrySequences({new SequenceStateMapEntryClose(), new SequenceCondition()});
|
||||
static std::vector<sequence_t*> entrySequences({
|
||||
new SequenceStateMapEntryClose(),
|
||||
new SequenceCondition(),
|
||||
});
|
||||
|
||||
static std::vector<sequence_t*> ruleSequences({new SequenceCondition(), new SequenceValue()});
|
||||
static std::vector<sequence_t*> ruleSequences({
|
||||
new SequenceCondition(),
|
||||
new SequenceValue(),
|
||||
});
|
||||
|
||||
if (m_state->m_in_entry)
|
||||
{
|
||||
|
@ -17,10 +17,16 @@ namespace sdd::def_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("enum"),
|
||||
create.Optional(create.And({create.Char('('), create.Integer().Capture(CAPTURE_RESERVED_COUNT), create.Char(')')})),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Keyword("enum"),
|
||||
create.Optional(create.And({
|
||||
create.Char('('),
|
||||
create.Integer().Capture(CAPTURE_RESERVED_COUNT),
|
||||
create.Char(')'),
|
||||
})),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -70,7 +76,11 @@ namespace sdd::def_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("struct"), create.Identifier().Capture(CAPTURE_NAME), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Keyword("struct"),
|
||||
create.Identifier().Capture(CAPTURE_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -126,7 +136,11 @@ namespace sdd::def_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("checksumoverride"), create.Integer().Capture(CAPTURE_VALUE), create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Keyword("checksumoverride"),
|
||||
create.Integer().Capture(CAPTURE_VALUE),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -148,7 +162,9 @@ namespace sdd::def_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}')});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -15,7 +15,13 @@ namespace sdd::enum_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.String().Capture(CAPTURE_ENTRY_VALUE), create.Or({create.Char(','), create.Char('}').NoConsume()})});
|
||||
AddMatchers({
|
||||
create.String().Capture(CAPTURE_ENTRY_VALUE),
|
||||
create.Or({
|
||||
create.Char(','),
|
||||
create.Char('}').NoConsume(),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -39,7 +45,10 @@ namespace sdd::enum_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}'), create.Optional(create.Char(';'))});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
create.Optional(create.Char(';')),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -13,7 +13,11 @@ namespace sdd::no_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("version"), create.Integer().Capture(CAPTURE_VERSION), create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Keyword("version"),
|
||||
create.Integer().Capture(CAPTURE_VERSION),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -24,21 +24,34 @@ namespace sdd::struct_scope_sequences
|
||||
|
||||
static std::unique_ptr<matcher_t> TypeMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.Or({create.Keyword("int").Tag(TAG_TYPE_INT),
|
||||
create.Keyword("byte").Tag(TAG_TYPE_BYTE),
|
||||
create.Keyword("bool").Tag(TAG_TYPE_BOOL),
|
||||
create.Keyword("float").Tag(TAG_TYPE_FLOAT),
|
||||
create.Keyword("short").Tag(TAG_TYPE_SHORT),
|
||||
create.And({create.Keyword("string"), create.Char('('), create.Integer().Capture(CAPTURE_STRING_LENGTH), create.Char(')')})
|
||||
.Tag(TAG_TYPE_STRING),
|
||||
create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME)});
|
||||
return create.Or({
|
||||
create.Keyword("int").Tag(TAG_TYPE_INT),
|
||||
create.Keyword("byte").Tag(TAG_TYPE_BYTE),
|
||||
create.Keyword("bool").Tag(TAG_TYPE_BOOL),
|
||||
create.Keyword("float").Tag(TAG_TYPE_FLOAT),
|
||||
create.Keyword("short").Tag(TAG_TYPE_SHORT),
|
||||
create
|
||||
.And({
|
||||
create.Keyword("string"),
|
||||
create.Char('('),
|
||||
create.Integer().Capture(CAPTURE_STRING_LENGTH),
|
||||
create.Char(')'),
|
||||
})
|
||||
.Tag(TAG_TYPE_STRING),
|
||||
create.Identifier().Tag(TAG_TYPE_NAMED).Capture(CAPTURE_TYPE_NAME),
|
||||
});
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> ArrayMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({create.Char('['),
|
||||
create.Or({create.Integer().Capture(CAPTURE_ARRAY_SIZE), create.Identifier().Capture(CAPTURE_ARRAY_SIZE)}),
|
||||
create.Char(']')});
|
||||
return create.And({
|
||||
create.Char('['),
|
||||
create.Or({
|
||||
create.Integer().Capture(CAPTURE_ARRAY_SIZE),
|
||||
create.Identifier().Capture(CAPTURE_ARRAY_SIZE),
|
||||
}),
|
||||
create.Char(']'),
|
||||
});
|
||||
}
|
||||
|
||||
public:
|
||||
@ -46,7 +59,12 @@ namespace sdd::struct_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({TypeMatchers(create), create.Identifier().Capture(CAPTURE_ENTRY_NAME), create.OptionalLoop(ArrayMatchers(create)), create.Char(';')});
|
||||
AddMatchers({
|
||||
TypeMatchers(create),
|
||||
create.Identifier().Capture(CAPTURE_ENTRY_NAME),
|
||||
create.OptionalLoop(ArrayMatchers(create)),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
private:
|
||||
@ -178,7 +196,13 @@ namespace sdd::struct_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("pad"), create.Char('('), create.Integer().Capture(CAPTURE_PADDING_VALUE), create.Char(')'), create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Keyword("pad"),
|
||||
create.Char('('),
|
||||
create.Integer().Capture(CAPTURE_PADDING_VALUE),
|
||||
create.Char(')'),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -201,7 +225,10 @@ namespace sdd::struct_scope_sequences
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}'), create.Optional(create.Char(';'))});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
create.Optional(create.Char(';')),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -15,7 +15,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('{')});
|
||||
AddMatchers({
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -31,7 +33,9 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueNoScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({new SequencePass()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequencePass(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}').Capture(CAPTURE_FIRST_TOKEN)});
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_FIRST_TOKEN),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -44,7 +46,11 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("stateMap").Capture(CAPTURE_START), create.String().Capture(CAPTURE_STATE_MAP_NAME), create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Keyword("stateMap").Capture(CAPTURE_START),
|
||||
create.String().Capture(CAPTURE_STATE_MAP_NAME),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -76,21 +82,25 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create
|
||||
.Or({
|
||||
create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER),
|
||||
create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER),
|
||||
})
|
||||
.Capture(CAPTURE_START),
|
||||
create.Or({create.And({
|
||||
create.Integer().Capture(CAPTURE_VERSION_MAJOR),
|
||||
create.Char('.'),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MINOR),
|
||||
}),
|
||||
create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it
|
||||
create.String().Capture(CAPTURE_VERSION)}),
|
||||
create.String().Capture(CAPTURE_SHADER_NAME),
|
||||
create.Char('{')});
|
||||
AddMatchers({
|
||||
create
|
||||
.Or({
|
||||
create.Keyword("vertexShader").Tag(TAG_VERTEX_SHADER),
|
||||
create.Keyword("pixelShader").Tag(TAG_PIXEL_SHADER),
|
||||
})
|
||||
.Capture(CAPTURE_START),
|
||||
create.Or({
|
||||
create.And({
|
||||
create.Integer().Capture(CAPTURE_VERSION_MAJOR),
|
||||
create.Char('.'),
|
||||
create.Integer().Capture(CAPTURE_VERSION_MINOR),
|
||||
}),
|
||||
create.FloatingPoint().Capture(CAPTURE_VERSION), // This is dumb but cod devs made the format so cannot change it
|
||||
create.String().Capture(CAPTURE_VERSION),
|
||||
}),
|
||||
create.String().Capture(CAPTURE_SHADER_NAME),
|
||||
create.Char('{'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -137,19 +147,29 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX), create.Char(']')})),
|
||||
AddMatchers({
|
||||
create.Keyword("vertex").Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_DESTINATION_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_DESTINATION_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
|
||||
create.Char('='),
|
||||
create.Char('='),
|
||||
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX), create.Char(']')})),
|
||||
create.Keyword("code"),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_STREAM_SOURCE_NAME),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_STREAM_SOURCE_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
|
||||
create.Char(';')});
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
static std::string CreateRoutingString(SequenceResult<SimpleParserValue>& result, const int nameCapture, const int indexCapture)
|
||||
@ -184,8 +204,12 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniquePassScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests(
|
||||
{new SequenceEndPass(), new SequenceStateMap(), new SequenceShader(), new SequenceVertexStreamRouting()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndPass(),
|
||||
new SequenceStateMap(),
|
||||
new SequenceShader(),
|
||||
new SequenceVertexStreamRouting(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Char('}')});
|
||||
AddMatchers({
|
||||
create.Char('}'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -44,16 +46,33 @@ namespace techset
|
||||
|
||||
static std::unique_ptr<matcher_t> CodeMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.And({create.Or({create.Keyword("constant").Tag(TAG_CONSTANT), create.Keyword("sampler").Tag(TAG_SAMPLER)}),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
create.OptionalLoop(create.And({create.Char('.'), create.Identifier().Capture(CAPTURE_CODE_ACCESSOR)})),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_CODE_INDEX), create.Char(']')}))});
|
||||
return create.And({
|
||||
create.Or({
|
||||
create.Keyword("constant").Tag(TAG_CONSTANT),
|
||||
create.Keyword("sampler").Tag(TAG_SAMPLER),
|
||||
}),
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
create.OptionalLoop(create.And({
|
||||
create.Char('.'),
|
||||
create.Identifier().Capture(CAPTURE_CODE_ACCESSOR),
|
||||
})),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_CODE_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> LiteralValueMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create.Or({create.FloatingPoint(), create.Integer()}).Capture(CAPTURE_LITERAL_VALUE);
|
||||
return create
|
||||
.Or({
|
||||
create.FloatingPoint(),
|
||||
create.Integer(),
|
||||
})
|
||||
.Capture(CAPTURE_LITERAL_VALUE);
|
||||
}
|
||||
|
||||
static std::unique_ptr<matcher_t> LiteralMatchers(const SimpleMatcherFactory& create)
|
||||
@ -77,11 +96,18 @@ namespace techset
|
||||
static std::unique_ptr<matcher_t> MaterialMatchers(const SimpleMatcherFactory& create)
|
||||
{
|
||||
return create
|
||||
.And({create.Keyword("material"),
|
||||
create.Char('.'),
|
||||
.And({
|
||||
create.Keyword("material"),
|
||||
create.Char('.'),
|
||||
|
||||
create.Or({create.And({create.Char('#'), create.Integer().Capture(CAPTURE_MATERIAL_HASH)}),
|
||||
create.Identifier().Capture(CAPTURE_MATERIAL_NAME)})})
|
||||
create.Or({
|
||||
create.And({
|
||||
create.Char('#'),
|
||||
create.Integer().Capture(CAPTURE_MATERIAL_HASH),
|
||||
}),
|
||||
create.Identifier().Capture(CAPTURE_MATERIAL_NAME),
|
||||
}),
|
||||
})
|
||||
.Tag(TAG_MATERIAL);
|
||||
}
|
||||
|
||||
@ -90,12 +116,22 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(),
|
||||
create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT),
|
||||
create.Optional(create.And({create.Char('['), create.Integer().Capture(CAPTURE_SHADER_INDEX), create.Char(']')})),
|
||||
create.Char('='),
|
||||
create.Or({CodeMatchers(create), LiteralMatchers(create), MaterialMatchers(create)}),
|
||||
create.Char(';')});
|
||||
AddMatchers({
|
||||
create.Identifier().Capture(CAPTURE_FIRST_TOKEN).NoConsume(),
|
||||
create.Identifier().Capture(CAPTURE_SHADER_ARGUMENT),
|
||||
create.Optional(create.And({
|
||||
create.Char('['),
|
||||
create.Integer().Capture(CAPTURE_SHADER_INDEX),
|
||||
create.Char(']'),
|
||||
})),
|
||||
create.Char('='),
|
||||
create.Or({
|
||||
CodeMatchers(create),
|
||||
LiteralMatchers(create),
|
||||
MaterialMatchers(create),
|
||||
}),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
static void ProcessCodeArgument(const TechniqueParserState* state, SequenceResult<SimpleParserValue>& result, ShaderArgument arg, const bool isSampler)
|
||||
@ -197,7 +233,10 @@ namespace techset
|
||||
|
||||
const std::vector<TechniqueParser::sequence_t*>& TechniqueShaderScopeSequences::GetSequences()
|
||||
{
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({new SequenceEndShader(), new SequenceShaderArgument()});
|
||||
static std::vector<TechniqueParser::sequence_t*> tests({
|
||||
new SequenceEndShader(),
|
||||
new SequenceShaderArgument(),
|
||||
});
|
||||
|
||||
return tests;
|
||||
}
|
||||
|
@ -15,7 +15,10 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.String().Capture(CAPTURE_TYPE_NAME), create.Char(':')});
|
||||
AddMatchers({
|
||||
create.String().Capture(CAPTURE_TYPE_NAME),
|
||||
create.Char(':'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -40,7 +43,15 @@ namespace techset
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
|
||||
AddMatchers({create.Or({create.Identifier(), create.String()}).Capture(CAPTURE_NAME), create.Char(';')});
|
||||
AddMatchers({
|
||||
create
|
||||
.Or({
|
||||
create.Identifier(),
|
||||
create.String(),
|
||||
})
|
||||
.Capture(CAPTURE_NAME),
|
||||
create.Char(';'),
|
||||
});
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -66,8 +77,13 @@ TechsetParser::TechsetParser(SimpleLexer* lexer, const char** validTechniqueType
|
||||
|
||||
const std::vector<TechsetParser::sequence_t*>& TechsetParser::GetTestsForState()
|
||||
{
|
||||
static std::vector<sequence_t*> allTests({new SequenceTechniqueTypeName(), new SequenceTechniqueName()});
|
||||
static std::vector<sequence_t*> techniqueTypeNameOnlyTests({new SequenceTechniqueTypeName()});
|
||||
static std::vector<sequence_t*> allTests({
|
||||
new SequenceTechniqueTypeName(),
|
||||
new SequenceTechniqueName(),
|
||||
});
|
||||
static std::vector<sequence_t*> techniqueTypeNameOnlyTests({
|
||||
new SequenceTechniqueTypeName(),
|
||||
});
|
||||
|
||||
return m_state->m_current_technique_types.empty() ? techniqueTypeNameOnlyTests : allTests;
|
||||
}
|
||||
|
Reference in New Issue
Block a user