mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
patterns: Fixed enum entry scope resolution
This commit is contained in:
@@ -25,9 +25,9 @@ namespace hex::pl {
|
||||
else if (std::get_if<double>(&*value) != nullptr)
|
||||
pattern = new PatternDataFloat(0, sizeof(double));
|
||||
else if (std::get_if<bool>(&*value) != nullptr)
|
||||
pattern = new PatternDataBoolean(0, sizeof(bool));
|
||||
pattern = new PatternDataBoolean(0);
|
||||
else if (std::get_if<char>(&*value) != nullptr)
|
||||
pattern = new PatternDataCharacter(0, sizeof(char));
|
||||
pattern = new PatternDataCharacter(0);
|
||||
else if (std::get_if<PatternData*>(&*value) != nullptr)
|
||||
pattern = std::get<PatternData*>(*value)->clone();
|
||||
else if (std::get_if<std::string>(&*value) != nullptr)
|
||||
|
||||
@@ -375,7 +375,7 @@ namespace hex::pl {
|
||||
|
||||
tokens.emplace_back(VALUE_TOKEN(String, Token::Literal(s)));
|
||||
offset += stringSize;
|
||||
} else if (std::isalpha(c)) {
|
||||
} else if (std::isalpha(c) || c == '_') {
|
||||
std::string identifier = matchTillInvalid(&code[offset], [](char c) -> bool { return std::isalnum(c) || c == '_'; });
|
||||
|
||||
// Check for reserved keywords
|
||||
|
||||
@@ -77,7 +77,10 @@ namespace hex::pl {
|
||||
typeName += "::";
|
||||
continue;
|
||||
} else {
|
||||
return create(new ASTNodeScopeResolution({ typeName, getValue<Token::Identifier>(-1).get() }));
|
||||
if (!this->m_types.contains(typeName))
|
||||
throwParseError(hex::format("cannot access scope of invalid type '{}'", typeName), -1);
|
||||
|
||||
return create(new ASTNodeScopeResolution(this->m_types[typeName]->clone(), getValue<Token::Identifier>(-1).get()));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user