mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
Accept static expressions for menu floating point and int
This commit is contained in:
parent
9279123ef9
commit
c3a44f60d3
@ -2,6 +2,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "Parsing/Menu/Matcher/MenuExpressionMatchers.h"
|
||||
#include "Parsing/Menu/Matcher/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
@ -11,9 +12,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.Numeric().Capture(CAPTURE_VALUE)
|
||||
create.NumericExpression()
|
||||
});
|
||||
}
|
||||
|
||||
@ -21,7 +23,7 @@ void GenericFloatingPointPropertySequence::ProcessMatch(MenuFileParserState* sta
|
||||
{
|
||||
if (m_set_callback)
|
||||
{
|
||||
const auto value = MenuMatcherFactory::TokenNumericFloatingPointValue(result.NextCapture(CAPTURE_VALUE));
|
||||
const auto value = MenuMatcherFactory::TokenNumericExpressionValue(result);
|
||||
m_set_callback(state, result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), value);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ namespace menu
|
||||
|
||||
private:
|
||||
static constexpr auto CAPTURE_FIRST_TOKEN = 1;
|
||||
static constexpr auto CAPTURE_VALUE = 2;
|
||||
|
||||
const callback_t m_set_callback;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "Parsing/Menu/Matcher/MenuExpressionMatchers.h"
|
||||
#include "Parsing/Menu/Matcher/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
@ -11,9 +12,10 @@ GenericIntPropertySequence::GenericIntPropertySequence(std::string keywordName,
|
||||
{
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddLabeledMatchers(MenuExpressionMatchers().Expression(this), MenuExpressionMatchers::LABEL_EXPRESSION);
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase(std::move(keywordName)).Capture(CAPTURE_FIRST_TOKEN),
|
||||
create.Integer().Capture(CAPTURE_VALUE)
|
||||
create.IntExpression(), // value
|
||||
});
|
||||
}
|
||||
|
||||
@ -21,7 +23,7 @@ void GenericIntPropertySequence::ProcessMatch(MenuFileParserState* state, Sequen
|
||||
{
|
||||
if (m_set_callback)
|
||||
{
|
||||
const auto value = result.NextCapture(CAPTURE_VALUE).IntegerValue();
|
||||
const auto value = MenuMatcherFactory::TokenIntExpressionValue(result);
|
||||
m_set_callback(state, result.NextCapture(CAPTURE_FIRST_TOKEN).GetPos(), value);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ namespace menu
|
||||
|
||||
private:
|
||||
static constexpr auto CAPTURE_FIRST_TOKEN = 1;
|
||||
static constexpr auto CAPTURE_VALUE = 2;
|
||||
|
||||
const callback_t m_set_callback;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user