Comparing version 3.3.4 to 3.3.5
@@ -42,23 +42,28 @@ "use strict"; | ||
} | ||
const { startPosition, endPosition } = nodes[currentToken]; | ||
const point = new astNodePoint_1.default({ row, column: columnAtLine }); | ||
if (currentToken < nodes.length && astNodePoint_1.default.isInRange([startPosition, endPosition], point)) { | ||
inRange = true; | ||
wordInRange += char; | ||
// if there's a token that spans till the end of the string | ||
if (column === source.length - 1 || columnAtLine === nodes[currentToken].endPosition.column - 1) { | ||
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions)); | ||
wordInRange = ""; | ||
currentToken += 1; | ||
inRange = false; | ||
try { | ||
const { startPosition, endPosition } = nodes[currentToken]; | ||
const point = new astNodePoint_1.default({ row, column: columnAtLine }); | ||
if (currentToken < nodes.length && astNodePoint_1.default.isInRange([startPosition, endPosition], point)) { | ||
inRange = true; | ||
wordInRange += char; | ||
// if there's a token that spans till the end of the string | ||
if (column === source.length - 1 || columnAtLine === nodes[currentToken].endPosition.column - 1) { | ||
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions)); | ||
wordInRange = ""; | ||
currentToken += 1; | ||
inRange = false; | ||
} | ||
} | ||
else { | ||
if (inRange) { | ||
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions)); | ||
wordInRange = ""; | ||
currentToken += 1; | ||
inRange = false; | ||
} | ||
// if the current char is not part of any token, then append it to the array | ||
decoratedStrings.push(this.decorators.word(char)); | ||
} | ||
} | ||
else { | ||
if (inRange) { | ||
decoratedStrings.push(...this.decorateNode(wordInRange, nodes[currentToken], definitions)); | ||
wordInRange = ""; | ||
currentToken += 1; | ||
inRange = false; | ||
} | ||
// if the current char is not part of any token, then append it to the array | ||
catch (err) { | ||
decoratedStrings.push(this.decorators.word(char)); | ||
@@ -65,0 +70,0 @@ } |
{ | ||
"name": "kmdr-ast", | ||
"version": "3.3.4", | ||
"version": "3.3.5", | ||
"description": "Traverse the AST of an explanation by kmdr", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
58224
703