parseman 0.60.2 → 0.60.3

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.
@@ -531,6 +531,8 @@ type RuntimeTableProgram = TableProgram & {
531
531
  readonly choiceRollbackMasks?: ReadonlyMap<number, number>
532
532
  readonly nonCommittingChoiceSites?: ReadonlySet<number>
533
533
  readonly failureRollbackCleanSites?: ReadonlySet<number>
534
+ readonly choiceLogRollbackMasks?: ReadonlyMap<number, number>
535
+ readonly failureLogRollbackSites?: ReadonlySet<number>
534
536
  }
535
537
  }
536
538
 
@@ -542,6 +544,8 @@ export function ownTableProgram(
542
544
  readonly choiceRollbackMasks?: ReadonlyMap<number, number>
543
545
  readonly failureRollbackCleanSites?: ReadonlySet<number>
544
546
  readonly nonCommittingChoiceSites?: ReadonlySet<number>
547
+ readonly choiceLogRollbackMasks?: ReadonlyMap<number, number>
548
+ readonly failureLogRollbackSites?: ReadonlySet<number>
545
549
  } = {},
546
550
  ): TableProgram {
547
551
  const runtime = (prog as RuntimeTableProgram)[TABLE_RUNTIME]
@@ -552,6 +556,8 @@ export function ownTableProgram(
552
556
  choiceRollbackMasks: caches.choiceRollbackMasks ?? runtime?.choiceRollbackMasks,
553
557
  nonCommittingChoiceSites: caches.nonCommittingChoiceSites ?? runtime?.nonCommittingChoiceSites,
554
558
  failureRollbackCleanSites: caches.failureRollbackCleanSites ?? runtime?.failureRollbackCleanSites,
559
+ choiceLogRollbackMasks: caches.choiceLogRollbackMasks ?? runtime?.choiceLogRollbackMasks,
560
+ failureLogRollbackSites: caches.failureLogRollbackSites ?? runtime?.failureLogRollbackSites,
555
561
  },
556
562
  } as RuntimeTableProgram
557
563
  }
@@ -575,6 +581,19 @@ export function failureRollbackClean(prog: TableProgram, ip: number): boolean {
575
581
  return (prog as RuntimeTableProgram)[TABLE_RUNTIME]?.failureRollbackCleanSites?.has(ip) === true
576
582
  }
577
583
 
584
+ /** The arms of the choice at `ip` the census counts as clean whose failure can
585
+ * still leave trivia-log rows: a node they reach fails after recording trivia
586
+ * (`encode.ts` `choiceLogRollbackMasks`). Zero without that authority. */
587
+ export function choiceLogRollbackMask(prog: TableProgram, ip: number): number {
588
+ return (prog as RuntimeTableProgram)[TABLE_RUNTIME]?.choiceLogRollbackMasks?.get(ip) ?? 0
589
+ }
590
+
591
+ /** An `optional()` or `attempt()` row `failureRollbackClean` admits whose failed
592
+ * child can still leave trivia-log rows, for the same reason. */
593
+ export function failureLogRollback(prog: TableProgram, ip: number): boolean {
594
+ return (prog as RuntimeTableProgram)[TABLE_RUNTIME]?.failureLogRollbackSites?.has(ip) === true
595
+ }
596
+
578
597
  /** A compiled entry, shaped exactly like a codegen rule function. */
579
598
  export type TableRule = (input: string, pos: number, ctx: ParseContext) => ParseResult<unknown>
580
599
 
package/src/version.ts CHANGED
@@ -13,4 +13,4 @@
13
13
  * Kept in sync with `package.json` by `test/unit/version-sync.test.ts`, which fails
14
14
  * the build if this constant drifts from the published version.
15
15
  */
16
- export const PARSEMAN_VERSION = '0.60.2'
16
+ export const PARSEMAN_VERSION = '0.60.3'