@driftsys/markspec 0.10.3 → 0.11.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.
- package/README.md +2 -2
- package/esm/compiler/deserialize.d.ts +49 -0
- package/esm/compiler/deserialize.d.ts.map +1 -0
- package/esm/compiler/deserialize.js +139 -0
- package/esm/compiler/manifest.d.ts +3 -0
- package/esm/compiler/manifest.d.ts.map +1 -1
- package/esm/compiler/manifest.js +9 -3
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +16 -7
- package/esm/config/markspec.d.ts +38 -1
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +127 -2
- package/esm/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +143 -147
- package/esm/decl/duplicates.d.ts +29 -0
- package/esm/decl/duplicates.d.ts.map +1 -0
- package/esm/decl/duplicates.js +28 -0
- package/esm/decl/mod.d.ts +4 -2
- package/esm/decl/mod.d.ts.map +1 -1
- package/esm/decl/mod.js +2 -1
- package/esm/decl/surfaces.d.ts +29 -7
- package/esm/decl/surfaces.d.ts.map +1 -1
- package/esm/decl/surfaces.js +31 -18
- package/esm/gates/mod.d.ts +13 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +38 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +3 -1
- package/esm/lock/acquire_compile.d.ts +31 -0
- package/esm/lock/acquire_compile.d.ts.map +1 -0
- package/esm/lock/acquire_compile.js +83 -0
- package/esm/lock/cache_check.d.ts +28 -0
- package/esm/lock/cache_check.d.ts.map +1 -0
- package/esm/lock/cache_check.js +51 -0
- package/esm/lock/check.d.ts +14 -3
- package/esm/lock/check.d.ts.map +1 -1
- package/esm/lock/check.js +41 -3
- package/esm/lock/git_intent.d.ts +46 -0
- package/esm/lock/git_intent.d.ts.map +1 -0
- package/esm/lock/git_intent.js +111 -0
- package/esm/lock/mod.d.ts +10 -3
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +7 -1
- package/esm/lock/model.d.ts +24 -1
- package/esm/lock/model.d.ts.map +1 -1
- package/esm/lock/parser.d.ts.map +1 -1
- package/esm/lock/parser.js +32 -0
- package/esm/lock/pin_assurance.d.ts +20 -0
- package/esm/lock/pin_assurance.d.ts.map +1 -0
- package/esm/lock/pin_assurance.js +34 -0
- package/esm/lock/resolve.d.ts +8 -17
- package/esm/lock/resolve.d.ts.map +1 -1
- package/esm/lock/resolve.js +7 -67
- package/esm/lock/serializer.d.ts.map +1 -1
- package/esm/lock/serializer.js +23 -0
- package/esm/lock/upstream_common.d.ts +29 -0
- package/esm/lock/upstream_common.d.ts.map +1 -0
- package/esm/lock/upstream_common.js +38 -0
- package/esm/lock/upstream_deps.d.ts +63 -0
- package/esm/lock/upstream_deps.d.ts.map +1 -0
- package/esm/lock/upstream_deps.js +172 -0
- package/esm/lock/upstream_refs.d.ts +69 -0
- package/esm/lock/upstream_refs.d.ts.map +1 -0
- package/esm/lock/upstream_refs.js +238 -0
- package/esm/mod.d.ts +16 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +15 -5
- package/esm/model/mod.d.ts +93 -28
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +66 -13
- package/esm/model/profile.d.ts +13 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +7 -51
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +20 -3
- package/esm/profile/merge.js +7 -0
- package/esm/reporter/mod.d.ts +11 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +19 -8
- package/esm/typl/assemble.d.ts +53 -0
- package/esm/typl/assemble.d.ts.map +1 -0
- package/esm/typl/assemble.js +238 -0
- package/esm/typl/ast.d.ts +7 -1
- package/esm/typl/ast.d.ts.map +1 -1
- package/esm/typl/ast.js +3 -0
- package/esm/typl/bullet.d.ts +9 -7
- package/esm/typl/bullet.d.ts.map +1 -1
- package/esm/typl/bullet.js +6 -4
- package/esm/typl/citations.d.ts +27 -0
- package/esm/typl/citations.d.ts.map +1 -0
- package/esm/typl/citations.js +16 -0
- package/esm/typl/diagnostics.d.ts +2 -2
- package/esm/typl/diagnostics.d.ts.map +1 -1
- package/esm/typl/diagnostics.js +18 -0
- package/esm/typl/grammar.d.ts.map +1 -1
- package/esm/typl/grammar.js +6 -0
- package/esm/typl/lexer.d.ts.map +1 -1
- package/esm/typl/lexer.js +25 -4
- package/esm/typl/mod.d.ts +8 -2
- package/esm/typl/mod.d.ts.map +1 -1
- package/esm/typl/mod.js +5 -1
- package/esm/typl/recognize.js +2 -2
- package/esm/typl/registry.d.ts +1 -1
- package/esm/typl/resolve.d.ts +31 -0
- package/esm/typl/resolve.d.ts.map +1 -0
- package/esm/typl/resolve.js +27 -0
- package/esm/typl/table.d.ts +52 -0
- package/esm/typl/table.d.ts.map +1 -0
- package/esm/typl/table.js +69 -0
- package/esm/typl/validator.d.ts +24 -5
- package/esm/typl/validator.d.ts.map +1 -1
- package/esm/typl/validator.js +55 -75
- package/esm/upstream/mod.d.ts +45 -0
- package/esm/upstream/mod.d.ts.map +1 -0
- package/esm/upstream/mod.js +98 -0
- package/esm/upstream/project.d.ts +33 -0
- package/esm/upstream/project.d.ts.map +1 -0
- package/esm/upstream/project.js +38 -0
- package/esm/upstream/refs.d.ts +23 -0
- package/esm/upstream/refs.d.ts.map +1 -0
- package/esm/upstream/refs.js +71 -0
- package/esm/util/paths.d.ts +14 -0
- package/esm/util/paths.d.ts.map +1 -0
- package/esm/util/paths.js +22 -0
- package/esm/uxil/assemble.d.ts +38 -0
- package/esm/uxil/assemble.d.ts.map +1 -0
- package/esm/uxil/assemble.js +268 -0
- package/esm/uxil/ast.d.ts +63 -0
- package/esm/uxil/ast.d.ts.map +1 -0
- package/esm/uxil/ast.js +9 -0
- package/esm/uxil/citations.d.ts +27 -0
- package/esm/uxil/citations.d.ts.map +1 -0
- package/esm/uxil/citations.js +25 -0
- package/esm/uxil/diagnostics.d.ts +39 -0
- package/esm/uxil/diagnostics.d.ts.map +1 -0
- package/esm/uxil/diagnostics.js +135 -0
- package/esm/uxil/grammar.d.ts +72 -0
- package/esm/uxil/grammar.d.ts.map +1 -0
- package/esm/uxil/grammar.js +505 -0
- package/esm/uxil/lexer.d.ts +23 -0
- package/esm/uxil/lexer.d.ts.map +1 -0
- package/esm/uxil/lexer.js +58 -0
- package/esm/uxil/mod.d.ts +32 -0
- package/esm/uxil/mod.d.ts.map +1 -0
- package/esm/uxil/mod.js +11 -0
- package/esm/uxil/projection.d.ts +40 -0
- package/esm/uxil/projection.d.ts.map +1 -0
- package/esm/uxil/projection.js +41 -0
- package/esm/uxil/recognize.d.ts +16 -0
- package/esm/uxil/recognize.d.ts.map +1 -0
- package/esm/uxil/recognize.js +28 -0
- package/esm/uxil/registry.d.ts +37 -0
- package/esm/uxil/registry.d.ts.map +1 -0
- package/esm/uxil/registry.js +29 -0
- package/esm/uxil/surfaces.d.ts +36 -0
- package/esm/uxil/surfaces.d.ts.map +1 -0
- package/esm/uxil/surfaces.js +34 -0
- package/esm/uxil/validator.d.ts +36 -0
- package/esm/uxil/validator.d.ts.map +1 -0
- package/esm/uxil/validator.js +139 -0
- package/esm/uxil/vocab.d.ts +33 -0
- package/esm/uxil/vocab.d.ts.map +1 -0
- package/esm/uxil/vocab.js +36 -0
- package/esm/validator/caption_convention.d.ts +2 -1
- package/esm/validator/caption_convention.d.ts.map +1 -1
- package/esm/validator/caption_convention.js +2 -1
- package/esm/validator/corpus.d.ts.map +1 -1
- package/esm/validator/corpus.js +40 -17
- package/esm/validator/discipline.d.ts +6 -4
- package/esm/validator/discipline.d.ts.map +1 -1
- package/esm/validator/discipline.js +6 -4
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +28 -15
- package/esm/validator/pipeline.d.ts +11 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +68 -18
- package/esm/validator/trace_types.d.ts +9 -2
- package/esm/validator/trace_types.d.ts.map +1 -1
- package/esm/validator/trace_types.js +21 -5
- package/esm/validator/traceability.d.ts +15 -3
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +39 -4
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +11 -1
- package/esm/validator/uxil_family.d.ts +43 -0
- package/esm/validator/uxil_family.d.ts.map +1 -0
- package/esm/validator/uxil_family.js +52 -0
- package/package.json +1 -1
- package/script/compiler/deserialize.d.ts +49 -0
- package/script/compiler/deserialize.d.ts.map +1 -0
- package/script/compiler/deserialize.js +144 -0
- package/script/compiler/manifest.d.ts +3 -0
- package/script/compiler/manifest.d.ts.map +1 -1
- package/script/compiler/manifest.js +10 -3
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +15 -6
- package/script/config/markspec.d.ts +38 -1
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +129 -3
- package/script/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +143 -147
- package/script/decl/duplicates.d.ts +29 -0
- package/script/decl/duplicates.d.ts.map +1 -0
- package/script/decl/duplicates.js +31 -0
- package/script/decl/mod.d.ts +4 -2
- package/script/decl/mod.d.ts.map +1 -1
- package/script/decl/mod.js +4 -2
- package/script/decl/surfaces.d.ts +29 -7
- package/script/decl/surfaces.d.ts.map +1 -1
- package/script/decl/surfaces.js +32 -19
- package/script/gates/mod.d.ts +13 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +37 -10
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +3 -1
- package/script/lock/acquire_compile.d.ts +31 -0
- package/script/lock/acquire_compile.d.ts.map +1 -0
- package/script/lock/acquire_compile.js +86 -0
- package/script/lock/cache_check.d.ts +28 -0
- package/script/lock/cache_check.d.ts.map +1 -0
- package/script/lock/cache_check.js +54 -0
- package/script/lock/check.d.ts +14 -3
- package/script/lock/check.d.ts.map +1 -1
- package/script/lock/check.js +41 -3
- package/script/lock/git_intent.d.ts +46 -0
- package/script/lock/git_intent.d.ts.map +1 -0
- package/script/lock/git_intent.js +115 -0
- package/script/lock/mod.d.ts +10 -3
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +16 -2
- package/script/lock/model.d.ts +24 -1
- package/script/lock/model.d.ts.map +1 -1
- package/script/lock/parser.d.ts.map +1 -1
- package/script/lock/parser.js +32 -0
- package/script/lock/pin_assurance.d.ts +20 -0
- package/script/lock/pin_assurance.d.ts.map +1 -0
- package/script/lock/pin_assurance.js +37 -0
- package/script/lock/resolve.d.ts +8 -17
- package/script/lock/resolve.d.ts.map +1 -1
- package/script/lock/resolve.js +7 -68
- package/script/lock/serializer.d.ts.map +1 -1
- package/script/lock/serializer.js +23 -0
- package/script/lock/upstream_common.d.ts +29 -0
- package/script/lock/upstream_common.d.ts.map +1 -0
- package/script/lock/upstream_common.js +42 -0
- package/script/lock/upstream_deps.d.ts +63 -0
- package/script/lock/upstream_deps.d.ts.map +1 -0
- package/script/lock/upstream_deps.js +175 -0
- package/script/lock/upstream_refs.d.ts +69 -0
- package/script/lock/upstream_refs.d.ts.map +1 -0
- package/script/lock/upstream_refs.js +244 -0
- package/script/mod.d.ts +16 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +40 -7
- package/script/model/mod.d.ts +93 -28
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +70 -14
- package/script/model/profile.d.ts +13 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +6 -50
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +20 -3
- package/script/profile/merge.js +7 -0
- package/script/reporter/mod.d.ts +11 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +18 -7
- package/script/typl/assemble.d.ts +53 -0
- package/script/typl/assemble.d.ts.map +1 -0
- package/script/typl/assemble.js +241 -0
- package/script/typl/ast.d.ts +7 -1
- package/script/typl/ast.d.ts.map +1 -1
- package/script/typl/ast.js +3 -0
- package/script/typl/bullet.d.ts +9 -7
- package/script/typl/bullet.d.ts.map +1 -1
- package/script/typl/bullet.js +6 -4
- package/script/typl/citations.d.ts +27 -0
- package/script/typl/citations.d.ts.map +1 -0
- package/script/typl/citations.js +20 -0
- package/script/typl/diagnostics.d.ts +2 -2
- package/script/typl/diagnostics.d.ts.map +1 -1
- package/script/typl/diagnostics.js +18 -0
- package/script/typl/grammar.d.ts.map +1 -1
- package/script/typl/grammar.js +6 -0
- package/script/typl/lexer.d.ts.map +1 -1
- package/script/typl/lexer.js +25 -4
- package/script/typl/mod.d.ts +8 -2
- package/script/typl/mod.d.ts.map +1 -1
- package/script/typl/mod.js +14 -2
- package/script/typl/recognize.js +2 -2
- package/script/typl/registry.d.ts +1 -1
- package/script/typl/resolve.d.ts +31 -0
- package/script/typl/resolve.d.ts.map +1 -0
- package/script/typl/resolve.js +33 -0
- package/script/typl/table.d.ts +52 -0
- package/script/typl/table.d.ts.map +1 -0
- package/script/typl/table.js +75 -0
- package/script/typl/validator.d.ts +24 -5
- package/script/typl/validator.d.ts.map +1 -1
- package/script/typl/validator.js +55 -75
- package/script/upstream/mod.d.ts +45 -0
- package/script/upstream/mod.d.ts.map +1 -0
- package/script/upstream/mod.js +101 -0
- package/script/upstream/project.d.ts +33 -0
- package/script/upstream/project.d.ts.map +1 -0
- package/script/upstream/project.js +41 -0
- package/script/upstream/refs.d.ts +23 -0
- package/script/upstream/refs.d.ts.map +1 -0
- package/script/upstream/refs.js +74 -0
- package/script/util/paths.d.ts +14 -0
- package/script/util/paths.d.ts.map +1 -0
- package/script/util/paths.js +25 -0
- package/script/uxil/assemble.d.ts +38 -0
- package/script/uxil/assemble.d.ts.map +1 -0
- package/script/uxil/assemble.js +272 -0
- package/script/uxil/ast.d.ts +63 -0
- package/script/uxil/ast.d.ts.map +1 -0
- package/script/uxil/ast.js +10 -0
- package/script/uxil/citations.d.ts +27 -0
- package/script/uxil/citations.d.ts.map +1 -0
- package/script/uxil/citations.js +29 -0
- package/script/uxil/diagnostics.d.ts +39 -0
- package/script/uxil/diagnostics.d.ts.map +1 -0
- package/script/uxil/diagnostics.js +140 -0
- package/script/uxil/grammar.d.ts +72 -0
- package/script/uxil/grammar.d.ts.map +1 -0
- package/script/uxil/grammar.js +511 -0
- package/script/uxil/lexer.d.ts +23 -0
- package/script/uxil/lexer.d.ts.map +1 -0
- package/script/uxil/lexer.js +61 -0
- package/script/uxil/mod.d.ts +32 -0
- package/script/uxil/mod.d.ts.map +1 -0
- package/script/uxil/mod.js +37 -0
- package/script/uxil/projection.d.ts +40 -0
- package/script/uxil/projection.d.ts.map +1 -0
- package/script/uxil/projection.js +44 -0
- package/script/uxil/recognize.d.ts +16 -0
- package/script/uxil/recognize.d.ts.map +1 -0
- package/script/uxil/recognize.js +31 -0
- package/script/uxil/registry.d.ts +37 -0
- package/script/uxil/registry.d.ts.map +1 -0
- package/script/uxil/registry.js +32 -0
- package/script/uxil/surfaces.d.ts +36 -0
- package/script/uxil/surfaces.d.ts.map +1 -0
- package/script/uxil/surfaces.js +39 -0
- package/script/uxil/validator.d.ts +36 -0
- package/script/uxil/validator.d.ts.map +1 -0
- package/script/uxil/validator.js +142 -0
- package/script/uxil/vocab.d.ts +33 -0
- package/script/uxil/vocab.d.ts.map +1 -0
- package/script/uxil/vocab.js +41 -0
- package/script/validator/caption_convention.d.ts +2 -1
- package/script/validator/caption_convention.d.ts.map +1 -1
- package/script/validator/caption_convention.js +2 -1
- package/script/validator/corpus.d.ts.map +1 -1
- package/script/validator/corpus.js +39 -16
- package/script/validator/discipline.d.ts +6 -4
- package/script/validator/discipline.d.ts.map +1 -1
- package/script/validator/discipline.js +6 -4
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +27 -14
- package/script/validator/pipeline.d.ts +11 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +67 -17
- package/script/validator/trace_types.d.ts +9 -2
- package/script/validator/trace_types.d.ts.map +1 -1
- package/script/validator/trace_types.js +20 -4
- package/script/validator/traceability.d.ts +15 -3
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +38 -3
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +10 -0
- package/script/validator/uxil_family.d.ts +43 -0
- package/script/validator/uxil_family.d.ts.map +1 -0
- package/script/validator/uxil_family.js +56 -0
package/esm/reporter/mod.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Output reporters. Transforms compiled traceability graph into
|
|
5
5
|
* traceability matrices and coverage reports in md, json, or csv format.
|
|
6
6
|
*/
|
|
7
|
-
import { formatEntryOrigin } from "../model/mod.js";
|
|
7
|
+
import { formatEntryOrigin, isUpstreamEntry } from "../model/mod.js";
|
|
8
8
|
/**
|
|
9
9
|
* Generate a report from compiled traceability graph.
|
|
10
10
|
*
|
|
@@ -17,7 +17,7 @@ export function report(result, options) {
|
|
|
17
17
|
if (options.kind === "traceability") {
|
|
18
18
|
return formatTraceability(result, entries, options.format);
|
|
19
19
|
}
|
|
20
|
-
return formatCoverage(result, entries, options.format);
|
|
20
|
+
return formatCoverage(result, entries, options.format, options.dependencyUpstreamIds);
|
|
21
21
|
}
|
|
22
22
|
// ---------------------------------------------------------------------------
|
|
23
23
|
// Filtering
|
|
@@ -95,7 +95,8 @@ function formatTraceability(result, entries, format) {
|
|
|
95
95
|
const lines = rows.map((r) => `| ${r.id} | ${r.title} | ${r.entryType} | ${r.origin} | ${r.satisfies || "\u2014"} | ${r.satisfiedBy || "\u2014"} |`);
|
|
96
96
|
return [header, sep, ...lines].join("\n");
|
|
97
97
|
}
|
|
98
|
-
function computeCoverage(result, entries) {
|
|
98
|
+
function computeCoverage(result, entries, opts = {}) {
|
|
99
|
+
const { dependencyUpstreamIds } = opts;
|
|
99
100
|
const byType = {};
|
|
100
101
|
const orphans = [];
|
|
101
102
|
const unsatisfied = [];
|
|
@@ -105,13 +106,22 @@ function computeCoverage(result, entries) {
|
|
|
105
106
|
// Bucket by profile-declared type when available, fall back to shape.
|
|
106
107
|
const t = entry.type ?? (entry.shape === "Reference" ? "ref" : "untyped");
|
|
107
108
|
byType[t] = (byType[t] ?? 0) + 1;
|
|
109
|
+
// Federated upstream (slice 4): a `references:` upstream entry is a
|
|
110
|
+
// traceability leaf — no coverage expectation points at or from it, so
|
|
111
|
+
// it is excluded from both gap lists below. A `dependencies:` upstream
|
|
112
|
+
// entry (its upstreamId present in `dependencyUpstreamIds`) participates
|
|
113
|
+
// like a project entry — this branch is inert until slice 3 loads
|
|
114
|
+
// dependency entries, but the classification is exercised here so it's
|
|
115
|
+
// ready when they do.
|
|
116
|
+
const isReferenceLeaf = isUpstreamEntry(entry) &&
|
|
117
|
+
!(dependencyUpstreamIds?.has(entry.origin.upstreamId) ?? false);
|
|
108
118
|
const fwd = result.forward.get(entry.displayId) ?? [];
|
|
109
119
|
const rev = result.reverse.get(entry.displayId) ?? [];
|
|
110
120
|
const hasSatisfies = fwd.some((l) => l.kind === "satisfies");
|
|
111
|
-
if (hasSatisfies) {
|
|
121
|
+
if (hasSatisfies && !isReferenceLeaf) {
|
|
112
122
|
withSatisfies++;
|
|
113
123
|
}
|
|
114
|
-
else if (entry.shape === "Authored") {
|
|
124
|
+
else if (entry.shape === "Authored" && !isReferenceLeaf) {
|
|
115
125
|
withoutSatisfies++;
|
|
116
126
|
orphans.push(entry.displayId);
|
|
117
127
|
}
|
|
@@ -120,7 +130,8 @@ function computeCoverage(result, entries) {
|
|
|
120
130
|
// profile-specific; a profile-aware reporter layer refines this.
|
|
121
131
|
const hasSatisfiedBy = rev.some((l) => l.kind === "satisfies");
|
|
122
132
|
if (entry.type &&
|
|
123
|
-
!hasSatisfiedBy
|
|
133
|
+
!hasSatisfiedBy &&
|
|
134
|
+
!isReferenceLeaf) {
|
|
124
135
|
unsatisfied.push(entry.displayId);
|
|
125
136
|
}
|
|
126
137
|
}
|
|
@@ -132,8 +143,8 @@ function computeCoverage(result, entries) {
|
|
|
132
143
|
gaps: { orphans, unsatisfied },
|
|
133
144
|
};
|
|
134
145
|
}
|
|
135
|
-
function formatCoverage(result, entries, format) {
|
|
136
|
-
const stats = computeCoverage(result, entries);
|
|
146
|
+
function formatCoverage(result, entries, format, dependencyUpstreamIds) {
|
|
147
|
+
const stats = computeCoverage(result, entries, { dependencyUpstreamIds });
|
|
137
148
|
if (format === "json") {
|
|
138
149
|
return JSON.stringify(stats, null, 2);
|
|
139
150
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module typl/assemble
|
|
3
|
+
*
|
|
4
|
+
* Entry-level typl assembly (#723, #724): extracts declarations from the four
|
|
5
|
+
* surfaces (fence / bullet / inline / table), resolves published names through
|
|
6
|
+
* the base-resolution engine (core/decl/resolve), and aggregates the
|
|
7
|
+
* result into the `Entry.types` TyplBlock. Moved out of parser/markdown.ts
|
|
8
|
+
* so the parser calls one function.
|
|
9
|
+
*
|
|
10
|
+
* Resolution rules (design spec D5):
|
|
11
|
+
* - a `: namespace` binding establishes a base; nested-bullet namespaces
|
|
12
|
+
* scope their subtree (innermost wins); the root namespace (no
|
|
13
|
+
* namespace ancestor) scopes the whole entry body, order-independent;
|
|
14
|
+
* - a table's `Table:` caption may carry a base (#724); a table row
|
|
15
|
+
* resolves against that caption base first (innermost, #722 rule 3),
|
|
16
|
+
* then the root — the caption base is not itself a root and never sets
|
|
17
|
+
* `rootNamespace`;
|
|
18
|
+
* - relative names (`$.x`) resolve to absolute dotted names before
|
|
19
|
+
* aggregation — Entry.types carries absolute names only;
|
|
20
|
+
* - namespace bindings are scaffolding: excluded from bindings;
|
|
21
|
+
* - a relative name with no base is TYPL-010 (binding dropped);
|
|
22
|
+
* - a second root is TYPL-012 (first root wins);
|
|
23
|
+
* - inline/fence relative refs resolve against the root base only.
|
|
24
|
+
*/
|
|
25
|
+
import type { BodyBlock } from "../ast/nodes.js";
|
|
26
|
+
import type { BodyToken, Diagnostic } from "../model/mod.js";
|
|
27
|
+
import type { TyplBlock } from "./ast.js";
|
|
28
|
+
/**
|
|
29
|
+
* Assemble one entry's typl declarations into its `Entry.types` block.
|
|
30
|
+
*
|
|
31
|
+
* Extracts declarations from the four embedding surfaces (fenced code,
|
|
32
|
+
* bullet glossary, inline code spans, table rows), resolves every relative
|
|
33
|
+
* `$.x` name against the caption/root/nested-namespace bases in scope (see
|
|
34
|
+
* the module doc's resolution rules), and aggregates the result.
|
|
35
|
+
*
|
|
36
|
+
* @param bodyAst - The entry body's parsed block AST (fence + bullet + table
|
|
37
|
+
* surfaces walk this).
|
|
38
|
+
* @param bodyTokens - The entry body's flat token stream (the inline
|
|
39
|
+
* surface walks this).
|
|
40
|
+
* @param file - Source file path, for bridging diagnostics back to
|
|
41
|
+
* file-relative positions.
|
|
42
|
+
* @param bodyStartLine - 1-based line the entry body starts on, added to
|
|
43
|
+
* each surface's body-relative range to get a file-relative line.
|
|
44
|
+
* @returns `types` — the assembled `TyplBlock`, omitted when the entry
|
|
45
|
+
* declares nothing (no bindings, no typedefs, no root namespace) — plus
|
|
46
|
+
* any diagnostics raised during extraction or resolution (TYPL-010,
|
|
47
|
+
* TYPL-012, and bridged parse diagnostics).
|
|
48
|
+
*/
|
|
49
|
+
export declare function assembleTyplTypes(bodyAst: readonly BodyBlock[], bodyTokens: readonly BodyToken[], file: string, bodyStartLine: number): {
|
|
50
|
+
types?: TyplBlock;
|
|
51
|
+
diagnostics: Diagnostic[];
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=assemble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../src/typl/assemble.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,KAAK,EAAoB,SAAS,EAAE,MAAM,UAAU,CAAC;AAkC5D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,SAAS,SAAS,EAAE,EAC7B,UAAU,EAAE,SAAS,SAAS,EAAE,EAChC,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,MAAM,GACpB;IAAE,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAqOlD"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { checkSingleRoot, resolveRef } from "../decl/mod.js";
|
|
2
|
+
import { bridgeTyplDiagnostic } from "./bridge.js";
|
|
3
|
+
import { typlDiagnostic } from "./diagnostics.js";
|
|
4
|
+
import { extractTyplFences } from "./fence.js";
|
|
5
|
+
import { extractTyplBulletsNested } from "./bullet.js";
|
|
6
|
+
import { extractTyplInlines } from "./inline.js";
|
|
7
|
+
import { extractTyplTable, typlTableCaptionBase } from "./table.js";
|
|
8
|
+
import { parseTyplBlock } from "./grammar.js";
|
|
9
|
+
import { TYPL_REF_OPS, typlPathOf } from "./resolve.js";
|
|
10
|
+
/**
|
|
11
|
+
* Assemble one entry's typl declarations into its `Entry.types` block.
|
|
12
|
+
*
|
|
13
|
+
* Extracts declarations from the four embedding surfaces (fenced code,
|
|
14
|
+
* bullet glossary, inline code spans, table rows), resolves every relative
|
|
15
|
+
* `$.x` name against the caption/root/nested-namespace bases in scope (see
|
|
16
|
+
* the module doc's resolution rules), and aggregates the result.
|
|
17
|
+
*
|
|
18
|
+
* @param bodyAst - The entry body's parsed block AST (fence + bullet + table
|
|
19
|
+
* surfaces walk this).
|
|
20
|
+
* @param bodyTokens - The entry body's flat token stream (the inline
|
|
21
|
+
* surface walks this).
|
|
22
|
+
* @param file - Source file path, for bridging diagnostics back to
|
|
23
|
+
* file-relative positions.
|
|
24
|
+
* @param bodyStartLine - 1-based line the entry body starts on, added to
|
|
25
|
+
* each surface's body-relative range to get a file-relative line.
|
|
26
|
+
* @returns `types` — the assembled `TyplBlock`, omitted when the entry
|
|
27
|
+
* declares nothing (no bindings, no typedefs, no root namespace) — plus
|
|
28
|
+
* any diagnostics raised during extraction or resolution (TYPL-010,
|
|
29
|
+
* TYPL-012, and bridged parse diagnostics).
|
|
30
|
+
*/
|
|
31
|
+
export function assembleTyplTypes(bodyAst, bodyTokens, file, bodyStartLine) {
|
|
32
|
+
const diagnostics = [];
|
|
33
|
+
const blocks = [];
|
|
34
|
+
// Map bullet-extraction index → blocks[] index, for parent lookups.
|
|
35
|
+
const bulletBlockIndex = [];
|
|
36
|
+
for (const fence of extractTyplFences(bodyAst)) {
|
|
37
|
+
const result = parseTyplBlock(fence.source);
|
|
38
|
+
const lineOffset = bodyStartLine + fence.range.start.line - 1;
|
|
39
|
+
for (const td of result.diagnostics) {
|
|
40
|
+
diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
|
|
41
|
+
}
|
|
42
|
+
blocks.push({ ...result.ast, file, lineOffset });
|
|
43
|
+
}
|
|
44
|
+
const bullets = extractTyplBulletsNested(bodyAst);
|
|
45
|
+
for (const bullet of bullets) {
|
|
46
|
+
const result = parseTyplBlock(bullet.source);
|
|
47
|
+
const lineOffset = bodyStartLine + bullet.range.start.line - 2;
|
|
48
|
+
for (const td of result.diagnostics) {
|
|
49
|
+
diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
|
|
50
|
+
}
|
|
51
|
+
bulletBlockIndex.push(blocks.length);
|
|
52
|
+
blocks.push({
|
|
53
|
+
...result.ast,
|
|
54
|
+
file,
|
|
55
|
+
lineOffset,
|
|
56
|
+
bulletParent: bullet.parent,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
for (const inline of extractTyplInlines(bodyTokens)) {
|
|
60
|
+
const result = parseTyplBlock(inline.source);
|
|
61
|
+
const lineOffset = inline.location.line - 1;
|
|
62
|
+
for (const td of result.diagnostics) {
|
|
63
|
+
diagnostics.push(bridgeTyplDiagnostic(td, inline.location.file, lineOffset));
|
|
64
|
+
}
|
|
65
|
+
blocks.push({ ...result.ast, file: inline.location.file, lineOffset });
|
|
66
|
+
}
|
|
67
|
+
// Table rows (#724): each recognized data row is one binding. Its range
|
|
68
|
+
// points AT the row's own line (like the bullet surface, not the fence
|
|
69
|
+
// whose range points at the opening ``` a line above its content), so the
|
|
70
|
+
// diagnostic offset subtracts 2, matching the bullet path. The `Table:`
|
|
71
|
+
// caption base — when the caption text is an absolute typl name — scopes
|
|
72
|
+
// the row's relative refs (see `scopeFor`); the caption base is not a
|
|
73
|
+
// namespace binding, so it takes no part in Pass A root detection or Pass B.
|
|
74
|
+
for (const row of extractTyplTable(bodyAst)) {
|
|
75
|
+
const result = parseTyplBlock(row.source);
|
|
76
|
+
const lineOffset = bodyStartLine + row.range.start.line - 2;
|
|
77
|
+
for (const td of result.diagnostics) {
|
|
78
|
+
diagnostics.push(bridgeTyplDiagnostic(td, file, lineOffset));
|
|
79
|
+
}
|
|
80
|
+
const captionBase = row.captionText !== undefined
|
|
81
|
+
? typlTableCaptionBase(row.captionText)
|
|
82
|
+
: undefined;
|
|
83
|
+
blocks.push({
|
|
84
|
+
...result.ast,
|
|
85
|
+
file,
|
|
86
|
+
lineOffset,
|
|
87
|
+
...(captionBase !== undefined ? { captionBase } : {}),
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Emit a bridged typl diagnostic for a binding in blocks[i].
|
|
91
|
+
const emit = (code, params, i, position) => {
|
|
92
|
+
const td = typlDiagnostic(code, params, position);
|
|
93
|
+
diagnostics.push(bridgeTyplDiagnostic(td, blocks[i].file, blocks[i].lineOffset));
|
|
94
|
+
};
|
|
95
|
+
// blockHasNamespace / hasNamespaceAncestor are static structure checks
|
|
96
|
+
// (independent of resolution), so Pass A is order-independent.
|
|
97
|
+
const blockHasNamespace = blocks.map((b) => b.bindings.some((x) => x.kind === "namespace"));
|
|
98
|
+
const hasNamespaceAncestor = (i) => {
|
|
99
|
+
let p = blocks[i].bulletParent;
|
|
100
|
+
while (p !== undefined) {
|
|
101
|
+
const idx = bulletBlockIndex[p];
|
|
102
|
+
if (blockHasNamespace[idx])
|
|
103
|
+
return true;
|
|
104
|
+
p = blocks[idx].bulletParent;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
};
|
|
108
|
+
// ── Pass A: find the root ────────────────────────────────────────────
|
|
109
|
+
// Root candidate = an ABSOLUTE namespace binding with no namespace
|
|
110
|
+
// ancestor in its bullet chain (a relative namespace can never be a
|
|
111
|
+
// root — it needs a base itself). checkSingleRoot (core/decl) enforces
|
|
112
|
+
// the one-root invariant; its bare contract also flags zero candidates
|
|
113
|
+
// as a failure ("no-root"), but an entry with no namespace binding at
|
|
114
|
+
// all is a normal, error-free shape here — only "multiple-roots"
|
|
115
|
+
// produces diagnostics, first candidate in source order wins (order-
|
|
116
|
+
// independent for authors: the root scopes the whole body).
|
|
117
|
+
const rootCandidates = [];
|
|
118
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
119
|
+
for (const binding of blocks[i].bindings) {
|
|
120
|
+
if (binding.kind !== "namespace")
|
|
121
|
+
continue;
|
|
122
|
+
if (!TYPL_REF_OPS.isAbsolute(binding.name))
|
|
123
|
+
continue;
|
|
124
|
+
if (hasNamespaceAncestor(i))
|
|
125
|
+
continue;
|
|
126
|
+
rootCandidates.push({
|
|
127
|
+
path: typlPathOf(binding.name),
|
|
128
|
+
blockIndex: i,
|
|
129
|
+
position: binding.position,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const rootCheck = checkSingleRoot(rootCandidates);
|
|
134
|
+
let rootPath;
|
|
135
|
+
if (rootCheck.ok) {
|
|
136
|
+
rootPath = rootCheck.root.path;
|
|
137
|
+
}
|
|
138
|
+
else if (rootCheck.reason === "multiple-roots") {
|
|
139
|
+
rootPath = rootCheck.roots[0].path;
|
|
140
|
+
for (let k = 1; k < rootCheck.roots.length; k++) {
|
|
141
|
+
const extra = rootCheck.roots[k];
|
|
142
|
+
emit("TYPL-012", { first: `$${rootPath}` }, extra.blockIndex, extra.position);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// "no-root" → rootPath stays undefined; not an error.
|
|
146
|
+
// basePathOfBlock[i] = the base path blocks[i] provides to its bullet
|
|
147
|
+
// subtree, or undefined. One base slot per block: a block with several
|
|
148
|
+
// namespace bindings keeps the last (bullet blocks hold a single
|
|
149
|
+
// declaration in practice).
|
|
150
|
+
const basePathOfBlock = blocks.map(() => undefined);
|
|
151
|
+
/**
|
|
152
|
+
* Scope chain for blocks[i], innermost-first, terminated by the root base.
|
|
153
|
+
* Which frames a block sees depends on its surface: a bullet block walks
|
|
154
|
+
* its bullet-ancestor bases; a table-row block contributes its `Table:`
|
|
155
|
+
* caption base (#724); fence/inline blocks have neither and see the root
|
|
156
|
+
* only. The frame kinds don't combine in practice — a table row carries no
|
|
157
|
+
* `bulletParent`, so a table nested inside a bullet-namespace subtree sees
|
|
158
|
+
* only its caption base + the root, not the enclosing bullet base (known
|
|
159
|
+
* limitation, #724). Built immutably per call.
|
|
160
|
+
*/
|
|
161
|
+
const scopeFor = (i) => {
|
|
162
|
+
const chain = []; // innermost first
|
|
163
|
+
let p = blocks[i].bulletParent;
|
|
164
|
+
while (p !== undefined) {
|
|
165
|
+
const idx = bulletBlockIndex[p];
|
|
166
|
+
const base = basePathOfBlock[idx];
|
|
167
|
+
if (base !== undefined)
|
|
168
|
+
chain.push(base);
|
|
169
|
+
p = blocks[idx].bulletParent;
|
|
170
|
+
}
|
|
171
|
+
let scope = rootPath !== undefined
|
|
172
|
+
? { base: rootPath }
|
|
173
|
+
: undefined;
|
|
174
|
+
for (let k = chain.length - 1; k >= 0; k--) {
|
|
175
|
+
scope = { base: chain[k], parent: scope };
|
|
176
|
+
}
|
|
177
|
+
// A table row resolves against its caption base first (#722 rule 3):
|
|
178
|
+
// innermost, above the bullet chain and the root.
|
|
179
|
+
const captionBase = blocks[i].captionBase;
|
|
180
|
+
if (captionBase !== undefined)
|
|
181
|
+
scope = { base: captionBase, parent: scope };
|
|
182
|
+
return scope;
|
|
183
|
+
};
|
|
184
|
+
// ── Pass B: establish bases ──────────────────────────────────────────
|
|
185
|
+
// Source order is parents-before-children (bullet extraction is
|
|
186
|
+
// depth-first), so an ancestor's base is always resolved before its
|
|
187
|
+
// descendants need it. A relative namespace resolves against its own
|
|
188
|
+
// chain (TYPL-010 when there is none). Extra roots (TYPL-012 in Pass A)
|
|
189
|
+
// establish no base.
|
|
190
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
191
|
+
for (const binding of blocks[i].bindings) {
|
|
192
|
+
if (binding.kind !== "namespace")
|
|
193
|
+
continue;
|
|
194
|
+
if (TYPL_REF_OPS.isAbsolute(binding.name)) {
|
|
195
|
+
const path = typlPathOf(binding.name);
|
|
196
|
+
const isExtraRoot = !hasNamespaceAncestor(i) && path !== rootPath;
|
|
197
|
+
if (!isExtraRoot)
|
|
198
|
+
basePathOfBlock[i] = path;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const res = resolveRef(binding.name, scopeFor(i), TYPL_REF_OPS);
|
|
202
|
+
if (!res.ok) {
|
|
203
|
+
emit("TYPL-010", { name: binding.name }, i, binding.position);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
basePathOfBlock[i] = typlPathOf(res.ref);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
// ── Pass C: resolve every non-namespace binding to an absolute name ──
|
|
210
|
+
const allBindings = [];
|
|
211
|
+
const allTypedefs = [];
|
|
212
|
+
for (let i = 0; i < blocks.length; i++) {
|
|
213
|
+
const block = blocks[i];
|
|
214
|
+
for (const binding of block.bindings) {
|
|
215
|
+
if (binding.kind === "namespace")
|
|
216
|
+
continue; // scaffolding (D8)
|
|
217
|
+
const res = resolveRef(binding.name, scopeFor(i), TYPL_REF_OPS);
|
|
218
|
+
if (!res.ok) {
|
|
219
|
+
emit("TYPL-010", { name: binding.name }, i, binding.position);
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
allBindings.push(res.ref === binding.name ? binding : { ...binding, name: res.ref });
|
|
223
|
+
}
|
|
224
|
+
allTypedefs.push(...block.typedefs);
|
|
225
|
+
}
|
|
226
|
+
if (allBindings.length === 0 && allTypedefs.length === 0 &&
|
|
227
|
+
rootPath === undefined) {
|
|
228
|
+
return { diagnostics };
|
|
229
|
+
}
|
|
230
|
+
return {
|
|
231
|
+
types: {
|
|
232
|
+
bindings: allBindings,
|
|
233
|
+
typedefs: allTypedefs,
|
|
234
|
+
...(rootPath !== undefined ? { rootNamespace: rootPath } : {}),
|
|
235
|
+
},
|
|
236
|
+
diagnostics,
|
|
237
|
+
};
|
|
238
|
+
}
|
package/esm/typl/ast.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* Closed kind vocabulary. `value` is the default kind when an author omits
|
|
9
9
|
* it from a binding.
|
|
10
10
|
*/
|
|
11
|
-
export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream"];
|
|
11
|
+
export declare const KINDS: readonly ["value", "event", "signal", "command", "state", "const", "config", "document", "stream", "namespace"];
|
|
12
12
|
export type Kind = typeof KINDS[number];
|
|
13
13
|
/** Schema AST — one discriminated union covering all shape variants. */
|
|
14
14
|
export type Shape = {
|
|
@@ -83,5 +83,11 @@ export type Statement = Binding | Typedef;
|
|
|
83
83
|
export interface TyplBlock {
|
|
84
84
|
readonly bindings: readonly Binding[];
|
|
85
85
|
readonly typedefs: readonly Typedef[];
|
|
86
|
+
/**
|
|
87
|
+
* The entry's root namespace path (no `$`, e.g. `"powertrain.brake"`),
|
|
88
|
+
* when the entry declares one (#723). The validator resolves relative
|
|
89
|
+
* citations against it.
|
|
90
|
+
*/
|
|
91
|
+
readonly rootNamespace?: string;
|
|
86
92
|
}
|
|
87
93
|
//# sourceMappingURL=ast.d.ts.map
|
package/esm/typl/ast.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/typl/ast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/typl/ast.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,KAAK,iHAaR,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC;AAExC,wEAAwE;AACxE,MAAM,MAAM,KAAK,GACb;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;CAAE,GAC1E;IACA,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACC;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD;IACA,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,KAAK,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAA;CAAE,GAChE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;CAAE,GACrD;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvC,uEAAuE;AACvE,MAAM,WAAW,QAAQ;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sBAAsB;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,yCAAyC;AACzC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,sCAAsC;AACtC,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,aAAa,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1C,iCAAiC;AACjC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;CACjC"}
|
package/esm/typl/ast.js
CHANGED
package/esm/typl/bullet.d.ts
CHANGED
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
* `type X = …` typedef). A thin wrapper over the shared
|
|
7
7
|
* declaration-surface machinery (core/decl): it supplies typl's text
|
|
8
8
|
* recognizer and re-exports the common declaration node as
|
|
9
|
-
* {@linkcode
|
|
10
|
-
* items are extracted, non-matching bullets are left alone.
|
|
9
|
+
* {@linkcode TyplNestedBulletExtraction}. Mixed lists are supported —
|
|
10
|
+
* matching items are extracted, non-matching bullets are left alone.
|
|
11
11
|
*
|
|
12
12
|
* See ADR-019.
|
|
13
13
|
*/
|
|
14
14
|
import type { BodyBlock } from "../ast/nodes.js";
|
|
15
|
-
import { type
|
|
16
|
-
/** A
|
|
17
|
-
export type
|
|
15
|
+
import { type NestedBlockDeclaration } from "../decl/mod.js";
|
|
16
|
+
/** A typl bullet declaration with its structural parent link (#723). */
|
|
17
|
+
export type TyplNestedBulletExtraction = NestedBlockDeclaration;
|
|
18
18
|
/**
|
|
19
19
|
* Walk a body AST and return every bullet-list item whose first paragraph
|
|
20
20
|
* is a typl declaration, in source order (depth-first, recursing into
|
|
21
|
-
* nested lists)
|
|
21
|
+
* nested lists), each with a `parent` link for base-resolution scope
|
|
22
|
+
* chains. Delegates traversal to
|
|
23
|
+
* {@linkcode extractNestedBulletDeclarations}.
|
|
22
24
|
*/
|
|
23
|
-
export declare function
|
|
25
|
+
export declare function extractTyplBulletsNested(blocks: readonly BodyBlock[]): readonly TyplNestedBulletExtraction[];
|
|
24
26
|
//# sourceMappingURL=bullet.d.ts.map
|
package/esm/typl/bullet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bullet.d.ts","sourceRoot":"","sources":["../../src/typl/bullet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"bullet.d.ts","sourceRoot":"","sources":["../../src/typl/bullet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,gBAAgB,CAAC;AAGxB,wEAAwE;AACxE,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,CAAC;AAEhE;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,SAAS,EAAE,GAC3B,SAAS,0BAA0B,EAAE,CAEvC"}
|
package/esm/typl/bullet.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { extractNestedBulletDeclarations, } from "../decl/mod.js";
|
|
2
2
|
import { isTyplDeclarationText } from "./recognize.js";
|
|
3
3
|
/**
|
|
4
4
|
* Walk a body AST and return every bullet-list item whose first paragraph
|
|
5
5
|
* is a typl declaration, in source order (depth-first, recursing into
|
|
6
|
-
* nested lists)
|
|
6
|
+
* nested lists), each with a `parent` link for base-resolution scope
|
|
7
|
+
* chains. Delegates traversal to
|
|
8
|
+
* {@linkcode extractNestedBulletDeclarations}.
|
|
7
9
|
*/
|
|
8
|
-
export function
|
|
9
|
-
return
|
|
10
|
+
export function extractTyplBulletsNested(blocks) {
|
|
11
|
+
return extractNestedBulletDeclarations(blocks, isTyplDeclarationText);
|
|
10
12
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module typl/citations
|
|
3
|
+
*
|
|
4
|
+
* Citation extraction for the published tier (#723): a *citation* is a
|
|
5
|
+
* bare published-shaped ref in an inline code span — absolute
|
|
6
|
+
* (`` `$powertrain.brake.pedal_position` ``) or relative
|
|
7
|
+
* (`` `$.pedal_position` ``) — with no declaration clause. Plain `$Name`
|
|
8
|
+
* spans are entry-local mentions and deliberately not validated
|
|
9
|
+
* (unchanged pre-#723 behavior). The validator resolves relative
|
|
10
|
+
* citations against the entry's root namespace and checks resolved names
|
|
11
|
+
* against the corpus registry (TYPL-010 / TYPL-011).
|
|
12
|
+
*/
|
|
13
|
+
import type { BodyToken, SourceLocation } from "../model/mod.js";
|
|
14
|
+
/** One published-tier citation: the ref text and its file location. */
|
|
15
|
+
export interface TyplCitation {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly location: SourceLocation;
|
|
18
|
+
}
|
|
19
|
+
/** True when a code span's (trimmed) text is a bare published-shaped ref. */
|
|
20
|
+
export declare function isTyplCitationText(text: string): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Filter `Entry.bodyTokens` to published-tier citations, in source order.
|
|
23
|
+
* Reuses the shared inline-declaration walker with the citation
|
|
24
|
+
* recognizer — the walker strips backtick delimiters before matching.
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractTyplCitations(bodyTokens: readonly BodyToken[]): readonly TyplCitation[];
|
|
27
|
+
//# sourceMappingURL=citations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../../src/typl/citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjE,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,6EAA6E;AAC7E,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,SAAS,YAAY,EAAE,CAGzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { extractInlineDeclarations } from "../decl/mod.js";
|
|
2
|
+
import { isPublishedTyplName, isRelativeTyplName } from "./resolve.js";
|
|
3
|
+
/** True when a code span's (trimmed) text is a bare published-shaped ref. */
|
|
4
|
+
export function isTyplCitationText(text) {
|
|
5
|
+
const t = text.trim();
|
|
6
|
+
return isPublishedTyplName(t) || isRelativeTyplName(t);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Filter `Entry.bodyTokens` to published-tier citations, in source order.
|
|
10
|
+
* Reuses the shared inline-declaration walker with the citation
|
|
11
|
+
* recognizer — the walker strips backtick delimiters before matching.
|
|
12
|
+
*/
|
|
13
|
+
export function extractTyplCitations(bodyTokens) {
|
|
14
|
+
return extractInlineDeclarations(bodyTokens, isTyplCitationText)
|
|
15
|
+
.map((d) => ({ name: d.source.trim(), location: d.location }));
|
|
16
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @module typl/diagnostics
|
|
3
3
|
*
|
|
4
4
|
* Diagnostic codes emitted by the typl parser and validator (TYPL-001
|
|
5
|
-
* through TYPL-
|
|
5
|
+
* through TYPL-012). Each code carries a severity and a template; the
|
|
6
6
|
* `typlDiagnostic` helper performs `${var}` substitution.
|
|
7
7
|
*/
|
|
8
8
|
import type { Position } from "./ast.js";
|
|
9
9
|
import type { Severity } from "../model/mod.js";
|
|
10
10
|
/** Union of all valid TYPL diagnostic codes. */
|
|
11
|
-
export type TyplCode = "TYPL-001" | "TYPL-002" | "TYPL-003" | "TYPL-004" | "TYPL-005" | "TYPL-006" | "TYPL-007" | "TYPL-008";
|
|
11
|
+
export type TyplCode = "TYPL-001" | "TYPL-002" | "TYPL-003" | "TYPL-004" | "TYPL-005" | "TYPL-006" | "TYPL-007" | "TYPL-008" | "TYPL-009" | "TYPL-010" | "TYPL-011" | "TYPL-012";
|
|
12
12
|
/** Shape of each entry in {@linkcode TYPL_CODES}. */
|
|
13
13
|
export interface TyplCodeEntry {
|
|
14
14
|
readonly severity: Severity;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/typl/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAWhD,gDAAgD;AAChD,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/typl/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAWhD,gDAAgD;AAChD,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,CAyDtD,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAUhB"}
|
package/esm/typl/diagnostics.js
CHANGED
|
@@ -10,10 +10,12 @@ export const TYPL_CODES = {
|
|
|
10
10
|
severity: "error",
|
|
11
11
|
template: "Duplicate binding for ${name} in the same entry (first wins, this is a duplicate).",
|
|
12
12
|
},
|
|
13
|
+
// Deprecated (#723): retired by the published tier. Kept resolvable for tooling; never emitted.
|
|
13
14
|
"TYPL-002": {
|
|
14
15
|
severity: "error",
|
|
15
16
|
template: "${name} is declared as kind ${kindA} here and ${kindB} in ${otherFile}:${otherLine}.",
|
|
16
17
|
},
|
|
18
|
+
// Deprecated (#723): retired by the published tier. Kept resolvable for tooling; never emitted.
|
|
17
19
|
"TYPL-003": {
|
|
18
20
|
severity: "error",
|
|
19
21
|
template: "${name} is declared with a different shape than in ${otherFile}:${otherLine}.",
|
|
@@ -38,6 +40,22 @@ export const TYPL_CODES = {
|
|
|
38
40
|
severity: "error",
|
|
39
41
|
template: "Literal ${value} violates declared ${constraint} (${detail}).",
|
|
40
42
|
},
|
|
43
|
+
"TYPL-009": {
|
|
44
|
+
severity: "error",
|
|
45
|
+
template: "${name} is already declared in ${otherFile}:${otherLine} (published symbols are declared exactly once).",
|
|
46
|
+
},
|
|
47
|
+
"TYPL-010": {
|
|
48
|
+
severity: "error",
|
|
49
|
+
template: "Relative reference ${name} has no namespace base in scope.",
|
|
50
|
+
},
|
|
51
|
+
"TYPL-011": {
|
|
52
|
+
severity: "error",
|
|
53
|
+
template: "Citation of undeclared published symbol ${name}.",
|
|
54
|
+
},
|
|
55
|
+
"TYPL-012": {
|
|
56
|
+
severity: "error",
|
|
57
|
+
template: "Multiple root namespace declarations in one entry (root is ${first}).",
|
|
58
|
+
},
|
|
41
59
|
};
|
|
42
60
|
/**
|
|
43
61
|
* Construct a typl diagnostic by substituting `${var}` placeholders in the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/typl/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/typl/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AAqgBvE;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,GACb;IAAE,GAAG,EAAE,SAAS,CAAC;IAAC,WAAW,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,CAK5D"}
|
package/esm/typl/grammar.js
CHANGED
|
@@ -125,6 +125,12 @@ class Parser {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
const shape = this.parseShapeOptional();
|
|
128
|
+
// A namespace declaration (#723) is scaffolding — it establishes a
|
|
129
|
+
// base for relative refs and must not carry a shape.
|
|
130
|
+
if (kind === "namespace" && shape !== undefined) {
|
|
131
|
+
this.diagnostics.push(typlDiagnostic("TYPL-006", { detail: "a namespace declaration carries no shape" }, nameTok.position));
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
128
134
|
return {
|
|
129
135
|
statementKind: "binding",
|
|
130
136
|
name: nameTok.value,
|
package/esm/typl/lexer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../src/typl/lexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AAEvE,sDAAsD;AACtD,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,aAAa,GACb,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,KAAK,GACL,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,KAAK,CAAC;AAEV,sDAAsD;AACtD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AA0BD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GACb;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../src/typl/lexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AAEvE,sDAAsD;AACtD,MAAM,MAAM,SAAS,GACjB,cAAc,GACd,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,OAAO,GACP,aAAa,GACb,OAAO,GACP,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,KAAK,GACL,OAAO,GACP,MAAM,GACN,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,KAAK,CAAC;AAEV,sDAAsD;AACtD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AA0BD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,GACb;IAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,CAuOpD"}
|
package/esm/typl/lexer.js
CHANGED
|
@@ -76,19 +76,40 @@ export function tokenize(source) {
|
|
|
76
76
|
push("COMMENT", value, startCol);
|
|
77
77
|
continue;
|
|
78
78
|
}
|
|
79
|
-
// ── Dollar-prefixed identifier — `$Speed`
|
|
79
|
+
// ── Dollar-prefixed identifier — `$Speed`, `$a.b.c`, `$.x` ──────
|
|
80
80
|
// $ identifier — body uses IDENT_BODY_RE (allows digits) intentionally;
|
|
81
|
-
// names like $1st are lexically valid and rejected by the parser
|
|
81
|
+
// names like $1st are lexically valid and rejected by the parser.
|
|
82
|
+
// Dotted paths (published tier, #723): a `.` is consumed only when an
|
|
83
|
+
// identifier character follows, so `float[0..100]` ranges and trailing
|
|
84
|
+
// dots never get eaten. A leading `.` right after `$` marks a relative
|
|
85
|
+
// published ref (`$.name`).
|
|
82
86
|
if (ch === "$") {
|
|
83
87
|
const startCol = column;
|
|
84
88
|
let value = "$";
|
|
85
89
|
i++;
|
|
86
90
|
column++;
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
if (source[i] === "." && i + 1 < source.length &&
|
|
92
|
+
IDENT_BODY_RE.test(source[i + 1])) {
|
|
93
|
+
value += ".";
|
|
89
94
|
i++;
|
|
90
95
|
column++;
|
|
91
96
|
}
|
|
97
|
+
while (i < source.length) {
|
|
98
|
+
if (IDENT_BODY_RE.test(source[i])) {
|
|
99
|
+
value += source[i];
|
|
100
|
+
i++;
|
|
101
|
+
column++;
|
|
102
|
+
}
|
|
103
|
+
else if (source[i] === "." && i + 1 < source.length &&
|
|
104
|
+
IDENT_BODY_RE.test(source[i + 1])) {
|
|
105
|
+
value += ".";
|
|
106
|
+
i++;
|
|
107
|
+
column++;
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
92
113
|
push("DOLLAR_IDENT", value, startCol);
|
|
93
114
|
continue;
|
|
94
115
|
}
|