clarity-pattern-parser 10.1.17 → 10.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.js +21 -3
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +21 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/dist/intellisense/AutoComplete.d.ts +1 -0
- package/package.json +1 -1
- package/src/intellisense/AutoComplete.ts +28 -9
- package/src/patterns/ExpressionPattern.ts +98 -0
- package/src/patterns/Options.ts +0 -2
package/dist/index.browser.js
CHANGED
|
@@ -2369,9 +2369,8 @@
|
|
|
2369
2369
|
errorAtIndex = startIndex;
|
|
2370
2370
|
}
|
|
2371
2371
|
else if (!isComplete && this._cursor.hasError && this._cursor.furthestError != null) {
|
|
2372
|
-
errorAtIndex = this.
|
|
2373
|
-
error = this.
|
|
2374
|
-
errorAtIndex = options.reduce((errorAtIndex, option) => Math.max(errorAtIndex, option.startIndex), errorAtIndex);
|
|
2372
|
+
errorAtIndex = this.getFurthestPosition(cursor);
|
|
2373
|
+
error = new ParseError(errorAtIndex, errorAtIndex, this._pattern);
|
|
2375
2374
|
}
|
|
2376
2375
|
return {
|
|
2377
2376
|
isComplete: isComplete,
|
|
@@ -2382,6 +2381,25 @@
|
|
|
2382
2381
|
ast,
|
|
2383
2382
|
};
|
|
2384
2383
|
}
|
|
2384
|
+
getFurthestPosition(cursor) {
|
|
2385
|
+
const furthestError = cursor.furthestError;
|
|
2386
|
+
const furthestMatch = cursor.allMatchedNodes[cursor.allMatchedNodes.length - 1];
|
|
2387
|
+
if (furthestError && furthestMatch) {
|
|
2388
|
+
if (furthestError.endIndex > furthestMatch.endIndex) {
|
|
2389
|
+
return furthestMatch.endIndex;
|
|
2390
|
+
}
|
|
2391
|
+
else {
|
|
2392
|
+
return furthestError.endIndex;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
if (furthestError == null && furthestMatch != null) {
|
|
2396
|
+
return furthestMatch.endIndex;
|
|
2397
|
+
}
|
|
2398
|
+
if (furthestMatch == null && furthestError != null) {
|
|
2399
|
+
return furthestError.endIndex;
|
|
2400
|
+
}
|
|
2401
|
+
return 0;
|
|
2402
|
+
}
|
|
2385
2403
|
suggestFor(text) {
|
|
2386
2404
|
return this.suggestForWithCursor(new Cursor(text));
|
|
2387
2405
|
}
|