@driftsys/markspec 0.5.0 → 0.6.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 +74 -20
- package/esm/ast/build.d.ts +11 -21
- package/esm/ast/build.d.ts.map +1 -1
- package/esm/ast/build.js +50 -139
- package/esm/ast/nodes.d.ts +11 -43
- package/esm/ast/nodes.d.ts.map +1 -1
- package/esm/ast/nodes.js +6 -1
- package/esm/ast/normalize.d.ts +8 -17
- package/esm/ast/normalize.d.ts.map +1 -1
- package/esm/ast/normalize.js +14 -72
- package/esm/compiler/constants.d.ts +16 -0
- package/esm/compiler/constants.d.ts.map +1 -0
- package/esm/compiler/constants.js +26 -0
- package/esm/compiler/discipline_classifier.d.ts +55 -0
- package/esm/compiler/discipline_classifier.d.ts.map +1 -0
- package/esm/compiler/discipline_classifier.js +191 -0
- package/esm/compiler/inverses.d.ts +7 -0
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +1 -18
- package/esm/compiler/mod.d.ts +30 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +198 -65
- package/esm/compiler/schema.d.ts +15 -0
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +12 -0
- package/esm/config/markspec.d.ts +5 -0
- package/esm/config/markspec.d.ts.map +1 -1
- package/esm/config/markspec.js +17 -2
- package/esm/formatter/mod.d.ts +9 -3
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +97 -49
- package/esm/lexicons/loader.d.ts +35 -0
- package/esm/lexicons/loader.d.ts.map +1 -0
- package/esm/lexicons/loader.js +51 -0
- package/esm/lexicons/mod.d.ts +13 -0
- package/esm/lexicons/mod.d.ts.map +1 -0
- package/esm/lexicons/mod.js +12 -0
- package/esm/lint/glossary.d.ts +45 -0
- package/esm/lint/glossary.d.ts.map +1 -0
- package/esm/lint/glossary.js +85 -0
- package/esm/lint/mod.d.ts +4 -0
- package/esm/lint/mod.d.ts.map +1 -1
- package/esm/lint/mod.js +2 -0
- package/esm/lint/range_util.d.ts +25 -0
- package/esm/lint/range_util.d.ts.map +1 -0
- package/esm/lint/range_util.js +50 -0
- package/esm/lint/rules/ears.d.ts +39 -0
- package/esm/lint/rules/ears.d.ts.map +1 -0
- package/esm/lint/rules/ears.js +316 -0
- package/esm/lint/rules/incose_sentence.d.ts +46 -0
- package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
- package/esm/lint/rules/incose_sentence.js +417 -0
- package/esm/lint/rules/modal_sentence.d.ts +46 -0
- package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
- package/esm/lint/rules/modal_sentence.js +146 -0
- package/esm/lint/rules/passive.d.ts +64 -0
- package/esm/lint/rules/passive.d.ts.map +1 -0
- package/esm/lint/rules/passive.js +282 -0
- package/esm/lint/rules/suppression.d.ts +38 -3
- package/esm/lint/rules/suppression.d.ts.map +1 -1
- package/esm/lint/rules/suppression.js +58 -4
- package/esm/lint/rules/xref.d.ts +19 -0
- package/esm/lint/rules/xref.d.ts.map +1 -0
- package/esm/lint/rules/xref.js +248 -0
- package/esm/lint/runner.d.ts +31 -11
- package/esm/lint/runner.d.ts.map +1 -1
- package/esm/lint/runner.js +67 -26
- package/esm/lint/score.d.ts +64 -0
- package/esm/lint/score.d.ts.map +1 -0
- package/esm/lint/score.js +163 -0
- package/esm/lint/segmenter.d.ts +32 -0
- package/esm/lint/segmenter.d.ts.map +1 -0
- package/esm/lint/segmenter.js +79 -0
- package/esm/lint/types.d.ts +12 -0
- package/esm/lint/types.d.ts.map +1 -1
- package/esm/lock/canonical_edges.d.ts +31 -0
- package/esm/lock/canonical_edges.d.ts.map +1 -0
- package/esm/lock/canonical_edges.js +57 -0
- package/esm/lock/check.d.ts +24 -0
- package/esm/lock/check.d.ts.map +1 -0
- package/esm/lock/check.js +127 -0
- package/esm/lock/hash.d.ts +12 -0
- package/esm/lock/hash.d.ts.map +1 -0
- package/esm/lock/hash.js +32 -0
- package/esm/lock/mod.d.ts +19 -0
- package/esm/lock/mod.d.ts.map +1 -0
- package/esm/lock/mod.js +14 -0
- package/esm/lock/model.d.ts +81 -0
- package/esm/lock/model.d.ts.map +1 -0
- package/esm/lock/model.js +7 -0
- package/esm/lock/parser.d.ts +26 -0
- package/esm/lock/parser.d.ts.map +1 -0
- package/esm/lock/parser.js +195 -0
- package/esm/lock/resolve.d.ts +142 -0
- package/esm/lock/resolve.d.ts.map +1 -0
- package/esm/lock/resolve.js +389 -0
- package/esm/lock/serializer.d.ts +14 -0
- package/esm/lock/serializer.d.ts.map +1 -0
- package/esm/lock/serializer.js +104 -0
- package/esm/mod.d.ts +16 -9
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +12 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +37 -0
- package/esm/model/discipline.d.ts +53 -0
- package/esm/model/discipline.d.ts.map +1 -0
- package/esm/model/discipline.js +50 -0
- package/esm/model/mod.d.ts +188 -30
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +42 -1
- package/esm/model/profile.d.ts +69 -0
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +1 -10
- package/esm/parser/body_tokens.d.ts +35 -0
- package/esm/parser/body_tokens.d.ts.map +1 -0
- package/esm/parser/body_tokens.js +232 -0
- package/esm/parser/glossary.d.ts +8 -0
- package/esm/parser/glossary.d.ts.map +1 -1
- package/esm/parser/glossary.js +6 -4
- package/esm/parser/grammars.d.ts +5 -3
- package/esm/parser/grammars.d.ts.map +1 -1
- package/esm/parser/grammars.js +12 -4
- package/esm/parser/language_spec.d.ts +55 -0
- package/esm/parser/language_spec.d.ts.map +1 -0
- package/esm/parser/language_spec.js +419 -0
- package/esm/parser/line_map.d.ts +60 -0
- package/esm/parser/line_map.d.ts.map +1 -0
- package/esm/parser/line_map.js +41 -0
- package/esm/parser/markdown.d.ts +9 -0
- package/esm/parser/markdown.d.ts.map +1 -1
- package/esm/parser/markdown.js +107 -31
- package/esm/parser/mod.d.ts +4 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +30 -8
- package/esm/parser/source.d.ts +39 -8
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +155 -65
- package/esm/parser/translate.d.ts +24 -0
- package/esm/parser/translate.d.ts.map +1 -0
- package/esm/parser/translate.js +99 -0
- package/esm/profile/chain.d.ts +8 -0
- package/esm/profile/chain.d.ts.map +1 -1
- package/esm/profile/chain.js +29 -1
- package/esm/profile/default_profile.d.ts +25 -0
- package/esm/profile/default_profile.d.ts.map +1 -0
- package/esm/profile/default_profile.js +43 -0
- package/esm/profile/discipline_mode.d.ts +64 -0
- package/esm/profile/discipline_mode.d.ts.map +1 -0
- package/esm/profile/discipline_mode.js +133 -0
- package/esm/profile/discipline_registry.d.ts +41 -0
- package/esm/profile/discipline_registry.d.ts.map +1 -0
- package/esm/profile/discipline_registry.js +67 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +24 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +253 -20
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +112 -0
- package/esm/profile/mod.d.ts +2 -0
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +2 -0
- package/esm/sync/locked_attributes.d.ts +19 -0
- package/esm/sync/locked_attributes.d.ts.map +1 -0
- package/esm/sync/locked_attributes.js +27 -0
- package/esm/sync/log.d.ts +34 -0
- package/esm/sync/log.d.ts.map +1 -0
- package/esm/sync/log.js +48 -0
- package/esm/sync/mapping.d.ts +66 -0
- package/esm/sync/mapping.d.ts.map +1 -0
- package/esm/sync/mapping.js +165 -0
- package/esm/sync/mod.d.ts +16 -0
- package/esm/sync/mod.d.ts.map +1 -0
- package/esm/sync/mod.js +12 -0
- package/esm/sync/status.d.ts +23 -0
- package/esm/sync/status.d.ts.map +1 -0
- package/esm/sync/status.js +21 -0
- package/esm/typl/ast.d.ts +87 -0
- package/esm/typl/ast.d.ts.map +1 -0
- package/esm/typl/ast.js +21 -0
- package/esm/typl/bridge.d.ts +32 -0
- package/esm/typl/bridge.d.ts.map +1 -0
- package/esm/typl/bridge.js +27 -0
- package/esm/typl/bullet.d.ts +34 -0
- package/esm/typl/bullet.d.ts.map +1 -0
- package/esm/typl/bullet.js +44 -0
- package/esm/typl/diagnostics.d.ts +43 -0
- package/esm/typl/diagnostics.d.ts.map +1 -0
- package/esm/typl/diagnostics.js +61 -0
- package/esm/typl/fence.d.ts +31 -0
- package/esm/typl/fence.d.ts.map +1 -0
- package/esm/typl/fence.js +24 -0
- package/esm/typl/grammar.d.ts +20 -0
- package/esm/typl/grammar.d.ts.map +1 -0
- package/esm/typl/grammar.js +471 -0
- package/esm/typl/inline.d.ts +34 -0
- package/esm/typl/inline.d.ts.map +1 -0
- package/esm/typl/inline.js +48 -0
- package/esm/typl/lexer.d.ts +37 -0
- package/esm/typl/lexer.d.ts.map +1 -0
- package/esm/typl/lexer.js +234 -0
- package/esm/typl/mod.d.ts +23 -0
- package/esm/typl/mod.d.ts.map +1 -0
- package/esm/typl/mod.js +16 -0
- package/esm/typl/registry.d.ts +42 -0
- package/esm/typl/registry.d.ts.map +1 -0
- package/esm/typl/registry.js +26 -0
- package/esm/typl/validator.d.ts +29 -0
- package/esm/typl/validator.d.ts.map +1 -0
- package/esm/typl/validator.js +141 -0
- package/esm/util/line_endings.d.ts +33 -0
- package/esm/util/line_endings.d.ts.map +1 -0
- package/esm/util/line_endings.js +53 -0
- package/esm/util/modals.d.ts +29 -0
- package/esm/util/modals.d.ts.map +1 -0
- package/esm/util/modals.js +38 -0
- package/esm/validator/discipline.d.ts +35 -0
- package/esm/validator/discipline.d.ts.map +1 -0
- package/esm/validator/discipline.js +204 -0
- package/esm/validator/mod.d.ts +1 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +23 -2
- package/esm/validator/modal_keywords.d.ts +15 -13
- package/esm/validator/modal_keywords.d.ts.map +1 -1
- package/esm/validator/modal_keywords.js +26 -109
- package/esm/validator/pattern.d.ts +15 -8
- package/esm/validator/pattern.d.ts.map +1 -1
- package/esm/validator/pattern.js +42 -19
- package/esm/validator/per_type_attrs.d.ts +2 -2
- package/esm/validator/per_type_attrs.d.ts.map +1 -1
- package/esm/validator/per_type_attrs.js +2 -2
- package/esm/validator/pipeline.d.ts +11 -0
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +37 -15
- package/esm/validator/type_resolution.d.ts +3 -3
- package/esm/validator/type_resolution.d.ts.map +1 -1
- package/esm/validator/type_resolution.js +31 -9
- package/package.json +2 -2
- package/script/ast/build.d.ts +11 -21
- package/script/ast/build.d.ts.map +1 -1
- package/script/ast/build.js +51 -140
- package/script/ast/nodes.d.ts +11 -43
- package/script/ast/nodes.d.ts.map +1 -1
- package/script/ast/nodes.js +6 -1
- package/script/ast/normalize.d.ts +8 -17
- package/script/ast/normalize.d.ts.map +1 -1
- package/script/ast/normalize.js +16 -74
- package/script/compiler/constants.d.ts +16 -0
- package/script/compiler/constants.d.ts.map +1 -0
- package/script/compiler/constants.js +29 -0
- package/script/compiler/discipline_classifier.d.ts +55 -0
- package/script/compiler/discipline_classifier.d.ts.map +1 -0
- package/script/compiler/discipline_classifier.js +196 -0
- package/script/compiler/inverses.d.ts +7 -0
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +2 -19
- package/script/compiler/mod.d.ts +30 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +202 -69
- package/script/compiler/schema.d.ts +15 -0
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +12 -0
- package/script/config/markspec.d.ts +5 -0
- package/script/config/markspec.d.ts.map +1 -1
- package/script/config/markspec.js +17 -2
- package/script/formatter/mod.d.ts +9 -3
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +99 -51
- package/script/lexicons/loader.d.ts +35 -0
- package/script/lexicons/loader.d.ts.map +1 -0
- package/script/lexicons/loader.js +55 -0
- package/script/lexicons/mod.d.ts +13 -0
- package/script/lexicons/mod.d.ts.map +1 -0
- package/script/lexicons/mod.js +17 -0
- package/script/lint/glossary.d.ts +45 -0
- package/script/lint/glossary.d.ts.map +1 -0
- package/script/lint/glossary.js +88 -0
- package/script/lint/mod.d.ts +4 -0
- package/script/lint/mod.d.ts.map +1 -1
- package/script/lint/mod.js +6 -1
- package/script/lint/range_util.d.ts +25 -0
- package/script/lint/range_util.d.ts.map +1 -0
- package/script/lint/range_util.js +53 -0
- package/script/lint/rules/ears.d.ts +39 -0
- package/script/lint/rules/ears.d.ts.map +1 -0
- package/script/lint/rules/ears.js +320 -0
- package/script/lint/rules/incose_sentence.d.ts +46 -0
- package/script/lint/rules/incose_sentence.d.ts.map +1 -0
- package/script/lint/rules/incose_sentence.js +421 -0
- package/script/lint/rules/modal_sentence.d.ts +46 -0
- package/script/lint/rules/modal_sentence.d.ts.map +1 -0
- package/script/lint/rules/modal_sentence.js +150 -0
- package/script/lint/rules/passive.d.ts +64 -0
- package/script/lint/rules/passive.d.ts.map +1 -0
- package/script/lint/rules/passive.js +286 -0
- package/script/lint/rules/suppression.d.ts +38 -3
- package/script/lint/rules/suppression.d.ts.map +1 -1
- package/script/lint/rules/suppression.js +59 -3
- package/script/lint/rules/xref.d.ts +19 -0
- package/script/lint/rules/xref.d.ts.map +1 -0
- package/script/lint/rules/xref.js +251 -0
- package/script/lint/runner.d.ts +31 -11
- package/script/lint/runner.d.ts.map +1 -1
- package/script/lint/runner.js +67 -26
- package/script/lint/score.d.ts +64 -0
- package/script/lint/score.d.ts.map +1 -0
- package/script/lint/score.js +167 -0
- package/script/lint/segmenter.d.ts +32 -0
- package/script/lint/segmenter.d.ts.map +1 -0
- package/script/lint/segmenter.js +82 -0
- package/script/lint/types.d.ts +12 -0
- package/script/lint/types.d.ts.map +1 -1
- package/script/lock/canonical_edges.d.ts +31 -0
- package/script/lock/canonical_edges.d.ts.map +1 -0
- package/script/lock/canonical_edges.js +61 -0
- package/script/lock/check.d.ts +24 -0
- package/script/lock/check.d.ts.map +1 -0
- package/script/lock/check.js +130 -0
- package/script/lock/hash.d.ts +12 -0
- package/script/lock/hash.d.ts.map +1 -0
- package/script/lock/hash.js +36 -0
- package/script/lock/mod.d.ts +19 -0
- package/script/lock/mod.d.ts.map +1 -0
- package/script/lock/mod.js +31 -0
- package/script/lock/model.d.ts +81 -0
- package/script/lock/model.d.ts.map +1 -0
- package/script/lock/model.js +10 -0
- package/script/lock/parser.d.ts +26 -0
- package/script/lock/parser.d.ts.map +1 -0
- package/script/lock/parser.js +198 -0
- package/script/lock/resolve.d.ts +142 -0
- package/script/lock/resolve.d.ts.map +1 -0
- package/script/lock/resolve.js +397 -0
- package/script/lock/serializer.d.ts +14 -0
- package/script/lock/serializer.d.ts.map +1 -0
- package/script/lock/serializer.js +107 -0
- package/script/mod.d.ts +16 -9
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +111 -38
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +38 -1
- package/script/model/discipline.d.ts +53 -0
- package/script/model/discipline.d.ts.map +1 -0
- package/script/model/discipline.js +53 -0
- package/script/model/mod.d.ts +188 -30
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +48 -1
- package/script/model/profile.d.ts +69 -0
- package/script/model/profile.d.ts.map +1 -1
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +1 -10
- package/script/parser/body_tokens.d.ts +35 -0
- package/script/parser/body_tokens.d.ts.map +1 -0
- package/script/parser/body_tokens.js +235 -0
- package/script/parser/glossary.d.ts +8 -0
- package/script/parser/glossary.d.ts.map +1 -1
- package/script/parser/glossary.js +7 -4
- package/script/parser/grammars.d.ts +5 -3
- package/script/parser/grammars.d.ts.map +1 -1
- package/script/parser/grammars.js +15 -8
- package/script/parser/language_spec.d.ts +55 -0
- package/script/parser/language_spec.d.ts.map +1 -0
- package/script/parser/language_spec.js +423 -0
- package/script/parser/line_map.d.ts +60 -0
- package/script/parser/line_map.d.ts.map +1 -0
- package/script/parser/line_map.js +44 -0
- package/script/parser/markdown.d.ts +9 -0
- package/script/parser/markdown.d.ts.map +1 -1
- package/script/parser/markdown.js +105 -29
- package/script/parser/mod.d.ts +4 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +32 -7
- package/script/parser/source.d.ts +39 -8
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +156 -69
- package/script/parser/translate.d.ts +24 -0
- package/script/parser/translate.d.ts.map +1 -0
- package/script/parser/translate.js +102 -0
- package/script/profile/chain.d.ts +8 -0
- package/script/profile/chain.d.ts.map +1 -1
- package/script/profile/chain.js +29 -1
- package/script/profile/default_profile.d.ts +25 -0
- package/script/profile/default_profile.d.ts.map +1 -0
- package/script/profile/default_profile.js +46 -0
- package/script/profile/discipline_mode.d.ts +64 -0
- package/script/profile/discipline_mode.d.ts.map +1 -0
- package/script/profile/discipline_mode.js +138 -0
- package/script/profile/discipline_registry.d.ts +41 -0
- package/script/profile/discipline_registry.d.ts.map +1 -0
- package/script/profile/discipline_registry.js +70 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +24 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +252 -19
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +112 -0
- package/script/profile/mod.d.ts +2 -0
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +6 -1
- package/script/sync/locked_attributes.d.ts +19 -0
- package/script/sync/locked_attributes.d.ts.map +1 -0
- package/script/sync/locked_attributes.js +30 -0
- package/script/sync/log.d.ts +34 -0
- package/script/sync/log.d.ts.map +1 -0
- package/script/sync/log.js +52 -0
- package/script/sync/mapping.d.ts +66 -0
- package/script/sync/mapping.d.ts.map +1 -0
- package/script/sync/mapping.js +169 -0
- package/script/sync/mod.d.ts +16 -0
- package/script/sync/mod.d.ts.map +1 -0
- package/script/sync/mod.js +21 -0
- package/script/sync/status.d.ts +23 -0
- package/script/sync/status.d.ts.map +1 -0
- package/script/sync/status.js +24 -0
- package/script/typl/ast.d.ts +87 -0
- package/script/typl/ast.d.ts.map +1 -0
- package/script/typl/ast.js +24 -0
- package/script/typl/bridge.d.ts +32 -0
- package/script/typl/bridge.d.ts.map +1 -0
- package/script/typl/bridge.js +30 -0
- package/script/typl/bullet.d.ts +34 -0
- package/script/typl/bullet.d.ts.map +1 -0
- package/script/typl/bullet.js +47 -0
- package/script/typl/diagnostics.d.ts +43 -0
- package/script/typl/diagnostics.d.ts.map +1 -0
- package/script/typl/diagnostics.js +65 -0
- package/script/typl/fence.d.ts +31 -0
- package/script/typl/fence.d.ts.map +1 -0
- package/script/typl/fence.js +27 -0
- package/script/typl/grammar.d.ts +20 -0
- package/script/typl/grammar.d.ts.map +1 -0
- package/script/typl/grammar.js +474 -0
- package/script/typl/inline.d.ts +34 -0
- package/script/typl/inline.d.ts.map +1 -0
- package/script/typl/inline.js +51 -0
- package/script/typl/lexer.d.ts +37 -0
- package/script/typl/lexer.d.ts.map +1 -0
- package/script/typl/lexer.js +237 -0
- package/script/typl/mod.d.ts +23 -0
- package/script/typl/mod.d.ts.map +1 -0
- package/script/typl/mod.js +29 -0
- package/script/typl/registry.d.ts +42 -0
- package/script/typl/registry.d.ts.map +1 -0
- package/script/typl/registry.js +29 -0
- package/script/typl/validator.d.ts +29 -0
- package/script/typl/validator.d.ts.map +1 -0
- package/script/typl/validator.js +144 -0
- package/script/util/line_endings.d.ts +33 -0
- package/script/util/line_endings.d.ts.map +1 -0
- package/script/util/line_endings.js +58 -0
- package/script/util/modals.d.ts +29 -0
- package/script/util/modals.d.ts.map +1 -0
- package/script/util/modals.js +42 -0
- package/script/validator/discipline.d.ts +35 -0
- package/script/validator/discipline.d.ts.map +1 -0
- package/script/validator/discipline.js +207 -0
- package/script/validator/mod.d.ts +1 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +23 -1
- package/script/validator/modal_keywords.d.ts +15 -13
- package/script/validator/modal_keywords.d.ts.map +1 -1
- package/script/validator/modal_keywords.js +26 -109
- package/script/validator/pattern.d.ts +15 -8
- package/script/validator/pattern.d.ts.map +1 -1
- package/script/validator/pattern.js +42 -19
- package/script/validator/per_type_attrs.d.ts +2 -2
- package/script/validator/per_type_attrs.d.ts.map +1 -1
- package/script/validator/per_type_attrs.js +2 -2
- package/script/validator/pipeline.d.ts +11 -0
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +40 -17
- package/script/validator/type_resolution.d.ts +3 -3
- package/script/validator/type_resolution.d.ts.map +1 -1
- package/script/validator/type_resolution.js +31 -9
- package/esm/parser/entity_refs.d.ts +0 -53
- package/esm/parser/entity_refs.d.ts.map +0 -1
- package/esm/parser/entity_refs.js +0 -151
- package/script/parser/entity_refs.d.ts +0 -53
- package/script/parser/entity_refs.d.ts.map +0 -1
- package/script/parser/entity_refs.js +0 -155
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/util/modals
|
|
3
|
+
*
|
|
4
|
+
* RFC 2119 and EARS modal-keyword helpers shared by `formatter/mod.ts`
|
|
5
|
+
* and `ast/normalize.ts`. Extracted to `core/util/` to avoid a dep cycle:
|
|
6
|
+
* `ast/` is a dependency of `formatter/`, so `formatter → ast` is OK but
|
|
7
|
+
* `ast → formatter` is not.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* RFC 2119 modal keywords in uppercase form, with optional ` NOT` suffix.
|
|
11
|
+
* Captured for canonical-form normalisation per spec §3.4.1: uppercase
|
|
12
|
+
* input is accepted but emitted lowercase, unconditionally.
|
|
13
|
+
*/
|
|
14
|
+
export const RFC2119_MODAL_RE = /\b(SHALL|SHOULD|MAY|MUST)(\s+NOT)?\b/g;
|
|
15
|
+
/**
|
|
16
|
+
* EARS keywords subject to the sentence-initial rule of spec §3.4.1:
|
|
17
|
+
* lowercased when mid-sentence, preserved when starting a sentence.
|
|
18
|
+
* `If…then` is deferred to a later slice because its multi-token form
|
|
19
|
+
* needs separate handling.
|
|
20
|
+
*/
|
|
21
|
+
export const EARS_KEYWORD_RE = /\b(When|While|Where|Unless)\b/g;
|
|
22
|
+
/**
|
|
23
|
+
* Decide whether the EARS keyword at `offset` in `line` is at sentence
|
|
24
|
+
* start (return value true). Walks left over whitespace and reports true
|
|
25
|
+
* when it hits the beginning of the line or a sentence-terminating
|
|
26
|
+
* punctuation character (`.`, `!`, `?`).
|
|
27
|
+
*/
|
|
28
|
+
export function isSentenceInitial(line, offset) {
|
|
29
|
+
if (offset === 0)
|
|
30
|
+
return true;
|
|
31
|
+
let i = offset - 1;
|
|
32
|
+
while (i >= 0 && (line[i] === " " || line[i] === "\t"))
|
|
33
|
+
i--;
|
|
34
|
+
if (i < 0)
|
|
35
|
+
return true;
|
|
36
|
+
const prev = line[i];
|
|
37
|
+
return prev === "." || prev === "!" || prev === "?";
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/discipline
|
|
3
|
+
*
|
|
4
|
+
* Discipline-attribute validator per ADR-017 Slice 3. Emits seven codes:
|
|
5
|
+
*
|
|
6
|
+
* - MSL-T025 — `Discipline:` value not in the effective kind set (error)
|
|
7
|
+
* - MSL-T026 — `Discipline-frozen:` value malformed (error)
|
|
8
|
+
* - MSL-T027 — `Discipline-frozen:` kind not in the effective set (error)
|
|
9
|
+
* - MSL-T028 — `Discipline:` conflicts with channel-3 derivation (warning)
|
|
10
|
+
* - MSL-T029 — `Discipline:` conflicts with channel-4 derivation (warning)
|
|
11
|
+
* - MSL-T030 — `Discipline-frozen:` differs from current derivation (warning)
|
|
12
|
+
* - MSL-T031 — `Discipline:` and `Discipline-frozen:` disagree (warning)
|
|
13
|
+
*
|
|
14
|
+
* The effective kind set used by T025/T027 is `CORE_KINDS` plus any kinds
|
|
15
|
+
* the active profile chain declared via `profile.kinds:` (Slice 2's
|
|
16
|
+
* effective registry).
|
|
17
|
+
*
|
|
18
|
+
* Tasks 5–8 of the plan add T026–T031 incrementally on top of this skeleton.
|
|
19
|
+
*/
|
|
20
|
+
import type { Diagnostic, DisciplineRegistry, DisplayId, Entry } from "../model/mod.js";
|
|
21
|
+
/**
|
|
22
|
+
* Validate the `Discipline:` and `Discipline-frozen:` attributes across
|
|
23
|
+
* every entry. Pure function: takes the entries, a lookup map (used by
|
|
24
|
+
* later tasks for channel-4 derivation), and the effective registry.
|
|
25
|
+
*
|
|
26
|
+
* @param entries Entries to walk.
|
|
27
|
+
* @param entriesByDisplayId Lookup map for channel-4 derivation. Tasks 5–8
|
|
28
|
+
* will use this; Task 4 ignores it but keeps the parameter to fix the
|
|
29
|
+
* signature now.
|
|
30
|
+
* @param registry Effective discipline registry from Slice 2's
|
|
31
|
+
* `buildEffectiveDisciplineRegistry()`, or `CORE_DISCIPLINE_REGISTRY` in
|
|
32
|
+
* core-only mode.
|
|
33
|
+
*/
|
|
34
|
+
export declare function validateDiscipline(entries: readonly Entry[], entriesByDisplayId: ReadonlyMap<DisplayId, Entry>, registry: DisciplineRegistry): Diagnostic[];
|
|
35
|
+
//# sourceMappingURL=discipline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discipline.d.ts","sourceRoot":"","sources":["../../src/validator/discipline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,KAAK,EACN,MAAM,iBAAiB,CAAC;AAmFzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,kBAAkB,EAAE,WAAW,CAAC,SAAS,EAAE,KAAK,CAAC,EACjD,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAuHd"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/validator/discipline
|
|
3
|
+
*
|
|
4
|
+
* Discipline-attribute validator per ADR-017 Slice 3. Emits seven codes:
|
|
5
|
+
*
|
|
6
|
+
* - MSL-T025 — `Discipline:` value not in the effective kind set (error)
|
|
7
|
+
* - MSL-T026 — `Discipline-frozen:` value malformed (error)
|
|
8
|
+
* - MSL-T027 — `Discipline-frozen:` kind not in the effective set (error)
|
|
9
|
+
* - MSL-T028 — `Discipline:` conflicts with channel-3 derivation (warning)
|
|
10
|
+
* - MSL-T029 — `Discipline:` conflicts with channel-4 derivation (warning)
|
|
11
|
+
* - MSL-T030 — `Discipline-frozen:` differs from current derivation (warning)
|
|
12
|
+
* - MSL-T031 — `Discipline:` and `Discipline-frozen:` disagree (warning)
|
|
13
|
+
*
|
|
14
|
+
* The effective kind set used by T025/T027 is `CORE_KINDS` plus any kinds
|
|
15
|
+
* the active profile chain declared via `profile.kinds:` (Slice 2's
|
|
16
|
+
* effective registry).
|
|
17
|
+
*
|
|
18
|
+
* Tasks 5–8 of the plan add T026–T031 incrementally on top of this skeleton.
|
|
19
|
+
*/
|
|
20
|
+
import { CORE_KINDS, makeDisplayId, MIXED_DISCIPLINE } from "../model/mod.js";
|
|
21
|
+
import { classifyDerivationOnly, parseFrozenValue, } from "../compiler/discipline_classifier.js";
|
|
22
|
+
/**
|
|
23
|
+
* Read the first non-empty value of a single-cardinality attribute. Mirrors
|
|
24
|
+
* the helper in the classifier so the validator doesn't need to import it.
|
|
25
|
+
*/
|
|
26
|
+
function singleAttrValue(entry, key) {
|
|
27
|
+
for (const attr of entry.rawAttributes) {
|
|
28
|
+
if (attr.key === key) {
|
|
29
|
+
const trimmed = attr.value.trim();
|
|
30
|
+
if (trimmed.length > 0)
|
|
31
|
+
return trimmed;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the effective kind set from `CORE_KINDS` plus every type → kind
|
|
38
|
+
* value the registry contains.
|
|
39
|
+
*/
|
|
40
|
+
function effectiveKindSet(registry) {
|
|
41
|
+
const set = new Set(CORE_KINDS);
|
|
42
|
+
for (const kind of registry.values())
|
|
43
|
+
set.add(kind);
|
|
44
|
+
return set;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Compute channel-3 alone for an entry — what the type-based registry
|
|
48
|
+
* lookup would yield. Returns `undefined` when no type or unknown type.
|
|
49
|
+
*/
|
|
50
|
+
function channel3Kind(entry, registry) {
|
|
51
|
+
if (entry.type === undefined) {
|
|
52
|
+
// Fallback: look at the raw Type: attribute (mirrors resolvedType()
|
|
53
|
+
// in the classifier so the validator works in core-only mode).
|
|
54
|
+
for (const attr of entry.rawAttributes) {
|
|
55
|
+
if (attr.key === "Type") {
|
|
56
|
+
const trimmed = attr.value.trim();
|
|
57
|
+
if (trimmed.length > 0)
|
|
58
|
+
return registry.get(trimmed);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
return registry.get(entry.type);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Compute channel-4 alone for an entry — walk Allocated-to targets,
|
|
67
|
+
* return the unique discipline if one, MIXED_DISCIPLINE if many,
|
|
68
|
+
* `undefined` if none.
|
|
69
|
+
*/
|
|
70
|
+
function channel4Kind(entry, entriesByDisplayId, registry) {
|
|
71
|
+
const seen = new Set();
|
|
72
|
+
for (const attr of entry.rawAttributes) {
|
|
73
|
+
if (attr.key !== "Allocated-to")
|
|
74
|
+
continue;
|
|
75
|
+
for (const raw of attr.value.split(",")) {
|
|
76
|
+
const token = raw.trim();
|
|
77
|
+
if (token.length === 0)
|
|
78
|
+
continue;
|
|
79
|
+
const target = entriesByDisplayId.get(makeDisplayId(token));
|
|
80
|
+
if (!target)
|
|
81
|
+
continue;
|
|
82
|
+
const targetType = target.type ??
|
|
83
|
+
target.rawAttributes.find((a) => a.key === "Type")?.value.trim();
|
|
84
|
+
if (!targetType)
|
|
85
|
+
continue;
|
|
86
|
+
const kind = registry.get(targetType);
|
|
87
|
+
if (kind !== undefined)
|
|
88
|
+
seen.add(kind);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (seen.size === 0)
|
|
92
|
+
return undefined;
|
|
93
|
+
if (seen.size === 1)
|
|
94
|
+
return [...seen][0];
|
|
95
|
+
return MIXED_DISCIPLINE;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Validate the `Discipline:` and `Discipline-frozen:` attributes across
|
|
99
|
+
* every entry. Pure function: takes the entries, a lookup map (used by
|
|
100
|
+
* later tasks for channel-4 derivation), and the effective registry.
|
|
101
|
+
*
|
|
102
|
+
* @param entries Entries to walk.
|
|
103
|
+
* @param entriesByDisplayId Lookup map for channel-4 derivation. Tasks 5–8
|
|
104
|
+
* will use this; Task 4 ignores it but keeps the parameter to fix the
|
|
105
|
+
* signature now.
|
|
106
|
+
* @param registry Effective discipline registry from Slice 2's
|
|
107
|
+
* `buildEffectiveDisciplineRegistry()`, or `CORE_DISCIPLINE_REGISTRY` in
|
|
108
|
+
* core-only mode.
|
|
109
|
+
*/
|
|
110
|
+
export function validateDiscipline(entries, entriesByDisplayId, registry) {
|
|
111
|
+
const out = [];
|
|
112
|
+
const knownKinds = effectiveKindSet(registry);
|
|
113
|
+
for (const entry of entries) {
|
|
114
|
+
const override = singleAttrValue(entry, "Discipline");
|
|
115
|
+
if (override !== undefined && !knownKinds.has(override)) {
|
|
116
|
+
out.push({
|
|
117
|
+
code: "MSL-T025",
|
|
118
|
+
severity: "error",
|
|
119
|
+
message: `${entry.displayId}: Discipline: '${override}' is not a known kind (declare it under profile.kinds: or use a core kind: ${[...CORE_KINDS].join(" / ")})`,
|
|
120
|
+
location: entry.location,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const frozen = singleAttrValue(entry, "Discipline-frozen");
|
|
124
|
+
if (frozen !== undefined) {
|
|
125
|
+
const parsed = parseFrozenValue(frozen);
|
|
126
|
+
if (parsed === undefined) {
|
|
127
|
+
out.push({
|
|
128
|
+
code: "MSL-T026",
|
|
129
|
+
severity: "error",
|
|
130
|
+
message: `${entry.displayId}: Discipline-frozen: '${frozen}' is malformed (expected '<kind>' or '<kind> @ YYYY-MM-DD'; kind must match /^[a-z][a-z0-9-]*$/; date must be calendar-valid)`,
|
|
131
|
+
location: entry.location,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
else if (!knownKinds.has(parsed.kind)) {
|
|
135
|
+
out.push({
|
|
136
|
+
code: "MSL-T027",
|
|
137
|
+
severity: "error",
|
|
138
|
+
message: `${entry.displayId}: Discipline-frozen: kind '${parsed.kind}' is not a known kind (declare it under profile.kinds: or use a core kind: ${[...CORE_KINDS].join(" / ")})`,
|
|
139
|
+
location: entry.location,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// T028 / T029: override vs channel-3 / channel-4 conflicts. Only run
|
|
144
|
+
// when the override is well-formed (suppressed by T025) and a channel
|
|
145
|
+
// actually produced a kind (default-system suppression).
|
|
146
|
+
if (override !== undefined && knownKinds.has(override)) {
|
|
147
|
+
const c3 = channel3Kind(entry, registry);
|
|
148
|
+
if (c3 !== undefined && c3 !== override) {
|
|
149
|
+
out.push({
|
|
150
|
+
code: "MSL-T028",
|
|
151
|
+
severity: "warning",
|
|
152
|
+
message: `${entry.displayId}: Discipline: '${override}' conflicts with type-based derivation '${c3}' (from Type: ${entry.type ?? "(raw)"})`,
|
|
153
|
+
location: entry.location,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
const c4 = channel4Kind(entry, entriesByDisplayId, registry);
|
|
157
|
+
if (c4 !== undefined && c4 !== override) {
|
|
158
|
+
out.push({
|
|
159
|
+
code: "MSL-T029",
|
|
160
|
+
severity: "warning",
|
|
161
|
+
message: `${entry.displayId}: Discipline: '${override}' conflicts with allocation-based derivation '${c4}' (via Allocated-to)`,
|
|
162
|
+
location: entry.location,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// T030: freeze divergence. Runs whenever the freeze is well-formed
|
|
167
|
+
// and references a known kind — NOT suppressed by default-system
|
|
168
|
+
// derivation (drift from a known kind to default-system is exactly
|
|
169
|
+
// what freeze is designed to surface).
|
|
170
|
+
if (frozen !== undefined) {
|
|
171
|
+
const parsedF = parseFrozenValue(frozen);
|
|
172
|
+
if (parsedF !== undefined && knownKinds.has(parsedF.kind)) {
|
|
173
|
+
const current = classifyDerivationOnly(entry, entriesByDisplayId, registry);
|
|
174
|
+
if (current !== parsedF.kind) {
|
|
175
|
+
out.push({
|
|
176
|
+
code: "MSL-T030",
|
|
177
|
+
severity: "warning",
|
|
178
|
+
message: `${entry.displayId}: Discipline-frozen: '${parsedF.kind}' differs from current derivation '${current}' (something changed since the freeze on ${parsedF.date ?? "(no date)"})`,
|
|
179
|
+
location: entry.location,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
// T031: override vs freeze disagreement. Both must be well-formed
|
|
185
|
+
// and reference known kinds — otherwise upstream errors (T025/T026/T027)
|
|
186
|
+
// handle the case.
|
|
187
|
+
if (override !== undefined &&
|
|
188
|
+
knownKinds.has(override) &&
|
|
189
|
+
frozen !== undefined) {
|
|
190
|
+
const parsedF = parseFrozenValue(frozen);
|
|
191
|
+
if (parsedF !== undefined && knownKinds.has(parsedF.kind)) {
|
|
192
|
+
if (override !== parsedF.kind) {
|
|
193
|
+
out.push({
|
|
194
|
+
code: "MSL-T031",
|
|
195
|
+
severity: "warning",
|
|
196
|
+
message: `${entry.displayId}: Discipline: '${override}' disagrees with Discipline-frozen: '${parsedF.kind}' (the override wins for derivedDiscipline; remove or update the freeze if the override is intentional)`,
|
|
197
|
+
location: entry.location,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return out;
|
|
204
|
+
}
|
package/esm/validator/mod.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export interface ValidateResult {
|
|
|
30
30
|
export declare function validate(entries: readonly Entry[]): ValidateResult;
|
|
31
31
|
export declare function indexByDisplayId(entries: readonly Entry[]): ReadonlyMap<string, Entry>;
|
|
32
32
|
export declare function findAttr(attrs: readonly Attribute[], key: string): Attribute | undefined;
|
|
33
|
-
export { runPipeline } from "./pipeline.js";
|
|
33
|
+
export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
|
|
34
34
|
export type { PipelineResult } from "./pipeline.js";
|
|
35
35
|
export { validateListingDocuments } from "./listing.js";
|
|
36
36
|
export type { ListingFileContext, ListingKind } from "./listing.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/validator/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAqCpE,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,GAAG,cAAc,CAclE;AA2aD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAM5B;AAGD,wBAAgB,QAAQ,CACtB,KAAK,EAAE,SAAS,SAAS,EAAE,EAC3B,GAAG,EAAE,MAAM,GACV,SAAS,GAAG,SAAS,CAEvB;AAED,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACtE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AACxD,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,mBAAmB,CAAC"}
|
package/esm/validator/mod.js
CHANGED
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
* constraints, enum vocabularies) are profile-declared and evaluated by
|
|
14
14
|
* a profile-aware validator layer (not in the core).
|
|
15
15
|
*/
|
|
16
|
-
import { attributeSpec, CORE_TYPE_SCOPED_ATTRS, IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
|
|
16
|
+
import { attributeSpec, CORE_TYPE_SCOPED_ATTRS, CSV_SPLITTABLE_TYPES, IDENTITY_KEY, ULID_RE, UNIVERSAL_ATTRIBUTE_KEYS, URI_SCHEME_RE, } from "../model/mod.js";
|
|
17
17
|
import { HTTP_URL_RE } from "./value_types.js";
|
|
18
|
+
import { validateTypl } from "../typl/mod.js";
|
|
18
19
|
/** Universal attribute keys the core recognizes. */
|
|
19
20
|
const UNIVERSAL_KEYS = new Set(UNIVERSAL_ATTRIBUTE_KEYS);
|
|
20
21
|
/**
|
|
@@ -46,6 +47,11 @@ export function validate(entries) {
|
|
|
46
47
|
const diagnostics = [];
|
|
47
48
|
checkStructural(entries, diagnostics);
|
|
48
49
|
checkReferences(entries, diagnostics);
|
|
50
|
+
// Typl cross-entry collisions (TYPL-002/003) and undefined-typedef-refs
|
|
51
|
+
// (TYPL-005). Per-block diagnostics (TYPL-001/004/006/007/008) already
|
|
52
|
+
// fired during parse via the bridge.
|
|
53
|
+
const typlResult = validateTypl(entries);
|
|
54
|
+
diagnostics.push(...typlResult.diagnostics);
|
|
49
55
|
const valid = !diagnostics.some((d) => d.severity === "error");
|
|
50
56
|
return { diagnostics, valid };
|
|
51
57
|
}
|
|
@@ -362,6 +368,21 @@ function checkStructural(entries, diagnostics) {
|
|
|
362
368
|
location: entry.location,
|
|
363
369
|
});
|
|
364
370
|
}
|
|
371
|
+
// MSL-A006: empty element in CSV attribute value (e.g. "A,,B").
|
|
372
|
+
const csvSpec = attributeSpec(attr.key);
|
|
373
|
+
if (csvSpec && CSV_SPLITTABLE_TYPES.has(csvSpec.type) &&
|
|
374
|
+
attr.value.includes(",")) {
|
|
375
|
+
const parts = attr.value.split(",").map((s) => s.trim());
|
|
376
|
+
const emptyCount = parts.filter((s) => s.length === 0).length;
|
|
377
|
+
if (emptyCount > 0) {
|
|
378
|
+
diagnostics.push({
|
|
379
|
+
code: "MSL-A006",
|
|
380
|
+
severity: "warning",
|
|
381
|
+
message: `${entry.displayId}: attribute '${attr.key}' contains ${emptyCount} empty element(s) in CSV value "${attr.value}"`,
|
|
382
|
+
location: entry.location,
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
365
386
|
}
|
|
366
387
|
}
|
|
367
388
|
}
|
|
@@ -445,7 +466,7 @@ export function indexByDisplayId(entries) {
|
|
|
445
466
|
export function findAttr(attrs, key) {
|
|
446
467
|
return attrs.find((a) => a.key === key);
|
|
447
468
|
}
|
|
448
|
-
export { runPipeline } from "./pipeline.js";
|
|
469
|
+
export { runPipeline, suppressDeclaredAttrR010 } from "./pipeline.js";
|
|
449
470
|
export { validateListingDocuments } from "./listing.js";
|
|
450
471
|
export { classifyEntriesStage, classifyEntry } from "./types.js";
|
|
451
472
|
export { compileDisplayIdPattern } from "./pattern.js";
|
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
* @module core/validator/modal_keywords
|
|
3
3
|
*
|
|
4
4
|
* MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
|
|
5
|
-
* `SHOULD`, `MAY`, `MUST`,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* content.
|
|
5
|
+
* `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
|
|
6
|
+
* normalises these to lowercase per spec §3.4.1; this validator
|
|
7
|
+
* surfaces the deviation in a lint-only flow. Profiles may promote the
|
|
8
|
+
* severity.
|
|
9
|
+
*
|
|
10
|
+
* Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
|
|
11
|
+
* AND `case === "upper"`. Code, feature, and math blocks are
|
|
12
|
+
* automatically excluded because the parser's `extractBodyTokens` does
|
|
13
|
+
* not emit tokens inside verbatim regions.
|
|
15
14
|
*/
|
|
16
15
|
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
17
|
+
* MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
|
|
18
|
+
* prose. Emits one diagnostic per uppercase occurrence with the exact
|
|
19
|
+
* source text in the message.
|
|
20
|
+
*
|
|
21
|
+
* MSL-M061: report when a Requirement-type entry contains no modal
|
|
22
|
+
* keyword at all (info severity; style hint to add an obligation verb).
|
|
21
23
|
*/
|
|
22
24
|
export declare function validateModalKeywords(entry: Entry): readonly Diagnostic[];
|
|
23
25
|
//# sourceMappingURL=modal_keywords.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal_keywords.d.ts","sourceRoot":"","sources":["../../src/validator/modal_keywords.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"modal_keywords.d.ts","sourceRoot":"","sources":["../../src/validator/modal_keywords.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAa,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAKpE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,UAAU,EAAE,CAoCzE"}
|
|
@@ -2,121 +2,38 @@
|
|
|
2
2
|
* @module core/validator/modal_keywords
|
|
3
3
|
*
|
|
4
4
|
* MSL-M060 validator — uppercase RFC 2119 modal keyword (`SHALL`,
|
|
5
|
-
* `SHOULD`, `MAY`, `MUST`,
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* content.
|
|
5
|
+
* `SHOULD`, `MAY`, `MUST`, `WILL`) in entry-body prose. The formatter
|
|
6
|
+
* normalises these to lowercase per spec §3.4.1; this validator
|
|
7
|
+
* surfaces the deviation in a lint-only flow. Profiles may promote the
|
|
8
|
+
* severity.
|
|
9
|
+
*
|
|
10
|
+
* Reads `Entry.bodyTokens` (ADR-016) and filters for `kind === "modal"`
|
|
11
|
+
* AND `case === "upper"`. Code, feature, and math blocks are
|
|
12
|
+
* automatically excluded because the parser's `extractBodyTokens` does
|
|
13
|
+
* not emit tokens inside verbatim regions.
|
|
15
14
|
*/
|
|
16
15
|
import { resolvedCoreType } from "./type_resolution.js";
|
|
17
|
-
// ---------------------------------------------------------------------------
|
|
18
|
-
// Marker collection from bodyAst
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
/** Collect all modal markers from an InlineContent object. */
|
|
21
|
-
function modalsFromInline(content) {
|
|
22
|
-
return content.markers.filter((m) => m.kind === "modal");
|
|
23
|
-
}
|
|
24
|
-
/** Recursively collect modal markers from a list item's blocks. */
|
|
25
|
-
function modalsFromListItem(item) {
|
|
26
|
-
const out = [];
|
|
27
|
-
for (const block of item.blocks) {
|
|
28
|
-
out.push(...modalsFromBlock(block));
|
|
29
|
-
}
|
|
30
|
-
return out;
|
|
31
|
-
}
|
|
32
|
-
/** Collect all modal markers from a single BodyBlock (recursively). */
|
|
33
|
-
function modalsFromBlock(block) {
|
|
34
|
-
const out = [];
|
|
35
|
-
switch (block.kind) {
|
|
36
|
-
case "paragraph":
|
|
37
|
-
out.push(...modalsFromInline(block.content));
|
|
38
|
-
break;
|
|
39
|
-
case "list":
|
|
40
|
-
for (const item of block.items) {
|
|
41
|
-
out.push(...modalsFromListItem(item));
|
|
42
|
-
}
|
|
43
|
-
break;
|
|
44
|
-
case "table":
|
|
45
|
-
for (const cell of block.header) {
|
|
46
|
-
out.push(...modalsFromInline(cell));
|
|
47
|
-
}
|
|
48
|
-
for (const row of block.rows) {
|
|
49
|
-
for (const cell of row) {
|
|
50
|
-
out.push(...modalsFromInline(cell));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
case "note":
|
|
55
|
-
out.push(...modalsFromInline(block.content));
|
|
56
|
-
break;
|
|
57
|
-
case "blockquote":
|
|
58
|
-
out.push(...modalsFromInline(block.content));
|
|
59
|
-
break;
|
|
60
|
-
case "definition-list":
|
|
61
|
-
for (const item of block.items) {
|
|
62
|
-
out.push(...modalsFromInline(item.term));
|
|
63
|
-
out.push(...modalsFromInline(item.definition));
|
|
64
|
-
}
|
|
65
|
-
break;
|
|
66
|
-
case "code":
|
|
67
|
-
case "feature":
|
|
68
|
-
case "math":
|
|
69
|
-
case "figure":
|
|
70
|
-
case "caption":
|
|
71
|
-
case "unknown":
|
|
72
|
-
// Verbatim / structural nodes: no modal markers.
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
return out;
|
|
78
|
-
}
|
|
79
|
-
// ---------------------------------------------------------------------------
|
|
80
|
-
// Public API
|
|
81
|
-
// ---------------------------------------------------------------------------
|
|
82
16
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
17
|
+
* MSL-M060: report every uppercase RFC 2119 modal keyword in entry-body
|
|
18
|
+
* prose. Emits one diagnostic per uppercase occurrence with the exact
|
|
19
|
+
* source text in the message.
|
|
20
|
+
*
|
|
21
|
+
* MSL-M061: report when a Requirement-type entry contains no modal
|
|
22
|
+
* keyword at all (info severity; style hint to add an obligation verb).
|
|
86
23
|
*/
|
|
87
24
|
export function validateModalKeywords(entry) {
|
|
88
25
|
const diagnostics = [];
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
for (const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
continue;
|
|
101
|
-
const raw = marker.raw ?? marker.canonical;
|
|
102
|
-
if (raw === marker.canonical)
|
|
103
|
-
continue; // already lowercase — OK
|
|
104
|
-
diagnostics.push({
|
|
105
|
-
code: "MSL-M060",
|
|
106
|
-
severity: "warning",
|
|
107
|
-
message: `${entry.displayId}: modal keyword '${raw}' in body ` +
|
|
108
|
-
`prose is uppercase (spec §3.4.1 canonical form is lowercase; ` +
|
|
109
|
-
`'markspec format' will rewrite it)`,
|
|
110
|
-
location: {
|
|
111
|
-
file: entry.location.file,
|
|
112
|
-
// marker.range.start.line is body-relative 1-based.
|
|
113
|
-
// entry.location.line is the title line (0-based offset 0).
|
|
114
|
-
// Body line 1 → file line entry.location.line + 0, etc.
|
|
115
|
-
line: entry.location.line + (marker.range.start.line - 1),
|
|
116
|
-
column: marker.range.start.column,
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
}
|
|
26
|
+
const modalTokens = entry.bodyTokens.filter((t) => t.kind === "modal");
|
|
27
|
+
const anyModalSeen = modalTokens.length > 0;
|
|
28
|
+
for (const t of modalTokens) {
|
|
29
|
+
if (t.case !== "upper")
|
|
30
|
+
continue;
|
|
31
|
+
diagnostics.push({
|
|
32
|
+
code: "MSL-M060",
|
|
33
|
+
severity: "warning",
|
|
34
|
+
message: `modal keyword '${t.text}' should be lowercase`,
|
|
35
|
+
location: t.location,
|
|
36
|
+
});
|
|
120
37
|
}
|
|
121
38
|
// MSL-M061 — Requirement-type entry contains no modal keyword
|
|
122
39
|
// (info; style hint). Gated on the resolved core type being
|
|
@@ -4,20 +4,27 @@
|
|
|
4
4
|
* Display-ID pattern template → anchored RegExp.
|
|
5
5
|
*
|
|
6
6
|
* Grammar (per ADR-009 §5):
|
|
7
|
-
* pattern
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* pattern := segment+ (exactly one counter)
|
|
8
|
+
* segment := literal | counter | named
|
|
9
|
+
* counter := "{n}" | "{n:" PADDING "d}"
|
|
10
|
+
* named := "{" identifier "}" (e.g. {scope}, {feature})
|
|
11
|
+
* PADDING := "0" digits
|
|
12
|
+
*
|
|
13
|
+
* The counter `{n}` is the numeric running index (exactly one required). A
|
|
14
|
+
* named placeholder such as `{scope}` matches a free alphanumeric segment —
|
|
15
|
+
* it validates the *shape* `PREFIX_<scope>_<NNNN>` without pinning the scope
|
|
16
|
+
* to a fixed value, so one profile pattern serves every feature scope.
|
|
10
17
|
*
|
|
11
18
|
* Examples:
|
|
12
|
-
* REQ-{n}
|
|
13
|
-
* REQ-{n:04d}
|
|
14
|
-
*
|
|
19
|
+
* REQ-{n} → ^REQ-(\d+)$
|
|
20
|
+
* REQ-{n:04d} → ^REQ-(\d{4})$
|
|
21
|
+
* XREQ_{scope}_{n:04d} → ^XREQ_(?<scope>[A-Za-z0-9]+)_(\d{4})$
|
|
15
22
|
*/
|
|
16
23
|
/**
|
|
17
24
|
* Compile a display-ID pattern template into an anchored RegExp.
|
|
18
25
|
*
|
|
19
|
-
* Throws if the template is missing the `{n}`
|
|
20
|
-
* padding specifier.
|
|
26
|
+
* Throws if the template is missing the `{n}` counter, has more than one, or
|
|
27
|
+
* has an invalid padding specifier.
|
|
21
28
|
*/
|
|
22
29
|
export declare function compileDisplayIdPattern(template: string): RegExp;
|
|
23
30
|
//# sourceMappingURL=pattern.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pattern.d.ts","sourceRoot":"","sources":["../../src/validator/pattern.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuChE"}
|