mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-02 05:27:41 -05:00
patterns: Fixed multiple parse and evaluate issues
This commit is contained in:
@@ -113,7 +113,8 @@ namespace hex::lang {
|
||||
PatternData *currPattern = nullptr;
|
||||
|
||||
// Local variable access
|
||||
currPattern = this->findPattern(*this->m_localVariables.back(), path);
|
||||
if (!this->m_localVariables.empty())
|
||||
currPattern = this->findPattern(*this->m_localVariables.back(), path);
|
||||
|
||||
// If no local variable was found try local structure members
|
||||
if (this->m_currMembers.size() > 1) {
|
||||
|
||||
@@ -365,7 +365,8 @@ namespace hex::lang {
|
||||
std::vector<std::string> params;
|
||||
|
||||
// Parse parameter list
|
||||
while (MATCHES(sequence(IDENTIFIER))) {
|
||||
bool hasParams = MATCHES(sequence(IDENTIFIER));
|
||||
while (hasParams) {
|
||||
params.push_back(getValue<std::string>(-1));
|
||||
|
||||
if (!MATCHES(sequence(SEPARATOR_COMMA))) {
|
||||
@@ -375,6 +376,10 @@ namespace hex::lang {
|
||||
throwParseError("expected closing ')' after parameter list");
|
||||
}
|
||||
}
|
||||
if (!hasParams) {
|
||||
if (!MATCHES(sequence(SEPARATOR_ROUNDBRACKETCLOSE)))
|
||||
throwParseError("expected closing ')' after parameter list");
|
||||
}
|
||||
|
||||
if (!MATCHES(sequence(SEPARATOR_CURLYBRACKETOPEN)))
|
||||
throwParseError("expected opening '{' after function definition");
|
||||
|
||||
Reference in New Issue
Block a user