@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
|
@@ -5,41 +5,64 @@
|
|
|
5
5
|
* Display-ID pattern template → anchored RegExp.
|
|
6
6
|
*
|
|
7
7
|
* Grammar (per ADR-009 §5):
|
|
8
|
-
* pattern
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* pattern := segment+ (exactly one counter)
|
|
9
|
+
* segment := literal | counter | named
|
|
10
|
+
* counter := "{n}" | "{n:" PADDING "d}"
|
|
11
|
+
* named := "{" identifier "}" (e.g. {scope}, {feature})
|
|
12
|
+
* PADDING := "0" digits
|
|
13
|
+
*
|
|
14
|
+
* The counter `{n}` is the numeric running index (exactly one required). A
|
|
15
|
+
* named placeholder such as `{scope}` matches a free alphanumeric segment —
|
|
16
|
+
* it validates the *shape* `PREFIX_<scope>_<NNNN>` without pinning the scope
|
|
17
|
+
* to a fixed value, so one profile pattern serves every feature scope.
|
|
11
18
|
*
|
|
12
19
|
* Examples:
|
|
13
|
-
* REQ-{n}
|
|
14
|
-
* REQ-{n:04d}
|
|
15
|
-
*
|
|
20
|
+
* REQ-{n} → ^REQ-(\d+)$
|
|
21
|
+
* REQ-{n:04d} → ^REQ-(\d{4})$
|
|
22
|
+
* XREQ_{scope}_{n:04d} → ^XREQ_(?<scope>[A-Za-z0-9]+)_(\d{4})$
|
|
16
23
|
*/
|
|
17
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
25
|
exports.compileDisplayIdPattern = compileDisplayIdPattern;
|
|
19
|
-
|
|
26
|
+
// One token: the {n} counter (optionally padded) OR a {named} segment.
|
|
27
|
+
const TOKEN_RE = /\{n(?::(0\d+)d)?\}|\{([A-Za-z][A-Za-z0-9_]*)\}/g;
|
|
20
28
|
/**
|
|
21
29
|
* Compile a display-ID pattern template into an anchored RegExp.
|
|
22
30
|
*
|
|
23
|
-
* Throws if the template is missing the `{n}`
|
|
24
|
-
* padding specifier.
|
|
31
|
+
* Throws if the template is missing the `{n}` counter, has more than one, or
|
|
32
|
+
* has an invalid padding specifier.
|
|
25
33
|
*/
|
|
26
34
|
function compileDisplayIdPattern(template) {
|
|
27
|
-
|
|
28
|
-
|
|
35
|
+
let regexSource = "^";
|
|
36
|
+
let lastIndex = 0;
|
|
37
|
+
let counters = 0;
|
|
38
|
+
const re = new RegExp(TOKEN_RE);
|
|
39
|
+
let match;
|
|
40
|
+
while ((match = re.exec(template)) !== null) {
|
|
41
|
+
regexSource += escapeRegex(template.slice(lastIndex, match.index));
|
|
42
|
+
const named = match[2];
|
|
43
|
+
if (named === undefined) {
|
|
44
|
+
// {n} / {n:0Nd} counter
|
|
45
|
+
const padding = match[1];
|
|
46
|
+
regexSource += "(" + (padding ? `\\d{${Number(padding)}}` : `\\d+`) + ")";
|
|
47
|
+
counters++;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// {scope}-style named segment → free alphanumeric capture
|
|
51
|
+
regexSource += `(?<${named}>[A-Za-z0-9]+)`;
|
|
52
|
+
}
|
|
53
|
+
lastIndex = match.index + match[0].length;
|
|
54
|
+
}
|
|
55
|
+
regexSource += escapeRegex(template.slice(lastIndex)) + "$";
|
|
56
|
+
if (counters === 0) {
|
|
29
57
|
if (/\{n:[^}]*\}/.test(template)) {
|
|
30
58
|
throw new Error(`display-id-pattern '${template}': invalid padding specifier ` +
|
|
31
59
|
`(expected {n} or {n:NNd})`);
|
|
32
60
|
}
|
|
33
61
|
throw new Error(`display-id-pattern '${template}': missing {n} placeholder`);
|
|
34
62
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const prefix = template.slice(0, placeholderStart);
|
|
39
|
-
const suffix = template.slice(placeholderEnd);
|
|
40
|
-
const digitGroup = padding ? `\\d{${Number(padding)}}` : `\\d+`;
|
|
41
|
-
const regexSource = "^" + escapeRegex(prefix) + "(" + digitGroup + ")" +
|
|
42
|
-
escapeRegex(suffix) + "$";
|
|
63
|
+
if (counters > 1) {
|
|
64
|
+
throw new Error(`display-id-pattern '${template}': multiple {n} counters (expected one)`);
|
|
65
|
+
}
|
|
43
66
|
return new RegExp(regexSource);
|
|
44
67
|
}
|
|
45
68
|
function escapeRegex(s) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* to the existing MSL-R010 unknown-attribute warning in
|
|
11
11
|
* `validator/mod.ts`.
|
|
12
12
|
*/
|
|
13
|
-
import type { Diagnostic, Entry } from "../model/mod.js";
|
|
13
|
+
import type { Diagnostic, EffectiveProfile, Entry } from "../model/mod.js";
|
|
14
14
|
/**
|
|
15
15
|
* Emit per-type attribute diagnostics:
|
|
16
16
|
*
|
|
@@ -25,5 +25,5 @@ import type { Diagnostic, Entry } from "../model/mod.js";
|
|
|
25
25
|
* on a `jira:`-scheme reference). Universal and entirely unknown
|
|
26
26
|
* attributes are exempt — those go through MSL-R010.
|
|
27
27
|
*/
|
|
28
|
-
export declare function validatePerTypeAttributes(entry: Entry): readonly Diagnostic[];
|
|
28
|
+
export declare function validatePerTypeAttributes(entry: Entry, profile?: EffectiveProfile): readonly Diagnostic[];
|
|
29
29
|
//# sourceMappingURL=per_type_attrs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"per_type_attrs.d.ts","sourceRoot":"","sources":["../../src/validator/per_type_attrs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"per_type_attrs.d.ts","sourceRoot":"","sources":["../../src/validator/per_type_attrs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAmB3E;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,SAAS,UAAU,EAAE,CAsCvB"}
|
|
@@ -37,8 +37,8 @@ const UNIVERSAL_KEYS = new Set(mod_js_1.UNIVERSAL_ATTRIBUTE_KEYS);
|
|
|
37
37
|
* on a `jira:`-scheme reference). Universal and entirely unknown
|
|
38
38
|
* attributes are exempt — those go through MSL-R010.
|
|
39
39
|
*/
|
|
40
|
-
function validatePerTypeAttributes(entry) {
|
|
41
|
-
const type = (0, type_resolution_js_1.resolvedCoreType)(entry);
|
|
40
|
+
function validatePerTypeAttributes(entry, profile) {
|
|
41
|
+
const type = (0, type_resolution_js_1.resolvedCoreType)(entry, profile);
|
|
42
42
|
if (type === undefined) {
|
|
43
43
|
const diagnostics = [];
|
|
44
44
|
for (const attr of entry.rawAttributes) {
|
|
@@ -32,4 +32,15 @@ export interface PipelineResult {
|
|
|
32
32
|
* conventions (rule inactive).
|
|
33
33
|
*/
|
|
34
34
|
export declare function runPipeline(entries: readonly Entry[], profile: EffectiveProfile | null, captionConventions?: CaptionConventions): PipelineResult;
|
|
35
|
+
/**
|
|
36
|
+
* Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
|
|
37
|
+
* the loaded profile declares — Stage 3 validates those directly, so the
|
|
38
|
+
* core-only check would be noise. Returns `diagnostics` unchanged when no
|
|
39
|
+
* profile is loaded.
|
|
40
|
+
*
|
|
41
|
+
* Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
|
|
42
|
+
* pass) suppress the same false positives the full {@linkcode runPipeline}
|
|
43
|
+
* does, keeping LSP/MCP diagnostics consistent with the `validate` command.
|
|
44
|
+
*/
|
|
45
|
+
export declare function suppressDeclaredAttrR010(diagnostics: readonly Diagnostic[], entries: readonly Entry[], profile: EffectiveProfile | null): readonly Diagnostic[];
|
|
35
46
|
//# sourceMappingURL=pipeline.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/validator/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,KAAK,EACN,MAAM,iBAAiB,CAAC;AAsBzB,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,QAAQ,CAAC,OAAO,EAAE,SAAS,KAAK,EAAE,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,8DAA8D;IAC9D,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,EAChC,kBAAkB,GAAE,kBAAuB,GAC1C,cAAc,CA6FhB;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,SAAS,UAAU,EAAE,EAClC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,gBAAgB,GAAG,IAAI,GAC/B,SAAS,UAAU,EAAE,CASvB"}
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.runPipeline = runPipeline;
|
|
13
|
-
|
|
13
|
+
exports.suppressDeclaredAttrR010 = suppressDeclaredAttrR010;
|
|
14
|
+
const mod_js_1 = require("../model/mod.js");
|
|
15
|
+
const mod_js_2 = require("./mod.js");
|
|
14
16
|
const types_js_1 = require("./types.js");
|
|
15
17
|
const body_blocks_js_1 = require("./body_blocks.js");
|
|
16
18
|
const captions_js_1 = require("./captions.js");
|
|
@@ -22,6 +24,8 @@ const normalize_js_1 = require("./normalize.js");
|
|
|
22
24
|
const traceability_js_1 = require("./traceability.js");
|
|
23
25
|
const feature_ac_js_1 = require("./feature_ac.js");
|
|
24
26
|
const caption_convention_js_1 = require("./caption_convention.js");
|
|
27
|
+
const discipline_js_1 = require("./discipline.js");
|
|
28
|
+
const discipline_registry_js_1 = require("../profile/discipline_registry.js");
|
|
25
29
|
/**
|
|
26
30
|
* Run the validator pipeline.
|
|
27
31
|
*
|
|
@@ -42,21 +46,8 @@ function runPipeline(entries, profile, captionConventions = {}) {
|
|
|
42
46
|
// Stage 1 — core hygiene. When a profile is loaded, suppress MSL-R010
|
|
43
47
|
// warnings for attributes the profile actually declares (Stage 3's scope
|
|
44
48
|
// validates them directly — the core-only R010 check would be noise).
|
|
45
|
-
const stage1 = (0,
|
|
46
|
-
|
|
47
|
-
? collectAllProfileAttributes(entries, profile)
|
|
48
|
-
: null;
|
|
49
|
-
const filteredStage1 = profileDeclaredAttrs === null
|
|
50
|
-
? stage1.diagnostics
|
|
51
|
-
: stage1.diagnostics.filter((d) => {
|
|
52
|
-
if (d.code !== "MSL-R010")
|
|
53
|
-
return true;
|
|
54
|
-
const match = /attribute '([^']+)'/.exec(d.message);
|
|
55
|
-
if (!match)
|
|
56
|
-
return true;
|
|
57
|
-
return !profileDeclaredAttrs.has(match[1]);
|
|
58
|
-
});
|
|
59
|
-
diagnostics.push(...filteredStage1);
|
|
49
|
+
const stage1 = (0, mod_js_2.validate)(entries);
|
|
50
|
+
diagnostics.push(...suppressDeclaredAttrR010(stage1.diagnostics, entries, profile));
|
|
60
51
|
// Stage 1.5 — core type-attribute check. Runs always (core-only mode
|
|
61
52
|
// included) so unknown `Type:` values fail fast regardless of profile.
|
|
62
53
|
// Also covers late-stage display-ID-shape inference (step 8 → MSL-T021)
|
|
@@ -68,13 +59,22 @@ function runPipeline(entries, profile, captionConventions = {}) {
|
|
|
68
59
|
diagnostics.push(...(0, caption_convention_js_1.validateCaptionConvention)(entry, captionConventions));
|
|
69
60
|
diagnostics.push(...(0, body_blocks_js_1.validateBodyBlocks)(entry));
|
|
70
61
|
diagnostics.push(...(0, feature_ac_js_1.validateFeatureAc)(entry));
|
|
71
|
-
diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry));
|
|
62
|
+
diagnostics.push(...(0, per_type_attrs_js_1.validatePerTypeAttributes)(entry, profile ?? undefined));
|
|
72
63
|
diagnostics.push(...(0, modal_keywords_js_1.validateModalKeywords)(entry));
|
|
73
64
|
}
|
|
74
65
|
// Stage 1.6 — cross-file trace target-type compatibility (MSL-R083).
|
|
75
66
|
// Runs project-wide because targets may live in any entry; needs the
|
|
76
67
|
// whole batch indexed.
|
|
77
68
|
diagnostics.push(...(0, trace_types_js_1.validateTraceTargetTypes)(entries));
|
|
69
|
+
// Stage 1.7 — discipline attribute validation (ADR-017 Slice 3).
|
|
70
|
+
// Runs in both core-only and profile modes. In core-only mode the
|
|
71
|
+
// registry is CORE_DISCIPLINE_REGISTRY (kinds: system/software/hardware
|
|
72
|
+
// only) so T025/T027 only accept core kinds.
|
|
73
|
+
const disciplineRegistry = profile !== null
|
|
74
|
+
? (0, discipline_registry_js_1.buildEffectiveDisciplineRegistry)(profile)
|
|
75
|
+
: mod_js_1.CORE_DISCIPLINE_REGISTRY;
|
|
76
|
+
const entriesByDisplayId = new Map(entries.map((e) => [(0, mod_js_1.makeDisplayId)(e.displayId), e]));
|
|
77
|
+
diagnostics.push(...(0, discipline_js_1.validateDiscipline)(entries, entriesByDisplayId, disciplineRegistry));
|
|
78
78
|
// Stage 2 — classification (only when a profile is loaded).
|
|
79
79
|
let finalEntries = entries;
|
|
80
80
|
if (profile !== null) {
|
|
@@ -120,6 +120,29 @@ function runPipeline(entries, profile, captionConventions = {}) {
|
|
|
120
120
|
const valid = !diagnostics.some((d) => d.severity === "error");
|
|
121
121
|
return { entries: finalEntries, diagnostics, valid };
|
|
122
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Drop core Stage 1 `MSL-R010` ("unknown attribute") warnings for attributes
|
|
125
|
+
* the loaded profile declares — Stage 3 validates those directly, so the
|
|
126
|
+
* core-only check would be noise. Returns `diagnostics` unchanged when no
|
|
127
|
+
* profile is loaded.
|
|
128
|
+
*
|
|
129
|
+
* Exported so callers that run only Stage 1 (e.g. the compiler's diagnostic
|
|
130
|
+
* pass) suppress the same false positives the full {@linkcode runPipeline}
|
|
131
|
+
* does, keeping LSP/MCP diagnostics consistent with the `validate` command.
|
|
132
|
+
*/
|
|
133
|
+
function suppressDeclaredAttrR010(diagnostics, entries, profile) {
|
|
134
|
+
if (profile === null)
|
|
135
|
+
return diagnostics;
|
|
136
|
+
const declared = collectAllProfileAttributes(entries, profile);
|
|
137
|
+
return diagnostics.filter((d) => {
|
|
138
|
+
if (d.code !== "MSL-R010")
|
|
139
|
+
return true;
|
|
140
|
+
const match = /attribute '([^']+)'/.exec(d.message);
|
|
141
|
+
if (!match)
|
|
142
|
+
return true;
|
|
143
|
+
return !declared.has(match[1]);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
123
146
|
/**
|
|
124
147
|
* Union of all attribute names declared by the profile's effective scope
|
|
125
148
|
* across all entries. Used to suppress core Stage 1 MSL-R010 warnings for
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* (display-ID shape) has its own warning-emitting stage in
|
|
20
20
|
* `validator/types.ts` (`inferTypeFromDisplayIdShape`).
|
|
21
21
|
*/
|
|
22
|
-
import type { Entry } from "../model/mod.js";
|
|
22
|
+
import type { EffectiveProfile, Entry } from "../model/mod.js";
|
|
23
23
|
/**
|
|
24
24
|
* Infer a core type from an Authored entry's display-ID prefix.
|
|
25
25
|
* Returns the type when the display ID starts with one of the
|
|
@@ -53,7 +53,7 @@ export interface ResolvedTypeWithProvenance {
|
|
|
53
53
|
* consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
|
|
54
54
|
* or treat the entry as unclassified (fallback to `Item`).
|
|
55
55
|
*/
|
|
56
|
-
export declare function resolvedCoreTypeWithProvenance(entry: Entry): ResolvedTypeWithProvenance | undefined;
|
|
56
|
+
export declare function resolvedCoreTypeWithProvenance(entry: Entry, profile?: EffectiveProfile): ResolvedTypeWithProvenance | undefined;
|
|
57
57
|
/**
|
|
58
58
|
* Resolve an entry's effective core type without provenance. Convenience
|
|
59
59
|
* wrapper around {@linkcode resolvedCoreTypeWithProvenance} for callers
|
|
@@ -63,5 +63,5 @@ export declare function resolvedCoreTypeWithProvenance(entry: Entry): ResolvedTy
|
|
|
63
63
|
* type. The caller decides whether to skip validation, fall back to a
|
|
64
64
|
* less specific check, or report on the unclassified state.
|
|
65
65
|
*/
|
|
66
|
-
export declare function resolvedCoreType(entry: Entry): string | undefined;
|
|
66
|
+
export declare function resolvedCoreType(entry: Entry, profile?: EffectiveProfile): string | undefined;
|
|
67
67
|
//# sourceMappingURL=type_resolution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"type_resolution.d.ts","sourceRoot":"","sources":["../../src/validator/type_resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAuB/D;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAWpB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAO7D;AAYD;mEACmE;AACnE,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAEvD,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;CACnC;AAkBD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,0BAA0B,GAAG,SAAS,CA4CxC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,KAAK,EACZ,OAAO,CAAC,EAAE,gBAAgB,GACzB,MAAM,GAAG,SAAS,CAEpB"}
|
|
@@ -85,6 +85,19 @@ function sourceValue(entry) {
|
|
|
85
85
|
}
|
|
86
86
|
return undefined;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* Map a profile-declared type name to the core type it `extends`. In the
|
|
90
|
+
* effective (merged) profile every type's `extends` is frozen to a core type
|
|
91
|
+
* (spec §1.3.1 step 2 / profile schema), so a single lookup — no chain walk —
|
|
92
|
+
* yields the core parent. Returns `undefined` when no profile is supplied, the
|
|
93
|
+
* name is not a profile type, or its `extends` is not a known core type.
|
|
94
|
+
*/
|
|
95
|
+
function profileTypeToCore(typeName, profile) {
|
|
96
|
+
if (!profile)
|
|
97
|
+
return undefined;
|
|
98
|
+
const core = profile.types.get(typeName)?.value.extends;
|
|
99
|
+
return core && mod_js_1.CORE_TYPE_HIERARCHY[core] ? core : undefined;
|
|
100
|
+
}
|
|
88
101
|
/**
|
|
89
102
|
* Resolve an entry's effective core type and report which step of the
|
|
90
103
|
* spec §1.3.1 chain matched. First match wins. Returns `undefined` when
|
|
@@ -92,15 +105,24 @@ function sourceValue(entry) {
|
|
|
92
105
|
* consult late-stage step-8 inference (`inferTypeFromDisplayIdShape`)
|
|
93
106
|
* or treat the entry as unclassified (fallback to `Item`).
|
|
94
107
|
*/
|
|
95
|
-
function resolvedCoreTypeWithProvenance(entry) {
|
|
96
|
-
// Step 1: explicit Type:
|
|
108
|
+
function resolvedCoreTypeWithProvenance(entry, profile) {
|
|
109
|
+
// Step 1: explicit Type: — a core type directly, or a profile type whose
|
|
110
|
+
// `extends:` resolves to a core type (frozen at declaration).
|
|
97
111
|
const explicit = explicitType(entry);
|
|
98
|
-
if (explicit
|
|
99
|
-
|
|
112
|
+
if (explicit) {
|
|
113
|
+
if (mod_js_1.CORE_TYPE_HIERARCHY[explicit])
|
|
114
|
+
return { type: explicit, step: 1 };
|
|
115
|
+
const core = profileTypeToCore(explicit, profile);
|
|
116
|
+
if (core)
|
|
117
|
+
return { type: core, step: 1 };
|
|
100
118
|
}
|
|
101
|
-
// Step 2: profile-classified entry.type
|
|
102
|
-
if (entry.type
|
|
103
|
-
|
|
119
|
+
// Step 2: profile-classified entry.type — same core/profile resolution.
|
|
120
|
+
if (entry.type) {
|
|
121
|
+
if (mod_js_1.CORE_TYPE_HIERARCHY[entry.type])
|
|
122
|
+
return { type: entry.type, step: 2 };
|
|
123
|
+
const core = profileTypeToCore(entry.type, profile);
|
|
124
|
+
if (core)
|
|
125
|
+
return { type: core, step: 2 };
|
|
104
126
|
}
|
|
105
127
|
// Step 3: Source: introspection
|
|
106
128
|
const source = sourceValue(entry);
|
|
@@ -141,6 +163,6 @@ function resolvedCoreTypeWithProvenance(entry) {
|
|
|
141
163
|
* type. The caller decides whether to skip validation, fall back to a
|
|
142
164
|
* less specific check, or report on the unclassified state.
|
|
143
165
|
*/
|
|
144
|
-
function resolvedCoreType(entry) {
|
|
145
|
-
return resolvedCoreTypeWithProvenance(entry)?.type;
|
|
166
|
+
function resolvedCoreType(entry, profile) {
|
|
167
|
+
return resolvedCoreTypeWithProvenance(entry, profile)?.type;
|
|
146
168
|
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module parser/entity_refs
|
|
3
|
-
*
|
|
4
|
-
* Inline `$Identifier` entity-reference extraction (spec §2.5.2).
|
|
5
|
-
* Scans entry body prose for `$Identifier` tokens and classifies each by
|
|
6
|
-
* its case convention (type / instance / constant). Code and feature fence
|
|
7
|
-
* boundaries are derived from the body AST to exclude verbatim content
|
|
8
|
-
* without re-implementing fence detection on the raw string. Math-fence
|
|
9
|
-
* handling retains the `$$`-toggle approach on the raw body string for
|
|
10
|
-
* inline math contexts the AST cannot distinguish.
|
|
11
|
-
*/
|
|
12
|
-
import type { EntityRef, EntityRefConvention, SourceLocation } from "../model/mod.js";
|
|
13
|
-
import type { BodyBlock } from "../ast/nodes.js";
|
|
14
|
-
/**
|
|
15
|
-
* Decide the case convention of an entity-reference identifier per spec
|
|
16
|
-
* §2.5.2:
|
|
17
|
-
*
|
|
18
|
-
* - `constant` — all-uppercase letters/digits/underscores, contains at
|
|
19
|
-
* least one underscore or digit, ends with `[A-Z0-9]`. Distinguishes
|
|
20
|
-
* `$DEBOUNCE_WINDOW` from a single-segment PascalCase like `$ASIL`.
|
|
21
|
-
* - `type` — starts with an uppercase letter (PascalCase / single
|
|
22
|
-
* uppercase segment).
|
|
23
|
-
* - `instance` — starts with a lowercase letter (camelCase).
|
|
24
|
-
*/
|
|
25
|
-
export declare function classifyConvention(ident: string): EntityRefConvention;
|
|
26
|
-
/**
|
|
27
|
-
* Extract `$Identifier` entity references from a body string.
|
|
28
|
-
*
|
|
29
|
-
* Skips fenced code blocks (between paired ` ``` ` or `~~~` markers) per
|
|
30
|
-
* spec §2.5.2 (markers are recognised in prose only, not in verbatim
|
|
31
|
-
* content). Code and Feature fence boundaries are derived from the body AST
|
|
32
|
-
* rather than regex-scanning the raw body string. Math content is skipped
|
|
33
|
-
* two ways: an inline `$$…$$` fence by discarding any `$ident` match
|
|
34
|
-
* preceded by another `$`; a multi-line display-math block (a line that is
|
|
35
|
-
* exactly `$$`, its interior lines, and the closing `$$`) by tracking the
|
|
36
|
-
* delimiter across lines — this retains the original `$$`-toggle approach
|
|
37
|
-
* because the markdown AST does not distinguish inline `$$` fences from
|
|
38
|
-
* plain text when no surrounding blank lines are present.
|
|
39
|
-
*
|
|
40
|
-
* The reported {@linkcode SourceLocation} uses 1-based line numbers
|
|
41
|
-
* relative to the body string; callers add the entry's body offset to
|
|
42
|
-
* obtain file-relative positions.
|
|
43
|
-
*
|
|
44
|
-
* @param body Entry body prose (post-`splitBodyAndAttributes`).
|
|
45
|
-
* @param baseLocation Source location of the body's first line, used as
|
|
46
|
-
* the `file` field on every emitted {@linkcode EntityRef} and as the
|
|
47
|
-
* starting line.
|
|
48
|
-
* @param blocks Optional pre-built body AST. When provided, the AST is used
|
|
49
|
-
* directly to identify code/feature block line ranges, avoiding a redundant
|
|
50
|
-
* `buildBodyAst` call. When omitted, the AST is built internally.
|
|
51
|
-
*/
|
|
52
|
-
export declare function extractEntityRefs(body: string, baseLocation: SourceLocation, blocks?: readonly BodyBlock[]): EntityRef[];
|
|
53
|
-
//# sourceMappingURL=entity_refs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity_refs.d.ts","sourceRoot":"","sources":["../../src/parser/entity_refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAMrE;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,cAAc,EAC5B,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,GAC5B,SAAS,EAAE,CAiDb"}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module parser/entity_refs
|
|
3
|
-
*
|
|
4
|
-
* Inline `$Identifier` entity-reference extraction (spec §2.5.2).
|
|
5
|
-
* Scans entry body prose for `$Identifier` tokens and classifies each by
|
|
6
|
-
* its case convention (type / instance / constant). Code and feature fence
|
|
7
|
-
* boundaries are derived from the body AST to exclude verbatim content
|
|
8
|
-
* without re-implementing fence detection on the raw string. Math-fence
|
|
9
|
-
* handling retains the `$$`-toggle approach on the raw body string for
|
|
10
|
-
* inline math contexts the AST cannot distinguish.
|
|
11
|
-
*/
|
|
12
|
-
import { buildBodyAst } from "../ast/build.js";
|
|
13
|
-
/**
|
|
14
|
-
* Lexical pattern for an inline entity reference. The leading `$` is the
|
|
15
|
-
* sigil; identifier characters follow. The pattern intentionally rejects
|
|
16
|
-
* the math-fence `$$…$$` form: a `$$` is consumed as two starts but the
|
|
17
|
-
* caller (see {@linkcode extractEntityRefs}) discards any match preceded
|
|
18
|
-
* by another `$`.
|
|
19
|
-
*/
|
|
20
|
-
const ENTITY_REF_RE = /\$([A-Za-z][A-Za-z0-9_]*)/g;
|
|
21
|
-
/**
|
|
22
|
-
* Decide the case convention of an entity-reference identifier per spec
|
|
23
|
-
* §2.5.2:
|
|
24
|
-
*
|
|
25
|
-
* - `constant` — all-uppercase letters/digits/underscores, contains at
|
|
26
|
-
* least one underscore or digit, ends with `[A-Z0-9]`. Distinguishes
|
|
27
|
-
* `$DEBOUNCE_WINDOW` from a single-segment PascalCase like `$ASIL`.
|
|
28
|
-
* - `type` — starts with an uppercase letter (PascalCase / single
|
|
29
|
-
* uppercase segment).
|
|
30
|
-
* - `instance` — starts with a lowercase letter (camelCase).
|
|
31
|
-
*/
|
|
32
|
-
export function classifyConvention(ident) {
|
|
33
|
-
if (/^[A-Z][A-Z0-9_]*[A-Z0-9]$/.test(ident) && /[_0-9]/.test(ident)) {
|
|
34
|
-
return "constant";
|
|
35
|
-
}
|
|
36
|
-
if (/^[A-Z]/.test(ident))
|
|
37
|
-
return "type";
|
|
38
|
-
return "instance";
|
|
39
|
-
}
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
// Code/feature-block line-range collection from bodyAst
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
/**
|
|
44
|
-
* Collect the set of 1-based body-relative line numbers that belong to
|
|
45
|
-
* code or feature fenced blocks. These lines are unconditionally excluded
|
|
46
|
-
* from entity-reference scanning.
|
|
47
|
-
*
|
|
48
|
-
* Math blocks (`MathNode`) are NOT included here — their interior lines
|
|
49
|
-
* are excluded via the `$$`-toggle logic in {@linkcode extractEntityRefs}
|
|
50
|
-
* (which handles both block-level and the inline `$$…$$` known-limitation
|
|
51
|
-
* case that the AST cannot distinguish).
|
|
52
|
-
*
|
|
53
|
-
* Recurses into list items via the list branch to find nested verbatim blocks.
|
|
54
|
-
*/
|
|
55
|
-
function collectCodeFeatureLines(blocks) {
|
|
56
|
-
const excluded = new Set();
|
|
57
|
-
for (const block of blocks) {
|
|
58
|
-
if (block.kind === "code" || block.kind === "feature") {
|
|
59
|
-
for (let ln = block.range.start.line; ln <= block.range.end.line; ln++) {
|
|
60
|
-
excluded.add(ln);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
else if (block.kind === "list") {
|
|
64
|
-
for (const item of block.items) {
|
|
65
|
-
for (const sub of item.blocks) {
|
|
66
|
-
for (const ln of collectCodeFeatureLines([sub])) {
|
|
67
|
-
excluded.add(ln);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return excluded;
|
|
74
|
-
}
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
// Public API
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
/**
|
|
79
|
-
* Extract `$Identifier` entity references from a body string.
|
|
80
|
-
*
|
|
81
|
-
* Skips fenced code blocks (between paired ` ``` ` or `~~~` markers) per
|
|
82
|
-
* spec §2.5.2 (markers are recognised in prose only, not in verbatim
|
|
83
|
-
* content). Code and Feature fence boundaries are derived from the body AST
|
|
84
|
-
* rather than regex-scanning the raw body string. Math content is skipped
|
|
85
|
-
* two ways: an inline `$$…$$` fence by discarding any `$ident` match
|
|
86
|
-
* preceded by another `$`; a multi-line display-math block (a line that is
|
|
87
|
-
* exactly `$$`, its interior lines, and the closing `$$`) by tracking the
|
|
88
|
-
* delimiter across lines — this retains the original `$$`-toggle approach
|
|
89
|
-
* because the markdown AST does not distinguish inline `$$` fences from
|
|
90
|
-
* plain text when no surrounding blank lines are present.
|
|
91
|
-
*
|
|
92
|
-
* The reported {@linkcode SourceLocation} uses 1-based line numbers
|
|
93
|
-
* relative to the body string; callers add the entry's body offset to
|
|
94
|
-
* obtain file-relative positions.
|
|
95
|
-
*
|
|
96
|
-
* @param body Entry body prose (post-`splitBodyAndAttributes`).
|
|
97
|
-
* @param baseLocation Source location of the body's first line, used as
|
|
98
|
-
* the `file` field on every emitted {@linkcode EntityRef} and as the
|
|
99
|
-
* starting line.
|
|
100
|
-
* @param blocks Optional pre-built body AST. When provided, the AST is used
|
|
101
|
-
* directly to identify code/feature block line ranges, avoiding a redundant
|
|
102
|
-
* `buildBodyAst` call. When omitted, the AST is built internally.
|
|
103
|
-
*/
|
|
104
|
-
export function extractEntityRefs(body, baseLocation, blocks) {
|
|
105
|
-
if (!body.trim())
|
|
106
|
-
return [];
|
|
107
|
-
// Use the caller-supplied body AST when available; otherwise build it
|
|
108
|
-
// internally to identify code/feature block line ranges.
|
|
109
|
-
const resolvedBlocks = blocks ?? buildBodyAst(body);
|
|
110
|
-
const codeFeatureLines = collectCodeFeatureLines(resolvedBlocks);
|
|
111
|
-
const refs = [];
|
|
112
|
-
// A line whose only content is `$$` opens (or closes) a display-math
|
|
113
|
-
// block; its interior lines are verbatim math, not prose. Inline
|
|
114
|
-
// `$$…$$` on a single line is *not* a fence (trimmed ≠ `$$`) and is
|
|
115
|
-
// still handled by the per-match "preceded by another $" guard below.
|
|
116
|
-
let inMathFence = false;
|
|
117
|
-
const lines = body.split("\n");
|
|
118
|
-
for (let lineIdx = 0; lineIdx < lines.length; lineIdx++) {
|
|
119
|
-
const line = lines[lineIdx];
|
|
120
|
-
// Body lines are 1-based; codeFeatureLines stores 1-based line numbers.
|
|
121
|
-
const bodyLine = lineIdx + 1;
|
|
122
|
-
if (codeFeatureLines.has(bodyLine))
|
|
123
|
-
continue;
|
|
124
|
-
if (line.trim() === "$$") {
|
|
125
|
-
inMathFence = !inMathFence;
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
if (inMathFence)
|
|
129
|
-
continue;
|
|
130
|
-
ENTITY_REF_RE.lastIndex = 0;
|
|
131
|
-
let match;
|
|
132
|
-
while ((match = ENTITY_REF_RE.exec(line)) !== null) {
|
|
133
|
-
// Discard the second half of a `$$…$$` math fence.
|
|
134
|
-
if (match.index > 0 && line[match.index - 1] === "$")
|
|
135
|
-
continue;
|
|
136
|
-
// Discard if the `$` is itself preceded by `\` (escaped).
|
|
137
|
-
if (match.index > 0 && line[match.index - 1] === "\\")
|
|
138
|
-
continue;
|
|
139
|
-
refs.push({
|
|
140
|
-
ident: match[0],
|
|
141
|
-
convention: classifyConvention(match[1]),
|
|
142
|
-
location: {
|
|
143
|
-
file: baseLocation.file,
|
|
144
|
-
line: baseLocation.line + lineIdx,
|
|
145
|
-
column: match.index + 1,
|
|
146
|
-
},
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return refs;
|
|
151
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module parser/entity_refs
|
|
3
|
-
*
|
|
4
|
-
* Inline `$Identifier` entity-reference extraction (spec §2.5.2).
|
|
5
|
-
* Scans entry body prose for `$Identifier` tokens and classifies each by
|
|
6
|
-
* its case convention (type / instance / constant). Code and feature fence
|
|
7
|
-
* boundaries are derived from the body AST to exclude verbatim content
|
|
8
|
-
* without re-implementing fence detection on the raw string. Math-fence
|
|
9
|
-
* handling retains the `$$`-toggle approach on the raw body string for
|
|
10
|
-
* inline math contexts the AST cannot distinguish.
|
|
11
|
-
*/
|
|
12
|
-
import type { EntityRef, EntityRefConvention, SourceLocation } from "../model/mod.js";
|
|
13
|
-
import type { BodyBlock } from "../ast/nodes.js";
|
|
14
|
-
/**
|
|
15
|
-
* Decide the case convention of an entity-reference identifier per spec
|
|
16
|
-
* §2.5.2:
|
|
17
|
-
*
|
|
18
|
-
* - `constant` — all-uppercase letters/digits/underscores, contains at
|
|
19
|
-
* least one underscore or digit, ends with `[A-Z0-9]`. Distinguishes
|
|
20
|
-
* `$DEBOUNCE_WINDOW` from a single-segment PascalCase like `$ASIL`.
|
|
21
|
-
* - `type` — starts with an uppercase letter (PascalCase / single
|
|
22
|
-
* uppercase segment).
|
|
23
|
-
* - `instance` — starts with a lowercase letter (camelCase).
|
|
24
|
-
*/
|
|
25
|
-
export declare function classifyConvention(ident: string): EntityRefConvention;
|
|
26
|
-
/**
|
|
27
|
-
* Extract `$Identifier` entity references from a body string.
|
|
28
|
-
*
|
|
29
|
-
* Skips fenced code blocks (between paired ` ``` ` or `~~~` markers) per
|
|
30
|
-
* spec §2.5.2 (markers are recognised in prose only, not in verbatim
|
|
31
|
-
* content). Code and Feature fence boundaries are derived from the body AST
|
|
32
|
-
* rather than regex-scanning the raw body string. Math content is skipped
|
|
33
|
-
* two ways: an inline `$$…$$` fence by discarding any `$ident` match
|
|
34
|
-
* preceded by another `$`; a multi-line display-math block (a line that is
|
|
35
|
-
* exactly `$$`, its interior lines, and the closing `$$`) by tracking the
|
|
36
|
-
* delimiter across lines — this retains the original `$$`-toggle approach
|
|
37
|
-
* because the markdown AST does not distinguish inline `$$` fences from
|
|
38
|
-
* plain text when no surrounding blank lines are present.
|
|
39
|
-
*
|
|
40
|
-
* The reported {@linkcode SourceLocation} uses 1-based line numbers
|
|
41
|
-
* relative to the body string; callers add the entry's body offset to
|
|
42
|
-
* obtain file-relative positions.
|
|
43
|
-
*
|
|
44
|
-
* @param body Entry body prose (post-`splitBodyAndAttributes`).
|
|
45
|
-
* @param baseLocation Source location of the body's first line, used as
|
|
46
|
-
* the `file` field on every emitted {@linkcode EntityRef} and as the
|
|
47
|
-
* starting line.
|
|
48
|
-
* @param blocks Optional pre-built body AST. When provided, the AST is used
|
|
49
|
-
* directly to identify code/feature block line ranges, avoiding a redundant
|
|
50
|
-
* `buildBodyAst` call. When omitted, the AST is built internally.
|
|
51
|
-
*/
|
|
52
|
-
export declare function extractEntityRefs(body: string, baseLocation: SourceLocation, blocks?: readonly BodyBlock[]): EntityRef[];
|
|
53
|
-
//# sourceMappingURL=entity_refs.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"entity_refs.d.ts","sourceRoot":"","sources":["../../src/parser/entity_refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EACnB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWjD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,CAMrE;AA0CD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,cAAc,EAC5B,MAAM,CAAC,EAAE,SAAS,SAAS,EAAE,GAC5B,SAAS,EAAE,CAiDb"}
|