Skip to content

Commit

Permalink
Parser: correct span when tree node has no children
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Mar 5, 2024
1 parent c636c65 commit c447646
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const compactParseNode = (node: ParseNode): any => {
}

export const getSpan = (node: ParseNode): Span => {
if ('nodes' in node && node.nodes.length === 0) return { start: 0, end: 0 }
const leftmostNode = (node: ParseNode): LexerToken => {
if ('nodes' in node) {
return leftmostNode(node.nodes[0])
Expand Down

0 comments on commit c447646

Please sign in to comment.