mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-18 18:57:57 -05:00
Handle condition stack on event handler closing parenthesis
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <sstream>
|
||||
|
||||
#include "Generic/GenericStringPropertySequence.h"
|
||||
#include "Parsing/Menu/Domain/EventHandler/CommonEventHandlerScript.h"
|
||||
#include "Parsing/Menu/Matcher/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
@ -26,7 +27,31 @@ namespace menu::event_handler_set_scope_sequences
|
||||
protected:
|
||||
void ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const override
|
||||
{
|
||||
state->m_current_event_handler_set = nullptr;
|
||||
auto remainingScript = state->m_current_script.str();
|
||||
if (!remainingScript.empty())
|
||||
state->m_current_nested_event_handler_set->m_elements.emplace_back(std::make_unique<CommonEventHandlerScript>(std::move(remainingScript)));
|
||||
state->m_current_script.clear();
|
||||
|
||||
if (!state->m_condition_stack.empty())
|
||||
{
|
||||
state->m_condition_stack.pop();
|
||||
|
||||
if(!state->m_condition_stack.empty())
|
||||
{
|
||||
const auto& newConditionState = state->m_condition_stack.top();
|
||||
if (newConditionState.m_in_condition_elements)
|
||||
state->m_current_nested_event_handler_set = newConditionState.m_condition->m_condition_elements.get();
|
||||
else
|
||||
state->m_current_nested_event_handler_set = newConditionState.m_condition->m_else_elements.get();
|
||||
}
|
||||
else
|
||||
state->m_current_nested_event_handler_set = state->m_current_event_handler_set;
|
||||
}
|
||||
else
|
||||
{
|
||||
state->m_current_event_handler_set = nullptr;
|
||||
state->m_current_nested_event_handler_set = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ void GenericMenuEventHandlerSetPropertySequence::ProcessMatch(MenuFileParserStat
|
||||
{
|
||||
auto newEventHandlerSet = std::make_unique<CommonEventHandlerSet>();
|
||||
state->m_current_event_handler_set = newEventHandlerSet.get();
|
||||
state->m_current_nested_event_handler_set = newEventHandlerSet.get();
|
||||
m_set_callback(state, std::move(newEventHandlerSet));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user