clarity-pattern-parser 10.0.4 → 10.0.5
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 +5 -10
- package/dist/index.browser.js.map +1 -1
- package/dist/index.esm.js +5 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/patterns/Cursor.d.ts +2 -1
- package/package.json +1 -1
- package/src/patterns/Cursor.ts +4 -2
- package/src/patterns/Options.test.ts +17 -0
- package/src/patterns/Options.ts +2 -7
package/dist/index.browser.js
CHANGED
|
@@ -379,10 +379,11 @@
|
|
|
379
379
|
}
|
|
380
380
|
|
|
381
381
|
class CyclicalParseError extends Error {
|
|
382
|
-
constructor(patternId, patternName) {
|
|
382
|
+
constructor(patternId, patternName, cursorIndex) {
|
|
383
383
|
super("Cyclical Parse Error");
|
|
384
384
|
this.patternId = patternId;
|
|
385
385
|
this.patternName = patternName;
|
|
386
|
+
this.cursorIndex = cursorIndex;
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
class Cursor {
|
|
@@ -496,7 +497,7 @@
|
|
|
496
497
|
};
|
|
497
498
|
const hasCycle = this._stackTrace.filter(t => t.pattern.id === pattern.id && this.index === t.cursorIndex).length > 1;
|
|
498
499
|
if (hasCycle) {
|
|
499
|
-
throw new CyclicalParseError(pattern.id, pattern.name);
|
|
500
|
+
throw new CyclicalParseError(pattern.id, pattern.name, this.index);
|
|
500
501
|
}
|
|
501
502
|
this._history.pushStackTrace(trace);
|
|
502
503
|
this._stackTrace.push(trace);
|
|
@@ -1008,14 +1009,8 @@
|
|
|
1008
1009
|
try {
|
|
1009
1010
|
result = pattern.parse(cursor);
|
|
1010
1011
|
}
|
|
1011
|
-
catch (
|
|
1012
|
-
|
|
1013
|
-
continue;
|
|
1014
|
-
}
|
|
1015
|
-
else {
|
|
1016
|
-
cursor.endParse();
|
|
1017
|
-
throw error;
|
|
1018
|
-
}
|
|
1012
|
+
catch (_a) {
|
|
1013
|
+
continue;
|
|
1019
1014
|
}
|
|
1020
1015
|
if (this._isGreedy) {
|
|
1021
1016
|
results.push(result);
|