mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-09-01 22:47:26 +00:00
refactor: use std ranges functions where applicable
This commit is contained in:
@@ -8,7 +8,7 @@ SimpleMatcherAnyCharacterBesides::SimpleMatcherAnyCharacterBesides(std::vector<c
|
||||
MatcherResult<SimpleParserValue> SimpleMatcherAnyCharacterBesides::CanMatch(ILexer<SimpleParserValue>* lexer, const unsigned tokenOffset)
|
||||
{
|
||||
const auto& token = lexer->GetToken(tokenOffset);
|
||||
return token.m_type == SimpleParserValueType::CHARACTER && std::find(m_chars.begin(), m_chars.end(), token.CharacterValue()) == m_chars.end()
|
||||
return token.m_type == SimpleParserValueType::CHARACTER && std::ranges::find(m_chars, token.CharacterValue()) == m_chars.end()
|
||||
? MatcherResult<SimpleParserValue>::Match(1)
|
||||
: MatcherResult<SimpleParserValue>::NoMatch();
|
||||
}
|
||||
|
@@ -17,14 +17,12 @@ MatcherResult<SimpleParserValue> SimpleMatcherKeywordIgnoreCase::CanMatch(ILexer
|
||||
return MatcherResult<SimpleParserValue>::NoMatch();
|
||||
|
||||
const auto& identifierValue = token.IdentifierValue();
|
||||
const auto isEqual = std::equal(identifierValue.begin(),
|
||||
identifierValue.end(),
|
||||
m_value.begin(),
|
||||
m_value.end(),
|
||||
[](const char a, const char b)
|
||||
{
|
||||
return tolower(a) == b;
|
||||
});
|
||||
const auto isEqual = std::ranges::equal(identifierValue,
|
||||
m_value,
|
||||
[](const char a, const char b)
|
||||
{
|
||||
return tolower(a) == b;
|
||||
});
|
||||
|
||||
if (isEqual)
|
||||
return MatcherResult<SimpleParserValue>::Match(1);
|
||||
|
Reference in New Issue
Block a user