parseman 0.60.6 → 0.61.1

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 (60) hide show
  1. package/dist/analysis/backtrack.d.ts +50 -0
  2. package/dist/analysis/backtrack.d.ts.map +1 -0
  3. package/dist/analysis/diagnostics.d.ts +3 -0
  4. package/dist/analysis/diagnostics.d.ts.map +1 -1
  5. package/dist/analysis/diagnostics.js +1162 -158
  6. package/dist/analysis/diagnostics.js.map +3 -3
  7. package/dist/analysis/rebuild.d.ts +17 -1
  8. package/dist/analysis/rebuild.d.ts.map +1 -1
  9. package/dist/cli/index.js +353 -69
  10. package/dist/cli/index.js.map +3 -3
  11. package/dist/combinators/choice.d.ts.map +1 -1
  12. package/dist/combinators/dispatch.d.ts +2 -0
  13. package/dist/combinators/dispatch.d.ts.map +1 -1
  14. package/dist/combinators/expect.d.ts.map +1 -1
  15. package/dist/combinators/link-scope.d.ts +7 -0
  16. package/dist/combinators/link-scope.d.ts.map +1 -0
  17. package/dist/combinators/node.d.ts.map +1 -1
  18. package/dist/combinators/parser.d.ts.map +1 -1
  19. package/dist/compiler/token-capability.js +1 -0
  20. package/dist/compiler/token-capability.js.map +1 -1
  21. package/dist/compiler/value-usage.d.ts.map +1 -1
  22. package/dist/coverage.d.ts.map +1 -1
  23. package/dist/functional/run.d.ts.map +1 -1
  24. package/dist/index.js +121 -90
  25. package/dist/index.js.map +3 -3
  26. package/dist/language-service/index.js +1 -1
  27. package/dist/language-service/index.js.map +1 -1
  28. package/dist/plugin/index.js +274 -243
  29. package/dist/plugin/index.js.map +3 -3
  30. package/dist/run/index.js +1 -1
  31. package/dist/run/index.js.map +1 -1
  32. package/dist/spec/index.js.map +1 -1
  33. package/dist/table/backtrack-probe.d.ts +41 -0
  34. package/dist/table/backtrack-probe.d.ts.map +1 -0
  35. package/dist/table/child-slots.d.ts +10 -0
  36. package/dist/table/child-slots.d.ts.map +1 -1
  37. package/dist/table/emit.d.ts.map +1 -1
  38. package/dist/table/index.js +31 -20
  39. package/dist/table/index.js.map +3 -3
  40. package/dist/table/program.d.ts +3 -1
  41. package/dist/table/program.d.ts.map +1 -1
  42. package/dist/version.d.ts +1 -1
  43. package/package.json +5 -1
  44. package/src/analysis/backtrack.ts +249 -0
  45. package/src/analysis/diagnostics.ts +4 -0
  46. package/src/analysis/rebuild.ts +63 -11
  47. package/src/combinators/choice.ts +3 -1
  48. package/src/combinators/dispatch.ts +9 -0
  49. package/src/combinators/expect.ts +1 -0
  50. package/src/combinators/link-scope.ts +19 -0
  51. package/src/combinators/node.ts +11 -2
  52. package/src/combinators/parser.ts +37 -31
  53. package/src/compiler/value-usage.ts +16 -29
  54. package/src/coverage.ts +2 -14
  55. package/src/functional/run.ts +3 -1
  56. package/src/table/backtrack-probe.ts +326 -0
  57. package/src/table/child-slots.ts +30 -14
  58. package/src/table/emit.ts +5 -1
  59. package/src/table/program.ts +8 -2
  60. package/src/version.ts +1 -1
@@ -6,6 +6,7 @@ import { leadRanges } from '../lead-ranges.ts'
6
6
  import { choice } from '../combinators/choice.ts'
7
7
  import { many } from '../combinators/repeat.ts'
8
8
  import type { EmittedFactory, PoolPlan } from './emit-assembly.ts'
9
+ import { PARSEMAN_VERSION } from '../version.ts'
9
10
  import { buildLexBodyRecognizer, type LexBodyRecognizer } from './lex-body.ts'
10
11
  import { buildLexProgramRunner, type LexProgramRunner } from './lex-program.ts'
11
12
 
@@ -328,7 +329,9 @@ export type CompactProgram = {
328
329
  readonly c: readonly number[]
329
330
  readonly k: readonly unknown[]
330
331
  readonly x: readonly string[]
331
- readonly e: readonly (readonly string[])[]
332
+ /** Expected sets, as indices into `es`. */
333
+ readonly e: readonly (readonly number[])[]
334
+ readonly es: readonly string[]
332
335
  readonly d: readonly (readonly number[])[]
333
336
  readonly r: Readonly<Record<string, number>>
334
337
  readonly f: readonly unknown[]
@@ -351,8 +354,11 @@ export type CompactProgram = {
351
354
 
352
355
  export function expandCompact(p: TableProgram | CompactProgram): TableProgram {
353
356
  if ('code' in p) return p
357
+ // A table from before the token pool has no `es`. Refuse it here, at load, instead of
358
+ // failing on the first expected set read below.
359
+ if (p.es === undefined) throw new Error(`parseman: this parser was printed by an earlier parseman; reprint it with parseman ${PARSEMAN_VERSION}`)
354
360
  return ownTableProgram({
355
- code: p.c, k: p.k, cc: p.x, fx: p.e, disp: p.d, rules: p.r, fns: p.f,
361
+ code: p.c, k: p.k, cc: p.x, fx: p.e.map(set => set.map(i => p.es[i]!)), disp: p.d, rules: p.r, fns: p.f,
356
362
  lines: p.l ?? 0, dsp: p.p ?? [],
357
363
  ...(p.lx === undefined ? {} : { lex: p.lx }),
358
364
  ...(p.lp === undefined ? {} : { lexPrograms: p.lp }),
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.6'
16
+ export const PARSEMAN_VERSION = '0.61.1'