patterns: Fixed multiple parse and evaluate issues
This commit is contained in:
parent
fde5b39495
commit
1e1cdb0ef0
@ -569,7 +569,7 @@ namespace hex::lang {
|
||||
|
||||
class ASTNodeAttribute : public ASTNode {
|
||||
public:
|
||||
explicit ASTNodeAttribute(std::string_view attribute, std::string_view value = { })
|
||||
explicit ASTNodeAttribute(std::string_view attribute, std::optional<std::string_view> value = { })
|
||||
: ASTNode(), m_attribute(attribute), m_value(value) { }
|
||||
|
||||
~ASTNodeAttribute() override = default;
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user