@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.
@@ -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, start);
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, start);
303
+ const dir = this.handleAfterCapture(token, captureResult, silent, prevSourcePosition);
301
304
  if (dir === "stop") {
302
305
  this.advanceToken();
303
306
  this._stopped = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/rgx",
3
- "version": "12.7.3",
3
+ "version": "12.7.4",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",