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.
- package/dist/analysis/backtrack.d.ts +50 -0
- package/dist/analysis/backtrack.d.ts.map +1 -0
- package/dist/analysis/diagnostics.d.ts +3 -0
- package/dist/analysis/diagnostics.d.ts.map +1 -1
- package/dist/analysis/diagnostics.js +1162 -158
- package/dist/analysis/diagnostics.js.map +3 -3
- package/dist/analysis/rebuild.d.ts +17 -1
- package/dist/analysis/rebuild.d.ts.map +1 -1
- package/dist/cli/index.js +353 -69
- package/dist/cli/index.js.map +3 -3
- package/dist/combinators/choice.d.ts.map +1 -1
- package/dist/combinators/dispatch.d.ts +2 -0
- package/dist/combinators/dispatch.d.ts.map +1 -1
- package/dist/combinators/expect.d.ts.map +1 -1
- package/dist/combinators/link-scope.d.ts +7 -0
- package/dist/combinators/link-scope.d.ts.map +1 -0
- package/dist/combinators/node.d.ts.map +1 -1
- package/dist/combinators/parser.d.ts.map +1 -1
- package/dist/compiler/token-capability.js +1 -0
- package/dist/compiler/token-capability.js.map +1 -1
- package/dist/compiler/value-usage.d.ts.map +1 -1
- package/dist/coverage.d.ts.map +1 -1
- package/dist/functional/run.d.ts.map +1 -1
- package/dist/index.js +121 -90
- package/dist/index.js.map +3 -3
- package/dist/language-service/index.js +1 -1
- package/dist/language-service/index.js.map +1 -1
- package/dist/plugin/index.js +274 -243
- package/dist/plugin/index.js.map +3 -3
- package/dist/run/index.js +1 -1
- package/dist/run/index.js.map +1 -1
- package/dist/spec/index.js.map +1 -1
- package/dist/table/backtrack-probe.d.ts +41 -0
- package/dist/table/backtrack-probe.d.ts.map +1 -0
- package/dist/table/child-slots.d.ts +10 -0
- package/dist/table/child-slots.d.ts.map +1 -1
- package/dist/table/emit.d.ts.map +1 -1
- package/dist/table/index.js +31 -20
- package/dist/table/index.js.map +3 -3
- package/dist/table/program.d.ts +3 -1
- package/dist/table/program.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +5 -1
- package/src/analysis/backtrack.ts +249 -0
- package/src/analysis/diagnostics.ts +4 -0
- package/src/analysis/rebuild.ts +63 -11
- package/src/combinators/choice.ts +3 -1
- package/src/combinators/dispatch.ts +9 -0
- package/src/combinators/expect.ts +1 -0
- package/src/combinators/link-scope.ts +19 -0
- package/src/combinators/node.ts +11 -2
- package/src/combinators/parser.ts +37 -31
- package/src/compiler/value-usage.ts +16 -29
- package/src/coverage.ts +2 -14
- package/src/functional/run.ts +3 -1
- package/src/table/backtrack-probe.ts +326 -0
- package/src/table/child-slots.ts +30 -14
- package/src/table/emit.ts +5 -1
- package/src/table/program.ts +8 -2
- package/src/version.ts +1 -1
package/src/table/program.ts
CHANGED
|
@@ -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
|
-
|
|
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