Delete parser and iterator

This commit is contained in:
Daumantas Kavolis 2023-06-16 13:20:20 +03:00
parent 4d6a30a69e
commit e2c2e39e15

View file

@ -51,14 +51,19 @@ describe("Lookahead iterator", () => {
({ JavaScript, Parser } = await require("./helper"));
const parser = new Parser().setLanguage(JavaScript);
const tree = parser.parse("function fn() {}");
parser.delete();
const cursor = tree.walk();
cursor.gotoFirstChild();
cursor.gotoFirstChild();
assert(cursor.gotoFirstChild());
assert(cursor.gotoFirstChild());
state = cursor.currentNode().nextParseState;
lookahead = JavaScript.lookaheadIterator(state);
assert.exists(lookahead);
});
after(() => {
lookahead.delete();
});
const expected = ["identifier", "comment", "(", "*", "formal_parameters"];
it("should iterate over valid symbols in the state", () => {
const symbols = Array.from(lookahead);