mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
Add string chains to menu string properties
This commit is contained in:
parent
6f15fe6010
commit
616c6414ff
@ -1,5 +1,7 @@
|
|||||||
#include "MenuMatcherFactory.h"
|
#include "MenuMatcherFactory.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "MenuExpressionMatchers.h"
|
#include "MenuExpressionMatchers.h"
|
||||||
|
|
||||||
using namespace menu;
|
using namespace menu;
|
||||||
@ -9,9 +11,30 @@ MenuMatcherFactory::MenuMatcherFactory(const IMatcherForLabelSupplier<SimplePars
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::StringChain() const
|
||||||
|
{
|
||||||
|
return Or({
|
||||||
|
And({
|
||||||
|
String(),
|
||||||
|
Loop(String())
|
||||||
|
}).Transform([](const token_list_t& tokens) -> SimpleParserValue
|
||||||
|
{
|
||||||
|
std::ostringstream ss;
|
||||||
|
|
||||||
|
for (const auto& token : tokens)
|
||||||
|
{
|
||||||
|
ss << token.get().StringValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return SimpleParserValue::String(tokens[0].get().GetPos(), new std::string(ss.str()));
|
||||||
|
}),
|
||||||
|
String()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Text() const
|
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Text() const
|
||||||
{
|
{
|
||||||
return MatcherFactoryWrapper(Or({String(), Identifier()}));
|
return MatcherFactoryWrapper(Or({StringChain(), Identifier()}));
|
||||||
}
|
}
|
||||||
|
|
||||||
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Numeric() const
|
MatcherFactoryWrapper<SimpleParserValue> MenuMatcherFactory::Numeric() const
|
||||||
|
@ -18,6 +18,7 @@ namespace menu
|
|||||||
public:
|
public:
|
||||||
explicit MenuMatcherFactory(const IMatcherForLabelSupplier<SimpleParserValue>* labelSupplier);
|
explicit MenuMatcherFactory(const IMatcherForLabelSupplier<SimpleParserValue>* labelSupplier);
|
||||||
|
|
||||||
|
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> StringChain() const;
|
||||||
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> Text() const;
|
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> Text() const;
|
||||||
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> Numeric() const;
|
_NODISCARD MatcherFactoryWrapper<SimpleParserValue> Numeric() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user