@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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { extractInlineDeclarations } from "../decl/mod.js";
|
|
2
|
+
import { parseUxRef } from "./grammar.js";
|
|
3
|
+
import { classifyUxilForm } from "./recognize.js";
|
|
4
|
+
/** True when a code span's (trimmed) text is a `ux:` citation, not a declaration. */
|
|
5
|
+
export function isUxCitationText(text) {
|
|
6
|
+
const t = text.trim();
|
|
7
|
+
return t.startsWith("ux:") && classifyUxilForm(t) === undefined;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Filter `Entry.bodyTokens` to `ux:` citations, in source order. Reuses
|
|
11
|
+
* the shared inline-declaration walker with the citation recognizer; a
|
|
12
|
+
* citation that fails to parse cleanly (e.g. a reserved character) is
|
|
13
|
+
* dropped rather than surfaced — parse-level diagnostics are S7's
|
|
14
|
+
* concern, not this extractor's.
|
|
15
|
+
*/
|
|
16
|
+
export function extractUxCitations(bodyTokens) {
|
|
17
|
+
const out = [];
|
|
18
|
+
for (const d of extractInlineDeclarations(bodyTokens, isUxCitationText)) {
|
|
19
|
+
const { ref, diagnostics } = parseUxRef(d.source.trim());
|
|
20
|
+
if (ref && diagnostics.length === 0) {
|
|
21
|
+
out.push({ ref, location: d.location });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module uxil/diagnostics
|
|
3
|
+
*
|
|
4
|
+
* Diagnostic codes emitted by the uxil parser and compiler (UXIL-001 through
|
|
5
|
+
* UXIL-026). Source-local positions only — S9 bridges these to file-anchored
|
|
6
|
+
* core `Diagnostic`s. Shape and helper mirror typl's `typlDiagnostic`.
|
|
7
|
+
*/
|
|
8
|
+
import type { Position } from "./ast.js";
|
|
9
|
+
import type { Diagnostic, Severity, SourceLocation } from "../model/mod.js";
|
|
10
|
+
/** Union of all uxil parser + compiler diagnostic codes. */
|
|
11
|
+
export type UxilCode = "UXIL-001" | "UXIL-002" | "UXIL-003" | "UXIL-004" | "UXIL-005" | "UXIL-006" | "UXIL-007" | "UXIL-008" | "UXIL-009" | "UXIL-010" | "UXIL-011" | "UXIL-012" | "UXIL-013" | "UXIL-014" | "UXIL-015" | "UXIL-016" | "UXIL-017" | "UXIL-018" | "UXIL-019" | "UXIL-020" | "UXIL-021" | "UXIL-022" | "UXIL-023" | "UXIL-024" | "UXIL-025" | "UXIL-026";
|
|
12
|
+
/** Shape of each entry in {@linkcode UXIL_CODES}. */
|
|
13
|
+
export interface UxilCodeEntry {
|
|
14
|
+
readonly severity: Severity;
|
|
15
|
+
readonly template: string;
|
|
16
|
+
}
|
|
17
|
+
/** A diagnostic emitted by the uxil parser (source-local position). */
|
|
18
|
+
export interface UxilDiagnostic {
|
|
19
|
+
readonly code: UxilCode;
|
|
20
|
+
readonly severity: Severity;
|
|
21
|
+
readonly message: string;
|
|
22
|
+
readonly position: Position;
|
|
23
|
+
}
|
|
24
|
+
export declare const UXIL_CODES: Record<UxilCode, UxilCodeEntry>;
|
|
25
|
+
/**
|
|
26
|
+
* Construct a uxil diagnostic by substituting `${var}` placeholders in the
|
|
27
|
+
* code's template. A missing key leaves a raw `${key}` in the message — test
|
|
28
|
+
* message formatting per code.
|
|
29
|
+
*/
|
|
30
|
+
export declare function uxilDiagnostic(code: UxilCode, params: Record<string, string | number>, position: Position): UxilDiagnostic;
|
|
31
|
+
/**
|
|
32
|
+
* Construct a file-anchored core {@linkcode Diagnostic} for a uxil code —
|
|
33
|
+
* the S9 sibling of {@linkcode uxilDiagnostic} (#727). Assembly, the
|
|
34
|
+
* validator, and the family orchestrator know their file coordinates, so
|
|
35
|
+
* they emit core diagnostics directly; only the file-agnostic grammar
|
|
36
|
+
* layer still uses the source-local shape.
|
|
37
|
+
*/
|
|
38
|
+
export declare function uxilDiagnosticAt(code: UxilCode, params: Record<string, string | number>, location: SourceLocation): Diagnostic;
|
|
39
|
+
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/uxil/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5E,4DAA4D;AAC5D,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,GACV,UAAU,GACV,UAAU,GACV,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,uEAAuE;AACvE,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,CAwHtD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAQhB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,QAAQ,EAAE,cAAc,GACvB,UAAU,CAMZ"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export const UXIL_CODES = {
|
|
2
|
+
"UXIL-001": {
|
|
3
|
+
severity: "error",
|
|
4
|
+
template: "Malformed uxil reference: ${detail}.",
|
|
5
|
+
},
|
|
6
|
+
"UXIL-002": {
|
|
7
|
+
severity: "error",
|
|
8
|
+
template: "Reserved character ${char} is not allowed in a uxil reference.",
|
|
9
|
+
},
|
|
10
|
+
"UXIL-003": {
|
|
11
|
+
severity: "error",
|
|
12
|
+
template: "The ux://authority form is reserved; use a scheme-relative reference.",
|
|
13
|
+
},
|
|
14
|
+
"UXIL-004": {
|
|
15
|
+
severity: "error",
|
|
16
|
+
template: "Root declaration is missing its kind (expected 'ux:surface : kind').",
|
|
17
|
+
},
|
|
18
|
+
"UXIL-005": {
|
|
19
|
+
severity: "error",
|
|
20
|
+
template: "Element declaration has an empty verb set (expected '/element : verb').",
|
|
21
|
+
},
|
|
22
|
+
"UXIL-006": {
|
|
23
|
+
severity: "error",
|
|
24
|
+
template: "Element declaration is missing its trailing event dictionary.",
|
|
25
|
+
},
|
|
26
|
+
"UXIL-007": {
|
|
27
|
+
severity: "error",
|
|
28
|
+
template: "Malformed key template: ${detail}.",
|
|
29
|
+
},
|
|
30
|
+
"UXIL-008": {
|
|
31
|
+
severity: "error",
|
|
32
|
+
template: "Malformed surface: ${detail}.",
|
|
33
|
+
},
|
|
34
|
+
"UXIL-009": {
|
|
35
|
+
severity: "error",
|
|
36
|
+
template: "Unknown surface kind '${kind}' (expected screen, panel, or agent).",
|
|
37
|
+
},
|
|
38
|
+
"UXIL-010": {
|
|
39
|
+
severity: "error",
|
|
40
|
+
template: "Unknown interaction verb '${verb}'.",
|
|
41
|
+
},
|
|
42
|
+
"UXIL-011": {
|
|
43
|
+
severity: "error",
|
|
44
|
+
template: "A ux-contract entry must declare exactly one root surface; none was found.",
|
|
45
|
+
},
|
|
46
|
+
"UXIL-012": {
|
|
47
|
+
severity: "error",
|
|
48
|
+
template: "A ux-contract entry must declare exactly one root surface; found another after '${first}'.",
|
|
49
|
+
},
|
|
50
|
+
"UXIL-013": {
|
|
51
|
+
severity: "error",
|
|
52
|
+
template: "Kind '${kind}' is stateless and cannot declare @ states.",
|
|
53
|
+
},
|
|
54
|
+
"UXIL-014": {
|
|
55
|
+
severity: "error",
|
|
56
|
+
template: "'observe' is exclusive and cannot be combined with other verbs on element '${element}'.",
|
|
57
|
+
},
|
|
58
|
+
"UXIL-015": {
|
|
59
|
+
severity: "error",
|
|
60
|
+
template: "Surface '${surface}' is already declared (first at ${otherFile}:${otherLine}).",
|
|
61
|
+
},
|
|
62
|
+
"UXIL-016": {
|
|
63
|
+
severity: "error",
|
|
64
|
+
template: "Surface '${surface}' has no declared parent surface '${parent}'.",
|
|
65
|
+
},
|
|
66
|
+
"UXIL-017": {
|
|
67
|
+
severity: "error",
|
|
68
|
+
template: "navigate target '${target}' does not resolve to a navigable (screen) surface.",
|
|
69
|
+
},
|
|
70
|
+
"UXIL-018": {
|
|
71
|
+
severity: "error",
|
|
72
|
+
template: "Unknown surface '${surface}'.",
|
|
73
|
+
},
|
|
74
|
+
"UXIL-019": {
|
|
75
|
+
severity: "error",
|
|
76
|
+
template: "Unknown element '${element}' on surface '${surface}'.",
|
|
77
|
+
},
|
|
78
|
+
"UXIL-020": {
|
|
79
|
+
severity: "error",
|
|
80
|
+
template: "Verb '${verb}' is not in the declared verb set of element '${element}'.",
|
|
81
|
+
},
|
|
82
|
+
"UXIL-021": {
|
|
83
|
+
severity: "error",
|
|
84
|
+
template: "State '${state}' is not declared on surface '${surface}'.",
|
|
85
|
+
},
|
|
86
|
+
"UXIL-022": {
|
|
87
|
+
severity: "error",
|
|
88
|
+
template: "Element '${element}' declares a key template; cite it with a '{name}' template, not a concrete key.",
|
|
89
|
+
},
|
|
90
|
+
"UXIL-023": {
|
|
91
|
+
severity: "error",
|
|
92
|
+
template: "uxil declaration outside a declaring entry type: '${entry}' (type '${type}') may not declare surfaces (requires 'declares: ux-surface').",
|
|
93
|
+
},
|
|
94
|
+
"UXIL-024": {
|
|
95
|
+
severity: "error",
|
|
96
|
+
template: "Relative reference '${ref}' has no base in scope.",
|
|
97
|
+
},
|
|
98
|
+
"UXIL-025": {
|
|
99
|
+
severity: "error",
|
|
100
|
+
template: "Element '${element}' declares 'observe' but surface '${surface}' has non-visual kind '${kind}'.",
|
|
101
|
+
},
|
|
102
|
+
"UXIL-026": {
|
|
103
|
+
severity: "error",
|
|
104
|
+
template: "Element '${element}' declares 'navigate' without a '-> target' clause.",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* Construct a uxil diagnostic by substituting `${var}` placeholders in the
|
|
109
|
+
* code's template. A missing key leaves a raw `${key}` in the message — test
|
|
110
|
+
* message formatting per code.
|
|
111
|
+
*/
|
|
112
|
+
export function uxilDiagnostic(code, params, position) {
|
|
113
|
+
const entry = UXIL_CODES[code];
|
|
114
|
+
if (!entry)
|
|
115
|
+
throw new Error(`Unknown UXIL code: ${code}`);
|
|
116
|
+
let message = entry.template;
|
|
117
|
+
for (const [k, v] of Object.entries(params)) {
|
|
118
|
+
message = message.replaceAll(`\${${k}}`, String(v));
|
|
119
|
+
}
|
|
120
|
+
return { code, severity: entry.severity, message, position };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Construct a file-anchored core {@linkcode Diagnostic} for a uxil code —
|
|
124
|
+
* the S9 sibling of {@linkcode uxilDiagnostic} (#727). Assembly, the
|
|
125
|
+
* validator, and the family orchestrator know their file coordinates, so
|
|
126
|
+
* they emit core diagnostics directly; only the file-agnostic grammar
|
|
127
|
+
* layer still uses the source-local shape.
|
|
128
|
+
*/
|
|
129
|
+
export function uxilDiagnosticAt(code, params, location) {
|
|
130
|
+
const d = uxilDiagnostic(code, params, {
|
|
131
|
+
line: location.line,
|
|
132
|
+
column: location.column,
|
|
133
|
+
});
|
|
134
|
+
return { code: d.code, severity: d.severity, message: d.message, location };
|
|
135
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module uxil/grammar
|
|
3
|
+
*
|
|
4
|
+
* Recursive-descent parsers for the uxil DSL: one reference parser
|
|
5
|
+
* ({@linkcode parseUxRef}) plus the three declaration-form parsers (added in
|
|
6
|
+
* later tasks). Each returns a best-effort AST node and a list of
|
|
7
|
+
* source-local {@linkcode UxilDiagnostic}s. Parse-only — no resolution.
|
|
8
|
+
*
|
|
9
|
+
* Diagnostics policy (#780): a single malformed region reports one specific
|
|
10
|
+
* code. After a parse error fires, leftover-token noise from the same
|
|
11
|
+
* region is suppressed (see {@linkcode expectEof}) rather than re-flagged
|
|
12
|
+
* as a redundant or contradictory second code, and a reserved character
|
|
13
|
+
* stops structural parsing outright (the lexer dropped the char, so the
|
|
14
|
+
* token stream is corrupt). Orthogonal region checks — the nav tail's
|
|
15
|
+
* reserved-char scan, the missing event dictionary (UXIL-006) — still
|
|
16
|
+
* co-report. Editors reparse per keystroke, so within a region errors
|
|
17
|
+
* surface progressively.
|
|
18
|
+
*/
|
|
19
|
+
import type { ChildSurfaceDecl, ElementDecl, RootDecl, UxRef } from "./ast.js";
|
|
20
|
+
import { type UxilDiagnostic } from "./diagnostics.js";
|
|
21
|
+
/**
|
|
22
|
+
* Parse a `ux:` reference (citation / nav target). The scheme is optional;
|
|
23
|
+
* `media.home/play` and `ux:media.home/play` yield identical AST except for
|
|
24
|
+
* `hasScheme`. Returns `ref` undefined only for a wholly malformed input
|
|
25
|
+
* (reserved char, reserved authority, no surface).
|
|
26
|
+
*/
|
|
27
|
+
export declare function parseUxRef(source: string): {
|
|
28
|
+
ref?: UxRef;
|
|
29
|
+
diagnostics: UxilDiagnostic[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Parse a root declaration: `[ux:]surface : kind [@state, …]`. The `:` here
|
|
33
|
+
* introduces the kind (not a ref key). Returns `decl` undefined only when no
|
|
34
|
+
* surface is present or a reserved char corrupted the source. A missing kind
|
|
35
|
+
* (no `:`, or a `:` with nothing after it) is UXIL-004 with a best-effort
|
|
36
|
+
* partial decl (`kind: ""`, surface and states still captured) — S8's
|
|
37
|
+
* assemble must gate uxRegistry registration on a clean parse, never on the
|
|
38
|
+
* partial decl alone (#780).
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseRootDecl(source: string): {
|
|
41
|
+
decl?: RootDecl;
|
|
42
|
+
diagnostics: UxilDiagnostic[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Parse a child-surface declaration: `.path[.seg…] [@state, …]`. The leading
|
|
46
|
+
* dot marks containment; nested bullets (its elements) are stitched in S8.
|
|
47
|
+
* There is no kind or verb set — kind is inherited (S8).
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseChildSurfaceDecl(source: string): {
|
|
50
|
+
decl?: ChildSurfaceDecl;
|
|
51
|
+
diagnostics: UxilDiagnostic[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Parse an element bullet: a leading code span
|
|
55
|
+
* `/element : verb[, verb…] [: {key}] [@state, …] [-> nav]` followed by a
|
|
56
|
+
* mandatory trailing prose event dictionary. Grammar decision K1 (#786,
|
|
57
|
+
* per the epic design doc): the key template is its own `:` clause after
|
|
58
|
+
* the verb set — never attached to the element name, so declarations
|
|
59
|
+
* cannot collide with the ref grammar's `element:{key}` form.
|
|
60
|
+
*
|
|
61
|
+
* Diagnostic columns are paragraph-relative (#781): the parser receives the
|
|
62
|
+
* whole paragraph and splits the leading code span itself, so every
|
|
63
|
+
* span-derived column is shifted by the span's start offset
|
|
64
|
+
* ({@linkcode splitLeadingCodeSpan}'s `spanStart`). The two whole-bullet
|
|
65
|
+
* diagnostics — no leading code span, and the missing event dictionary —
|
|
66
|
+
* anchor at paragraph column 1.
|
|
67
|
+
*/
|
|
68
|
+
export declare function parseElementBullet(paragraph: string): {
|
|
69
|
+
decl?: ElementDecl;
|
|
70
|
+
diagnostics: UxilDiagnostic[];
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=grammar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grammar.d.ts","sourceRoot":"","sources":["../../src/uxil/grammar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,QAAQ,EAER,KAAK,EACN,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,KAAK,cAAc,EAAkB,MAAM,kBAAkB,CAAC;AA0LvE;;;;;GAKG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,GACb;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,CA6DhD;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,GACb;IAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,CAyCpD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,GACb;IAAE,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,CAmC5D;AA2CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,GAChB;IAAE,IAAI,CAAC,EAAE,WAAW,CAAC;IAAC,WAAW,EAAE,cAAc,EAAE,CAAA;CAAE,CAsMvD"}
|