From 19ed3e8063c8acd8660713226a916b7997f95ca8 Mon Sep 17 00:00:00 2001 From: Clang Format Date: Sun, 19 Nov 2023 21:59:57 +0100 Subject: [PATCH] Adjust further code formatting --- src/ObjLoading/ObjLoading.cpp | 8 +- .../Menu/Matcher/MenuExpressionMatchers.cpp | 25 +- .../Menu/Matcher/MenuMatcherFactory.cpp | 80 +- .../EventHandlerSetScopeSequences.cpp | 1790 +++++++++++------ .../Menu/Sequence/FunctionScopeSequences.cpp | 4 +- .../Generic/GenericBoolPropertySequence.cpp | 5 +- .../Generic/GenericColorPropertySequence.cpp | 2 +- .../GenericExpressionPropertySequence.cpp | 26 +- .../GenericFloatingPointPropertySequence.cpp | 5 +- ...ricMenuEventHandlerSetPropertySequence.cpp | 5 +- .../Generic/GenericStringPropertySequence.cpp | 5 +- .../Menu/Sequence/GlobalScopeSequences.cpp | 4 +- .../Menu/Sequence/ItemScopeSequences.cpp | 106 +- .../Menu/Sequence/MenuScopeSequences.cpp | 42 +- .../Menu/Sequence/NoScopeSequences.cpp | 4 +- .../StateMap/Parsing/StateMapParser.cpp | 66 +- .../StructuredDataDefScopeSequences.cpp | 30 +- .../StructuredDataEnumScopeSequences.cpp | 13 +- .../StructuredDataNoScopeSequences.cpp | 6 +- .../StructuredDataStructScopeSequences.cpp | 55 +- .../Sequence/TechniqueNoScopeSequences.cpp | 8 +- .../Sequence/TechniquePassScopeSequences.cpp | 88 +- .../TechniqueShaderScopeSequences.cpp | 77 +- .../Techset/Parsing/TechsetFileParser.cpp | 24 +- .../AssetDumpers/AssetDumperLoadedSound.cpp | 14 +- .../IW3/AssetDumpers/AssetDumperMaterial.cpp | 60 +- .../T6/AssetDumpers/AssetDumperFontIcon.cpp | 209 +- .../T6/AssetDumpers/AssetDumperSndBank.cpp | 12 +- .../Model/XModel/XModelExportWriter.cpp | 8 +- .../ObjContainer/IPak/IPakWriter.cpp | 28 +- src/ObjWriting/ObjWriting.cpp | 8 +- src/ObjWriting/Sound/WavWriter.cpp | 14 +- .../SimpleExpressionBinaryOperation.cpp | 3 +- .../Expression/SimpleExpressionMatchers.cpp | 51 +- .../Simple/SimpleExpressionInterpreter.cpp | 4 +- src/Unlinker/UnlinkerArgs.cpp | 174 +- src/Utils/Math/Matrix.h | 4 +- .../Domain/Evaluation/OperationType.cpp | 38 +- .../Parsing/Commands/Impl/CommandsParser.cpp | 36 +- .../Matcher/CommandsCommonMatchers.cpp | 353 ++-- .../Commands/Sequence/SequenceAction.cpp | 36 +- .../Commands/Sequence/SequenceAllocAlign.cpp | 12 +- .../Sequence/SequenceArchitecture.cpp | 6 +- .../Commands/Sequence/SequenceArrayCount.cpp | 12 +- .../Commands/Sequence/SequenceArraySize.cpp | 12 +- .../Commands/Sequence/SequenceAsset.cpp | 10 +- .../Commands/Sequence/SequenceBlock.cpp | 12 +- .../Commands/Sequence/SequenceCondition.cpp | 18 +- .../Commands/Sequence/SequenceCount.cpp | 16 +- .../Commands/Sequence/SequenceGame.cpp | 6 +- .../Commands/Sequence/SequenceName.cpp | 7 +- .../Commands/Sequence/SequenceReorder.cpp | 20 +- .../Commands/Sequence/SequenceReusable.cpp | 8 +- .../Sequence/SequenceScriptString.cpp | 8 +- .../Commands/Sequence/SequenceSetBlock.cpp | 18 +- .../Commands/Sequence/SequenceString.cpp | 8 +- .../Parsing/Commands/Sequence/SequenceUse.cpp | 6 +- .../Parsing/Header/Block/HeaderBlockEnum.cpp | 5 +- .../Header/Block/HeaderBlockNamespace.cpp | 16 +- .../Parsing/Header/Block/HeaderBlockNone.cpp | 10 +- .../Header/Block/HeaderBlockStruct.cpp | 9 +- .../Parsing/Header/Block/HeaderBlockUnion.cpp | 9 +- .../Header/Matcher/HeaderCommonMatchers.cpp | 138 +- .../Header/Sequence/SequenceCloseBlock.cpp | 9 +- .../Parsing/Header/Sequence/SequenceEnum.cpp | 15 +- .../Header/Sequence/SequenceEnumMember.cpp | 18 +- .../Header/Sequence/SequenceForwardDecl.cpp | 18 +- .../Header/Sequence/SequenceNamespace.cpp | 6 +- .../Header/Sequence/SequenceStruct.cpp | 19 +- .../Header/Sequence/SequenceTypedef.cpp | 54 +- .../Parsing/Header/Sequence/SequenceUnion.cpp | 19 +- .../Header/Sequence/SequenceVariable.cpp | 52 +- src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp | 11 +- src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h | 3 +- src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp | 94 +- src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h | 3 +- src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp | 3 +- src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp | 122 +- src/ZoneCommon/Game/T6/ZoneConstantsT6.h | 9 +- .../SequenceZoneDefinitionAssetList.cpp | 6 +- .../Sequence/SequenceZoneDefinitionBuild.cpp | 6 +- .../Sequence/SequenceZoneDefinitionEntry.cpp | 15 +- .../Sequence/SequenceZoneDefinitionIgnore.cpp | 6 +- .../SequenceZoneDefinitionInclude.cpp | 6 +- .../SequenceZoneDefinitionMetaData.cpp | 7 +- .../ZoneDefinition/ZoneDefinitionParser.cpp | 14 +- src/ZoneLoading/ZoneLoading.cpp | 7 +- src/ZoneWriting/ZoneWriting.cpp | 7 +- .../EventHandlerSetScopeSequencesTests.cpp | 633 ++++-- .../Menu/Sequence/ItemScopeSequencesTests.cpp | 26 +- .../Parsing/Simple/SimpleExpressionTests.cpp | 359 ++-- .../Commands/Sequence/SequenceActionTests.cpp | 258 +-- .../Sequence/SequenceArchitectureTests.cpp | 30 +- .../Commands/Sequence/SequenceGameTests.cpp | 10 +- .../Sequence/SequenceNamespaceTests.cpp | 12 +- .../Parsing/Matcher/MatcherTests.cpp | 622 +++--- 96 files changed, 4085 insertions(+), 2290 deletions(-) diff --git a/src/ObjLoading/ObjLoading.cpp b/src/ObjLoading/ObjLoading.cpp index 4fe5af417..a4727ec15 100644 --- a/src/ObjLoading/ObjLoading.cpp +++ b/src/ObjLoading/ObjLoading.cpp @@ -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) { diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp index 915956675..684257b1a 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuExpressionMatchers.cpp @@ -30,15 +30,22 @@ std::unique_ptr 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& MenuExpressionMatchers::GetBaseFunctionMapForFeatureLevel(const FeatureLevel featureLevel) diff --git a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp index f6fefcefd..3adb50438 100644 --- a/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp +++ b/src/ObjLoading/Parsing/Menu/Matcher/MenuMatcherFactory.cpp @@ -13,57 +13,75 @@ MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier 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 MenuMatcherFactory::Text() const { - return MatcherFactoryWrapper(Or({StringChain(), Identifier()})); + return MatcherFactoryWrapper(Or({ + StringChain(), + Identifier(), + })); } MatcherFactoryWrapper MenuMatcherFactory::TextNoChain() const { - return MatcherFactoryWrapper(Or({String(), Identifier()})); + return MatcherFactoryWrapper(Or({ + String(), + Identifier(), + })); } MatcherFactoryWrapper MenuMatcherFactory::Numeric() const { - return MatcherFactoryWrapper(Or({FloatingPoint(), Integer()})); + return MatcherFactoryWrapper(Or({ + FloatingPoint(), + Integer(), + })); } MatcherFactoryWrapper 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 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) diff --git a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp index 5e919b8cf..04aa7a6f0 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/EventHandlerSetScopeSequences.cpp @@ -33,113 +33,125 @@ namespace menu _NODISCARD MatcherFactoryWrapper ScriptStrictNumeric() const { - return And({MatcherFactoryWrapper(std::make_unique()) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - { - const auto& secondToken = tokens[1].get(); - if (secondToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); - - std::ostringstream ss; - ss << std::noshowpoint << -firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) - { - std::ostringstream ss; - ss << std::noshowpoint << firstToken.FloatingPointValue(); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); - } - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - })}); + return And({ + MatcherFactoryWrapper(std::make_unique()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + { + const auto& secondToken = tokens[1].get(); + if (secondToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-secondToken.IntegerValue()))); + + std::ostringstream ss; + ss << std::noshowpoint << -firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + if (firstToken.m_type == SimpleParserValueType::FLOATING_POINT) + { + std::ostringstream ss; + ss << std::noshowpoint << firstToken.FloatingPointValue(); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(ss.str())); + } + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptNumeric() const { - return Or({ScriptStrictNumeric(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::NUMERIC)); - })}); + return Or({ + ScriptStrictNumeric(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::NUMERIC)); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptStrictInt() const { - return And({MatcherFactoryWrapper(std::make_unique()) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - const auto& firstToken = tokens[0].get(); - - if (firstToken.m_type == SimpleParserValueType::CHARACTER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); - - if (firstToken.m_type == SimpleParserValueType::INTEGER) - return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); - return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); - })}); + return And({ + MatcherFactoryWrapper(std::make_unique()) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + const auto& firstToken = tokens[0].get(); + + if (firstToken.m_type == SimpleParserValueType::CHARACTER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(-tokens[1].get().IntegerValue()))); + + if (firstToken.m_type == SimpleParserValueType::INTEGER) + return SimpleParserValue::String(firstToken.GetPos(), new std::string(std::to_string(firstToken.IntegerValue()))); + return SimpleParserValue::String(firstToken.GetPos(), new std::string(firstToken.StringValue())); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptChar(const char c) const { - return Or({Char(c), - Or({ - Type(SimpleParserValueType::INTEGER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); - })}); + return Or({ + Char(c), + Or({ + Type(SimpleParserValueType::INTEGER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptInt() const { - return Or({ScriptStrictInt(), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); - })}); + return Or({ + ScriptStrictInt(), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::INT)); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptText() const { - return Or({Type(SimpleParserValueType::STRING), - Type(SimpleParserValueType::IDENTIFIER), - Or({ - Type(SimpleParserValueType::CHARACTER), - Type(SimpleParserValueType::FLOATING_POINT), - Type(SimpleParserValueType::INTEGER), - }) - .Transform( - [](const token_list_t& tokens) -> SimpleParserValue - { - return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::TEXT)); - })}); + return Or({ + Type(SimpleParserValueType::STRING), + Type(SimpleParserValueType::IDENTIFIER), + Or({ + Type(SimpleParserValueType::CHARACTER), + Type(SimpleParserValueType::FLOATING_POINT), + Type(SimpleParserValueType::INTEGER), + }) + .Transform( + [](const token_list_t& tokens) -> SimpleParserValue + { + return SimpleParserValue::Integer(tokens[0].get().GetPos(), static_cast(ExpectedScriptToken::TEXT)); + }), + }); } _NODISCARD MatcherFactoryWrapper ScriptKeyword(std::string keyword) const @@ -149,7 +161,12 @@ namespace menu _NODISCARD MatcherFactoryWrapper ScriptColor() const { - return And({ScriptStrictNumeric(), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric()), Optional(ScriptStrictNumeric())}); + return And({ + ScriptStrictNumeric(), + Optional(ScriptStrictNumeric()), + Optional(ScriptStrictNumeric()), + Optional(ScriptStrictNumeric()), + }); } _NODISCARD MatcherFactoryWrapper ScriptLocalVarIntOrLiteral() const @@ -191,7 +208,9 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: @@ -239,7 +258,9 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char(';')}); + AddMatchers({ + create.Char(';'), + }); } protected: @@ -262,14 +283,16 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({create - .Or({ - create.Numeric(), - create.String(), - create.Identifier(), - create.Type(SimpleParserValueType::CHARACTER), - }) - .Capture(CAPTURE_SCRIPT_TOKEN)}); + AddMatchers({ + create + .Or({ + create.Numeric(), + create.String(), + create.Identifier(), + create.Type(SimpleParserValueType::CHARACTER), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + }); } protected: @@ -319,7 +342,10 @@ namespace menu::event_handler_set_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); + AddMatchers({ + create.And(matchers).Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } static std::unique_ptr @@ -389,8 +415,15 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers( - {create.And({create.ScriptKeyword("uiScript"), create.And(matchers)}).Capture(CAPTURE_SCRIPT_TOKEN), create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("uiScript"), + create.And(matchers), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } static std::unique_ptr Create(std::initializer_list>>> matchers) @@ -406,21 +439,23 @@ namespace menu::event_handler_set_scope_sequences static std::unique_ptr PlayerDataPathMatchers(const ScriptMatcherFactory& create) { - return create.Or({create.ScriptKeyword("false"), - create.ScriptKeyword("true"), - create.And({ - create.Or({ - create.ScriptKeyword("localvarstring"), - create.ScriptKeyword("localvarint"), - create.ScriptKeyword("localvarfloat"), - create.ScriptKeyword("localvarbool"), - }), - create.ScriptChar('('), - create.ScriptText(), - create.ScriptChar(')'), - }), - create.ScriptStrictInt(), - create.ScriptText()}); + return create.Or({ + create.ScriptKeyword("false"), + create.ScriptKeyword("true"), + create.And({ + create.Or({ + create.ScriptKeyword("localvarstring"), + create.ScriptKeyword("localvarint"), + create.ScriptKeyword("localvarfloat"), + create.ScriptKeyword("localvarbool"), + }), + create.ScriptChar('('), + create.ScriptText(), + create.ScriptChar(')'), + }), + create.ScriptStrictInt(), + create.ScriptText(), + }); } }; @@ -432,16 +467,21 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({create - .And({ - create.ScriptKeyword("setPlayerData"), - create.ScriptChar('('), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), - create.ScriptChar(')'), - }) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("setPlayerData"), + create.ScriptChar('('), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({ + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + })), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -453,18 +493,23 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); AddLabeledMatchers(PlayerDataPathMatchers(create), LABEL_PLAYER_DATA_PATH_ELEMENT); - AddMatchers({create - .And({ - create.ScriptKeyword("setPlayerDataSplitscreen"), - create.ScriptChar('('), - create.ScriptInt(), - create.ScriptChar(','), - create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), - create.Loop(create.And({create.ScriptChar(','), create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT)})), - create.ScriptChar(')'), - }) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("setPlayerDataSplitscreen"), + create.ScriptChar('('), + create.ScriptInt(), + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + create.Loop(create.And({ + create.ScriptChar(','), + create.Label(LABEL_PLAYER_DATA_PATH_ELEMENT), + })), + create.ScriptChar(')'), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -475,22 +520,26 @@ namespace menu::event_handler_set_scope_sequences { const ScriptMatcherFactory create(this); - AddMatchers({create - .And({create.ScriptKeyword("lerp"), - create.Or({ - create.ScriptKeyword("scale"), - create.ScriptKeyword("alpha"), - create.ScriptKeyword("x"), - create.ScriptKeyword("y"), - }), - create.ScriptKeyword("from"), - create.ScriptNumeric(), - create.ScriptKeyword("to"), - create.ScriptNumeric(), - create.ScriptKeyword("over"), - create.ScriptNumeric()}) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("lerp"), + create.Or({ + create.ScriptKeyword("scale"), + create.ScriptKeyword("alpha"), + create.ScriptKeyword("x"), + create.ScriptKeyword("y"), + }), + create.ScriptKeyword("from"), + create.ScriptNumeric(), + create.ScriptKeyword("to"), + create.ScriptNumeric(), + create.ScriptKeyword("over"), + create.ScriptNumeric(), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; @@ -511,13 +560,17 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Or({create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), - create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), - create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), - create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING)}), - create.ScriptText().Capture(CAPTURE_VAR_NAME), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Optional(create.Char(';'))}); + AddMatchers({ + create.Or({ + create.ScriptKeyword("setLocalVarBool").Tag(TAG_BOOL), + create.ScriptKeyword("setLocalVarInt").Tag(TAG_INT), + create.ScriptKeyword("setLocalVarFloat").Tag(TAG_FLOAT), + create.ScriptKeyword("setLocalVarString").Tag(TAG_STRING), + }), + create.ScriptText().Capture(CAPTURE_VAR_NAME), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Optional(create.Char(';')), + }); } private: @@ -640,11 +693,13 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Keyword("if").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{')}); + AddMatchers({ + create.Keyword("if").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{'), + }); } protected: @@ -682,12 +737,14 @@ namespace menu::event_handler_set_scope_sequences AddLabeledMatchers(expressionMatchers.Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION); - AddMatchers({create.Char('}'), - create.Keyword("elseif").Capture(CAPTURE_KEYWORD), - create.Char('('), - create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), - create.Char(')'), - create.Char('{')}); + AddMatchers({ + create.Char('}'), + create.Keyword("elseif").Capture(CAPTURE_KEYWORD), + create.Char('('), + create.Label(MenuExpressionMatchers::LABEL_EXPRESSION), + create.Char(')'), + create.Char('{'), + }); } protected: @@ -734,7 +791,11 @@ namespace menu::event_handler_set_scope_sequences const ScriptMatcherFactory create(this); const MenuExpressionMatchers expressionMatchers; - AddMatchers({create.Char('}'), create.Keyword("else").Capture(CAPTURE_KEYWORD), create.Char('{')}); + AddMatchers({ + create.Char('}'), + create.Keyword("else").Capture(CAPTURE_KEYWORD), + create.Char('{'), + }); } protected: @@ -798,32 +859,38 @@ namespace menu::event_handler_set_scope_sequences }), LABEL_FILE_CATEGORY); - AddLabeledMatchers(create.And({create.ScriptKeyword("open"), - create.Label(LABEL_PARADIGM), - create.Optional(create.Label(LABEL_PLATFORM)), - create.Optional(create.Label(LABEL_FILE_CATEGORY)), - create.ScriptText()}), + AddLabeledMatchers(create.And({ + create.ScriptKeyword("open"), + create.Label(LABEL_PARADIGM), + create.Optional(create.Label(LABEL_PLATFORM)), + create.Optional(create.Label(LABEL_FILE_CATEGORY)), + create.ScriptText(), + }), LABEL_OPEN); - AddMatchers({create - .And({create.ScriptKeyword("uiScript"), - create.ScriptKeyword("OnlineVault"), - create.Or({ - create.Label(LABEL_OPEN), - create.ScriptKeyword("Pop"), - create.ScriptKeyword("CloseAll"), - create.ScriptKeyword("Load"), - create.ScriptKeyword("LoadAndRenderMovie"), - create.ScriptKeyword("TrySave"), - create.ScriptKeyword("Save"), - create.ScriptKeyword("Rename"), - create.ScriptKeyword("Delete"), - create.ScriptKeyword("Abort"), - create.ScriptKeyword("FacebookUploadPhoto"), - create.ScriptKeyword("FacebookUploadVideo"), - })}) - .Capture(CAPTURE_SCRIPT_TOKEN), - create.Optional(create.Char(';'))}); + AddMatchers({ + create + .And({ + create.ScriptKeyword("uiScript"), + create.ScriptKeyword("OnlineVault"), + create.Or({ + create.Label(LABEL_OPEN), + create.ScriptKeyword("Pop"), + create.ScriptKeyword("CloseAll"), + create.ScriptKeyword("Load"), + create.ScriptKeyword("LoadAndRenderMovie"), + create.ScriptKeyword("TrySave"), + create.ScriptKeyword("Save"), + create.ScriptKeyword("Rename"), + create.ScriptKeyword("Delete"), + create.ScriptKeyword("Abort"), + create.ScriptKeyword("FacebookUploadPhoto"), + create.ScriptKeyword("FacebookUploadVideo"), + }), + }) + .Capture(CAPTURE_SCRIPT_TOKEN), + create.Optional(create.Char(';')), + }); } }; } // namespace menu::event_handler_set_scope_sequences @@ -846,208 +913,466 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel if (!permissive) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeIn"), create.ScriptText()})); // fadeIn - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("fadeOut"), create.ScriptText()})); // fadeOut - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("show"), create.ScriptText()})); // show - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hide"), create.ScriptText()})); // hide - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showMenu"), create.ScriptText()})); // showMenu - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("hideMenu"), create.ScriptText()})); // hideMenu - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setColor"), - create.Or({create.ScriptKeyword("backColor"), create.ScriptKeyword("foreColor"), create.ScriptKeyword("borderColor")}), - create.ScriptColor()})); // setColor ("backColor" | "foreColor" | "borderColor") [] [] [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("open"), create.ScriptText()})); // open - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("close"), create.ScriptText()})); // close ("self" | ) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("escape"), create.ScriptText()})); // escape ("self" | ) - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForAllPlayers"), create.ScriptText()})); // closeForAllPlayers - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameOpen"), create.ScriptText()})); // ingameOpen - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("ingameClose"), create.ScriptText()})); // ingameClose - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackground"), create.ScriptText()})); // setBackground - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setItemColor"), - create.ScriptText(), - create.Or({create.ScriptKeyword("backColor"), - create.ScriptKeyword("foreColor"), - create.ScriptKeyword("borderColor"), - create.ScriptKeyword("disableColor")}), - create.ScriptColor()})); // setItemColor (backColor | foreColor | borderColor | disableColor) [] [] [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("focusFirst")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("fadeIn"), + create.ScriptText(), + })); // fadeIn + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("fadeOut"), + create.ScriptText(), + })); // fadeOut + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("show"), + create.ScriptText(), + })); // show + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("hide"), + create.ScriptText(), + })); // hide + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showMenu"), + create.ScriptText(), + })); // showMenu + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("hideMenu"), + create.ScriptText(), + })); // hideMenu + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setColor"), + create.Or({ + create.ScriptKeyword("backColor"), + create.ScriptKeyword("foreColor"), + create.ScriptKeyword("borderColor"), + }), + create.ScriptColor(), + })); // setColor ("backColor" | "foreColor" | "borderColor") [] [] [] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("open"), + create.ScriptText(), + })); // open + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("close"), + create.ScriptText(), + })); // close ("self" | ) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("escape"), + create.ScriptText(), + })); // escape ("self" | ) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("closeForAllPlayers"), + create.ScriptText(), + })); // closeForAllPlayers + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("ingameOpen"), + create.ScriptText(), + })); // ingameOpen + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("ingameClose"), + create.ScriptText(), + })); // ingameClose + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setBackground"), + create.ScriptText(), + })); // setBackground + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setItemColor"), + create.ScriptText(), + create.Or({ + create.ScriptKeyword("backColor"), + create.ScriptKeyword("foreColor"), + create.ScriptKeyword("borderColor"), + create.ScriptKeyword("disableColor"), + }), + create.ScriptColor(), + })); // setItemColor (backColor | foreColor | borderColor | disableColor) [] [] [] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("focusFirst"), + })); // setFocus game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocusByDvar"), create.ScriptText()})); // setFocusByDvar + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setFocusByDvar"), + create.ScriptText(), + })); // setFocusByDvar // setDvar game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("exec"), create.ScriptText()})); // exec - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNow"), create.ScriptText()})); // execNow - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // execOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // execOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // execOnDvarFloatValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // execNowOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // execNowOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execNowOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // execNowOnDvarFloatValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("play"), create.ScriptText()})); // play + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("exec"), + create.ScriptText(), + })); // exec + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNow"), + create.ScriptText(), + })); // execNow + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // execOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // execOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // execOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // execNowOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // execNowOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execNowOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // execNowOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("play"), + create.ScriptText(), + })); // play // scriptMenuResponse game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), - create.ScriptText(), - create.ScriptText(), - create.ScriptText()})); // scriptMenuRespondOnDvarStringValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), - create.ScriptText(), - create.ScriptInt(), - create.ScriptText()})); // scriptMenuRespondOnDvarIntValue - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), - create.ScriptText(), - create.ScriptNumeric(), - create.ScriptText()})); // scriptMenuRespondOnDvarFloatValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarStringValue"), + create.ScriptText(), + create.ScriptText(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarStringValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarIntValue"), + create.ScriptText(), + create.ScriptInt(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarIntValue + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuRespondOnDvarFloatValue"), + create.ScriptText(), + create.ScriptNumeric(), + create.ScriptText(), + })); // scriptMenuRespondOnDvarFloatValue AddSequence(std::make_unique()); AddSequence(std::make_unique()); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resetStatsConfirm")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resetStatsCancel")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setGameMode"), create.ScriptText()})); // setGameMode + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resetStatsConfirm"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resetStatsCancel"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setGameMode"), + create.ScriptText(), + })); // setGameMode // feederTop / feederBottom game specific - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showGamerCard")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("openForGameType"), create.ScriptText()})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("closeForGameType"), create.ScriptText()})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("kickPlayer")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("getKickPlayerQuestion")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("partyUpdateMissingMapPackDvar")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("togglePlayerMute")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("resolveError")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showGamerCard"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("openForGameType"), + create.ScriptText(), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("closeForGameType"), + create.ScriptText(), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("kickPlayer"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("getKickPlayerQuestion"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("partyUpdateMissingMapPackDvar"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("togglePlayerMute"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("resolveError"), + })); AddSequence(std::make_unique()); // UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("StartServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadArenas")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadGameInfo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearError")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Quit")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Controls")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Leave")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeingame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("update"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("startSingleplayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("startMultiplayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("getLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("verifyLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("updateLanguage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("mutePlayer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("openMenuOnDvarNot"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeMenuOnDvarNot"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()}), - create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("setRecommended")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearLoadErrorsSummary")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("clearClientMatchData")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("StartServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadArenas"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadGameInfo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearError"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Quit"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Controls"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Leave"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeingame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("update"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("startSingleplayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("startMultiplayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("getLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("verifyLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("updateLanguage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("mutePlayer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("openMenuOnDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("openMenuOnDvarNot"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeMenuOnDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeMenuOnDvarNot"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("setRecommended"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearLoadErrorsSummary"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("clearClientMatchData"), + })); if (featureLevel == FeatureLevel::IW4) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setFocus"), create.ScriptText()})); // setFocus - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setDvar"), - create.ScriptText(), - create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // setDvar - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("scriptMenuResponse"), create.ScriptText()})); // scriptMenuResponse - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("updateMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("openMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteMail")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("doMailLottery")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederTop")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom")})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setFocus"), + create.ScriptText(), + })); // setFocus + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setDvar"), + create.ScriptText(), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + })); // setDvar + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("scriptMenuResponse"), + create.ScriptText(), + })); // scriptMenuResponse + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("updateMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("openMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("deleteMail"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("doMailLottery"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederTop"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederBottom"), + })); // statClearPerkNew // TODO // statSetUsingTable // TODO // statClearBitMask // TODO // IW4x UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadMods")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RunMod")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ClearMods")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("security_increase_cancel")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("mod_download_cancel")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadFriends")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("JoinFriend")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("downloadDLC"), create.ScriptInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("checkFirstLaunch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitWebsite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitWiki")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("visitDiscord")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("updateui_mousePitch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ServerStatus")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshServers")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("JoinServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ServerSort"), create.ScriptInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateListFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("CreateCurrentServerFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DeleteFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("nextStartupMessage")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateClasses")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadDemos")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("launchDemo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deleteDemo")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ApplyMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ApplyInitialMap")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadMods"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RunMod"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ClearMods"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("security_increase_cancel"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("mod_download_cancel"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadFriends"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("JoinFriend"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("downloadDLC"), + create.ScriptInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("checkFirstLaunch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitWebsite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitWiki"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("visitDiscord"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("updateui_mousePitch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ServerStatus"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshServers"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("JoinServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ServerSort"), + create.ScriptInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateListFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("CreateCurrentServerFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DeleteFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("nextStartupMessage"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateClasses"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadDemos"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("launchDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deleteDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ApplyMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ApplyInitialMap"), + })); } if (featureLevel == FeatureLevel::IW5) { - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("forceClose"), create.ScriptText()})); // forceClose ("self" | ) + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("forceClose"), + create.ScriptText(), + })); // forceClose ("self" | ) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setFocus"), - create.Or({create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptText()}), + create.Or({ + create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptText(), + }), })); // setFocus ((localVarString '(' ')') | ) AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("setDvar"), create.ScriptText(), - create.Or({create.And({ - create.ScriptKeyword("localVarString"), - create.Char('('), - create.ScriptText(), - create.Char(')'), - }), - create.ScriptStrictNumeric(), - create.ScriptText()}), + create.Or({ + create.And({ + create.ScriptKeyword("localVarString"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + }), + create.ScriptStrictNumeric(), + create.ScriptText(), + }), })); // setDvar ((localVarString '(' ')') | ) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execFirstClient"), create.ScriptText()})); // execFirstClient - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("execKeyPress"), create.Or({create.ScriptStrictNumeric(), create.ScriptText()})})); // execKeyPress + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execFirstClient"), + create.ScriptText(), + })); // execFirstClient + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execKeyPress"), + create.Or({ + create.ScriptStrictNumeric(), + create.ScriptText(), + }), + })); // execKeyPress AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("scriptMenuResponse"), create.Or({ @@ -1066,101 +1391,199 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel create.ScriptText(), }), })); // scriptMenuResponse (((localVarInt | localVarFloat | localVarBool | localVarString) '(' ')') | ) - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("deleteEliteCacFile")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("integrateEliteCacFile")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDataToPlayer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataFromHistory")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDataDefaults")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setUsingMatchRulesData")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("loadMatchRulesDedicatedServer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("onlineVaultEditMetadata")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("includeInMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useCustomMapRotation")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("useIntermissionTimer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("stopIntermissionTimer")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederTop"), create.Optional(create.Text())})); // feederTop [] - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederBottom"), create.Optional(create.Text())})); // feederBottom [] - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("feederPageUp"), create.Optional(create.Text())})); // feederPageUp [] - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("feederPageDown"), create.Optional(create.Text())})); // feederPageDown [] - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showCoopGamerCard")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("showSplitscreenGamerCard")})); // unknown parameters - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerOffensive")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerExploiting")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerCheating")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("reportPlayerBoosting")})); - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIcon"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setCardIcon '(' ((localVarInt '(' ')') | ) ')' - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitle"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setCardTitle '(' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("setCardIconNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... - // The game's menus do it and i don't want to fix it everywhere - create.ScriptKeyword("false"), - }), - create.Char( - ')')})); // setCardIconNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNew"), - create.Char('('), - create.ScriptLocalVarIntOrLiteral(), - create.Char(','), - create.Or({ - create.ScriptLocalVarIntOrLiteral(), - // This is a hack (see setCardIconNew for details) - create.ScriptKeyword("false"), - }), - create.Char(')')})); // setCardTitleNew '(' ((localVarInt '(' ')') | ) ',' ((localVarInt '(' ')') | ) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardIconNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setCardTitleNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("purchasePrestigeTitle"), - create.Char('('), - create.ScriptText(), - create.Char(')')})); // purchasePrestigeTitle '(' ')' - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNew"), - create.Char('('), - create.ScriptText(), - create.Char(','), - create.ScriptLocalVarIntOrLiteral(), - create.Char(')')})); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setProfileItemNewSplitScreen")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("storePopupXuid")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("getHostMigrateQuestion")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("makeHost")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameHide")})); // saveGameHide <item name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameShow")})); // saveGameShow <item name> - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveGameSetLocalBool"), create.ScriptText()})); // saveGameSetLocalBool <var name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("saveDelay")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("writeSave")})); - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("setSaveExecOnSuccess"), create.ScriptText()})); // setSaveExecOnSuccess <command> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("nextLevel")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("disablePause")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("enablePause")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("runCompletionResolve")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("clearCompletionResolve")})); - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("execWithResolve"), create.ScriptText()})); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("deleteEliteCacFile"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("integrateEliteCacFile"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setMatchRulesData"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataFromPlayer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveMatchRulesDataToPlayer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataFromHistory"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDataDefaults"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setUsingMatchRulesData"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveMatchRulesDedicatedServer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("loadMatchRulesDedicatedServer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("onlineVaultEditMetadata"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("includeInMapRotation"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("useCustomMapRotation"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("useIntermissionTimer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("stopIntermissionTimer"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederTop"), + create.Optional(create.Text()), + })); // feederTop [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederBottom"), + create.Optional(create.Text()), + })); // feederBottom [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederPageUp"), + create.Optional(create.Text()), + })); // feederPageUp [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("feederPageDown"), + create.Optional(create.Text()), + })); // feederPageDown [<var name>] + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showCoopGamerCard"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("showSplitscreenGamerCard"), + })); // unknown parameters + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerOffensive"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerExploiting"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerCheating"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("reportPlayerBoosting"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIcon"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setCardIcon '(' ((localVarInt '(' <var name> ')') | <card icon index>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitle"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setCardTitle '(' ((localVarInt '(' <var name> ')') | <card title index>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is wrong and the game does not even understand it. But because it's not a number it evaluates to 0... + // The game's menus do it and i don't want to fix it everywhere + create.ScriptKeyword("false"), + }), + create.Char(')'), + })); // setCardIconNew '(' ((localVarInt '(' <var name> ')') | <card icon index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleNew"), + create.Char('('), + create.ScriptLocalVarIntOrLiteral(), + create.Char(','), + create.Or({ + create.ScriptLocalVarIntOrLiteral(), + // This is a hack (see setCardIconNew for details) + create.ScriptKeyword("false"), + }), + create.Char(')'), + })); // setCardTitleNew '(' ((localVarInt '(' <var name> ')') | <card icon index>) ',' ((localVarInt '(' <var name> ')') | <is new>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardIconNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setCardTitleNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("purchasePrestigeTitle"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + })); // purchasePrestigeTitle '(' <title name> ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setProfileItemNew"), + create.Char('('), + create.ScriptText(), + create.Char(','), + create.ScriptLocalVarIntOrLiteral(), + create.Char(')'), + })); // setProfileItemNew '(' <item name> ',' (0|1|(localVarInt '(' <var name> ')')) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setProfileItemNewSplitScreen"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("storePopupXuid"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("getHostMigrateQuestion"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("makeHost"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameHide"), + })); // saveGameHide <item name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameShow"), + })); // saveGameShow <item name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveGameSetLocalBool"), + create.ScriptText(), + })); // saveGameSetLocalBool <var name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("saveDelay"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("writeSave"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setSaveExecOnSuccess"), + create.ScriptText(), + })); // setSaveExecOnSuccess <command> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("nextLevel"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("disablePause"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("enablePause"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("runCompletionResolve"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("clearCompletionResolve"), + })); + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("execWithResolve"), + create.ScriptText(), + })); AddSequence(SequenceGenericScriptStatement::Create({ create.ScriptKeyword("playMenuVideo"), create.Char('('), @@ -1170,124 +1593,329 @@ void EventHandlerSetScopeSequences::AddSequences(const FeatureLevel featureLevel create.Char(','), create.ScriptLocalVarBoolOrLiteral(), create.Char(')'), - })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | <maybe looping - // bool>) ')' - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setBackgroundVideo"), - create.Char('('), - create.ScriptText(), - create.Char(')')})); // setBackgroundVideo '(' <video name or empty string> ')' - AddSequence(SequenceGenericScriptStatement::Create( - {create.ScriptKeyword("clearEntitlementNew"), create.ScriptText()})); // clearEntitlementNew <entitlement name> - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitleRank")})); // unknown - AddSequence(SequenceGenericScriptStatement::Create({create.ScriptKeyword("setPastTitlePrestige")})); // unknown - AddSequence( - SequenceGenericScriptStatement::Create({create.ScriptKeyword("anticheat_bancheck"), create.ScriptStrictNumeric()})); // anticheat_bancheck <num> + })); // playMenuVideo '(' <video name> ',' ((localVarInt '(' <var name> ')') | <offset>) ',' ((localVarBool '(' <var name> ')') | + // <maybe_looping_bool>) ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setBackgroundVideo"), + create.Char('('), + create.ScriptText(), + create.Char(')'), + })); // setBackgroundVideo '(' <video name or empty string> ')' + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("clearEntitlementNew"), + create.ScriptText(), + })); // clearEntitlementNew <entitlement name> + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setPastTitleRank"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("setPastTitlePrestige"), + })); // unknown + AddSequence(SequenceGenericScriptStatement::Create({ + create.ScriptKeyword("anticheat_bancheck"), + create.ScriptStrictNumeric(), + })); // anticheat_bancheck <num> // UiScripts - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadSaveGames")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LoadGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SaveGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ForceSave")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DelSaveGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SaveGameSort"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("playerStart")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("saveComplete")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("saveRevert")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("resetvscroll"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshLeaderboards")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ViewGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("OpenLeaderboard"), create.ScriptText()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("OpenLeaderboardExt"), create.ScriptText(), create.Optional(create.Text())})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ClearLeaderboard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FriendReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerShowGroups")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RecentPlayerReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookPageRight")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookPageLeft")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("FacebookReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanStoreXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanClearXUID")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanGamerCard")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanFriendRequest")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanInvite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportOffensive")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportExploiter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportCheater")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("EliteClanReportBooster")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("coopPlayerShowGroups"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("simulateKeyPress"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("commerceShowStore")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteTypeMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteMap")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteGame")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshServers")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("RefreshFilter")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("closeJoin")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("StopRefresh")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("TrimRecipeName")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ResetRecipeList")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SelectServer")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("ShowCurrentServerTooltip")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("voteTempBan")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("addFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deleteFavorite")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PlayDemo")})); - AddSequence( - SequenceUiScriptStatement::Create({create.ScriptKeyword("SwitchSegmentTransition"), create.ScriptStrictInt(), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PreviewSegment")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("MoveSegment"), create.ScriptStrictInt()})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("DeleteSegment")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SetFocusOnSegmentButton")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("PopulateLocalDemoFileInformation")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadSaveGames"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LoadGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SaveGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ForceSave"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DelSaveGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SaveGameSort"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("playerStart"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("saveComplete"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("saveRevert"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("resetvscroll"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshLeaderboards"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ViewGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("OpenLeaderboard"), + create.ScriptText(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("OpenLeaderboardExt"), + create.ScriptText(), + create.Optional(create.Text()), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ClearLeaderboard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FriendReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerShowGroups"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RecentPlayerReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookPageRight"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookPageLeft"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("FacebookReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanStoreXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanClearXUID"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanGamerCard"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanFriendRequest"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanInvite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportOffensive"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportExploiter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportCheater"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("EliteClanReportBooster"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("coopPlayerShowGroups"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("simulateKeyPress"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("commerceShowStore"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteTypeMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteMap"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteGame"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshServers"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("RefreshFilter"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("closeJoin"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("StopRefresh"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("TrimRecipeName"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ResetRecipeList"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SelectServer"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("ShowCurrentServerTooltip"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("voteTempBan"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("addFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deleteFavorite"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PlayDemo"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SwitchSegmentTransition"), + create.ScriptStrictInt(), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PreviewSegment"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("MoveSegment"), + create.ScriptStrictInt(), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("DeleteSegment"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SetFocusOnSegmentButton"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("PopulateLocalDemoFileInformation"), + })); AddSequence(std::make_unique<SequenceOnlineVault>()); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("Playlist"), - create.Or({ - create.And({ - create.ScriptKeyword("Open"), - create.ScriptStrictInt(), - }), - create.ScriptKeyword("DoAction"), - create.ScriptKeyword("Close"), - create.ScriptKeyword("CloseAll"), - })})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("UpdateArenas")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("SortChallengesTop")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitesearch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitelaunch")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("xlaunchelitestore")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("LobbyShowGroups")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("addPlayerProfiles")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("createPlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("deletePlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("loadPlayerProfile")})); - AddSequence(SequenceUiScriptStatement::Create({create.ScriptKeyword("selectActivePlayerProfile")})); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("Playlist"), + create.Or({ + create.And({ + create.ScriptKeyword("Open"), + create.ScriptStrictInt(), + }), + create.ScriptKeyword("DoAction"), + create.ScriptKeyword("Close"), + create.ScriptKeyword("CloseAll"), + }), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("UpdateArenas"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("SortChallengesTop"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitesearch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitelaunch"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("xlaunchelitestore"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("LobbyShowGroups"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("addPlayerProfiles"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("createPlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("deletePlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("loadPlayerProfile"), + })); + AddSequence(SequenceUiScriptStatement::Create({ + create.ScriptKeyword("selectActivePlayerProfile"), + })); } } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp index bf749de03..5459a3dd6 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/FunctionScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp index d098304f6..ac44837f9 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericBoolPropertySequence.cpp @@ -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 diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp index 0ad92d427..53856cd10 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericColorPropertySequence.cpp @@ -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 }); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp index 08d9a3964..dd793646f 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericExpressionPropertySequence.cpp @@ -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); } diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp index e9156d618..4582e91b9 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericFloatingPointPropertySequence.cpp @@ -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 diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp index 39c68f375..131cbf005 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericMenuEventHandlerSetPropertySequence.cpp @@ -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 diff --git a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp index 8a800b6d3..c0faa0744 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/Generic/GenericStringPropertySequence.cpp @@ -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 diff --git a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp index 23e85c0cc..ec034cca1 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/GlobalScopeSequences.cpp @@ -14,7 +14,9 @@ namespace menu::global_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('}')}); + AddMatchers({ + create.Char('}'), + }); } protected: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp index a3f24a3db..cf6f6ad4a 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/ItemScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp index ec85215dd..8b8efced6 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/MenuScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp index 34f4de888..213e91438 100644 --- a/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp +++ b/src/ObjLoading/Parsing/Menu/Sequence/NoScopeSequences.cpp @@ -14,7 +14,9 @@ namespace menu::no_scope_sequences { const MenuMatcherFactory create(this); - AddMatchers({create.Char('{')}); + AddMatchers({ + create.Char('{'), + }); } protected: diff --git a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp index f0e7edcc8..12a29f29e 100644 --- a/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp +++ b/src/ObjLoading/StateMap/Parsing/StateMapParser.cpp @@ -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); - - AddMatchers({create.Or({create.Keyword("passthrough").Tag(TAG_PASSTHROUGH), create.Label(LABEL_VALUE_LIST).Tag(TAG_VALUE_LIST)}), - create.Char(';').Capture(CAPTURE_VALUE_END)}); + 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), + }); } 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*> entrySequences({new SequenceStateMapEntryClose(), new SequenceCondition()}); - - static std::vector<sequence_t*> ruleSequences({new SequenceCondition(), new SequenceValue()}); + static std::vector<sequence_t*> rootSequences({ + new SequenceStateMapEntry(), + }); + + static std::vector<sequence_t*> entrySequences({ + new SequenceStateMapEntryClose(), + new SequenceCondition(), + }); + + static std::vector<sequence_t*> ruleSequences({ + new SequenceCondition(), + new SequenceValue(), + }); if (m_state->m_in_entry) { diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp index ab11f31b6..e4100de8e 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataDefScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp index 5f93e0085..9ee63a2c3 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataEnumScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp index 2193bad02..db77583fc 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataNoScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp index 496589911..bde662ecc 100644 --- a/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp +++ b/src/ObjLoading/StructuredDataDef/Parsing/Sequence/StructuredDataStructScopeSequences.cpp @@ -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: diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp index f6c5e1375..f94e1a71f 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueNoScopeSequences.cpp @@ -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; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp index 009a51d5f..fca643b8b 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniquePassScopeSequences.cpp @@ -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(']')})), - - 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(';')}); + 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.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(';'), + }); } 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; } diff --git a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp index 9435cfdaa..c94d9f6e2 100644 --- a/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp +++ b/src/ObjLoading/Techset/Parsing/Sequence/TechniqueShaderScopeSequences.cpp @@ -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('.'), - - create.Or({create.And({create.Char('#'), create.Integer().Capture(CAPTURE_MATERIAL_HASH)}), - create.Identifier().Capture(CAPTURE_MATERIAL_NAME)})}) + .And({ + create.Keyword("material"), + create.Char('.'), + + 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; } diff --git a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp index 1314e332b..6b6f1b860 100644 --- a/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp +++ b/src/ObjLoading/Techset/Parsing/TechsetFileParser.cpp @@ -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; } diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp index 29a9a2941..0c894a2c4 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperLoadedSound.cpp @@ -21,12 +21,14 @@ void AssetDumperLoadedSound::DumpWavPcm(AssetDumpingContext& context, const Load const WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - WavFormatChunkPcm formatChunk{WavFormat::PCM, - static_cast<uint16_t>(asset->sound.info.channels), - asset->sound.info.rate, - asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, - static_cast<uint16_t>(asset->sound.info.block_size), - static_cast<uint16_t>(asset->sound.info.bits)}; + WavFormatChunkPcm formatChunk{ + WavFormat::PCM, + static_cast<uint16_t>(asset->sound.info.channels), + asset->sound.info.rate, + asset->sound.info.rate * asset->sound.info.channels * asset->sound.info.bits / 8, + static_cast<uint16_t>(asset->sound.info.block_size), + static_cast<uint16_t>(asset->sound.info.bits), + }; stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk)); const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, asset->sound.info.data_len}; diff --git a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp index f1314d065..0f90a158b 100644 --- a/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp +++ b/src/ObjWriting/Game/IW3/AssetDumpers/AssetDumperMaterial.cpp @@ -41,7 +41,7 @@ namespace IW3 const auto& entry = complexTable[index]; jArray.emplace_back(json{ {"real", entry.real}, - {"imag", entry.imag} + {"imag", entry.imag}, }); } } @@ -66,14 +66,24 @@ namespace IW3 {"winddir", std::vector(std::begin(water->winddir), std::end(water->winddir))}, {"amplitude", water->amplitude}, {"codeConstant", std::vector(std::begin(water->codeConstant), std::end(water->codeConstant))}, - {"image", water->image && water->image->name ? AssetName(water->image->name) : nullptr} + {"image", water->image && water->image->name ? AssetName(water->image->name) : nullptr}, }; } json BuildSamplerStateJson(unsigned char samplerState) { - static const char* samplerFilterNames[]{"none", "nearest", "linear", "aniso2x", "aniso4x"}; - static const char* samplerMipmapNames[]{"disabled", "nearest", "linear"}; + static const char* samplerFilterNames[]{ + "none", + "nearest", + "linear", + "aniso2x", + "aniso4x", + }; + static const char* samplerMipmapNames[]{ + "disabled", + "nearest", + "linear", + }; return json{ {"filter", ArrayEntry(samplerFilterNames, (samplerState & SAMPLER_FILTER_MASK) >> SAMPLER_FILTER_SHIFT)}, @@ -87,7 +97,19 @@ namespace IW3 json BuildTextureTableJson(const MaterialTextureDef* textureTable, const size_t count) { static const char* semanticNames[]{ - "2d", "function", "colorMap", "unused1", "unused2", "normalMap", "unused3", "unused4", "specularMap", "unused5", "unused6", "waterMap"}; + "2d", + "function", + "colorMap", + "unused1", + "unused2", + "normalMap", + "unused3", + "unused4", + "specularMap", + "unused5", + "unused6", + "waterMap", + }; auto jArray = json::array(); @@ -99,7 +121,7 @@ namespace IW3 json jEntry = { {"samplerState", BuildSamplerStateJson(entry.samplerState)}, - {"semantic", ArrayEntry(semanticNames, entry.semantic)} + {"semantic", ArrayEntry(semanticNames, entry.semantic)}, }; const auto knownMaterialSourceName = knownMaterialSourceNames.find(entry.nameHash); @@ -142,7 +164,7 @@ namespace IW3 { const auto& entry = constantTable[index]; json jEntry = { - {"literal", std::vector(std::begin(entry.literal), std::end(entry.literal))} + {"literal", std::vector(std::begin(entry.literal), std::end(entry.literal))}, }; const auto nameLen = strnlen(entry.name, std::extent_v<decltype(MaterialConstantDef::name)>); @@ -166,7 +188,7 @@ namespace IW3 { jEntry.merge_patch({ {"nameHash", entry.nameHash}, - {"namePart", fullLengthName} + {"namePart", fullLengthName}, }); } } @@ -198,7 +220,14 @@ namespace IW3 "destColor", "invDestColor", }; - static const char* blendOpNames[]{"disabled", "add", "subtract", "revSubtract", "min", "max"}; + static const char* blendOpNames[]{ + "disabled", + "add", + "subtract", + "revSubtract", + "min", + "max", + }; static const char* depthTestNames[]{ "always", "less", @@ -211,7 +240,16 @@ namespace IW3 "2", "shadowMap", }; - static const char* stencilOpNames[]{"keep", "zero", "replace", "incrSat", "decrSat", "invert", "incr", "decr"}; + static const char* stencilOpNames[]{ + "keep", + "zero", + "replace", + "incrSat", + "decrSat", + "invert", + "incr", + "decr", + }; auto jArray = json::array(); @@ -422,7 +460,7 @@ void AssetDumperMaterial::DumpAsset(AssetDumpingContext& context, XAssetInfo<Mat {"techniqueSet", material->techniqueSet && material->techniqueSet->name ? AssetName(material->techniqueSet->name) : nullptr}, {"textureTable", BuildTextureTableJson(material->textureTable, material->textureCount)}, {"constantTable", BuildConstantTableJson(material->constantTable, material->constantCount)}, - {"stateBitsTable", BuildStateBitsTableJson(material->stateBitsTable, material->stateBitsCount)} + {"stateBitsTable", BuildStateBitsTableJson(material->stateBitsTable, material->stateBitsCount)}, }; stream << std::setw(4) << j; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp index 3ceb26186..4849d6090 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperFontIcon.cpp @@ -23,105 +23,120 @@ class AssetDumperFontIconInternal }; inline static const std::string TYPE_ICON = "icon"; - inline static const std::string ICON_HEADERS[]{"# index", "# type", "# name", "# material", "# size", "# xScale", "# yScale"}; + inline static const std::string ICON_HEADERS[]{ + "# index", + "# type", + "# name", + "# material", + "# size", + "# xScale", + "# yScale", + }; inline static const std::string TYPE_ALIAS = "alias"; - inline static const std::string ALIAS_HEADERS[]{"# index", "# type", "# alias", "# button"}; - - inline static const KnownAlias KNOWN_ALIASES[]{KnownAlias("BUTTON_ADS"), - KnownAlias("BUTTON_CAC_NEXT"), - KnownAlias("BUTTON_CAC_PREV"), - KnownAlias("BUTTON_CANCEL"), - KnownAlias("BUTTON_CAROUSEL_STICK"), - KnownAlias("BUTTON_CREATE"), - KnownAlias("BUTTON_CYCLE_LEFT"), - KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), - KnownAlias("BUTTON_CYCLE_RIGHT"), - KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), - KnownAlias("BUTTON_DELETE"), - KnownAlias("BUTTON_EDIT"), - KnownAlias("BUTTON_EMBLEM_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_FLIP"), - KnownAlias("BUTTON_EMBLEM_FORWARD"), - KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), - KnownAlias("BUTTON_EMBLEM_MOVE"), - KnownAlias("BUTTON_EMBLEM_OUTLINE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), - KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), - KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), - KnownAlias("BUTTON_EMBLEM_RESET"), - KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), - KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), - KnownAlias("BUTTON_EMBLEM_SCALE"), - KnownAlias("BUTTON_FIRE"), - KnownAlias("BUTTON_FRIENDSLIST"), - KnownAlias("BUTTON_INTERACT"), - KnownAlias("BUTTON_LOOKSTICK"), - KnownAlias("BUTTON_LOOK"), - KnownAlias("BUTTON_LUI_ALT1"), - KnownAlias("BUTTON_LUI_ALT2"), - KnownAlias("BUTTON_LUI_DPAD_ALL"), - KnownAlias("BUTTON_LUI_DPAD_D"), - KnownAlias("BUTTON_LUI_DPAD_L"), - KnownAlias("BUTTON_LUI_DPAD_RL"), - KnownAlias("BUTTON_LUI_DPAD_R"), - KnownAlias("BUTTON_LUI_DPAD_UD"), - KnownAlias("BUTTON_LUI_DPAD_U"), - KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), - KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), - KnownAlias("BUTTON_LUI_PRIMARY"), - KnownAlias("BUTTON_LUI_RIGHT_STICK"), - KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), - KnownAlias("BUTTON_LUI_SECONDARY"), - KnownAlias("BUTTON_LUI_SELECT"), - KnownAlias("BUTTON_LUI_SHOULDERL"), - KnownAlias("BUTTON_LUI_SHOULDERR"), - KnownAlias("BUTTON_LUI_START"), - KnownAlias("BUTTON_MOUSE_CLICK"), - KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), - KnownAlias("BUTTON_MOUSE_EDIT"), - KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), - KnownAlias("BUTTON_MOUSE_LEFT"), - KnownAlias("BUTTON_MOUSE_MIDDLE"), - KnownAlias("BUTTON_MOUSE_RIGHT"), - KnownAlias("BUTTON_MOVESTICK"), - KnownAlias("BUTTON_MOVE"), - KnownAlias("BUTTON_MP_CANCELCOMMAND"), - KnownAlias("BUTTON_MP_CHANGESETTINGS"), - KnownAlias("BUTTON_MP_GAMERCARD"), - KnownAlias("BUTTON_MP_GAMERREVIEW"), - KnownAlias("BUTTON_MP_JOINGAME"), - KnownAlias("BUTTON_MP_KICKPLAYER"), - KnownAlias("BUTTON_MP_LEAVEGAME"), - KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), - KnownAlias("BUTTON_MP_NOTREADY"), - KnownAlias("BUTTON_MP_PGDOWN"), - KnownAlias("BUTTON_MP_PGUP"), - KnownAlias("BUTTON_MP_READY"), - KnownAlias("BUTTON_MP_REFRESH"), - KnownAlias("BUTTON_MP_SCOREBOARD"), - KnownAlias("BUTTON_MP_SIGNIN"), - KnownAlias("BUTTON_MP_SPECNEXT"), - KnownAlias("BUTTON_MP_SPECPREV"), - KnownAlias("BUTTON_MP_STARTGAME"), - KnownAlias("BUTTON_MP_TOGGLECHASECAM"), - KnownAlias("BUTTON_MP_TOGGLEVIEW"), - KnownAlias("BUTTON_NO"), - KnownAlias("BUTTON_RECORD_VIEW_NEXT"), - KnownAlias("BUTTON_RECORD_VIEW_PREV"), - KnownAlias("BUTTON_SELECTCHOICE"), - KnownAlias("BUTTON_SP_TOGGLEMENU"), - KnownAlias("BUTTON_YES"), - KnownAlias("CP"), - KnownAlias("FONT_CAPITAL_I"), - KnownAlias("FONT_NUMBER_ZERO"), - KnownAlias("KEY_DOWN_ARROW"), - KnownAlias("KEY_LEFT_ARROW"), - KnownAlias("KEY_RIGHT_ARROW"), - KnownAlias("KEY_UP_ARROW"), - KnownAlias("MOUSE_WHEEL_DOWN"), - KnownAlias("MOUSE_WHEEL_UP"), - KnownAlias("Remote_LStick")}; + inline static const std::string ALIAS_HEADERS[]{ + "# index", + "# type", + "# alias", + "# button", + }; + + inline static const KnownAlias KNOWN_ALIASES[]{ + KnownAlias("BUTTON_ADS"), + KnownAlias("BUTTON_CAC_NEXT"), + KnownAlias("BUTTON_CAC_PREV"), + KnownAlias("BUTTON_CANCEL"), + KnownAlias("BUTTON_CAROUSEL_STICK"), + KnownAlias("BUTTON_CREATE"), + KnownAlias("BUTTON_CYCLE_LEFT"), + KnownAlias("BUTTON_CYCLE_LEFT_ACTIVE"), + KnownAlias("BUTTON_CYCLE_RIGHT"), + KnownAlias("BUTTON_CYCLE_RIGHT_ACTIVE"), + KnownAlias("BUTTON_DELETE"), + KnownAlias("BUTTON_EDIT"), + KnownAlias("BUTTON_EMBLEM_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_FLIP"), + KnownAlias("BUTTON_EMBLEM_FORWARD"), + KnownAlias("BUTTON_EMBLEM_FORWARD_BACKWARD"), + KnownAlias("BUTTON_EMBLEM_MOVE"), + KnownAlias("BUTTON_EMBLEM_OUTLINE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_CYCLE"), + KnownAlias("BUTTON_EMBLEM_PALETTE_NEXT"), + KnownAlias("BUTTON_EMBLEM_PALETTE_PREV"), + KnownAlias("BUTTON_EMBLEM_RESET"), + KnownAlias("BUTTON_EMBLEM_ROTATE_LEFT"), + KnownAlias("BUTTON_EMBLEM_ROTATE_RIGHT"), + KnownAlias("BUTTON_EMBLEM_SCALE"), + KnownAlias("BUTTON_FIRE"), + KnownAlias("BUTTON_FRIENDSLIST"), + KnownAlias("BUTTON_INTERACT"), + KnownAlias("BUTTON_LOOKSTICK"), + KnownAlias("BUTTON_LOOK"), + KnownAlias("BUTTON_LUI_ALT1"), + KnownAlias("BUTTON_LUI_ALT2"), + KnownAlias("BUTTON_LUI_DPAD_ALL"), + KnownAlias("BUTTON_LUI_DPAD_D"), + KnownAlias("BUTTON_LUI_DPAD_L"), + KnownAlias("BUTTON_LUI_DPAD_RL"), + KnownAlias("BUTTON_LUI_DPAD_R"), + KnownAlias("BUTTON_LUI_DPAD_UD"), + KnownAlias("BUTTON_LUI_DPAD_U"), + KnownAlias("BUTTON_LUI_LEFT_STICK_UP"), + KnownAlias("BUTTON_LUI_LEFT_TRIGGER"), + KnownAlias("BUTTON_LUI_PRIMARY"), + KnownAlias("BUTTON_LUI_RIGHT_STICK"), + KnownAlias("BUTTON_LUI_RIGHT_TRIGGER"), + KnownAlias("BUTTON_LUI_SECONDARY"), + KnownAlias("BUTTON_LUI_SELECT"), + KnownAlias("BUTTON_LUI_SHOULDERL"), + KnownAlias("BUTTON_LUI_SHOULDERR"), + KnownAlias("BUTTON_LUI_START"), + KnownAlias("BUTTON_MOUSE_CLICK"), + KnownAlias("BUTTON_MOUSE_CLICK_ACTIVE"), + KnownAlias("BUTTON_MOUSE_EDIT"), + KnownAlias("BUTTON_MOUSE_EDIT_ACTIVE"), + KnownAlias("BUTTON_MOUSE_LEFT"), + KnownAlias("BUTTON_MOUSE_MIDDLE"), + KnownAlias("BUTTON_MOUSE_RIGHT"), + KnownAlias("BUTTON_MOVESTICK"), + KnownAlias("BUTTON_MOVE"), + KnownAlias("BUTTON_MP_CANCELCOMMAND"), + KnownAlias("BUTTON_MP_CHANGESETTINGS"), + KnownAlias("BUTTON_MP_GAMERCARD"), + KnownAlias("BUTTON_MP_GAMERREVIEW"), + KnownAlias("BUTTON_MP_JOINGAME"), + KnownAlias("BUTTON_MP_KICKPLAYER"), + KnownAlias("BUTTON_MP_LEAVEGAME"), + KnownAlias("BUTTON_MP_LOBBY_GAMERCARD"), + KnownAlias("BUTTON_MP_NOTREADY"), + KnownAlias("BUTTON_MP_PGDOWN"), + KnownAlias("BUTTON_MP_PGUP"), + KnownAlias("BUTTON_MP_READY"), + KnownAlias("BUTTON_MP_REFRESH"), + KnownAlias("BUTTON_MP_SCOREBOARD"), + KnownAlias("BUTTON_MP_SIGNIN"), + KnownAlias("BUTTON_MP_SPECNEXT"), + KnownAlias("BUTTON_MP_SPECPREV"), + KnownAlias("BUTTON_MP_STARTGAME"), + KnownAlias("BUTTON_MP_TOGGLECHASECAM"), + KnownAlias("BUTTON_MP_TOGGLEVIEW"), + KnownAlias("BUTTON_NO"), + KnownAlias("BUTTON_RECORD_VIEW_NEXT"), + KnownAlias("BUTTON_RECORD_VIEW_PREV"), + KnownAlias("BUTTON_SELECTCHOICE"), + KnownAlias("BUTTON_SP_TOGGLEMENU"), + KnownAlias("BUTTON_YES"), + KnownAlias("CP"), + KnownAlias("FONT_CAPITAL_I"), + KnownAlias("FONT_NUMBER_ZERO"), + KnownAlias("KEY_DOWN_ARROW"), + KnownAlias("KEY_LEFT_ARROW"), + KnownAlias("KEY_RIGHT_ARROW"), + KnownAlias("KEY_UP_ARROW"), + KnownAlias("MOUSE_WHEEL_DOWN"), + KnownAlias("MOUSE_WHEEL_UP"), + KnownAlias("Remote_LStick"), + }; CsvOutputStream m_csv; diff --git a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp index 50b321053..b72dabfa8 100644 --- a/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp +++ b/src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp @@ -85,7 +85,17 @@ namespace "devraw/", }; - constexpr size_t FRAME_RATE_FOR_INDEX[]{8000, 12000, 16000, 24000, 32000, 44100, 48000, 96000, 192000}; + constexpr size_t FRAME_RATE_FOR_INDEX[]{ + 8000, + 12000, + 16000, + 24000, + 32000, + 44100, + 48000, + 96000, + 192000, + }; } // namespace class AssetDumperSndBank::Internal diff --git a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp index 64e0dc101..c8b963959 100644 --- a/src/ObjWriting/Model/XModel/XModelExportWriter.cpp +++ b/src/ObjWriting/Model/XModel/XModelExportWriter.cpp @@ -129,9 +129,11 @@ class XModelExportWriter6 final : public XModelExportWriterBase stream << "NUMFACES " << m_faces.size() << "\n"; for (const auto& face : m_faces) { - const size_t distinctPositions[3]{m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), - m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2])}; + const size_t distinctPositions[3]{ + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[0]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[1]), + m_vertex_merger.GetDistinctPositionByInputPosition(face.vertexIndex[2]), + }; const XModelVertex& v0 = m_vertices[face.vertexIndex[0]]; const XModelVertex& v1 = m_vertices[face.vertexIndex[1]]; diff --git a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp index 98a745c68..f97318b05 100644 --- a/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp +++ b/src/ObjWriting/ObjContainer/IPak/IPakWriter.cpp @@ -82,18 +82,26 @@ class IPakWriterImpl final : public IPakWriter const IPakHeader header{ipak_consts::IPAK_MAGIC, ipak_consts::IPAK_VERSION, static_cast<uint32_t>(m_total_size), SECTION_COUNT}; - const IPakSection dataSection{ipak_consts::IPAK_DATA_SECTION, - static_cast<uint32_t>(m_data_section_offset), - static_cast<uint32_t>(m_data_section_size), - static_cast<uint32_t>(m_index_entries.size())}; - - const IPakSection indexSection{ipak_consts::IPAK_INDEX_SECTION, - static_cast<uint32_t>(m_index_section_offset), - static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), - static_cast<uint32_t>(m_index_entries.size())}; + const IPakSection dataSection{ + ipak_consts::IPAK_DATA_SECTION, + static_cast<uint32_t>(m_data_section_offset), + static_cast<uint32_t>(m_data_section_size), + static_cast<uint32_t>(m_index_entries.size()), + }; + + const IPakSection indexSection{ + ipak_consts::IPAK_INDEX_SECTION, + static_cast<uint32_t>(m_index_section_offset), + static_cast<uint32_t>(sizeof(IPakIndexEntry) * m_index_entries.size()), + static_cast<uint32_t>(m_index_entries.size()), + }; const IPakSection brandingSection{ - ipak_consts::IPAK_BRANDING_SECTION, static_cast<uint32_t>(m_branding_section_offset), std::extent_v<decltype(BRANDING)>, 1}; + ipak_consts::IPAK_BRANDING_SECTION, + static_cast<uint32_t>(m_branding_section_offset), + std::extent_v<decltype(BRANDING)>, + 1, + }; Write(&header, sizeof(header)); Write(&dataSection, sizeof(dataSection)); diff --git a/src/ObjWriting/ObjWriting.cpp b/src/ObjWriting/ObjWriting.cpp index ca028755f..46627e65d 100644 --- a/src/ObjWriting/ObjWriting.cpp +++ b/src/ObjWriting/ObjWriting.cpp @@ -9,7 +9,13 @@ ObjWriting::Configuration_t ObjWriting::Configuration; -const IZoneDumper* const ZONE_DUMPER[]{new IW3::ZoneDumper(), new IW4::ZoneDumper(), new IW5::ZoneDumper(), new T5::ZoneDumper(), new T6::ZoneDumper()}; +const IZoneDumper* const ZONE_DUMPER[]{ + new IW3::ZoneDumper(), + new IW4::ZoneDumper(), + new IW5::ZoneDumper(), + new T5::ZoneDumper(), + new T6::ZoneDumper(), +}; bool ObjWriting::DumpZone(AssetDumpingContext& context) { diff --git a/src/ObjWriting/Sound/WavWriter.cpp b/src/ObjWriting/Sound/WavWriter.cpp index 6f5caa9cc..6d0a5ae71 100644 --- a/src/ObjWriting/Sound/WavWriter.cpp +++ b/src/ObjWriting/Sound/WavWriter.cpp @@ -19,12 +19,14 @@ void WavWriter::WritePcmHeader(const WavMetaData& metaData, const size_t dataLen constexpr WavChunkHeader formatChunkHeader{WAV_CHUNK_ID_FMT, sizeof(WavFormatChunkPcm)}; m_stream.write(reinterpret_cast<const char*>(&formatChunkHeader), sizeof(formatChunkHeader)); - const WavFormatChunkPcm formatChunk{WavFormat::PCM, - static_cast<uint16_t>(metaData.channelCount), - metaData.samplesPerSec, - metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, - static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), - static_cast<uint16_t>(metaData.bitsPerSample)}; + const WavFormatChunkPcm formatChunk{ + WavFormat::PCM, + static_cast<uint16_t>(metaData.channelCount), + metaData.samplesPerSec, + metaData.samplesPerSec * metaData.channelCount * metaData.bitsPerSample / 8, + static_cast<uint16_t>(metaData.channelCount * (metaData.bitsPerSample / 8)), + static_cast<uint16_t>(metaData.bitsPerSample), + }; m_stream.write(reinterpret_cast<const char*>(&formatChunk), sizeof(formatChunk)); const WavChunkHeader dataChunkHeader{WAV_CHUNK_ID_DATA, dataLen}; diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp index 4cd1175e1..649130e45 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionBinaryOperation.cpp @@ -404,7 +404,8 @@ const SimpleExpressionBinaryOperationType* const SimpleExpressionBinaryOperation &OPERATION_EQUALS, &OPERATION_NOT_EQUAL, &OPERATION_AND, - &OPERATION_OR}; + &OPERATION_OR, +}; SimpleExpressionBinaryOperation::SimpleExpressionBinaryOperation(const SimpleExpressionBinaryOperationType* operationType, std::unique_ptr<ISimpleExpression> operand1, diff --git a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp index a6d571fd0..7a3e3b986 100644 --- a/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp +++ b/src/Parser/Parsing/Simple/Expression/SimpleExpressionMatchers.cpp @@ -298,7 +298,11 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P if (hasAddOperation && hasSubtractOperation) { - binaryOperationsMatchers.emplace_back(create.Or({create.IntegerWithSign(), create.FloatingPointWithSign()}) + binaryOperationsMatchers.emplace_back(create + .Or({ + create.IntegerWithSign(), + create.FloatingPointWithSign(), + }) .NoConsume() .Transform( [](const SimpleMatcherFactory::token_list_t& values) @@ -360,11 +364,13 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::P if (!m_enable_conditional_operator) return create.False(); - return create.And({create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), - create.Label(LABEL_EXPRESSION), - create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), - create.Label(LABEL_EXPRESSION), - create.True().Tag(TAG_CONDITIONAL_OPERATOR_END)}); + return create.And({ + create.Char('?').Tag(TAG_CONDITIONAL_OPERATOR), + create.Label(LABEL_EXPRESSION), + create.Char(':').Tag(TAG_CONDITIONAL_OPERATOR_SEPARATOR), + create.Label(LABEL_EXPRESSION), + create.True().Tag(TAG_CONDITIONAL_OPERATOR_END), + }); } std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::Expression(const supplier_t* labelSupplier) const @@ -372,11 +378,32 @@ std::unique_ptr<SimpleExpressionMatchers::matcher_t> SimpleExpressionMatchers::E const SimpleMatcherFactory create(labelSupplier); return create - .And({create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), - create.Or({create.And({create.Char('('), create.Label(LABEL_EXPRESSION), create.Char(')').Tag(TAG_PARENTHESIS_END)}).Tag(TAG_PARENTHESIS), - create.And({create.True().Tag(TAG_OPERAND_EXT), ParseOperandExtension(labelSupplier), create.True().Tag(TAG_OPERAND_EXT_END)}), - ParseOperand(labelSupplier)}), - create.Optional(create.Or({ParseConditionalOperator(labelSupplier), - create.And({ParseBinaryOperationType(labelSupplier), create.Label(LABEL_EXPRESSION)}).Tag(TAG_BINARY_OPERATION)}))}) + .And({ + create.OptionalLoop(ParseUnaryOperationType(labelSupplier)), + create.Or({ + create + .And({ + create.Char('('), + create.Label(LABEL_EXPRESSION), + create.Char(')').Tag(TAG_PARENTHESIS_END), + }) + .Tag(TAG_PARENTHESIS), + create.And({ + create.True().Tag(TAG_OPERAND_EXT), + ParseOperandExtension(labelSupplier), + create.True().Tag(TAG_OPERAND_EXT_END), + }), + ParseOperand(labelSupplier), + }), + create.Optional(create.Or({ + ParseConditionalOperator(labelSupplier), + create + .And({ + ParseBinaryOperationType(labelSupplier), + create.Label(LABEL_EXPRESSION), + }) + .Tag(TAG_BINARY_OPERATION), + })), + }) .Tag(TAG_EXPRESSION); } diff --git a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp index 01a9b09a8..6f8ba50cb 100644 --- a/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp +++ b/src/Parser/Parsing/Simple/SimpleExpressionInterpreter.cpp @@ -47,7 +47,9 @@ class SimpleExpressionInterpreterParser final : public AbstractParser<SimplePars protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> sequences{new SimpleExpressionInterpreterExpressionSequence()}; + static std::vector<sequence_t*> sequences{ + new SimpleExpressionInterpreterExpressionSequence(), + }; return sequences; } }; diff --git a/src/Unlinker/UnlinkerArgs.cpp b/src/Unlinker/UnlinkerArgs.cpp index 3802354a3..5c7bfaa02 100644 --- a/src/Unlinker/UnlinkerArgs.cpp +++ b/src/Unlinker/UnlinkerArgs.cpp @@ -8,97 +8,125 @@ #include <regex> #include <type_traits> +// clang-format off const CommandLineOption* const OPTION_HELP = - CommandLineOption::Builder::Create().WithShortName("?").WithLongName("help").WithDescription("Displays usage information.").Build(); + CommandLineOption::Builder::Create() + .WithShortName("?") + .WithLongName("help") + .WithDescription("Displays usage information.") + .Build(); const CommandLineOption* const OPTION_VERBOSE = - CommandLineOption::Builder::Create().WithShortName("v").WithLongName("verbose").WithDescription("Outputs a lot more and more detailed messages.").Build(); + CommandLineOption::Builder::Create() + .WithShortName("v") + .WithLongName("verbose") + .WithDescription("Outputs a lot more and more detailed messages.") + .Build(); const CommandLineOption* const OPTION_MINIMAL_ZONE_FILE = CommandLineOption::Builder::Create() - .WithShortName("min") - .WithLongName("minimal-zone") - .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") - .Build(); - -const CommandLineOption* const OPTION_LOAD = CommandLineOption::Builder::Create() - .WithShortName("l") - .WithLongName("load") - .WithDescription("Loads an existing zone before trying to unlink any zone.") - .WithParameter("zonePath") - .Reusable() - .Build(); + .WithShortName("min") + .WithLongName("minimal-zone") + .WithDescription("Minimizes the size of the zone file output by only including assets that are not a dependency of another asset.") + .Build(); + +const CommandLineOption* const OPTION_LOAD = + CommandLineOption::Builder::Create() + .WithShortName("l") + .WithLongName("load") + .WithDescription("Loads an existing zone before trying to unlink any zone.") + .WithParameter("zonePath") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LIST = - CommandLineOption::Builder::Create().WithLongName("list").WithDescription("Lists the contents of a zone instead of writing them to the disk.").Build(); + CommandLineOption::Builder::Create() + .WithLongName("list") + .WithDescription("Lists the contents of a zone instead of writing them to the disk.") + .Build(); const CommandLineOption* const OPTION_OUTPUT_FOLDER = CommandLineOption::Builder::Create() - .WithShortName("o") - .WithLongName("output-folder") - .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" - + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") - .WithParameter("outputFolderPath") - .Build(); - -const CommandLineOption* const OPTION_SEARCH_PATH = CommandLineOption::Builder::Create() - .WithLongName("search-path") - .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") - .WithParameter("searchPathString") - .Build(); - -const CommandLineOption* const OPTION_IMAGE_FORMAT = CommandLineOption::Builder::Create() - .WithLongName("image-format") - .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") - .WithParameter("imageFormatValue") - .Build(); - -const CommandLineOption* const OPTION_MODEL_FORMAT = CommandLineOption::Builder::Create() - .WithLongName("model-format") - .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") - .WithParameter("modelFormatValue") - .Build(); + .WithShortName("o") + .WithLongName("output-folder") + .WithDescription("Specifies the output folder containing the contents of the unlinked zones. Defaults to \"" + + std::string(UnlinkerArgs::DEFAULT_OUTPUT_FOLDER) + "\"") + .WithParameter("outputFolderPath") + .Build(); + +const CommandLineOption* const OPTION_SEARCH_PATH = + CommandLineOption::Builder::Create() + .WithLongName("search-path") + .WithDescription("Specifies a semi-colon separated list of paths to search for additional game files.") + .WithParameter("searchPathString") + .Build(); + +const CommandLineOption* const OPTION_IMAGE_FORMAT = + CommandLineOption::Builder::Create() + .WithLongName("image-format") + .WithDescription("Specifies the format of dumped image files. Valid values are: DDS, IWI") + .WithParameter("imageFormatValue") + .Build(); + +const CommandLineOption* const OPTION_MODEL_FORMAT = + CommandLineOption::Builder::Create() + .WithLongName("model-format") + .WithDescription("Specifies the format of dumped model files. Valid values are: XMODEL_EXPORT, OBJ") + .WithParameter("modelFormatValue") + .Build(); const CommandLineOption* const OPTION_SKIP_OBJ = - CommandLineOption::Builder::Create().WithLongName("skip-obj").WithDescription("Skips loading raw obj data.").Build(); + CommandLineOption::Builder::Create() + .WithLongName("skip-obj") + .WithDescription("Skips loading raw obj data.") + .Build(); const CommandLineOption* const OPTION_GDT = - CommandLineOption::Builder::Create().WithLongName("gdt").WithDescription("Dumps assets in a GDT whenever possible.").Build(); - -const CommandLineOption* const OPTION_EXCLUDE_ASSETS = CommandLineOption::Builder::Create() - .WithLongName("exclude-assets") - .WithDescription("Specify all asset types that should be excluded.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); - -const CommandLineOption* const OPTION_INCLUDE_ASSETS = CommandLineOption::Builder::Create() - .WithLongName("include-assets") - .WithDescription("Specify all asset types that should be included.") - .WithParameter("assetTypeList") - .Reusable() - .Build(); + CommandLineOption::Builder::Create() + .WithLongName("gdt") + .WithDescription("Dumps assets in a GDT whenever possible.") + .Build(); + +const CommandLineOption* const OPTION_EXCLUDE_ASSETS = + CommandLineOption::Builder::Create() + .WithLongName("exclude-assets") + .WithDescription("Specify all asset types that should be excluded.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); + +const CommandLineOption* const OPTION_INCLUDE_ASSETS = + CommandLineOption::Builder::Create() + .WithLongName("include-assets") + .WithDescription("Specify all asset types that should be included.") + .WithParameter("assetTypeList") + .Reusable() + .Build(); const CommandLineOption* const OPTION_LEGACY_MENUS = CommandLineOption::Builder::Create() - .WithLongName("legacy-menus") - .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") - .Build(); - -const CommandLineOption* const COMMAND_LINE_OPTIONS[]{OPTION_HELP, - OPTION_VERBOSE, - OPTION_MINIMAL_ZONE_FILE, - OPTION_LOAD, - OPTION_LIST, - OPTION_OUTPUT_FOLDER, - OPTION_SEARCH_PATH, - OPTION_IMAGE_FORMAT, - OPTION_MODEL_FORMAT, - OPTION_SKIP_OBJ, - OPTION_GDT, - OPTION_EXCLUDE_ASSETS, - OPTION_INCLUDE_ASSETS, - OPTION_LEGACY_MENUS}; + .WithLongName("legacy-menus") + .WithDescription("Dumps menus with a compatibility mode to work with applications not compatible with the newer dumping mode.") + .Build(); + +// clang-format on + +const CommandLineOption* const COMMAND_LINE_OPTIONS[]{ + OPTION_HELP, + OPTION_VERBOSE, + OPTION_MINIMAL_ZONE_FILE, + OPTION_LOAD, + OPTION_LIST, + OPTION_OUTPUT_FOLDER, + OPTION_SEARCH_PATH, + OPTION_IMAGE_FORMAT, + OPTION_MODEL_FORMAT, + OPTION_SKIP_OBJ, + OPTION_GDT, + OPTION_EXCLUDE_ASSETS, + OPTION_INCLUDE_ASSETS, + OPTION_LEGACY_MENUS, +}; UnlinkerArgs::UnlinkerArgs() : m_argument_parser(COMMAND_LINE_OPTIONS, std::extent_v<decltype(COMMAND_LINE_OPTIONS)>), diff --git a/src/Utils/Math/Matrix.h b/src/Utils/Math/Matrix.h index 9810a344b..4bbd96f1a 100644 --- a/src/Utils/Math/Matrix.h +++ b/src/Utils/Math/Matrix.h @@ -10,7 +10,7 @@ template<typename T> class Matrix {T(1.0), 0, 0, 0 }, {0, T(1.0), 0, 0 }, {0, 0, T(1.0), 0 }, - {0, 0, 0, T(1.0)} + {0, 0, 0, T(1.0)}, } { } @@ -20,7 +20,7 @@ template<typename T> class Matrix {d00, d01, d02, d03}, {d10, d11, d12, d13}, {d20, d21, d22, d23}, - {d30, d31, d32, d33} + {d30, d31, d32, d33}, } { } diff --git a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp index baa482891..f032fbc40 100644 --- a/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp +++ b/src/ZoneCodeGeneratorLib/Domain/Evaluation/OperationType.cpp @@ -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, +}; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp index 4f634b577..f86e1f8f0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Impl/CommandsParser.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp index c25d4a376..032ff879d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Matcher/CommandsCommonMatchers.cpp @@ -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; - - 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(); - - 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 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)]; + } + + 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(); + + 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); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp index 85451c486..bc7a9d30a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAction.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp index 36709e8d2..9048380a8 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAllocAlign.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp index 38244c446..e3cde76ad 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArchitecture.cpp @@ -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; diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp index 2ae1a944d..50d41bb16 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArrayCount.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp index 91bd363c0..1a8f5dd15 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceArraySize.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp index 0cf06711b..559820a97 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceAsset.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp index 2e3381900..2bbcfaef0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceBlock.cpp @@ -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) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp index dd2e7566b..98f6f2975 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCondition.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp index 38aee31a1..b05cc6e91 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceCount.cpp @@ -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, diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp index 7ef01077c..56b9718bd 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceGame.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp index 73489fe05..efeb5b006 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceName.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp index 4244b33de..58365f3d7 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReorder.cpp @@ -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) diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp index deafe3970..8c1aece92 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceReusable.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp index e2c1dc65e..54c52aa09 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceScriptString.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp index bb9a03070..066565f0f 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceSetBlock.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp index a82092ac9..79405a322 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceString.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp index 3ba7cffff..b223ce940 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Commands/Sequence/SequenceUse.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp index 8f09895d3..5a147599b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockEnum.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp index 1fce375f7..6d7b60507 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNamespace.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp index 02cf11f88..330cb6e77 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockNone.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp index 2a07ab7f2..90ca7e6c0 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockStruct.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp index f3570ae0e..13767f26d 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Block/HeaderBlockUnion.cpp @@ -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; } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp index 3b7482d50..90969e85a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Matcher/HeaderCommonMatchers.cpp @@ -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())); + }), + }); } diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp index 16aeedae7..668e2b26a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceCloseBlock.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp index e5e0cee7c..b95330816 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnum.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp index 1ea705390..607276169 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceEnumMember.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp index 161d56807..ed71388ac 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceForwardDecl.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp index f40e6c7ec..d878a7f5a 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceNamespace.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp index dda29228d..60a6a1542 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceStruct.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp index 7b3995730..f56579b18 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceTypedef.cpp @@ -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.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)})}); + 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); + + 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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp index a685b9632..ce7c0045b 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceUnion.cpp @@ -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 diff --git a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp index da19809ae..ea9c8d9dd 100644 --- a/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp +++ b/src/ZoneCodeGeneratorLib/Parsing/Header/Sequence/SequenceVariable.cpp @@ -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.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)})); + 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); + + 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 diff --git a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp index b05195335..5ddea61de 100644 --- a/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp +++ b/src/ZoneCommon/Game/IW4/GameAssetPoolIW4.cpp @@ -9,11 +9,12 @@ using namespace IW4; const char* GameAssetPoolIW4::ASSET_TYPE_NAMES[]{ - "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", - "image", "sound", "soundcurve", "loadedsound", "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", - "fxworld", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", - "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", - "tracer", "vehicle", "addonmapents"}; + "physpreset", "physcollmap", "xanim", "xmodelsurfs", "xmodel", "material", "pixelshader", "vertexshader", "vertexdecl", "techniqueset", + "image", "sound", "soundcurve", "loadedsound", "clipmap", "clipmap", "comworld", "gameworldsp", "gameworldmp", "mapents", + "fxworld", "gfxworld", "lightdef", "uimap", "font", "menulist", "menu", "localize", "weapon", "snddriverglobals", + "fx", "impactfx", "aitype", "mptype", "character", "xmodelalias", "rawfile", "stringtable", "leaderboard", "structureddatadef", + "tracer", "vehicle", "addonmapents", +}; /* Asset Pool Table diff --git a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h index 8b6cbee48..42a334cdf 100644 --- a/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h +++ b/src/ZoneCommon/Game/IW4/ZoneConstantsIW4.h @@ -37,7 +37,8 @@ namespace IW4 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, - 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01, + }; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; diff --git a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp index ceb8e3bcb..673c9a7af 100644 --- a/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp +++ b/src/ZoneCommon/Game/IW5/GameAssetPoolIW5.cpp @@ -8,52 +8,54 @@ using namespace IW5; -const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[]{"physpreset", - "physcollmap", - "xanim", - "xmodelsurfs", - "xmodel", - "material", - "pixelshader", - "vertexshader", - "vertexdecl", - "techniqueset", - "image", - "sound", - "soundcurve", - "loadedsound", - "clipmap", - "comworld", - "glassworld", - "pathdata", - "vehicletrack", - "mapents", - "fxworld", - "gfxworld", - "lightdef", - "uimap", - "font", - "menulist", - "menu", - "localize", - "attachment", - "weapon", - "snddriverglobals", - "fx", - "impactfx", - "surfacefx", - "aitype", - "mptype", - "character", - "xmodelalias", - "rawfile", - "scriptfile", - "stringtable", - "leaderboard", - "structureddatadef", - "tracer", - "vehicle", - "addonmapents"}; +const char* GameAssetPoolIW5::ASSET_TYPE_NAMES[]{ + "physpreset", + "physcollmap", + "xanim", + "xmodelsurfs", + "xmodel", + "material", + "pixelshader", + "vertexshader", + "vertexdecl", + "techniqueset", + "image", + "sound", + "soundcurve", + "loadedsound", + "clipmap", + "comworld", + "glassworld", + "pathdata", + "vehicletrack", + "mapents", + "fxworld", + "gfxworld", + "lightdef", + "uimap", + "font", + "menulist", + "menu", + "localize", + "attachment", + "weapon", + "snddriverglobals", + "fx", + "impactfx", + "surfacefx", + "aitype", + "mptype", + "character", + "xmodelalias", + "rawfile", + "scriptfile", + "stringtable", + "leaderboard", + "structureddatadef", + "tracer", + "vehicle", + "addonmapents", +}; /* Asset Pool Table diff --git a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h index 618b2ab79..27f6b9f51 100644 --- a/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h +++ b/src/ZoneCommon/Game/IW5/ZoneConstantsIW5.h @@ -34,7 +34,8 @@ namespace IW5 0x89, 0x76, 0x11, 0xFD, 0x1B, 0x83, 0xE4, 0xE8, 0x8E, 0x7E, 0xB4, 0x03, 0xA3, 0x29, 0xDD, 0x4F, 0xAC, 0x99, 0xBE, 0x7C, 0xD3, 0xFD, 0x14, 0x28, 0x1C, 0x59, 0x69, 0xE0, 0x79, 0x5F, 0x4B, 0xDA, 0x6B, 0xAB, 0x48, 0x4E, 0x28, 0x39, 0x84, 0xC6, 0x2B, 0xC6, 0x20, 0x05, 0xDB, 0x05, 0x21, 0xC3, 0xE1, 0xD4, 0x20, 0x28, 0xDD, 0x3A, 0x4D, 0x51, 0xE7, 0x49, 0x8A, 0x49, 0xEF, 0xF5, 0xDA, 0xDA, 0x7D, 0x5D, 0xA8, 0x0B, 0xA1, - 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x77, 0xCD, 0x62, 0x7D, 0x9D, 0x40, 0x26, 0x44, 0x4B, 0x3B, 0x0A, 0x89, 0x02, 0x03, 0x01, 0x00, 0x01, + }; static constexpr size_t AUTHED_CHUNK_SIZE = 0x2000; static constexpr unsigned AUTHED_CHUNK_COUNT_PER_GROUP = 256; diff --git a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp index 40f05d444..b5e6effac 100644 --- a/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp +++ b/src/ZoneCommon/Game/T5/GameAssetPoolT5.cpp @@ -15,7 +15,8 @@ const char* GameAssetPoolT5::ASSET_TYPE_NAMES[]{ "menulist", "menu", "localize", "weapon", "weapondef", "weaponvariant", "snddriverglobals", "fx", "fximpacttable", "aitype", "mptype", "mpbody", "mphead", "character", "xmodelalias", "rawfile", "stringtable", "packindex", "xglobals", "ddl", "glasses", - "emblemset"}; + "emblemset", +}; GameAssetPoolT5::GameAssetPoolT5(Zone* zone, const int priority) : ZoneAssetPools(zone), diff --git a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp index c8e130206..300cab7de 100644 --- a/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp +++ b/src/ZoneCommon/Game/T6/GameAssetPoolT6.cpp @@ -8,66 +8,68 @@ using namespace T6; -const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]{"xmodelpieces", - "physpreset", - "physconstraints", - "destructibledef", - "xanim", - "xmodel", - "material", - "techniqueset", - "image", - "soundbank", - "soundpatch", - "clipmap", - "clipmap", - "comworld", - "gameworldsp", - "gameworldmp", - "mapents", - "gfxworld", - "gfxlightdef", - "uimap", - "font", - "fonticon", - "menulist", - "menu", - "localize", - "weapon", - "weapondef", - "weaponvariant", - "weaponfull", - "attachment", - "attachmentunique", - "camo", - "snddriverglobals", - "fx", - "fximpacttable", - "aitype", - "mptype", - "mpbody", - "mphead", - "character", - "xmodelalias", - "rawfile", - "stringtable", - "leaderboard", - "xglobals", - "ddl", - "glasses", - "emblemset", - "script", - "keyvaluepairs", - "vehicle", - "memoryblock", - "addonmapents", - "tracer", - "skinnedverts", - "qdb", - "slug", - "footsteptable", - "footstepfxtable", - "zbarrier"}; +const char* GameAssetPoolT6::ASSET_TYPE_NAMES[]{ + "xmodelpieces", + "physpreset", + "physconstraints", + "destructibledef", + "xanim", + "xmodel", + "material", + "techniqueset", + "image", + "soundbank", + "soundpatch", + "clipmap", + "clipmap", + "comworld", + "gameworldsp", + "gameworldmp", + "mapents", + "gfxworld", + "gfxlightdef", + "uimap", + "font", + "fonticon", + "menulist", + "menu", + "localize", + "weapon", + "weapondef", + "weaponvariant", + "weaponfull", + "attachment", + "attachmentunique", + "camo", + "snddriverglobals", + "fx", + "fximpacttable", + "aitype", + "mptype", + "mpbody", + "mphead", + "character", + "xmodelalias", + "rawfile", + "stringtable", + "leaderboard", + "xglobals", + "ddl", + "glasses", + "emblemset", + "script", + "keyvaluepairs", + "vehicle", + "memoryblock", + "addonmapents", + "tracer", + "skinnedverts", + "qdb", + "slug", + "footsteptable", + "footstepfxtable", + "zbarrier", +}; GameAssetPoolT6::GameAssetPoolT6(Zone* zone, const int priority) : ZoneAssetPools(zone), diff --git a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h index 217265888..d68535ca9 100644 --- a/src/ZoneCommon/Game/T6/ZoneConstantsT6.h +++ b/src/ZoneCommon/Game/T6/ZoneConstantsT6.h @@ -34,8 +34,10 @@ namespace T6 static constexpr size_t FILE_SUFFIX_ZERO_ALIGN = 0x40; static constexpr const char* MAGIC_AUTH_HEADER = "PHEEBs71"; - inline static const uint8_t SALSA20_KEY_TREYARCH[]{0x64, 0x1D, 0x8A, 0x2F, 0xE3, 0x1D, 0x3A, 0xA6, 0x36, 0x22, 0xBB, 0xC9, 0xCE, 0x85, 0x87, 0x22, - 0x9D, 0x42, 0xB0, 0xF8, 0xED, 0x9B, 0x92, 0x41, 0x30, 0xBF, 0x88, 0xB6, 0x5E, 0xDC, 0x50, 0xBE}; + inline static const uint8_t SALSA20_KEY_TREYARCH[]{ + 0x64, 0x1D, 0x8A, 0x2F, 0xE3, 0x1D, 0x3A, 0xA6, 0x36, 0x22, 0xBB, 0xC9, 0xCE, 0x85, 0x87, 0x22, + 0x9D, 0x42, 0xB0, 0xF8, 0xED, 0x9B, 0x92, 0x41, 0x30, 0xBF, 0x88, 0xB6, 0x5E, 0xDC, 0x50, 0xBE, + }; inline static const uint8_t RSA_PUBLIC_KEY_TREYARCH[]{ 0x30, 0x82, 0x01, 0x0a, 0x02, 0x82, 0x01, 0x01, 0x00, 0xc7, 0x9d, 0x33, 0xe0, 0x75, 0xaf, 0xef, 0x08, 0x08, 0x2b, 0x89, 0xd9, 0x3b, 0xf3, @@ -49,6 +51,7 @@ namespace T6 0x12, 0x69, 0x1e, 0xdb, 0x2d, 0x3e, 0xbd, 0x48, 0x16, 0xe1, 0x72, 0x37, 0xb8, 0x5f, 0x61, 0xfa, 0x24, 0x16, 0x3a, 0xde, 0xbf, 0x6a, 0x71, 0x62, 0x32, 0xf3, 0xaa, 0x7f, 0x28, 0x3a, 0x0c, 0x27, 0xeb, 0xa9, 0x0a, 0x4c, 0x79, 0x88, 0x84, 0xb3, 0xe2, 0x52, 0xb9, 0x68, 0x1e, 0x82, 0xcf, 0x67, 0x43, 0xf3, 0x68, 0xf7, 0x26, 0x19, 0xaa, 0xdd, 0x3f, 0x1e, 0xc6, 0x46, 0x11, 0x9f, 0x24, 0x23, 0xa7, 0xb0, 0x1b, 0x79, 0xa7, - 0x0c, 0x5a, 0xfe, 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01}; + 0x0c, 0x5a, 0xfe, 0x96, 0xf7, 0xe7, 0x88, 0x09, 0xa6, 0x69, 0xe3, 0x8b, 0x02, 0x03, 0x01, 0x00, 0x01, + }; }; } // namespace T6 diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp index 72d1a4fbe..2ba2af5ea 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionAssetList.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionAssetList::SequenceZoneDefinitionAssetList() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("assetlist"), create.Char(','), create.Field().Capture(CAPTURE_ASSET_LIST_NAME)}); + AddMatchers({ + create.Keyword("assetlist"), + create.Char(','), + create.Field().Capture(CAPTURE_ASSET_LIST_NAME), + }); } void SequenceZoneDefinitionAssetList::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp index 423551024..a7a11a080 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionBuild.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionBuild::SequenceZoneDefinitionBuild() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("build"), create.Char(','), create.Field().Capture(CAPTURE_BUILD_TARGET_NAME)}); + AddMatchers({ + create.Keyword("build"), + create.Char(','), + create.Field().Capture(CAPTURE_BUILD_TARGET_NAME), + }); } void SequenceZoneDefinitionBuild::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp index db52b8b3d..dbdb150ee 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionEntry.cpp @@ -6,10 +6,17 @@ SequenceZoneDefinitionEntry::SequenceZoneDefinitionEntry() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Field().Capture(CAPTURE_TYPE_NAME), - create.Char(','), - create.Optional(create.Char(',').Tag(TAG_REFERENCE)), - create.Or({create.String(), create.Field()}).Capture(CAPTURE_ASSET_NAME)}); + AddMatchers({ + create.Field().Capture(CAPTURE_TYPE_NAME), + create.Char(','), + create.Optional(create.Char(',').Tag(TAG_REFERENCE)), + create + .Or({ + create.String(), + create.Field(), + }) + .Capture(CAPTURE_ASSET_NAME), + }); } void SequenceZoneDefinitionEntry::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp index 1ecac14df..a6ea79af7 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionIgnore.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionIgnore::SequenceZoneDefinitionIgnore() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("ignore"), create.Char(','), create.Field().Capture(CAPTURE_IGNORE_NAME)}); + AddMatchers({ + create.Keyword("ignore"), + create.Char(','), + create.Field().Capture(CAPTURE_IGNORE_NAME), + }); } void SequenceZoneDefinitionIgnore::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp index 1d94366d0..dda360f25 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionInclude.cpp @@ -6,7 +6,11 @@ SequenceZoneDefinitionInclude::SequenceZoneDefinitionInclude() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Keyword("include"), create.Char(','), create.Field().Capture(CAPTURE_INCLUDE_NAME)}); + AddMatchers({ + create.Keyword("include"), + create.Char(','), + create.Field().Capture(CAPTURE_INCLUDE_NAME), + }); } void SequenceZoneDefinitionInclude::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp index 0a662cf03..56e8cd3d7 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/Sequence/SequenceZoneDefinitionMetaData.cpp @@ -6,7 +6,12 @@ SequenceZoneDefinitionMetaData::SequenceZoneDefinitionMetaData() { const ZoneDefinitionMatcherFactory create(this); - AddMatchers({create.Char('>'), create.Field().Capture(CAPTURE_KEY), create.Char(','), create.Field().Capture(CAPTURE_VALUE)}); + AddMatchers({ + create.Char('>'), + create.Field().Capture(CAPTURE_KEY), + create.Char(','), + create.Field().Capture(CAPTURE_VALUE), + }); } void SequenceZoneDefinitionMetaData::ProcessMatch(ZoneDefinition* state, SequenceResult<ZoneDefinitionParserValue>& result) const diff --git a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp index 32163600d..5ae6bfc20 100644 --- a/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp +++ b/src/ZoneCommon/Parsing/ZoneDefinition/ZoneDefinitionParser.cpp @@ -14,12 +14,14 @@ ZoneDefinitionParser::ZoneDefinitionParser(ZoneDefinitionLexer* lexer) const std::vector<AbstractParser<ZoneDefinitionParserValue, ZoneDefinition>::sequence_t*>& ZoneDefinitionParser::GetTestsForState() { - static std::vector<sequence_t*> tests({new SequenceZoneDefinitionMetaData(), - new SequenceZoneDefinitionInclude(), - new SequenceZoneDefinitionIgnore(), - new SequenceZoneDefinitionAssetList(), - new SequenceZoneDefinitionBuild(), - new SequenceZoneDefinitionEntry()}); + static std::vector<sequence_t*> tests({ + new SequenceZoneDefinitionMetaData(), + new SequenceZoneDefinitionInclude(), + new SequenceZoneDefinitionIgnore(), + new SequenceZoneDefinitionAssetList(), + new SequenceZoneDefinitionBuild(), + new SequenceZoneDefinitionEntry(), + }); return tests; } diff --git a/src/ZoneLoading/ZoneLoading.cpp b/src/ZoneLoading/ZoneLoading.cpp index cf9041de2..6842cb1fb 100644 --- a/src/ZoneLoading/ZoneLoading.cpp +++ b/src/ZoneLoading/ZoneLoading.cpp @@ -14,7 +14,12 @@ namespace fs = std::filesystem; IZoneLoaderFactory* ZoneLoaderFactories[]{ - new IW3::ZoneLoaderFactory(), new IW4::ZoneLoaderFactory(), new IW5::ZoneLoaderFactory(), new T5::ZoneLoaderFactory(), new T6::ZoneLoaderFactory()}; + new IW3::ZoneLoaderFactory(), + new IW4::ZoneLoaderFactory(), + new IW5::ZoneLoaderFactory(), + new T5::ZoneLoaderFactory(), + new T6::ZoneLoaderFactory(), +}; std::unique_ptr<Zone> ZoneLoading::LoadZone(const std::string& path) { diff --git a/src/ZoneWriting/ZoneWriting.cpp b/src/ZoneWriting/ZoneWriting.cpp index b0c3af93d..eaf3ebcc8 100644 --- a/src/ZoneWriting/ZoneWriting.cpp +++ b/src/ZoneWriting/ZoneWriting.cpp @@ -8,7 +8,12 @@ #include "Writing/IZoneWriterFactory.h" IZoneWriterFactory* ZoneWriterFactories[]{ - new IW3::ZoneWriterFactory(), new IW4::ZoneWriterFactory(), new IW5::ZoneWriterFactory(), new T5::ZoneWriterFactory(), new T6::ZoneWriterFactory()}; + new IW3::ZoneWriterFactory(), + new IW4::ZoneWriterFactory(), + new IW5::ZoneWriterFactory(), + new T5::ZoneWriterFactory(), + new T6::ZoneWriterFactory(), +}; bool ZoneWriting::WriteZone(std::ostream& stream, Zone* zone) { diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp index 3f01ebb81..63c87085e 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/EventHandlerSetScopeSequencesTests.cpp @@ -71,10 +71,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("fadein")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("fadein")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -89,10 +91,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), - SimpleParserValue::String(pos, new std::string("some_element")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("noScriptCommand")), + SimpleParserValue::String(pos, new std::string("some_element")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -104,11 +108,13 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, true); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("uiScript")), - SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), - SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("uiScript")), + SimpleParserValue::Identifier(pos, new std::string("somethingUnknown")), + SimpleParserValue::String(pos, new std::string("anArgumentForTheUnknownScript")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); REQUIRE(result); @@ -161,42 +167,60 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeIn", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("fadeIn")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("fadeIn" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use fadeOut", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("fadeOut")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("fadeOut" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use show", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("show")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("show")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("show" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hide", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("hide")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("hide" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("showMenu")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("showMenu" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use hideMenu", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("hideMenu")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("hideMenu" "some_element" ; )"); } @@ -254,10 +278,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("setColor")), - SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), - SimpleParserValue::Character(pos, ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("setColor")), + SimpleParserValue::Identifier(TokenPos(), new std::string("backColor")), + SimpleParserValue::Character(pos, ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -268,50 +294,71 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use open", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("open")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("open")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("open" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use close", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("close")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("close")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("close" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use escape", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("escape")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("escape" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForAllPlayers", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), - SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, - R"("closeForAllPlayers" "some_element" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("closeForAllPlayers")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, + R"("closeForAllPlayers" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameOpen", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("ingameOpen")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("ingameOpen" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use ingameClose", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("ingameClose")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("ingameClose" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setBackground", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), - SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, - R"("setBackground" "some_element" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setBackground")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, + R"("setBackground" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setItemColor with forecolor", "[parsing][sequence][menu]") @@ -386,14 +433,20 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocus", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), SimpleParserValue::String(TokenPos(), new std::string("some_element"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setFocus")), + SimpleParserValue::String(TokenPos(), new std::string("some_element")), + }, R"("setFocus" "some_element" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setFocusByDvar", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), SimpleParserValue::String(TokenPos(), new std::string("some_dvar"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setFocusByDvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + }, R"("setFocusByDvar" "some_dvar" ; )"); } @@ -411,202 +464,305 @@ namespace test::parsing::menu::sequence::event_handler_set TEST_CASE("EventHandlerSetScopeSequences: Ensure can use exec", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("exec")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, R"("exec" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNow", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNow")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, R"("execNow" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarStringValue" "some_dvar" "some_value" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarIntValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use execNowOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_command"))}, - R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("execNowOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_command")), + }, + R"("execNowOnDvarFloatValue" "some_dvar" "1" "some_command" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use play", "[parsing][sequence][menu]") { TestGenericScriptStatement( - {SimpleParserValue::Identifier(TokenPos(), new std::string("play")), SimpleParserValue::String(TokenPos(), new std::string("some_sound"))}, + { + SimpleParserValue::Identifier(TokenPos(), new std::string("play")), + SimpleParserValue::String(TokenPos(), new std::string("some_sound")), + }, R"("play" "some_sound" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuResponse", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuResponse" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuResponse")), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuResponse" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarStringValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::String(TokenPos(), new std::string("some_value")), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarStringValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::String(TokenPos(), new std::string("some_value")), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarStringValue" "some_dvar" "some_value" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarIntValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarIntValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarIntValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use scriptMenuRespondOnDvarFloatValue", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), - SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), - SimpleParserValue::Integer(TokenPos(), 1), - SimpleParserValue::String(TokenPos(), new std::string("some_response"))}, - R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("scriptMenuRespondOnDvarFloatValue")), + SimpleParserValue::String(TokenPos(), new std::string("some_dvar")), + SimpleParserValue::Integer(TokenPos(), 1), + SimpleParserValue::String(TokenPos(), new std::string("some_response")), + }, + R"("scriptMenuRespondOnDvarFloatValue" "some_dvar" "1" "some_response" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use updateMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail"))}, R"("updateMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("updateMail")), + }, + R"("updateMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openMail"))}, R"("openMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("openMail")), + }, + R"("openMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use deleteMail", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail"))}, R"("deleteMail" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("deleteMail")), + }, + R"("deleteMail" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use doMailLottery", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery"))}, R"("doMailLottery" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("doMailLottery")), + }, + R"("doMailLottery" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsConfirm", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm"))}, R"("resetStatsConfirm" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsConfirm")), + }, + R"("resetStatsConfirm" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resetStatsCancel", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel"))}, R"("resetStatsCancel" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resetStatsCancel")), + }, + R"("resetStatsCancel" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use setGameMode", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_mode"))}, - R"("setGameMode" "some_game_mode" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("setGameMode")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_mode")), + }, + R"("setGameMode" "some_game_mode" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederTop", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop"))}, R"("feederTop" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("feederTop")), + }, + R"("feederTop" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use feederBottom", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom"))}, R"("feederBottom" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("feederBottom")), + }, + R"("feederBottom" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use showGamerCard", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard"))}, R"("showGamerCard" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("showGamerCard")), + }, + R"("showGamerCard" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use openForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, - R"("openForGameType" "some_game_type" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("openForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type")), + }, + R"("openForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use closeForGameType", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), - SimpleParserValue::String(TokenPos(), new std::string("some_game_type"))}, - R"("closeForGameType" "some_game_type" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("closeForGameType")), + SimpleParserValue::String(TokenPos(), new std::string("some_game_type")), + }, + R"("closeForGameType" "some_game_type" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use kickPlayer", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer"))}, R"("kickPlayer" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("kickPlayer")), + }, + R"("kickPlayer" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use getKickPlayerQuestion", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion"))}, R"("getKickPlayerQuestion" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("getKickPlayerQuestion")), + }, + R"("getKickPlayerQuestion" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use partyUpdateMissingMapPackDvar", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar"))}, - R"("partyUpdateMissingMapPackDvar" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("partyUpdateMissingMapPackDvar")), + }, + R"("partyUpdateMissingMapPackDvar" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use togglePlayerMute", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute"))}, R"("togglePlayerMute" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("togglePlayerMute")), + }, + R"("togglePlayerMute" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use resolveError", "[parsing][sequence][menu]") { - TestGenericScriptStatement({SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError"))}, R"("resolveError" ; )"); + TestGenericScriptStatement( + { + SimpleParserValue::Identifier(TokenPos(), new std::string("resolveError")), + }, + R"("resolveError" ; )"); } TEST_CASE("EventHandlerSetScopeSequences: Ensure can use lerp scale", "[parsing][sequence][menu]") @@ -745,15 +901,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '%'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarBool")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '%'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -778,15 +936,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '*'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarInt")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '*'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -811,15 +971,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '/'), - SimpleParserValue::Integer(TokenPos(), 2), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarFloat")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '/'), + SimpleParserValue::Integer(TokenPos(), 2), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -844,15 +1006,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), - SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), - SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), - SimpleParserValue::Character(TokenPos(), '('), - SimpleParserValue::Character(TokenPos(), ')'), - SimpleParserValue::Character(TokenPos(), '+'), - SimpleParserValue::String(TokenPos(), new std::string(" Hello")), - SimpleParserValue::Character(TokenPos(), ';'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(TokenPos(), new std::string("setLocalVarString")), + SimpleParserValue::Identifier(TokenPos(), new std::string("sample_var")), + SimpleParserValue::Identifier(TokenPos(), new std::string("milliseconds")), + SimpleParserValue::Character(TokenPos(), '('), + SimpleParserValue::Character(TokenPos(), ')'), + SimpleParserValue::Character(TokenPos(), '+'), + SimpleParserValue::String(TokenPos(), new std::string(" Hello")), + SimpleParserValue::Character(TokenPos(), ';'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); REQUIRE(result); @@ -881,7 +1045,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -899,7 +1066,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -925,14 +1095,16 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -969,12 +1141,14 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("if")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("if")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_state->m_current_script << R"("fadeIn" "some_element" ; )"; @@ -1006,15 +1180,17 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1058,13 +1234,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1100,13 +1278,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1115,13 +1295,15 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("elseif")), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("elseif")), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1136,10 +1318,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1166,10 +1350,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1196,10 +1382,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); } @@ -1208,10 +1396,12 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), - SimpleParserValue::Identifier(pos, new std::string("else")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::Identifier(pos, new std::string("else")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1226,7 +1416,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto currentIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = currentIfCondition->m_condition_elements.get(); @@ -1248,7 +1441,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1274,7 +1470,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), std::make_unique<CommonEventHandlerSet>()); @@ -1302,7 +1501,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); @@ -1332,7 +1534,10 @@ namespace test::parsing::menu::sequence::event_handler_set { EventHandlerSetSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '}'), SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); const auto baseIfCondition = std::make_unique<CommonEventHandlerCondition>(nullptr, std::make_unique<CommonEventHandlerSet>(), nullptr); helper.m_state->m_current_nested_event_handler_set = baseIfCondition->m_condition_elements.get(); diff --git a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp index 818bed7a8..7109a818b 100644 --- a/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp +++ b/test/ObjLoadingTests/Parsing/Menu/Sequence/ItemScopeSequencesTests.cpp @@ -66,18 +66,20 @@ namespace test::parsing::menu::sequence::item { ItemSequenceTestsHelper helper(FeatureLevel::IW4, false); const TokenPos pos; - helper.Tokens({SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), - SimpleParserValue::Character(pos, '{'), - SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), - SimpleParserValue::String(pos, new std::string("auto")), - SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), - SimpleParserValue::String(pos, new std::string("standard")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), - SimpleParserValue::String(pos, new std::string("wide 16:10")), - SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), - SimpleParserValue::String(pos, new std::string("wide 16:9")), - SimpleParserValue::Character(pos, '}'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Identifier(pos, new std::string("dvarStrList")), + SimpleParserValue::Character(pos, '{'), + SimpleParserValue::String(pos, new std::string("@MENU_AUTO")), + SimpleParserValue::String(pos, new std::string("auto")), + SimpleParserValue::String(pos, new std::string("@MENU_STANDARD_4_3")), + SimpleParserValue::String(pos, new std::string("standard")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_10")), + SimpleParserValue::String(pos, new std::string("wide 16:10")), + SimpleParserValue::String(pos, new std::string("@MENU_WIDE_16_9")), + SimpleParserValue::String(pos, new std::string("wide 16:9")), + SimpleParserValue::Character(pos, '}'), + SimpleParserValue::EndOfFile(pos), + }); helper.m_item->m_feature_type = CommonItemFeatureType::MULTI_VALUE; helper.m_item->m_multi_value_features = std::make_unique<CommonItemFeaturesMultiValue>(); diff --git a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp index 4ce91aec1..2e2778a79 100644 --- a/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp +++ b/test/ParserTests/Parsing/Simple/SimpleExpressionTests.cpp @@ -59,7 +59,9 @@ namespace test::parsing::simple::expression protected: const std::vector<sequence_t*>& GetTestsForState() override { - static std::vector<sequence_t*> tests({new SimpleExpressionSequence()}); + static std::vector<sequence_t*> tests({ + new SimpleExpressionSequence(), + }); return tests; } @@ -140,10 +142,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -162,10 +166,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 428), - SimpleParserValue::Character(pos, '-'), - SimpleParserValue::Integer(pos, 8), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 428), + SimpleParserValue::Character(pos, '-'), + SimpleParserValue::Integer(pos, 8), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -184,10 +190,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 105), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 105), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -206,10 +214,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 561540), - SimpleParserValue::Character(pos, '/'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 561540), + SimpleParserValue::Character(pos, '/'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -228,10 +238,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 92673), - SimpleParserValue::Character(pos, '%'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 92673), + SimpleParserValue::Character(pos, '%'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -250,10 +262,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0x7FFFFFF0), - SimpleParserValue::Character(pos, '&'), - SimpleParserValue::Integer(pos, 0x2AAAAAAA), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0x7FFFFFF0), + SimpleParserValue::Character(pos, '&'), + SimpleParserValue::Integer(pos, 0x2AAAAAAA), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -272,10 +286,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 5), - SimpleParserValue::Character(pos, '|'), - SimpleParserValue::Integer(pos, 3), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 5), + SimpleParserValue::Character(pos, '|'), + SimpleParserValue::Integer(pos, 3), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -294,11 +310,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 105), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 105), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_LEFT)), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -317,11 +334,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 42784), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), - SimpleParserValue::Integer(pos, 5), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 42784), + SimpleParserValue::MultiCharacter(pos, + SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::SHIFT_RIGHT)), + SimpleParserValue::Integer(pos, 5), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -340,10 +359,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, '>'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, '>'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -362,11 +383,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter( + pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::GREATER_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -385,10 +408,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, '<'), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, '<'), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -407,11 +432,13 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 420), - SimpleParserValue::MultiCharacter( - pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), - SimpleParserValue::Integer(pos, 421), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::MultiCharacter(pos, + SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::LESS_EQUAL_THAN)), + SimpleParserValue::Integer(pos, 421), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -430,11 +457,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::EQUALS)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -453,11 +481,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::NOT_EQUAL)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -476,11 +505,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::AND)), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -499,11 +529,12 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens( - {SimpleParserValue::Integer(pos, 0), - SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::MultiCharacter(pos, SimpleExpressionMatchers::MULTI_TOKEN_OFFSET_BINARY + static_cast<int>(SimpleBinaryOperationId::OR)), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -522,14 +553,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 100), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 4), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 25), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 220), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 100), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 4), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 25), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 220), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -548,14 +581,16 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 40), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 10), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 40), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 10), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -574,12 +609,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -598,12 +635,14 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -622,16 +661,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -650,16 +691,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -678,16 +721,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, -1), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, -1), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -706,16 +751,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 210), - SimpleParserValue::Character(pos, '*'), - SimpleParserValue::Integer(pos, 2), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Integer(pos, 1337), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 210), + SimpleParserValue::Character(pos, '*'), + SimpleParserValue::Integer(pos, 2), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Integer(pos, 1337), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); @@ -734,16 +781,18 @@ namespace test::parsing::simple::expression { SimpleExpressionTestsHelper helper; const TokenPos pos; - helper.Tokens({SimpleParserValue::Integer(pos, 0), - SimpleParserValue::Character(pos, '?'), - SimpleParserValue::Integer(pos, 420), - SimpleParserValue::Character(pos, ':'), - SimpleParserValue::Character(pos, '('), - SimpleParserValue::Integer(pos, 1336), - SimpleParserValue::Character(pos, '+'), - SimpleParserValue::Integer(pos, 1), - SimpleParserValue::Character(pos, ')'), - SimpleParserValue::EndOfFile(pos)}); + helper.Tokens({ + SimpleParserValue::Integer(pos, 0), + SimpleParserValue::Character(pos, '?'), + SimpleParserValue::Integer(pos, 420), + SimpleParserValue::Character(pos, ':'), + SimpleParserValue::Character(pos, '('), + SimpleParserValue::Integer(pos, 1336), + SimpleParserValue::Character(pos, '+'), + SimpleParserValue::Integer(pos, 1), + SimpleParserValue::Character(pos, ')'), + SimpleParserValue::EndOfFile(pos), + }); const auto result = helper.PerformTest(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp index e78a1dc0f..2c89f3a0d 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceActionTests.cpp @@ -125,14 +125,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -147,15 +149,17 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -171,17 +175,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -198,19 +204,21 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("yeet_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("yeet_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -228,14 +236,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("unknown_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -245,19 +255,21 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Identifier(pos, new std::string("arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), - CommandsParserValue::Character(pos, ','), - CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Identifier(pos, new std::string("arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("another_arg_t")), + CommandsParserValue::Character(pos, ','), + CommandsParserValue::Identifier(pos, new std::string("unknown_type_t")), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -267,13 +279,15 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); @@ -283,13 +297,15 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_test_struct); auto result = helper.PerformTest(); @@ -305,17 +321,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -330,14 +348,16 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_test_struct2); auto result = helper.PerformTest(); @@ -353,17 +373,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_child")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("container_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_child")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); helper.m_state->SetInUse(helper.m_arg_struct2); auto result = helper.PerformTest(); @@ -379,17 +401,19 @@ namespace test::parsing::commands::sequence::sequence_action { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("set")), - CommandsParserValue::Identifier(pos, new std::string("action")), - CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Character(pos, ':'), - CommandsParserValue::Identifier(pos, new std::string("m_test")), - CommandsParserValue::Identifier(pos, new std::string("TestMethod")), - CommandsParserValue::Character(pos, '('), - CommandsParserValue::Character(pos, ')'), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("set")), + CommandsParserValue::Identifier(pos, new std::string("action")), + CommandsParserValue::Identifier(pos, new std::string("test_struct_t")), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Character(pos, ':'), + CommandsParserValue::Identifier(pos, new std::string("m_test")), + CommandsParserValue::Identifier(pos, new std::string("TestMethod")), + CommandsParserValue::Character(pos, '('), + CommandsParserValue::Character(pos, ')'), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_test_struct->m_post_load_action == nullptr); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp index 01d5cfe91..9a4692395 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceArchitectureTests.cpp @@ -41,10 +41,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -57,10 +59,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x86")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x86")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); @@ -73,10 +77,12 @@ namespace test::parsing::commands::sequence::sequence_architecture { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("architecture")), - CommandsParserValue::Identifier(pos, new std::string("x1337")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("architecture")), + CommandsParserValue::Identifier(pos, new std::string("x1337")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); REQUIRE_THROWS_AS(helper.PerformTest(), ParsingException); REQUIRE(helper.m_repository->GetArchitecture() == Architecture::UNKNOWN); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp index d6d64ddba..1a800565d 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Commands/Sequence/SequenceGameTests.cpp @@ -41,10 +41,12 @@ namespace test::parsing::commands::sequence::sequence_game { CommandsSequenceTestsHelper helper; const TokenPos pos; - helper.Tokens({CommandsParserValue::Identifier(pos, new std::string("game")), - CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), - CommandsParserValue::Character(pos, ';'), - CommandsParserValue::EndOfFile(pos)}); + helper.Tokens({ + CommandsParserValue::Identifier(pos, new std::string("game")), + CommandsParserValue::Identifier(pos, new std::string("very_cool_game")), + CommandsParserValue::Character(pos, ';'), + CommandsParserValue::EndOfFile(pos), + }); auto result = helper.PerformTest(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp index 7137da5f8..27599a372 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Header/Sequence/SequenceNamespaceTests.cpp @@ -10,11 +10,13 @@ namespace test::parsing::header::sequence::sequence_namespace TEST_CASE("SequenceNamespace: Ensure can parse simple namespace directive", "[parsing][parsingstream]") { const TokenPos pos; - const auto lexer = - std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{')}, - HeaderParserValue::EndOfFile(pos))); + const auto lexer = std::make_unique<MockLexer<HeaderParserValue>>(MockLexer<HeaderParserValue>( + { + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + }, + HeaderParserValue::EndOfFile(pos))); const auto packValueSupplier = std::make_unique<MockPackValueSupplier>(); const auto sequence = std::make_unique<SequenceNamespace>(); diff --git a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp index e4abf4ff4..912f2b407 100644 --- a/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp +++ b/test/ZoneCodeGeneratorLibTests/Parsing/Matcher/MatcherTests.cpp @@ -79,12 +79,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('{'), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -94,12 +100,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('+')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('+'), + }); REQUIRE(!test.PerformTest()); } @@ -109,12 +121,16 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + }); test.MatchCallback( [&callbackCalled](sequence_result_t& result) { @@ -130,9 +146,14 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; auto callbackCalled = false; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + }); test.MatchCallback( [&callbackCalled](sequence_result_t& result) { @@ -151,15 +172,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - })}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -169,10 +194,12 @@ namespace test::parsing::matcher REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("test_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("test_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -191,15 +218,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - })}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -217,14 +248,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -246,10 +281,15 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); + test.Matchers({ + create.Loop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); REQUIRE(!test.PerformTest()); } @@ -262,10 +302,15 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}); + test.Matchers({ + create.OptionalLoop(create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE)), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 1); @@ -280,13 +325,17 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -301,14 +350,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); @@ -323,15 +376,19 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), - create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Optional(create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); REQUIRE(!test.PerformTest()); } @@ -346,19 +403,28 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Or({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF)})), - create.Or({create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM)})}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), - HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Or({ + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), + })), + create.Or({ + create.Type(HeaderParserValueType::TYPEDEF).Tag(TAG_TYPEDEF), + create.Type(HeaderParserValueType::ENUM).Tag(TAG_ENUM), + }), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::TYPEDEF), + HeaderParserValue::Keyword(pos, HeaderParserValueType::ENUM), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -386,14 +452,23 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); - test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT)}, - LABEL_TEST); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Label(LABEL_TEST), + }); + test.LabeledMatchers( + { + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + }, + LABEL_TEST); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -417,14 +492,24 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Label(LABEL_TEST)}); - test.LabeledMatchers({create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), create.Optional(create.Label(LABEL_TEST))}, LABEL_TEST); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Label(LABEL_TEST), + }); + test.LabeledMatchers( + { + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Optional(create.Label(LABEL_TEST)), + }, + LABEL_TEST); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -448,13 +533,18 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), create.Char('{')}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), + create.Char('{'), + }); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -487,20 +577,26 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Or({create.And({ - create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), - }), - create.And({ - create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), - create.Identifier().Capture(CAPTURE_STRUCT_NAME), - })}), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Or({ + create.And({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Identifier().Capture(CAPTURE_NAMESPACE_NAME), + }), + create.And({ + create.Type(HeaderParserValueType::STRUCT).Tag(TAG_STRUCT), + create.Identifier().Capture(CAPTURE_STRUCT_NAME), + }), + }), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -520,10 +616,12 @@ namespace test::parsing::matcher REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 3); - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("bye_struct")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("bye_struct")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) { @@ -553,16 +651,20 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), - create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE).Tag(TAG_NAMESPACE), + create.Loop(create.Identifier().Capture(CAPTURE_NAMESPACE_NAME)), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Identifier(pos, new std::string("hello_everyone")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -607,13 +709,23 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()}).Tag(TAG_AND_GROUP).Capture(CAPTURE_AND_GROUP), create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create + .And({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + }) + .Tag(TAG_AND_GROUP) + .Capture(CAPTURE_AND_GROUP), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -647,16 +759,25 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers( - {create.Loop(create.And({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier()})).Tag(TAG_LOOP_GROUP).Capture(CAPTURE_LOOP_GROUP), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("hello_universe")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create + .Loop(create.And({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + })) + .Tag(TAG_LOOP_GROUP) + .Capture(CAPTURE_LOOP_GROUP), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("hello_universe")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -700,28 +821,45 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); - test.LabeledMatchers({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(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}, - LABEL_TYPENAME); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), + create.Char('{'), + }); + test.LabeledMatchers( + { + 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(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }, + LABEL_TYPENAME); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -752,30 +890,45 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), create.Char('{')}); - test.LabeledMatchers({create - .And({create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_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(); - - return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); - })}, - LABEL_TYPENAME); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello")), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Character(pos, ':'), - HeaderParserValue::Identifier(pos, new std::string("world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Label(LABEL_TYPENAME).Capture(CAPTURE_TYPENAME), + create.Char('{'), + }); + test.LabeledMatchers( + { + create + .And({ + create.Identifier().Capture(CAPTURE_FIRST_TYPENAME_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(); + + return HeaderParserValue::TypeName(values[0].get().GetPos(), new std::string(str.str())); + }), + }, + LABEL_TYPENAME); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello")), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Character(pos, ':'), + HeaderParserValue::Identifier(pos, new std::string("world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -812,22 +965,26 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::STRUCT), - create.Identifier() - .Capture(CAPTURE_NAME) - .Transform( - [](HeaderMatcherFactory::token_list_t& tokens) - { - auto str = tokens[0].get().IdentifierValue(); - std::transform(str.begin(), str.end(), str.begin(), toupper); - return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); - }), - create.Char('{')}); - - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), - HeaderParserValue::Identifier(pos, new std::string("hello_world")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Matchers({ + create.Type(HeaderParserValueType::STRUCT), + create.Identifier() + .Capture(CAPTURE_NAME) + .Transform( + [](HeaderMatcherFactory::token_list_t& tokens) + { + auto str = tokens[0].get().IdentifierValue(); + std::transform(str.begin(), str.end(), str.begin(), toupper); + return HeaderParserValue::Identifier(tokens[0].get().GetPos(), new std::string(std::move(str))); + }), + create.Char('{'), + }); + + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::STRUCT), + HeaderParserValue::Identifier(pos, new std::string("hello_world")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); test.MatchCallback( [](sequence_result_t& result) @@ -852,12 +1009,18 @@ namespace test::parsing::matcher { MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier(), create.Char('{').NoConsume()}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier(), + create.Char('{').NoConsume(), + }); REQUIRE(test.PerformTest()); REQUIRE(test.GetConsumedTokenCount() == 2); @@ -869,12 +1032,17 @@ namespace test::parsing::matcher MatchersTestsHelper test; const TokenPos pos; - test.Tokens({HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), - HeaderParserValue::Identifier(pos, new std::string("test_namespace")), - HeaderParserValue::Character(pos, '{'), - HeaderParserValue::Invalid(pos)}); + test.Tokens({ + HeaderParserValue::Keyword(pos, HeaderParserValueType::NAMESPACE), + HeaderParserValue::Identifier(pos, new std::string("test_namespace")), + HeaderParserValue::Character(pos, '{'), + HeaderParserValue::Invalid(pos), + }); const auto create = test.Factory(); - test.Matchers({create.Type(HeaderParserValueType::NAMESPACE), create.Identifier().NoConsume().Capture(CAPTURE_NAME)}); + test.Matchers({ + create.Type(HeaderParserValueType::NAMESPACE), + create.Identifier().NoConsume().Capture(CAPTURE_NAME), + }); test.MatchCallback( [](sequence_result_t& result) {