mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-18 18:57:57 -05:00
Add MenuMatcherFactory with extensions for Numeric and Text token types
This commit is contained in:
@ -1,25 +1,24 @@
|
||||
#include "SequenceName.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceName::SequenceName()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.KeywordIgnoreCase("name"),
|
||||
create.Or({create.String(), create.Identifier()}).Capture(CAPTURE_NAME)
|
||||
create.Text().Capture(CAPTURE_NAME)
|
||||
});
|
||||
}
|
||||
|
||||
void SequenceName::ProcessMatch(MenuFileParserState* state, SequenceResult<SimpleParserValue>& result) const
|
||||
{
|
||||
assert(state->m_current_item || state->m_current_menu || state->m_current_function);
|
||||
|
||||
const auto& nameToken = result.NextCapture(CAPTURE_NAME);
|
||||
const auto nameValue = nameToken.m_type == SimpleParserValueType::IDENTIFIER ? nameToken.IdentifierValue() : nameToken.StringValue();
|
||||
|
||||
const auto nameValue = MenuMatcherFactory::TokenTextValue(result.NextCapture(CAPTURE_NAME));
|
||||
|
||||
if (state->m_current_item)
|
||||
state->m_current_item->m_name = nameValue;
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceCloseBlock::SequenceCloseBlock()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Char('}').Capture(CAPTURE_TOKEN)
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "SequenceFunctionDef.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceFunctionDef::SequenceFunctionDef()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("functionDef"),
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "SequenceItemDef.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceItemDef::SequenceItemDef()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("itemDef"),
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "SequenceLoadMenu.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceLoadMenu::SequenceLoadMenu()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("loadMenu"),
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "SequenceMenuDef.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceMenuDef::SequenceMenuDef()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Keyword("menuDef"),
|
||||
|
@ -1,12 +1,12 @@
|
||||
#include "SequenceOpenGlobalScopeBlock.h"
|
||||
|
||||
#include "Parsing/Simple/Matcher/SimpleMatcherFactory.h"
|
||||
#include "Parsing/Menu/MenuMatcherFactory.h"
|
||||
|
||||
using namespace menu;
|
||||
|
||||
SequenceOpenGlobalScopeBlock::SequenceOpenGlobalScopeBlock()
|
||||
{
|
||||
const SimpleMatcherFactory create(this);
|
||||
const MenuMatcherFactory create(this);
|
||||
|
||||
AddMatchers({
|
||||
create.Char('{')
|
||||
|
Reference in New Issue
Block a user