Closed joelburget closed 2 years ago
In my parsed expression, SyntaxNode.firstChild is missing. I compared to both Tree.children and TreeCursor.firstChild().
SyntaxNode.firstChild
Tree.children
TreeCursor.firstChild()
My grammar is here: https://github.com/joelburget/lvca-web/blob/master/grammar/flowchart.grammar
Interaction showing inconsistency:
❯ node Welcome to Node.js v17.5.0. Type ".help" for more information. > let flowchart = await import("./grammar/flowchart.mjs"); undefined > let exprParser = flowchart.parser.configure({ top: "topExpr" }) { topRules: { Program: [ 0, 2 ], topExpr: [ 1, 31 ] } } undefined > function parseExpr(str) { return exprParser.parse(str); } undefined > let node = parseExpr("hd '(a b)") undefined > node.children.length 1 > let cursor = node.cursor() undefined > cursor.firstChild() true > [cursor.name, cursor.from, cursor.to] [ 'Expr', 0, 9 ] > node.firstChild undefined
node is of type Tree, which has no firstChild property. You want node.topNode.firstChild.
node
Tree
firstChild
node.topNode.firstChild
In my parsed expression,
SyntaxNode.firstChild
is missing. I compared to bothTree.children
andTreeCursor.firstChild()
.My grammar is here: https://github.com/joelburget/lvca-web/blob/master/grammar/flowchart.grammar
Interaction showing inconsistency: