@ptolemy2002/rgx 12.7.3 → 12.7.4
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/walker/base.js +5 -2
- package/package.json +1 -1
package/dist/walker/base.js
CHANGED
|
@@ -247,6 +247,9 @@ class RGXWalker {
|
|
|
247
247
|
silent = dir === "silent";
|
|
248
248
|
}
|
|
249
249
|
const branchedToken = isPart ? createBranchGroups(token.token) : createBranchGroups(token);
|
|
250
|
+
// Still track the previous source position,
|
|
251
|
+
// because if we have to skip, we need to reset to it.
|
|
252
|
+
const prevSourcePosition = this.sourcePosition;
|
|
250
253
|
let captureAttempt;
|
|
251
254
|
try {
|
|
252
255
|
captureAttempt = this.attemptCapture(branchedToken, isPart ? token : null);
|
|
@@ -284,7 +287,7 @@ class RGXWalker {
|
|
|
284
287
|
groups: captureAttempt.groups ?? null
|
|
285
288
|
};
|
|
286
289
|
if (isPart) {
|
|
287
|
-
const dir = this.validateCapture(token, captureResult,
|
|
290
|
+
const dir = this.validateCapture(token, captureResult, prevSourcePosition);
|
|
288
291
|
if (dir === "stop") {
|
|
289
292
|
this._stopped = true;
|
|
290
293
|
return null;
|
|
@@ -297,7 +300,7 @@ class RGXWalker {
|
|
|
297
300
|
if (!silent)
|
|
298
301
|
this.registerCapture(captureResult, token);
|
|
299
302
|
if (isPart) {
|
|
300
|
-
const dir = this.handleAfterCapture(token, captureResult, silent,
|
|
303
|
+
const dir = this.handleAfterCapture(token, captureResult, silent, prevSourcePosition);
|
|
301
304
|
if (dir === "stop") {
|
|
302
305
|
this.advanceToken();
|
|
303
306
|
this._stopped = true;
|