parseman 0.51.2 → 0.52.0

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.
Files changed (54) hide show
  1. package/dist/analysis/commitment.d.ts.map +1 -1
  2. package/dist/analysis/diagnostics.js +53 -20
  3. package/dist/analysis/diagnostics.js.map +1 -1
  4. package/dist/cli/index.js +53 -20
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/combinators/attempt.d.ts +11 -1
  7. package/dist/combinators/attempt.d.ts.map +1 -1
  8. package/dist/combinators/map.d.ts.map +1 -1
  9. package/dist/combinators/node.d.ts +6 -2
  10. package/dist/combinators/node.d.ts.map +1 -1
  11. package/dist/compiler/token-capability.js +4 -0
  12. package/dist/compiler/token-capability.js.map +1 -1
  13. package/dist/cst/trivia-kinds.d.ts.map +1 -1
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +55 -22
  17. package/dist/index.js.map +1 -1
  18. package/dist/plugin/index.js +55 -22
  19. package/dist/plugin/index.js.map +1 -1
  20. package/dist/spec/index.js +28 -5
  21. package/dist/spec/index.js.map +1 -1
  22. package/dist/table/assemble.d.ts.map +1 -1
  23. package/dist/table/emit-assembly.d.ts.map +1 -1
  24. package/dist/table/encode-baseline.d.ts.map +1 -1
  25. package/dist/table/exec.d.ts.map +1 -1
  26. package/dist/table/index.js +37 -15
  27. package/dist/table/index.js.map +1 -1
  28. package/dist/table/ops.d.ts +7 -5
  29. package/dist/table/ops.d.ts.map +1 -1
  30. package/dist/table/site-labels.d.ts.map +1 -1
  31. package/dist/types.d.ts +8 -1
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/analysis/commitment.ts +3 -1
  36. package/src/analysis/rebuild.ts +1 -1
  37. package/src/combinators/attempt.ts +26 -3
  38. package/src/combinators/first-set.ts +5 -1
  39. package/src/combinators/map.ts +5 -1
  40. package/src/combinators/node.ts +12 -3
  41. package/src/compiler/ir-serialize.ts +1 -1
  42. package/src/coverage.ts +1 -1
  43. package/src/cst/trivia-kinds.ts +6 -0
  44. package/src/index.ts +1 -0
  45. package/src/plugin/evaluator.ts +1 -1
  46. package/src/table/assemble.ts +22 -8
  47. package/src/table/emit-assembly.ts +8 -3
  48. package/src/table/encode-baseline.ts +5 -1
  49. package/src/table/encode.ts +13 -13
  50. package/src/table/exec.ts +6 -2
  51. package/src/table/ops.ts +7 -5
  52. package/src/table/site-labels.ts +3 -1
  53. package/src/types.ts +8 -1
  54. package/src/version.ts +1 -1
package/src/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { LabeledTriviaSpec } from './cst/trivia-kinds.ts'
2
+
1
3
  export type Span = {
2
4
  start: number
3
5
  end: number
@@ -56,7 +58,7 @@ export type ParserDef =
56
58
  // closures live in `gates`.
57
59
  | { tag: 'choice'; parsers: Combinator<unknown>[]; gates: (((state: unknown) => boolean) | null)[]; gateSrcs?: (string | null)[]; disjoint: boolean; strategy: ChoiceStrategy; autoNot: (AutoNotCheck[] | null)[] }
58
60
  | { tag: 'dispatch'; selector: Combinator<string>; cases: readonly DispatchCase[]; matchers?: readonly DispatchMatcherCase[] | undefined; otherwise?: Combinator<unknown> | undefined; otherwiseUsesRouted?: boolean | undefined }
59
- | { tag: 'attempt'; parser: Combinator<unknown> }
61
+ | { tag: 'attempt'; parser: Combinator<unknown>; /** `attempt(p, { contain: true })`: a committed failure inside is reported uncommitted. */ contain?: true }
60
62
  // The TAG carries NULLABILITY (what every downstream switch keys on): `many` is
61
63
  // the nullable min-0 repeat, `oneOrMore` the non-nullable min>=1 one. `min`/`max`
62
64
  // carry the actual ITEM bounds (`many(x, { min: 3, max: 8 })` is a `oneOrMore`
@@ -433,6 +435,11 @@ export type ParserMeta = {
433
435
  isTrivia: boolean
434
436
  /** User-defined labels for labeled trivia arms (`label(name, parser)`). */
435
437
  triviaKindLabels?: readonly string[]
438
+ /**
439
+ * Set only by `trivia()`: the labeled-arm spec of this trivia (`null` when it is
440
+ * not labeled), built once so a labeled scan never re-derives it.
441
+ */
442
+ labeledTriviaSpec?: LabeledTriviaSpec | null
436
443
  /** Preclassified lightweight trivia scanner for the ordinary skip path. */
437
444
  triviaScanner?: ((input: string, cur: number) => number) | null
438
445
  /** Set only by `classifiedTrivia()`: each root-visible category is a separate
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.51.2'
16
+ export const PARSEMAN_VERSION = '0.52.0'