mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-09 14:28:03 -05:00
17 lines
685 B
C++
17 lines
685 B
C++
#include "ZoneDefinitionMatcherKeyword.h"
|
|
|
|
ZoneDefinitionMatcherKeyword::ZoneDefinitionMatcherKeyword(std::string value)
|
|
: m_value(std::move(value))
|
|
{
|
|
const std::hash<std::string> hash;
|
|
m_hash = hash(m_value);
|
|
}
|
|
|
|
MatcherResult<ZoneDefinitionParserValue> ZoneDefinitionMatcherKeyword::CanMatch(ILexer<ZoneDefinitionParserValue>* lexer, const unsigned tokenOffset)
|
|
{
|
|
const auto& token = lexer->GetToken(tokenOffset);
|
|
return token.m_type == ZoneDefinitionParserValueType::FIELD && token.FieldHash() == m_hash && token.FieldValue() == m_value
|
|
? MatcherResult<ZoneDefinitionParserValue>::Match(1)
|
|
: MatcherResult<ZoneDefinitionParserValue>::NoMatch();
|
|
}
|