good-enough-parser
Advanced tools
Comparing version 1.1.4 to 1.1.5
@@ -79,3 +79,4 @@ "use strict"; | ||
this.matchCount = 0; | ||
const rootNode = checkpoint.cursor.node; | ||
const rootCursor = this.seekNext(checkpoint.cursor); | ||
const rootNode = rootCursor.node; | ||
if ((0, parser_1.isTree)(rootNode)) { | ||
@@ -88,3 +89,3 @@ if (this.type && this.type !== rootNode.type) { | ||
if (this.matcher) { | ||
let nextMatch = this.walkToNextMatch(context, checkpoint.cursor); | ||
let nextMatch = this.walkToNextMatch(context, rootCursor); | ||
while (nextMatch) { | ||
@@ -102,5 +103,3 @@ context = nextMatch.context; | ||
context = this.postHandler(context, rootNode); | ||
const cursor = rootNode.type === 'root-tree' | ||
? checkpoint.cursor | ||
: this.moveRight(checkpoint.cursor); | ||
const cursor = rootNode.type === 'root-tree' ? rootCursor : this.moveRight(rootCursor); | ||
return { context, cursor }; | ||
@@ -107,0 +106,0 @@ } |
@@ -76,3 +76,4 @@ import { isTree } from '../../parser'; | ||
this.matchCount = 0; | ||
const rootNode = checkpoint.cursor.node; | ||
const rootCursor = this.seekNext(checkpoint.cursor); | ||
const rootNode = rootCursor.node; | ||
if (isTree(rootNode)) { | ||
@@ -85,3 +86,3 @@ if (this.type && this.type !== rootNode.type) { | ||
if (this.matcher) { | ||
let nextMatch = this.walkToNextMatch(context, checkpoint.cursor); | ||
let nextMatch = this.walkToNextMatch(context, rootCursor); | ||
while (nextMatch) { | ||
@@ -99,5 +100,3 @@ context = nextMatch.context; | ||
context = this.postHandler(context, rootNode); | ||
const cursor = rootNode.type === 'root-tree' | ||
? checkpoint.cursor | ||
: this.moveRight(checkpoint.cursor); | ||
const cursor = rootNode.type === 'root-tree' ? rootCursor : this.moveRight(rootCursor); | ||
return { context, cursor }; | ||
@@ -104,0 +103,0 @@ } |
{ | ||
"name": "good-enough-parser", | ||
"description": "Parse and query computer programs source code", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"repository": "git@github.com:zharinov/good-enough-parser.git", | ||
@@ -6,0 +6,0 @@ "author": "Sergei Zharinov", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
372826
4960