@driftsys/markspec 0.10.3 → 0.12.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 +11 -2
- package/esm/ast/normalize.d.ts +4 -5
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +6 -37
- package/esm/collect/mod.d.ts +29 -9
- package/esm/collect/mod.d.ts.map +1 -1
- package/esm/collect/mod.js +36 -10
- 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 +18 -13
- package/esm/config/markspec.d.ts +40 -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/discovery/mod.d.ts +24 -8
- package/esm/discovery/mod.d.ts.map +1 -1
- package/esm/discovery/mod.js +57 -21
- package/esm/discovery/projects.d.ts +109 -0
- package/esm/discovery/projects.d.ts.map +1 -0
- package/esm/discovery/projects.js +232 -0
- package/esm/formatter/entry_body.d.ts +86 -0
- package/esm/formatter/entry_body.d.ts.map +1 -0
- package/esm/formatter/entry_body.js +287 -0
- package/esm/formatter/mod.d.ts +13 -9
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +126 -50
- package/esm/gates/mod.d.ts +13 -2
- package/esm/gates/mod.d.ts.map +1 -1
- package/esm/gates/mod.js +41 -13
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +7 -5
- 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 +43 -4
- package/esm/lock/edge_drift.d.ts +2 -0
- package/esm/lock/edge_drift.d.ts.map +1 -1
- package/esm/lock/edge_drift.js +4 -0
- 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 +11 -4
- package/esm/lock/mod.d.ts.map +1 -1
- package/esm/lock/mod.js +8 -2
- 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 +23 -11
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +20 -8
- package/esm/model/mod.d.ts +114 -28
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +76 -13
- package/esm/model/profile.d.ts +13 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/code_regions.d.ts +29 -0
- package/esm/parser/code_regions.d.ts.map +1 -0
- package/esm/parser/code_regions.js +38 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +110 -91
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +7 -1
- package/esm/parser/translate.d.ts.map +1 -1
- package/esm/parser/translate.js +5 -0
- 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/refs/mod.d.ts.map +1 -1
- package/esm/refs/mod.js +8 -19
- package/esm/reporter/mod.d.ts +11 -0
- package/esm/reporter/mod.d.ts.map +1 -1
- package/esm/reporter/mod.js +20 -9
- 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/fence.d.ts +20 -29
- package/esm/util/fence.d.ts.map +1 -1
- package/esm/util/fence.js +42 -50
- package/esm/util/modals.d.ts +6 -0
- package/esm/util/modals.d.ts.map +1 -1
- package/esm/util/modals.js +37 -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/body_blocks.d.ts +2 -1
- package/esm/validator/body_blocks.d.ts.map +1 -1
- package/esm/validator/body_blocks.js +80 -2
- 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 +6 -0
- package/esm/validator/corpus.d.ts.map +1 -1
- package/esm/validator/corpus.js +55 -20
- 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 +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +29 -16
- package/esm/validator/pipeline.d.ts +11 -1
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -23
- 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/ast/normalize.d.ts +4 -5
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +5 -36
- package/script/collect/mod.d.ts +29 -9
- package/script/collect/mod.d.ts.map +1 -1
- package/script/collect/mod.js +38 -10
- 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 +16 -11
- package/script/config/markspec.d.ts +40 -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/discovery/mod.d.ts +24 -8
- package/script/discovery/mod.d.ts.map +1 -1
- package/script/discovery/mod.js +56 -20
- package/script/discovery/projects.d.ts +109 -0
- package/script/discovery/projects.d.ts.map +1 -0
- package/script/discovery/projects.js +240 -0
- package/script/formatter/entry_body.d.ts +86 -0
- package/script/formatter/entry_body.d.ts.map +1 -0
- package/script/formatter/entry_body.js +292 -0
- package/script/formatter/mod.d.ts +13 -9
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +124 -48
- package/script/gates/mod.d.ts +13 -2
- package/script/gates/mod.d.ts.map +1 -1
- package/script/gates/mod.js +50 -22
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +6 -4
- 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 +43 -4
- package/script/lock/edge_drift.d.ts +2 -0
- package/script/lock/edge_drift.d.ts.map +1 -1
- package/script/lock/edge_drift.js +5 -0
- 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 +11 -4
- package/script/lock/mod.d.ts.map +1 -1
- package/script/lock/mod.js +17 -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 +23 -11
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +55 -7
- package/script/model/mod.d.ts +114 -28
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +81 -14
- package/script/model/profile.d.ts +13 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/code_regions.d.ts +29 -0
- package/script/parser/code_regions.d.ts.map +1 -0
- package/script/parser/code_regions.js +41 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +108 -89
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +7 -1
- package/script/parser/translate.d.ts.map +1 -1
- package/script/parser/translate.js +5 -0
- 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/refs/mod.d.ts.map +1 -1
- package/script/refs/mod.js +7 -18
- package/script/reporter/mod.d.ts +11 -0
- package/script/reporter/mod.d.ts.map +1 -1
- package/script/reporter/mod.js +19 -8
- 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/fence.d.ts +20 -29
- package/script/util/fence.d.ts.map +1 -1
- package/script/util/fence.js +47 -54
- package/script/util/modals.d.ts +6 -0
- package/script/util/modals.d.ts.map +1 -1
- package/script/util/modals.js +38 -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/body_blocks.d.ts +2 -1
- package/script/validator/body_blocks.d.ts.map +1 -1
- package/script/validator/body_blocks.js +80 -2
- 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 +6 -0
- package/script/validator/corpus.d.ts.map +1 -1
- package/script/validator/corpus.js +55 -19
- 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 +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +29 -15
- package/script/validator/pipeline.d.ts +11 -1
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +75 -22
- 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,505 @@
|
|
|
1
|
+
import { tokenize } from "./lexer.js";
|
|
2
|
+
import { uxilDiagnostic } from "./diagnostics.js";
|
|
3
|
+
/** A forward-only cursor over a `Token[]`. */
|
|
4
|
+
class Cursor {
|
|
5
|
+
constructor(tokens) {
|
|
6
|
+
Object.defineProperty(this, "tokens", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true,
|
|
10
|
+
value: tokens
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(this, "i", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: 0
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
peek() {
|
|
20
|
+
return this.tokens[this.i];
|
|
21
|
+
}
|
|
22
|
+
peekAt(n) {
|
|
23
|
+
return this.tokens[Math.min(this.i + n, this.tokens.length - 1)];
|
|
24
|
+
}
|
|
25
|
+
advance() {
|
|
26
|
+
const t = this.tokens[this.i];
|
|
27
|
+
if (this.i < this.tokens.length - 1)
|
|
28
|
+
this.i++;
|
|
29
|
+
return t;
|
|
30
|
+
}
|
|
31
|
+
atEof() {
|
|
32
|
+
return this.peek().kind === "EOF";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Push UXIL-002 for a reserved `?`/`#` character anywhere in `source`.
|
|
37
|
+
* Returns whether one was found — callers stop structural parsing on a hit,
|
|
38
|
+
* because the lexer silently drops the char and every diagnostic derived
|
|
39
|
+
* from the mangled token stream would be noise (#780). `baseColumn` shifts
|
|
40
|
+
* the reported column for callers scanning a slice of a larger source (the
|
|
41
|
+
* peeled `-> nav` tail, or a code span offset into its paragraph — #781),
|
|
42
|
+
* keeping positions relative to the caller's chosen origin.
|
|
43
|
+
*/
|
|
44
|
+
function scanReservedChars(source, diags, baseColumn = 0) {
|
|
45
|
+
const idx = source.search(/[?#]/);
|
|
46
|
+
if (idx >= 0) {
|
|
47
|
+
diags.push(uxilDiagnostic("UXIL-002", { char: source[idx] }, {
|
|
48
|
+
line: 1,
|
|
49
|
+
column: baseColumn + idx + 1,
|
|
50
|
+
}));
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
/** Consume `IDENT`, or push UXIL-001 describing what was expected. */
|
|
56
|
+
function expectIdent(c, diags, what) {
|
|
57
|
+
if (c.peek().kind === "IDENT")
|
|
58
|
+
return c.advance().value;
|
|
59
|
+
diags.push(uxilDiagnostic("UXIL-001", { detail: `expected ${what}` }, c.peek().position));
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
/** Parse `segment *("." segment)`; `undefined` when no leading segment. */
|
|
63
|
+
function parseSurface(c, diags) {
|
|
64
|
+
if (c.peek().kind !== "IDENT")
|
|
65
|
+
return undefined;
|
|
66
|
+
const segments = [c.advance().value];
|
|
67
|
+
while (c.peek().kind === "DOT") {
|
|
68
|
+
c.advance();
|
|
69
|
+
if (c.peek().kind !== "IDENT") {
|
|
70
|
+
diags.push(uxilDiagnostic("UXIL-008", { detail: "trailing '.' in surface" }, c.peek().position));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
segments.push(c.advance().value);
|
|
74
|
+
}
|
|
75
|
+
return segments;
|
|
76
|
+
}
|
|
77
|
+
/** Parse a ref key after `:` — a `{name}` template or a concrete value. */
|
|
78
|
+
function parseKey(c, diags) {
|
|
79
|
+
if (c.peek().kind === "LBRACE") {
|
|
80
|
+
c.advance();
|
|
81
|
+
if (c.peek().kind !== "IDENT") {
|
|
82
|
+
diags.push(uxilDiagnostic("UXIL-007", { detail: "expected a name inside { }" }, c.peek().position));
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
const name = c.advance().value;
|
|
86
|
+
if (c.peek().kind !== "RBRACE") {
|
|
87
|
+
diags.push(uxilDiagnostic("UXIL-007", { detail: "missing closing '}'" }, c.peek().position));
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
c.advance();
|
|
91
|
+
return { kind: "template", name };
|
|
92
|
+
}
|
|
93
|
+
if (c.peek().kind === "IDENT") {
|
|
94
|
+
return { kind: "concrete", value: c.advance().value };
|
|
95
|
+
}
|
|
96
|
+
diags.push(uxilDiagnostic("UXIL-001", { detail: "expected a key after ':'" }, c.peek().position));
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Consume a leading `ux:` scheme if present. Returns whether it was consumed.
|
|
101
|
+
* Known limitation (#780 case 6, S7 design doc): a surface literally named
|
|
102
|
+
* `ux` followed by `:` is greedily read as the scheme, so
|
|
103
|
+
* `parseRootDecl("ux : screen")` misparses. Revisit only if a real
|
|
104
|
+
* `ux`-named surface is ever needed.
|
|
105
|
+
*/
|
|
106
|
+
function consumeScheme(c) {
|
|
107
|
+
if (c.peek().kind === "IDENT" && c.peek().value === "ux" &&
|
|
108
|
+
c.peekAt(1).kind === "COLON") {
|
|
109
|
+
c.advance();
|
|
110
|
+
c.advance();
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Push UXIL-001 for any leftover tokens before EOF. No-ops when a prior
|
|
117
|
+
* diagnostic exists — a specific parse error already explains the malformed
|
|
118
|
+
* tail, and re-flagging the leftovers produced the redundant second code
|
|
119
|
+
* (#780). One clear error per span; the editor reparses on the next edit.
|
|
120
|
+
*/
|
|
121
|
+
function expectEof(c, diags) {
|
|
122
|
+
if (diags.length > 0)
|
|
123
|
+
return;
|
|
124
|
+
if (!c.atEof()) {
|
|
125
|
+
const t = c.peek();
|
|
126
|
+
diags.push(uxilDiagnostic("UXIL-001", {
|
|
127
|
+
detail: `unexpected '${t.value || t.kind}'`,
|
|
128
|
+
}, t.position));
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/** Parse an optional `@state, state, …` set; empty array when absent. */
|
|
132
|
+
function parseStateSet(c, diags) {
|
|
133
|
+
const states = [];
|
|
134
|
+
if (c.peek().kind !== "AT")
|
|
135
|
+
return states;
|
|
136
|
+
c.advance();
|
|
137
|
+
const first = expectIdent(c, diags, "state");
|
|
138
|
+
if (first !== undefined)
|
|
139
|
+
states.push(first);
|
|
140
|
+
while (c.peek().kind === "COMMA") {
|
|
141
|
+
c.advance();
|
|
142
|
+
const s = expectIdent(c, diags, "state");
|
|
143
|
+
if (s !== undefined)
|
|
144
|
+
states.push(s);
|
|
145
|
+
}
|
|
146
|
+
return states;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Parse a `ux:` reference (citation / nav target). The scheme is optional;
|
|
150
|
+
* `media.home/play` and `ux:media.home/play` yield identical AST except for
|
|
151
|
+
* `hasScheme`. Returns `ref` undefined only for a wholly malformed input
|
|
152
|
+
* (reserved char, reserved authority, no surface).
|
|
153
|
+
*/
|
|
154
|
+
export function parseUxRef(source) {
|
|
155
|
+
const diagnostics = [];
|
|
156
|
+
if (scanReservedChars(source, diagnostics))
|
|
157
|
+
return { diagnostics };
|
|
158
|
+
const c = new Cursor(tokenize(source));
|
|
159
|
+
const hasScheme = consumeScheme(c);
|
|
160
|
+
// Reserved authority: a `/` where a surface segment is required.
|
|
161
|
+
if (c.peek().kind === "SLASH") {
|
|
162
|
+
if (c.peekAt(1).kind === "SLASH") {
|
|
163
|
+
diagnostics.push(uxilDiagnostic("UXIL-003", {}, c.peek().position));
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
diagnostics.push(uxilDiagnostic("UXIL-008", { detail: "missing surface" }, c.peek().position));
|
|
167
|
+
}
|
|
168
|
+
return { diagnostics };
|
|
169
|
+
}
|
|
170
|
+
const surface = parseSurface(c, diagnostics);
|
|
171
|
+
if (!surface) {
|
|
172
|
+
diagnostics.push(uxilDiagnostic("UXIL-008", { detail: "expected a surface segment" }, c.peek().position));
|
|
173
|
+
return { diagnostics };
|
|
174
|
+
}
|
|
175
|
+
const ref = {
|
|
176
|
+
hasScheme,
|
|
177
|
+
surface,
|
|
178
|
+
position: { line: 1, column: 1 },
|
|
179
|
+
};
|
|
180
|
+
if (c.peek().kind === "AT") {
|
|
181
|
+
c.advance();
|
|
182
|
+
const s = expectIdent(c, diagnostics, "state");
|
|
183
|
+
if (s !== undefined)
|
|
184
|
+
ref.state = s;
|
|
185
|
+
}
|
|
186
|
+
if (c.peek().kind === "SLASH") {
|
|
187
|
+
c.advance();
|
|
188
|
+
const el = expectIdent(c, diagnostics, "element");
|
|
189
|
+
if (el !== undefined)
|
|
190
|
+
ref.element = el;
|
|
191
|
+
if (c.peek().kind === "COLON") {
|
|
192
|
+
c.advance();
|
|
193
|
+
const k = parseKey(c, diagnostics);
|
|
194
|
+
if (k)
|
|
195
|
+
ref.key = k;
|
|
196
|
+
}
|
|
197
|
+
if (c.peek().kind === "BANG") {
|
|
198
|
+
c.advance();
|
|
199
|
+
const v = expectIdent(c, diagnostics, "verb");
|
|
200
|
+
if (v !== undefined)
|
|
201
|
+
ref.verb = v;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
expectEof(c, diagnostics);
|
|
205
|
+
return { ref, diagnostics };
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Parse a root declaration: `[ux:]surface : kind [@state, …]`. The `:` here
|
|
209
|
+
* introduces the kind (not a ref key). Returns `decl` undefined only when no
|
|
210
|
+
* surface is present or a reserved char corrupted the source. A missing kind
|
|
211
|
+
* (no `:`, or a `:` with nothing after it) is UXIL-004 with a best-effort
|
|
212
|
+
* partial decl (`kind: ""`, surface and states still captured) — S8's
|
|
213
|
+
* assemble must gate uxRegistry registration on a clean parse, never on the
|
|
214
|
+
* partial decl alone (#780).
|
|
215
|
+
*/
|
|
216
|
+
export function parseRootDecl(source) {
|
|
217
|
+
const diagnostics = [];
|
|
218
|
+
if (scanReservedChars(source, diagnostics))
|
|
219
|
+
return { diagnostics };
|
|
220
|
+
const c = new Cursor(tokenize(source));
|
|
221
|
+
consumeScheme(c);
|
|
222
|
+
const surface = parseSurface(c, diagnostics);
|
|
223
|
+
if (!surface) {
|
|
224
|
+
diagnostics.push(uxilDiagnostic("UXIL-008", { detail: "expected a surface segment" }, c.peek().position));
|
|
225
|
+
return { diagnostics };
|
|
226
|
+
}
|
|
227
|
+
// Missing kind — with or without the introducing `:` — is the same defect
|
|
228
|
+
// (#780 case 5): one UXIL-004, one partial-decl return shape.
|
|
229
|
+
let kind;
|
|
230
|
+
if (c.peek().kind !== "COLON") {
|
|
231
|
+
diagnostics.push(uxilDiagnostic("UXIL-004", {}, c.peek().position));
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
c.advance();
|
|
235
|
+
if (c.peek().kind === "IDENT") {
|
|
236
|
+
kind = c.advance().value;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
diagnostics.push(uxilDiagnostic("UXIL-004", {}, c.peek().position));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
const states = parseStateSet(c, diagnostics);
|
|
243
|
+
expectEof(c, diagnostics);
|
|
244
|
+
return {
|
|
245
|
+
decl: {
|
|
246
|
+
form: "root",
|
|
247
|
+
surface,
|
|
248
|
+
kind: kind ?? "",
|
|
249
|
+
states,
|
|
250
|
+
position: { line: 1, column: 1 },
|
|
251
|
+
},
|
|
252
|
+
diagnostics,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Parse a child-surface declaration: `.path[.seg…] [@state, …]`. The leading
|
|
257
|
+
* dot marks containment; nested bullets (its elements) are stitched in S8.
|
|
258
|
+
* There is no kind or verb set — kind is inherited (S8).
|
|
259
|
+
*/
|
|
260
|
+
export function parseChildSurfaceDecl(source) {
|
|
261
|
+
const diagnostics = [];
|
|
262
|
+
if (scanReservedChars(source, diagnostics))
|
|
263
|
+
return { diagnostics };
|
|
264
|
+
const c = new Cursor(tokenize(source));
|
|
265
|
+
if (c.peek().kind !== "DOT") {
|
|
266
|
+
diagnostics.push(uxilDiagnostic("UXIL-008", { detail: "child surface must start with '.'" }, c.peek().position));
|
|
267
|
+
return { diagnostics };
|
|
268
|
+
}
|
|
269
|
+
c.advance();
|
|
270
|
+
const path = parseSurface(c, diagnostics);
|
|
271
|
+
if (!path) {
|
|
272
|
+
diagnostics.push(uxilDiagnostic("UXIL-008", { detail: "expected a child surface name after '.'" }, c.peek().position));
|
|
273
|
+
return { diagnostics };
|
|
274
|
+
}
|
|
275
|
+
const states = parseStateSet(c, diagnostics);
|
|
276
|
+
expectEof(c, diagnostics);
|
|
277
|
+
const decl = {
|
|
278
|
+
form: "child",
|
|
279
|
+
path,
|
|
280
|
+
position: { line: 1, column: 1 },
|
|
281
|
+
};
|
|
282
|
+
if (states.length > 0)
|
|
283
|
+
decl.states = states;
|
|
284
|
+
return { decl, diagnostics };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Split the leading inline code span from the rest of a bullet paragraph.
|
|
288
|
+
* Handles single- and double-backtick spans. Returns `span` undefined when
|
|
289
|
+
* the paragraph does not begin with a code span.
|
|
290
|
+
*
|
|
291
|
+
* `spanStart` is the number of paragraph characters consumed before the
|
|
292
|
+
* span's inner text — leading whitespace plus the opening backtick
|
|
293
|
+
* delimiter(s). {@linkcode parseElementBullet} adds it to every span-derived
|
|
294
|
+
* diagnostic column so positions are paragraph-relative (#781): the parser is
|
|
295
|
+
* handed the whole paragraph, so — like every other uxil parser, which
|
|
296
|
+
* reports columns relative to the source string it receives — its diagnostics
|
|
297
|
+
* must be relative to that paragraph, not the de-backticked span. `0` when
|
|
298
|
+
* there is no span (the only diagnostic on that path anchors at paragraph
|
|
299
|
+
* column 1).
|
|
300
|
+
*/
|
|
301
|
+
function splitLeadingCodeSpan(text) {
|
|
302
|
+
const t = text.replace(/^\s+/, "");
|
|
303
|
+
const leading = text.length - t.length;
|
|
304
|
+
if (t.startsWith("``")) {
|
|
305
|
+
const end = t.indexOf("``", 2);
|
|
306
|
+
if (end < 0)
|
|
307
|
+
return { rest: text, spanStart: 0 };
|
|
308
|
+
return {
|
|
309
|
+
span: t.slice(2, end),
|
|
310
|
+
rest: t.slice(end + 2),
|
|
311
|
+
spanStart: leading + 2,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
if (t.startsWith("`")) {
|
|
315
|
+
const end = t.indexOf("`", 1);
|
|
316
|
+
if (end < 0)
|
|
317
|
+
return { rest: text, spanStart: 0 };
|
|
318
|
+
return {
|
|
319
|
+
span: t.slice(1, end),
|
|
320
|
+
rest: t.slice(end + 1),
|
|
321
|
+
spanStart: leading + 1,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return { rest: text, spanStart: 0 };
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Parse an element bullet: a leading code span
|
|
328
|
+
* `/element : verb[, verb…] [: {key}] [@state, …] [-> nav]` followed by a
|
|
329
|
+
* mandatory trailing prose event dictionary. Grammar decision K1 (#786,
|
|
330
|
+
* per the epic design doc): the key template is its own `:` clause after
|
|
331
|
+
* the verb set — never attached to the element name, so declarations
|
|
332
|
+
* cannot collide with the ref grammar's `element:{key}` form.
|
|
333
|
+
*
|
|
334
|
+
* Diagnostic columns are paragraph-relative (#781): the parser receives the
|
|
335
|
+
* whole paragraph and splits the leading code span itself, so every
|
|
336
|
+
* span-derived column is shifted by the span's start offset
|
|
337
|
+
* ({@linkcode splitLeadingCodeSpan}'s `spanStart`). The two whole-bullet
|
|
338
|
+
* diagnostics — no leading code span, and the missing event dictionary —
|
|
339
|
+
* anchor at paragraph column 1.
|
|
340
|
+
*/
|
|
341
|
+
export function parseElementBullet(paragraph) {
|
|
342
|
+
const diagnostics = [];
|
|
343
|
+
const { span, rest, spanStart } = splitLeadingCodeSpan(paragraph);
|
|
344
|
+
if (span === undefined) {
|
|
345
|
+
diagnostics.push(uxilDiagnostic("UXIL-001", { detail: "element bullet must begin with a code span" }, { line: 1, column: 1 }));
|
|
346
|
+
return { diagnostics };
|
|
347
|
+
}
|
|
348
|
+
// Peel off an optional `-> nav` tail before tokenizing the structured part.
|
|
349
|
+
let structPart = span;
|
|
350
|
+
let navSource;
|
|
351
|
+
const arrow = span.indexOf("->");
|
|
352
|
+
if (arrow >= 0) {
|
|
353
|
+
structPart = span.slice(0, arrow);
|
|
354
|
+
navSource = span.slice(arrow + 2).trim();
|
|
355
|
+
}
|
|
356
|
+
// Paragraph-relative base column for the nav tail (#781): the span's own
|
|
357
|
+
// start offset plus the nav source's 0-based index within the span. Nav
|
|
358
|
+
// diagnostics add this so their columns compose both offsets and land on
|
|
359
|
+
// the paragraph — "the -> nav sub-parse offset should compose too".
|
|
360
|
+
const navBase = navSource
|
|
361
|
+
? spanStart + span.indexOf(navSource, arrow + 2)
|
|
362
|
+
: 0;
|
|
363
|
+
// The nav tail is an orthogonal region: every return path must still
|
|
364
|
+
// surface a reserved char in it, even when the struct part fails first.
|
|
365
|
+
const scanNavReserved = () => {
|
|
366
|
+
if (navSource)
|
|
367
|
+
scanReservedChars(navSource, diagnostics, navBase);
|
|
368
|
+
};
|
|
369
|
+
// Scan the structured part only — the nav tail is scanned separately
|
|
370
|
+
// (scanNavReserved / parseUxRef below), so scanning the whole span would
|
|
371
|
+
// report a single `?`/`#` in the nav target twice (#780 case 2). A hit
|
|
372
|
+
// poisons the token stream (the lexer drops the char): stop before the
|
|
373
|
+
// structure checks turn the mangled tokens into contradictory codes. The
|
|
374
|
+
// scan's base column is the span start so its column is paragraph-relative
|
|
375
|
+
// (#781).
|
|
376
|
+
if (scanReservedChars(structPart, diagnostics, spanStart)) {
|
|
377
|
+
scanNavReserved();
|
|
378
|
+
return { diagnostics };
|
|
379
|
+
}
|
|
380
|
+
// Shift every struct-part token column by the span start so all downstream
|
|
381
|
+
// diagnostics (slash, element, verb set, key clause, states, expectEof)
|
|
382
|
+
// come out paragraph-relative (#781) without threading the offset through
|
|
383
|
+
// each individual call site.
|
|
384
|
+
const structTokens = tokenize(structPart).map((t) => ({
|
|
385
|
+
...t,
|
|
386
|
+
position: { line: t.position.line, column: t.position.column + spanStart },
|
|
387
|
+
}));
|
|
388
|
+
const c = new Cursor(structTokens);
|
|
389
|
+
if (c.peek().kind !== "SLASH") {
|
|
390
|
+
diagnostics.push(uxilDiagnostic("UXIL-001", { detail: "element must start with '/'" }, c.peek().position));
|
|
391
|
+
scanNavReserved();
|
|
392
|
+
return { diagnostics };
|
|
393
|
+
}
|
|
394
|
+
c.advance();
|
|
395
|
+
const element = expectIdent(c, diagnostics, "element name");
|
|
396
|
+
if (element === undefined) {
|
|
397
|
+
scanNavReserved();
|
|
398
|
+
return { diagnostics };
|
|
399
|
+
}
|
|
400
|
+
const decl = {
|
|
401
|
+
form: "element",
|
|
402
|
+
element,
|
|
403
|
+
verbs: [],
|
|
404
|
+
eventDictionary: "",
|
|
405
|
+
position: { line: 1, column: 1 },
|
|
406
|
+
};
|
|
407
|
+
// Old glued form `/element{key}` (pre-#786): one targeted diagnostic
|
|
408
|
+
// pointing at the clause form, then consume-and-discard the braces so
|
|
409
|
+
// the verb set still parses instead of cascading UXIL-005 + UXIL-001.
|
|
410
|
+
if (c.peek().kind === "LBRACE") {
|
|
411
|
+
diagnostics.push(uxilDiagnostic("UXIL-007", {
|
|
412
|
+
detail: "the key template is a clause after the verb set (write '/element : verb : {key}')",
|
|
413
|
+
}, c.peek().position));
|
|
414
|
+
parseKey(c, diagnostics);
|
|
415
|
+
}
|
|
416
|
+
// Verb set: `: verb[, verb…]` (>= 1).
|
|
417
|
+
if (c.peek().kind !== "COLON") {
|
|
418
|
+
if (c.peek().kind === "IDENT") {
|
|
419
|
+
// A verb is present but the introducing `:` is missing — reporting
|
|
420
|
+
// "empty verb set" here would be contradictory (#780 case 4).
|
|
421
|
+
diagnostics.push(uxilDiagnostic("UXIL-001", { detail: "expected ':' before the verb set" }, c.peek().position));
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
diagnostics.push(uxilDiagnostic("UXIL-005", {}, c.peek().position));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
c.advance();
|
|
429
|
+
const verbs = [];
|
|
430
|
+
// Peek rather than expectIdent for the first verb: a truly empty set
|
|
431
|
+
// reports only UXIL-005, not a redundant UXIL-001 too (#780 case 1).
|
|
432
|
+
if (c.peek().kind === "IDENT") {
|
|
433
|
+
verbs.push(c.advance().value);
|
|
434
|
+
while (c.peek().kind === "COMMA") {
|
|
435
|
+
c.advance();
|
|
436
|
+
const v = expectIdent(c, diagnostics, "verb");
|
|
437
|
+
if (v !== undefined)
|
|
438
|
+
verbs.push(v);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (verbs.length === 0) {
|
|
442
|
+
diagnostics.push(uxilDiagnostic("UXIL-005", {}, c.peek().position));
|
|
443
|
+
}
|
|
444
|
+
decl.verbs = verbs;
|
|
445
|
+
}
|
|
446
|
+
// Optional key-template clause: `: {key}` after the verb set (K1, #786).
|
|
447
|
+
// Declarations declare templates — a concrete key is a citation-only form.
|
|
448
|
+
if (c.peek().kind === "COLON") {
|
|
449
|
+
c.advance();
|
|
450
|
+
const keyAt = c.peek().position;
|
|
451
|
+
const k = parseKey(c, diagnostics);
|
|
452
|
+
if (k?.kind === "template") {
|
|
453
|
+
decl.keyTemplate = k;
|
|
454
|
+
}
|
|
455
|
+
else if (k) {
|
|
456
|
+
diagnostics.push(uxilDiagnostic("UXIL-007", {
|
|
457
|
+
detail: "expected a '{name}' template, not a concrete key",
|
|
458
|
+
}, keyAt));
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
const states = parseStateSet(c, diagnostics);
|
|
462
|
+
if (states.length > 0)
|
|
463
|
+
decl.states = states;
|
|
464
|
+
// Order is load-bearing: expectEof suppresses itself once any diagnostic
|
|
465
|
+
// exists, so it MUST run before the nav and event-dictionary checks below
|
|
466
|
+
// push theirs — moving it later would let those orthogonal regions hide a
|
|
467
|
+
// real leftover-token error in the struct part.
|
|
468
|
+
expectEof(c, diagnostics);
|
|
469
|
+
// Nav target (parsed as a ux ref; may be scheme-less / relative). Nav
|
|
470
|
+
// diagnostics carry positions relative to the sliced nav source — shift
|
|
471
|
+
// them by navBase so editor squiggles land on the paragraph's own columns
|
|
472
|
+
// (#781).
|
|
473
|
+
if (navSource !== undefined) {
|
|
474
|
+
if (navSource.length === 0) {
|
|
475
|
+
// No nav source to point into — anchor at the '->' arrow, paragraph-
|
|
476
|
+
// relative (#781): spanStart shifts past the code-span delimiter, arrow
|
|
477
|
+
// is the 0-based index of '->' within the span, +1 makes it 1-based.
|
|
478
|
+
diagnostics.push(uxilDiagnostic("UXIL-001", { detail: "missing navigation target after '->'" }, { line: 1, column: spanStart + arrow + 1 }));
|
|
479
|
+
}
|
|
480
|
+
else {
|
|
481
|
+
const nav = parseUxRef(navSource);
|
|
482
|
+
diagnostics.push(...nav.diagnostics.map((d) => ({
|
|
483
|
+
...d,
|
|
484
|
+
position: {
|
|
485
|
+
line: d.position.line,
|
|
486
|
+
column: d.position.column + navBase,
|
|
487
|
+
},
|
|
488
|
+
})));
|
|
489
|
+
if (nav.ref)
|
|
490
|
+
decl.nav = nav.ref;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
// Event dictionary: trailing prose, minus a leading em-dash separator. Only
|
|
494
|
+
// an em-dash "—" is stripped (never an ASCII "-"), so prose that legitimately
|
|
495
|
+
// opens with a hyphen — e.g. "-5 dB is the floor" — keeps its first character.
|
|
496
|
+
const eventDictionary = rest.replace(/^\s*—\s*/, "").trim();
|
|
497
|
+
if (eventDictionary.length === 0) {
|
|
498
|
+
// Whole-bullet diagnostic — the missing dictionary is the trailing prose,
|
|
499
|
+
// so anchor at paragraph column 1 (the bullet start) rather than a
|
|
500
|
+
// span-derived column (#781).
|
|
501
|
+
diagnostics.push(uxilDiagnostic("UXIL-006", {}, { line: 1, column: 1 }));
|
|
502
|
+
}
|
|
503
|
+
decl.eventDictionary = eventDictionary;
|
|
504
|
+
return { decl, diagnostics };
|
|
505
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module uxil/lexer
|
|
3
|
+
*
|
|
4
|
+
* Single-line tokenizer for the uxil DSL. Converts a source string (a `ux:`
|
|
5
|
+
* reference, or the machine-readable portion of a declaration) into a flat
|
|
6
|
+
* `Token[]` ending in one `EOF`. Whitespace is skipped; unrecognised
|
|
7
|
+
* characters are skipped silently — the parser surfaces the diagnostic,
|
|
8
|
+
* keeping lexer/parser responsibilities separated (as in typl's lexer).
|
|
9
|
+
*/
|
|
10
|
+
import type { Position } from "./ast.js";
|
|
11
|
+
/** All token kinds produced by the uxil tokenizer. */
|
|
12
|
+
export type TokenKind = "IDENT" | "DOT" | "AT" | "SLASH" | "COLON" | "BANG" | "COMMA" | "ARROW" | "LBRACE" | "RBRACE" | "EOF";
|
|
13
|
+
/** A single token emitted by {@linkcode tokenize}. */
|
|
14
|
+
export interface Token {
|
|
15
|
+
readonly kind: TokenKind;
|
|
16
|
+
/** Raw text (empty for EOF). */
|
|
17
|
+
readonly value: string;
|
|
18
|
+
/** 1-based position of the token's first character (line always 1). */
|
|
19
|
+
readonly position: Position;
|
|
20
|
+
}
|
|
21
|
+
/** Tokenize a single-line uxil source string. */
|
|
22
|
+
export declare function tokenize(source: string): Token[];
|
|
23
|
+
//# sourceMappingURL=lexer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lexer.d.ts","sourceRoot":"","sources":["../../src/uxil/lexer.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,sDAAsD;AACtD,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,KAAK,GACL,IAAI,GACJ,OAAO,GACP,OAAO,GACP,MAAM,GACN,OAAO,GACP,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,KAAK,CAAC;AAEV,sDAAsD;AACtD,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAeD,iDAAiD;AACjD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,CAoDhD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const IDENT_CHAR_RE = /[A-Za-z0-9_]/;
|
|
2
|
+
const SINGLE_CHAR = {
|
|
3
|
+
".": "DOT",
|
|
4
|
+
"@": "AT",
|
|
5
|
+
"/": "SLASH",
|
|
6
|
+
":": "COLON",
|
|
7
|
+
"!": "BANG",
|
|
8
|
+
",": "COMMA",
|
|
9
|
+
"{": "LBRACE",
|
|
10
|
+
"}": "RBRACE",
|
|
11
|
+
};
|
|
12
|
+
/** Tokenize a single-line uxil source string. */
|
|
13
|
+
export function tokenize(source) {
|
|
14
|
+
const tokens = [];
|
|
15
|
+
let i = 0;
|
|
16
|
+
let column = 1;
|
|
17
|
+
const push = (kind, value, startCol) => {
|
|
18
|
+
tokens.push({ kind, value, position: { line: 1, column: startCol } });
|
|
19
|
+
};
|
|
20
|
+
while (i < source.length) {
|
|
21
|
+
const ch = source[i];
|
|
22
|
+
if (ch === " " || ch === "\t") {
|
|
23
|
+
i++;
|
|
24
|
+
column++;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Arrow `->` before the single-char scan (it is not in SINGLE_CHAR).
|
|
28
|
+
if (ch === "-" && source[i + 1] === ">") {
|
|
29
|
+
push("ARROW", "->", column);
|
|
30
|
+
i += 2;
|
|
31
|
+
column += 2;
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const single = SINGLE_CHAR[ch];
|
|
35
|
+
if (single !== undefined) {
|
|
36
|
+
push(single, ch, column);
|
|
37
|
+
i++;
|
|
38
|
+
column++;
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
if (IDENT_CHAR_RE.test(ch)) {
|
|
42
|
+
const startCol = column;
|
|
43
|
+
let value = "";
|
|
44
|
+
while (i < source.length && IDENT_CHAR_RE.test(source[i])) {
|
|
45
|
+
value += source[i];
|
|
46
|
+
i++;
|
|
47
|
+
column++;
|
|
48
|
+
}
|
|
49
|
+
push("IDENT", value, startCol);
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
// Unrecognised character — skip; the parser surfaces the diagnostic.
|
|
53
|
+
i++;
|
|
54
|
+
column++;
|
|
55
|
+
}
|
|
56
|
+
push("EOF", "", column);
|
|
57
|
+
return tokens;
|
|
58
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module uxil
|
|
3
|
+
*
|
|
4
|
+
* uxil DSL layer: `ux:` reference + declaration-form parsers (S7 #725),
|
|
5
|
+
* the declaration AST, structured parse diagnostics, the form recognizer,
|
|
6
|
+
* and the compiler — corpus registry, enforced semantics, and a
|
|
7
|
+
* deterministic machine projection (S8 #726). The compiler is now
|
|
8
|
+
* reachable from `check`/LSP through `core/validator/uxil_family.ts`
|
|
9
|
+
* (S9 #727); the family + LSP wiring itself lands in S9/S10.
|
|
10
|
+
*/
|
|
11
|
+
export type { ChildSurfaceDecl, ElementDecl, Position, RootDecl, UxilDecl, UxKey, UxRef, } from "./ast.js";
|
|
12
|
+
export type { UxilCode, UxilCodeEntry, UxilDiagnostic } from "./diagnostics.js";
|
|
13
|
+
export { UXIL_CODES, uxilDiagnostic, uxilDiagnosticAt } from "./diagnostics.js";
|
|
14
|
+
export type { Token, TokenKind } from "./lexer.js";
|
|
15
|
+
export { tokenize } from "./lexer.js";
|
|
16
|
+
export { parseChildSurfaceDecl, parseElementBullet, parseRootDecl, parseUxRef, } from "./grammar.js";
|
|
17
|
+
export type { UxilForm } from "./recognize.js";
|
|
18
|
+
export { classifyUxilForm } from "./recognize.js";
|
|
19
|
+
export type { UxElement, UxSurface, UxSurfaceTree } from "./assemble.js";
|
|
20
|
+
export { assembleUxSurface, UX_REF_OPS } from "./assemble.js";
|
|
21
|
+
export type { SurfaceRecord, UxRegistry } from "./registry.js";
|
|
22
|
+
export { buildUxRegistry } from "./registry.js";
|
|
23
|
+
export type { UxCitation } from "./citations.js";
|
|
24
|
+
export { extractUxCitations, isUxCitationText } from "./citations.js";
|
|
25
|
+
export { extractUxBullets, extractUxRootSpans, stripUxilLeadingSpan, } from "./surfaces.js";
|
|
26
|
+
export type { UxilValidateOptions, UxilValidation } from "./validator.js";
|
|
27
|
+
export { validateUxil } from "./validator.js";
|
|
28
|
+
export type { ProjectedElement, ProjectedSurface, UxProjection, } from "./projection.js";
|
|
29
|
+
export { projectUxRegistry } from "./projection.js";
|
|
30
|
+
export type { KindInfo, VerbInfo } from "./vocab.js";
|
|
31
|
+
export { isKnownKind, isKnownVerb, UX_KINDS, UX_VERBS } from "./vocab.js";
|
|
32
|
+
//# sourceMappingURL=mod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/uxil/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,KAAK,GACN,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAChF,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC9D,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/esm/uxil/mod.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { UXIL_CODES, uxilDiagnostic, uxilDiagnosticAt } from "./diagnostics.js";
|
|
2
|
+
export { tokenize } from "./lexer.js";
|
|
3
|
+
export { parseChildSurfaceDecl, parseElementBullet, parseRootDecl, parseUxRef, } from "./grammar.js";
|
|
4
|
+
export { classifyUxilForm } from "./recognize.js";
|
|
5
|
+
export { assembleUxSurface, UX_REF_OPS } from "./assemble.js";
|
|
6
|
+
export { buildUxRegistry } from "./registry.js";
|
|
7
|
+
export { extractUxCitations, isUxCitationText } from "./citations.js";
|
|
8
|
+
export { extractUxBullets, extractUxRootSpans, stripUxilLeadingSpan, } from "./surfaces.js";
|
|
9
|
+
export { validateUxil } from "./validator.js";
|
|
10
|
+
export { projectUxRegistry } from "./projection.js";
|
|
11
|
+
export { isKnownKind, isKnownVerb, UX_KINDS, UX_VERBS } from "./vocab.js";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module uxil/projection
|
|
3
|
+
*
|
|
4
|
+
* Deterministic machine projection of a {@linkcode UxRegistry} (S8 #726):
|
|
5
|
+
* the seam downstream codegen (and the S11 payload bridge) build on. Pure
|
|
6
|
+
* transform — no timestamps or run metadata, every collection sorted by a
|
|
7
|
+
* stable key so `projectUxRegistry(registry)` is byte-identical across
|
|
8
|
+
* runs. A duplicated surface id uses only its first-declared record
|
|
9
|
+
* (mirrors the first-declaration-wins convention used elsewhere in S8);
|
|
10
|
+
* the duplicate itself is a separate validator concern (UXIL-015).
|
|
11
|
+
*/
|
|
12
|
+
import type { UxRegistry } from "./registry.js";
|
|
13
|
+
/** One projected interaction element. */
|
|
14
|
+
export interface ProjectedElement {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly verbs: readonly string[];
|
|
17
|
+
readonly keyTemplate: string | null;
|
|
18
|
+
readonly nav: string | null;
|
|
19
|
+
readonly states: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
/** One projected surface. */
|
|
22
|
+
export interface ProjectedSurface {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly kind: string;
|
|
25
|
+
readonly states: readonly string[];
|
|
26
|
+
readonly parent: string | null;
|
|
27
|
+
readonly elements: readonly ProjectedElement[];
|
|
28
|
+
}
|
|
29
|
+
/** The full deterministic projection. */
|
|
30
|
+
export interface UxProjection {
|
|
31
|
+
readonly surfaces: readonly ProjectedSurface[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Project a {@linkcode UxRegistry} into a deterministic, JSON-serialisable
|
|
35
|
+
* manifest. Surfaces sorted by id; elements within a surface sorted by
|
|
36
|
+
* name; states sorted; verbs kept in declaration order (still
|
|
37
|
+
* deterministic — load-bearing for compound controls).
|
|
38
|
+
*/
|
|
39
|
+
export declare function projectUxRegistry(registry: UxRegistry): UxProjection;
|
|
40
|
+
//# sourceMappingURL=projection.d.ts.map
|