mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-19 15:52:53 +00:00
31 lines
1019 B
C++
31 lines
1019 B
C++
#include "SequenceArchitecture.h"
|
|
|
|
#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h"
|
|
#include "Parsing/Commands/Matcher/CommandsCommonMatchers.h"
|
|
|
|
SequenceArchitecture::SequenceArchitecture()
|
|
{
|
|
const CommandsMatcherFactory create(this);
|
|
|
|
AddMatchers({
|
|
create.Keyword("architecture"),
|
|
create.Identifier().Capture(CAPTURE_ARCHITECTURE),
|
|
create.Char(';')
|
|
});
|
|
|
|
m_architecture_mapping["x86"] = Architecture::X86;
|
|
m_architecture_mapping["x64"] = Architecture::X64;
|
|
}
|
|
|
|
void SequenceArchitecture::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const
|
|
{
|
|
const auto& architectureToken = result.NextCapture(CAPTURE_ARCHITECTURE);
|
|
|
|
const auto foundArchitecture = m_architecture_mapping.find(architectureToken.IdentifierValue());
|
|
|
|
if(foundArchitecture == m_architecture_mapping.end())
|
|
throw ParsingException(architectureToken.GetPos(), "Unknown architecture");
|
|
|
|
state->SetArchitecture(foundArchitecture->second);
|
|
}
|