parseman 0.58.0 → 0.58.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/diagnostics.js +4 -3
- package/dist/analysis/diagnostics.js.map +1 -1
- package/dist/cli/index.js +4 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/plugin/index.js +5 -4
- package/dist/plugin/index.js.map +1 -1
- package/dist/run/index.d.ts +2 -0
- package/dist/run/index.d.ts.map +1 -1
- package/dist/run/index.js +9 -0
- package/dist/run/index.js.map +1 -1
- package/dist/table/encode.d.ts.map +1 -1
- package/dist/table/index.js +4 -3
- package/dist/table/index.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/run/index.ts +5 -0
- package/src/table/encode.ts +11 -8
- package/src/version.ts +1 -1
package/dist/version.d.ts
CHANGED
|
@@ -13,5 +13,5 @@
|
|
|
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 declare const PARSEMAN_VERSION = "0.58.
|
|
16
|
+
export declare const PARSEMAN_VERSION = "0.58.1";
|
|
17
17
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/run/index.ts
CHANGED
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* const result = run(myGrammar, source, { trivia })
|
|
26
26
|
*/
|
|
27
27
|
export { buildRootTriviaIndex } from '../cst/trivia-entries.ts'
|
|
28
|
+
// Line/column lookup for the spans and errors `run()` returns. `line-index.ts` is
|
|
29
|
+
// already in the driver's closure (recovery annotates errors with it), so exposing
|
|
30
|
+
// it here costs no module — a caller reporting positions need not import the main entry.
|
|
31
|
+
export { buildLineIndex, offsetToLineCol } from '../line-index.ts'
|
|
32
|
+
export type { LineIndex } from '../line-index.ts'
|
|
28
33
|
export { run } from '../functional/run.ts'
|
|
29
34
|
export type { RootTriviaCapture, Runnable, RunOptions, RunResult } from '../functional/run.ts'
|
|
30
35
|
export type { RootTriviaGap, RootTriviaIndex, TriviaEntriesView } from '../cst/trivia-entries.ts'
|
package/src/table/encode.ts
CHANGED
|
@@ -983,17 +983,20 @@ class Encoder {
|
|
|
983
983
|
const rr = this.refResolver()
|
|
984
984
|
const { next, boundary } = follow
|
|
985
985
|
if (matchesEmpty(next, new Set(), rr) || mayCommitFailure(next, rr, this.commitFailureMemo)) return undefined
|
|
986
|
-
// A miss reports `
|
|
987
|
-
//
|
|
988
|
-
//
|
|
989
|
-
//
|
|
990
|
-
//
|
|
991
|
-
|
|
992
|
-
|
|
986
|
+
// A miss reports the set `next` fails with at its start, so only a row with
|
|
987
|
+
// one such set is gated: a terminal, which fails with its own spelling
|
|
988
|
+
// (`directTerminalFailureExpected` — `keywords()` and `word()` say `keyword`,
|
|
989
|
+
// not each word as `deriveExpected` lists them), or a label, which fails with
|
|
990
|
+
// its name. A sequence over an `optional` prefix reports the prefix's labels
|
|
991
|
+
// statically but not when it runs, and a choice whose arms share an opener
|
|
992
|
+
// reports that opener once statically, once per arm when it runs.
|
|
993
|
+
const nextDef = next._def as ParserDef
|
|
994
|
+
if (nextDef.tag !== 'literal' && nextDef.tag !== 'regex' && nextDef.tag !== 'keywords' && nextDef.tag !== 'label') return undefined
|
|
993
995
|
const first = firstSetOf(next, new Set(), rr, boundary)
|
|
994
996
|
const cls = this.charClass(boundary === undefined ? first : union(first, firstSetOf(boundary, new Set(), rr)))
|
|
995
997
|
if (cls < 0) return undefined
|
|
996
|
-
|
|
998
|
+
const miss = nextDef.tag === 'label' ? deriveExpected(next) : directTerminalFailureExpected(nextDef)
|
|
999
|
+
return { cls, fx: this.expected(miss) }
|
|
997
1000
|
}
|
|
998
1001
|
|
|
999
1002
|
node(p: Combinator<unknown>): Emitted {
|
package/src/version.ts
CHANGED