Skip to content

Commit

Permalink
fix: Fix predicates in alternations
Browse files Browse the repository at this point in the history
Closes: #107
Related-to: tree-sitter/tree-sitter#1392
Related-to: tree-sitter/tree-sitter#1394
Signed-off-by: Joao Moreno <[email protected]>
  • Loading branch information
joaomoreno committed Apr 29, 2022
1 parent d466161 commit 3c761b2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ Query.prototype._init = function() {
if (c.name === captureName1) node1 = c.node;
if (c.name === captureName2) node2 = c.node;
}
if (node1 === undefined || node2 === undefined) return true;
return (node1.text === node2.text) === isPositive;
});
} else {
Expand All @@ -449,7 +450,7 @@ Query.prototype._init = function() {
return (c.node.text === stringValue) === isPositive;
};
}
return false;
return true;
});
}
break;
Expand All @@ -470,7 +471,7 @@ Query.prototype._init = function() {
for (const c of captures) {
if (c.name === captureName) return regex.test(c.node.text);
}
return false;
return true;
});
break;

Expand Down

0 comments on commit 3c761b2

Please sign in to comment.