@driftsys/markspec 0.4.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 +60 -0
- package/esm/ast/build.d.ts.map +1 -0
- package/esm/ast/build.js +516 -0
- package/esm/ast/equivalence.d.ts +18 -0
- package/esm/ast/equivalence.d.ts.map +1 -0
- package/esm/ast/equivalence.js +56 -0
- package/esm/ast/nodes.d.ts +189 -0
- package/esm/ast/nodes.d.ts.map +1 -0
- package/esm/ast/nodes.js +17 -0
- package/esm/ast/normalize.d.ts +58 -0
- package/esm/ast/normalize.d.ts.map +1 -0
- package/esm/ast/normalize.js +197 -0
- package/esm/ast/render.d.ts +34 -0
- package/esm/ast/render.d.ts.map +1 -0
- package/esm/ast/render.js +215 -0
- 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 +2 -1
- package/esm/compiler/inverses.d.ts.map +1 -1
- package/esm/compiler/inverses.js +33 -14
- package/esm/compiler/manifest.d.ts +59 -0
- package/esm/compiler/manifest.d.ts.map +1 -0
- package/esm/compiler/manifest.js +48 -0
- package/esm/compiler/mod.d.ts +38 -1
- package/esm/compiler/mod.d.ts.map +1 -1
- package/esm/compiler/mod.js +202 -50
- package/esm/compiler/ndjson_writer.d.ts +50 -0
- package/esm/compiler/ndjson_writer.d.ts.map +1 -0
- package/esm/compiler/ndjson_writer.js +73 -0
- package/esm/compiler/schema.d.ts +33 -1
- package/esm/compiler/schema.d.ts.map +1 -1
- package/esm/compiler/schema.js +30 -9
- 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/config/mod.d.ts.map +1 -1
- package/esm/config/mod.js +54 -0
- package/esm/formatter/mod.d.ts +55 -4
- package/esm/formatter/mod.d.ts.map +1 -1
- package/esm/formatter/mod.js +423 -46
- package/esm/formatter/synth_ulid.d.ts +21 -0
- package/esm/formatter/synth_ulid.d.ts.map +1 -0
- package/esm/formatter/synth_ulid.js +64 -0
- 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 +14 -0
- package/esm/lint/mod.d.ts.map +1 -0
- package/esm/lint/mod.js +9 -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/lexicon.d.ts +24 -0
- package/esm/lint/rules/lexicon.d.ts.map +1 -0
- package/esm/lint/rules/lexicon.js +236 -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/struct.d.ts +17 -0
- package/esm/lint/rules/struct.d.ts.map +1 -0
- package/esm/lint/rules/struct.js +55 -0
- package/esm/lint/rules/suppression.d.ts +54 -0
- package/esm/lint/rules/suppression.d.ts.map +1 -0
- package/esm/lint/rules/suppression.js +129 -0
- 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 +59 -0
- package/esm/lint/runner.d.ts.map +1 -0
- package/esm/lint/runner.js +153 -0
- 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 +31 -0
- package/esm/lint/types.d.ts.map +1 -0
- package/esm/lint/types.js +9 -0
- 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 +28 -8
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +23 -4
- package/esm/model/attributes.d.ts +6 -0
- package/esm/model/attributes.d.ts.map +1 -1
- package/esm/model/attributes.js +200 -2
- 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/discriminating_attr.d.ts +33 -0
- package/esm/model/discriminating_attr.d.ts.map +1 -0
- package/esm/model/discriminating_attr.js +74 -0
- package/esm/model/mod.d.ts +267 -14
- package/esm/model/mod.d.ts.map +1 -1
- package/esm/model/mod.js +99 -3
- package/esm/model/profile.d.ts +102 -27
- package/esm/model/profile.d.ts.map +1 -1
- package/esm/model/source_introspection.d.ts +26 -0
- package/esm/model/source_introspection.d.ts.map +1 -0
- package/esm/model/source_introspection.js +77 -0
- package/esm/model/type_hierarchy.d.ts +51 -0
- package/esm/model/type_hierarchy.d.ts.map +1 -0
- package/esm/model/type_hierarchy.js +126 -0
- package/esm/model/uri_scheme_map.d.ts +21 -0
- package/esm/model/uri_scheme_map.d.ts.map +1 -0
- package/esm/model/uri_scheme_map.js +66 -0
- package/esm/parser/attributes.d.ts.map +1 -1
- package/esm/parser/attributes.js +10 -16
- 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 +51 -0
- package/esm/parser/glossary.d.ts.map +1 -0
- package/esm/parser/glossary.js +219 -0
- 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 +317 -25
- package/esm/parser/mod.d.ts +5 -0
- package/esm/parser/mod.d.ts.map +1 -1
- package/esm/parser/mod.js +31 -8
- package/esm/parser/source.d.ts +53 -2
- package/esm/parser/source.d.ts.map +1 -1
- package/esm/parser/source.js +158 -68
- 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 +32 -14
- package/esm/profile/colors.js +1 -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/introspect.d.ts +135 -0
- package/esm/profile/introspect.d.ts.map +1 -0
- package/esm/profile/introspect.js +378 -0
- package/esm/profile/load.d.ts +3 -1
- package/esm/profile/load.d.ts.map +1 -1
- package/esm/profile/load.js +91 -5
- package/esm/profile/manifest.d.ts.map +1 -1
- package/esm/profile/manifest.js +512 -90
- package/esm/profile/merge.d.ts.map +1 -1
- package/esm/profile/merge.js +251 -39
- package/esm/profile/mod.d.ts +4 -4
- package/esm/profile/mod.d.ts.map +1 -1
- package/esm/profile/mod.js +7 -2
- package/esm/reporter/mod.js +4 -4
- 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/fence.d.ts +30 -0
- package/esm/util/fence.d.ts.map +1 -0
- package/esm/util/fence.js +40 -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/attributes.d.ts +3 -3
- package/esm/validator/attributes.d.ts.map +1 -1
- package/esm/validator/attributes.js +1 -18
- package/esm/validator/body_blocks.d.ts +38 -0
- package/esm/validator/body_blocks.d.ts.map +1 -0
- package/esm/validator/body_blocks.js +218 -0
- package/esm/validator/caption_convention.d.ts +29 -0
- package/esm/validator/caption_convention.d.ts.map +1 -0
- package/esm/validator/caption_convention.js +58 -0
- package/esm/validator/captions.d.ts +22 -0
- package/esm/validator/captions.d.ts.map +1 -0
- package/esm/validator/captions.js +137 -0
- package/esm/validator/component_schemes.d.ts +73 -0
- package/esm/validator/component_schemes.d.ts.map +1 -0
- package/esm/validator/component_schemes.js +375 -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/feature_ac.d.ts +28 -0
- package/esm/validator/feature_ac.d.ts.map +1 -0
- package/esm/validator/feature_ac.js +102 -0
- package/esm/validator/listing.d.ts +42 -0
- package/esm/validator/listing.d.ts.map +1 -0
- package/esm/validator/listing.js +295 -0
- package/esm/validator/mod.d.ts +3 -1
- package/esm/validator/mod.d.ts.map +1 -1
- package/esm/validator/mod.js +275 -13
- package/esm/validator/modal_keywords.d.ts +25 -0
- package/esm/validator/modal_keywords.d.ts.map +1 -0
- package/esm/validator/modal_keywords.js +54 -0
- 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 +29 -0
- package/esm/validator/per_type_attrs.d.ts.map +1 -0
- package/esm/validator/per_type_attrs.js +75 -0
- package/esm/validator/pipeline.d.ts +18 -2
- package/esm/validator/pipeline.d.ts.map +1 -1
- package/esm/validator/pipeline.js +76 -21
- package/esm/validator/trace_types.d.ts +26 -0
- package/esm/validator/trace_types.d.ts.map +1 -0
- package/esm/validator/trace_types.js +232 -0
- package/esm/validator/traceability.d.ts +3 -4
- package/esm/validator/traceability.d.ts.map +1 -1
- package/esm/validator/traceability.js +5 -10
- package/esm/validator/type_resolution.d.ts +67 -0
- package/esm/validator/type_resolution.d.ts.map +1 -0
- package/esm/validator/type_resolution.js +162 -0
- package/esm/validator/types.d.ts +45 -0
- package/esm/validator/types.d.ts.map +1 -1
- package/esm/validator/types.js +128 -16
- package/esm/validator/value_types.d.ts +8 -0
- package/esm/validator/value_types.d.ts.map +1 -1
- package/esm/validator/value_types.js +8 -1
- package/package.json +2 -2
- package/script/ast/build.d.ts +60 -0
- package/script/ast/build.d.ts.map +1 -0
- package/script/ast/build.js +521 -0
- package/script/ast/equivalence.d.ts +18 -0
- package/script/ast/equivalence.d.ts.map +1 -0
- package/script/ast/equivalence.js +59 -0
- package/script/ast/nodes.d.ts +189 -0
- package/script/ast/nodes.d.ts.map +1 -0
- package/script/ast/nodes.js +18 -0
- package/script/ast/normalize.d.ts +58 -0
- package/script/ast/normalize.d.ts.map +1 -0
- package/script/ast/normalize.js +200 -0
- package/script/ast/render.d.ts +34 -0
- package/script/ast/render.d.ts.map +1 -0
- package/script/ast/render.js +218 -0
- 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 +2 -1
- package/script/compiler/inverses.d.ts.map +1 -1
- package/script/compiler/inverses.js +33 -14
- package/script/compiler/manifest.d.ts +59 -0
- package/script/compiler/manifest.d.ts.map +1 -0
- package/script/compiler/manifest.js +51 -0
- package/script/compiler/mod.d.ts +38 -1
- package/script/compiler/mod.d.ts.map +1 -1
- package/script/compiler/mod.js +206 -54
- package/script/compiler/ndjson_writer.d.ts +50 -0
- package/script/compiler/ndjson_writer.d.ts.map +1 -0
- package/script/compiler/ndjson_writer.js +78 -0
- package/script/compiler/schema.d.ts +33 -1
- package/script/compiler/schema.d.ts.map +1 -1
- package/script/compiler/schema.js +30 -8
- 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/config/mod.d.ts.map +1 -1
- package/script/config/mod.js +54 -0
- package/script/formatter/mod.d.ts +55 -4
- package/script/formatter/mod.d.ts.map +1 -1
- package/script/formatter/mod.js +426 -46
- package/script/formatter/synth_ulid.d.ts +21 -0
- package/script/formatter/synth_ulid.d.ts.map +1 -0
- package/script/formatter/synth_ulid.js +67 -0
- 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 +14 -0
- package/script/lint/mod.d.ts.map +1 -0
- package/script/lint/mod.js +17 -0
- 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/lexicon.d.ts +24 -0
- package/script/lint/rules/lexicon.d.ts.map +1 -0
- package/script/lint/rules/lexicon.js +240 -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/struct.d.ts +17 -0
- package/script/lint/rules/struct.d.ts.map +1 -0
- package/script/lint/rules/struct.js +59 -0
- package/script/lint/rules/suppression.d.ts +54 -0
- package/script/lint/rules/suppression.d.ts.map +1 -0
- package/script/lint/rules/suppression.js +136 -0
- 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 +59 -0
- package/script/lint/runner.d.ts.map +1 -0
- package/script/lint/runner.js +157 -0
- 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 +31 -0
- package/script/lint/types.d.ts.map +1 -0
- package/script/lint/types.js +10 -0
- 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 +28 -8
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +129 -32
- package/script/model/attributes.d.ts +6 -0
- package/script/model/attributes.d.ts.map +1 -1
- package/script/model/attributes.js +201 -3
- 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/discriminating_attr.d.ts +33 -0
- package/script/model/discriminating_attr.d.ts.map +1 -0
- package/script/model/discriminating_attr.js +77 -0
- package/script/model/mod.d.ts +267 -14
- package/script/model/mod.d.ts.map +1 -1
- package/script/model/mod.js +111 -3
- package/script/model/profile.d.ts +102 -27
- package/script/model/profile.d.ts.map +1 -1
- package/script/model/source_introspection.d.ts +26 -0
- package/script/model/source_introspection.d.ts.map +1 -0
- package/script/model/source_introspection.js +80 -0
- package/script/model/type_hierarchy.d.ts +51 -0
- package/script/model/type_hierarchy.d.ts.map +1 -0
- package/script/model/type_hierarchy.js +130 -0
- package/script/model/uri_scheme_map.d.ts +21 -0
- package/script/model/uri_scheme_map.d.ts.map +1 -0
- package/script/model/uri_scheme_map.js +69 -0
- package/script/parser/attributes.d.ts.map +1 -1
- package/script/parser/attributes.js +10 -16
- 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 +51 -0
- package/script/parser/glossary.d.ts.map +1 -0
- package/script/parser/glossary.js +224 -0
- 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 +315 -23
- package/script/parser/mod.d.ts +5 -0
- package/script/parser/mod.d.ts.map +1 -1
- package/script/parser/mod.js +36 -7
- package/script/parser/source.d.ts +53 -2
- package/script/parser/source.d.ts.map +1 -1
- package/script/parser/source.js +159 -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 +32 -14
- package/script/profile/colors.js +1 -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/introspect.d.ts +135 -0
- package/script/profile/introspect.d.ts.map +1 -0
- package/script/profile/introspect.js +381 -0
- package/script/profile/load.d.ts +3 -1
- package/script/profile/load.d.ts.map +1 -1
- package/script/profile/load.js +91 -5
- package/script/profile/manifest.d.ts.map +1 -1
- package/script/profile/manifest.js +511 -89
- package/script/profile/merge.d.ts.map +1 -1
- package/script/profile/merge.js +251 -39
- package/script/profile/mod.d.ts +4 -4
- package/script/profile/mod.d.ts.map +1 -1
- package/script/profile/mod.js +12 -6
- package/script/reporter/mod.js +4 -4
- 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/fence.d.ts +30 -0
- package/script/util/fence.d.ts.map +1 -0
- package/script/util/fence.js +44 -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/attributes.d.ts +3 -3
- package/script/validator/attributes.d.ts.map +1 -1
- package/script/validator/attributes.js +1 -18
- package/script/validator/body_blocks.d.ts +38 -0
- package/script/validator/body_blocks.d.ts.map +1 -0
- package/script/validator/body_blocks.js +221 -0
- package/script/validator/caption_convention.d.ts +29 -0
- package/script/validator/caption_convention.d.ts.map +1 -0
- package/script/validator/caption_convention.js +61 -0
- package/script/validator/captions.d.ts +22 -0
- package/script/validator/captions.d.ts.map +1 -0
- package/script/validator/captions.js +140 -0
- package/script/validator/component_schemes.d.ts +73 -0
- package/script/validator/component_schemes.d.ts.map +1 -0
- package/script/validator/component_schemes.js +384 -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/feature_ac.d.ts +28 -0
- package/script/validator/feature_ac.d.ts.map +1 -0
- package/script/validator/feature_ac.js +105 -0
- package/script/validator/listing.d.ts +42 -0
- package/script/validator/listing.d.ts.map +1 -0
- package/script/validator/listing.js +298 -0
- package/script/validator/mod.d.ts +3 -1
- package/script/validator/mod.d.ts.map +1 -1
- package/script/validator/mod.js +278 -14
- package/script/validator/modal_keywords.d.ts +25 -0
- package/script/validator/modal_keywords.d.ts.map +1 -0
- package/script/validator/modal_keywords.js +57 -0
- 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 +29 -0
- package/script/validator/per_type_attrs.d.ts.map +1 -0
- package/script/validator/per_type_attrs.js +78 -0
- package/script/validator/pipeline.d.ts +18 -2
- package/script/validator/pipeline.d.ts.map +1 -1
- package/script/validator/pipeline.js +78 -22
- package/script/validator/trace_types.d.ts +26 -0
- package/script/validator/trace_types.d.ts.map +1 -0
- package/script/validator/trace_types.js +235 -0
- package/script/validator/traceability.d.ts +3 -4
- package/script/validator/traceability.d.ts.map +1 -1
- package/script/validator/traceability.js +5 -10
- package/script/validator/type_resolution.d.ts +67 -0
- package/script/validator/type_resolution.d.ts.map +1 -0
- package/script/validator/type_resolution.js +168 -0
- package/script/validator/types.d.ts +45 -0
- package/script/validator/types.d.ts.map +1 -1
- package/script/validator/types.js +131 -16
- package/script/validator/value_types.d.ts +8 -0
- package/script/validator/value_types.d.ts.map +1 -1
- package/script/validator/value_types.js +10 -2
package/script/parser/source.js
CHANGED
|
@@ -6,13 +6,15 @@
|
|
|
6
6
|
* comments in Rust, Kotlin, C, C++, and Java source files. Delegates parsed
|
|
7
7
|
* content to the markdown parser for entry extraction.
|
|
8
8
|
*/
|
|
9
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
-
};
|
|
12
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
10
|
exports.parseSource = parseSource;
|
|
14
|
-
|
|
11
|
+
exports.stripLineCommentPrefix = stripLineCommentPrefix;
|
|
12
|
+
exports.stripBlockCommentPrefix = stripBlockCommentPrefix;
|
|
13
|
+
exports.wrapAsListItem = wrapAsListItem;
|
|
14
|
+
const web_tree_sitter_1 = require("web-tree-sitter");
|
|
15
15
|
const markdown_js_1 = require("./markdown.js");
|
|
16
|
+
const line_map_js_1 = require("./line_map.js");
|
|
17
|
+
const language_spec_js_1 = require("./language_spec.js");
|
|
16
18
|
/**
|
|
17
19
|
* Parse a source file and return entries extracted from doc comments.
|
|
18
20
|
*
|
|
@@ -25,30 +27,41 @@ const markdown_js_1 = require("./markdown.js");
|
|
|
25
27
|
*/
|
|
26
28
|
function parseSource(content, options) {
|
|
27
29
|
const file = options.file ?? "<unknown>";
|
|
28
|
-
const
|
|
30
|
+
const spec = language_spec_js_1.LANGUAGE_SPECS[options.languageId];
|
|
31
|
+
const parser = new web_tree_sitter_1.Parser();
|
|
29
32
|
parser.setLanguage(options.language);
|
|
30
33
|
const tree = parser.parse(content);
|
|
34
|
+
if (!tree)
|
|
35
|
+
return { entries: [] };
|
|
31
36
|
const blocks = [];
|
|
32
|
-
walkForDocComments(tree.rootNode, blocks);
|
|
37
|
+
walkForDocComments(tree.rootNode, blocks, spec);
|
|
33
38
|
const entries = [];
|
|
34
39
|
for (const block of blocks) {
|
|
35
40
|
const markdown = wrapAsListItem(block.lines);
|
|
36
|
-
const
|
|
41
|
+
const lineMap = (0, line_map_js_1.buildBlockLineMap)({
|
|
42
|
+
startLine: block.startLine,
|
|
43
|
+
startColumn: block.startColumn,
|
|
44
|
+
prefixWidths: block.prefixWidths,
|
|
45
|
+
});
|
|
46
|
+
const { entries: parsed } = (0, markdown_js_1.parseMarkdown)(markdown, { file, lineMap });
|
|
37
47
|
for (const entry of parsed) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
48
|
+
// entry.location, bodyAst ranges, and bodyTokens are already
|
|
49
|
+
// file-relative thanks to the lineMap post-pass inside parseMarkdown.
|
|
50
|
+
// Source files have no front matter; properties.file is derived from
|
|
51
|
+
// the translated entry.location.
|
|
43
52
|
entries.push({
|
|
44
53
|
...entry,
|
|
45
|
-
source:
|
|
46
|
-
|
|
54
|
+
source: {
|
|
55
|
+
kind: "doc-comment",
|
|
56
|
+
language: options.languageId,
|
|
57
|
+
function: block.itemName,
|
|
58
|
+
rule: block.rule,
|
|
59
|
+
},
|
|
47
60
|
properties: {
|
|
48
61
|
file: {
|
|
49
62
|
path: file,
|
|
50
|
-
line:
|
|
51
|
-
column:
|
|
63
|
+
line: entry.location.line,
|
|
64
|
+
column: entry.location.column,
|
|
52
65
|
},
|
|
53
66
|
},
|
|
54
67
|
});
|
|
@@ -58,74 +71,109 @@ function parseSource(content, options) {
|
|
|
58
71
|
parser.delete();
|
|
59
72
|
return { entries };
|
|
60
73
|
}
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
/** Maximum sibling-walk length before giving up. Generous for typical
|
|
75
|
+
* attribute stacks; bounds pathological inputs. */
|
|
76
|
+
const ENCLOSING_ITEM_LOOKAHEAD = 10;
|
|
77
|
+
/** Search the doc-comment's siblings for an enclosing item, skipping
|
|
78
|
+
* attribute/annotation/comment nodes per the language spec. Returns
|
|
79
|
+
* the item-name string or undefined. */
|
|
80
|
+
function findItemName(commentNode, spec) {
|
|
81
|
+
let sibling = commentNode.nextSibling;
|
|
82
|
+
let examined = 0;
|
|
83
|
+
while (sibling !== null && examined < ENCLOSING_ITEM_LOOKAHEAD) {
|
|
84
|
+
examined++;
|
|
85
|
+
if (spec.enclosingItemTypes.includes(sibling.type)) {
|
|
86
|
+
return spec.itemName(sibling);
|
|
87
|
+
}
|
|
88
|
+
if (!spec.attributeSkipTypes.includes(sibling.type)) {
|
|
89
|
+
// Hit something that isn't an item AND isn't a skippable attribute —
|
|
90
|
+
// structural surprise. Give up rather than walk forever.
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
sibling = sibling.nextSibling;
|
|
94
|
+
}
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
function walkForDocComments(node, blocks, spec) {
|
|
71
98
|
let currentLines = [];
|
|
99
|
+
let currentPrefixWidths = [];
|
|
72
100
|
let currentStartLine = 0;
|
|
73
101
|
let currentStartColumn = 0;
|
|
102
|
+
let currentRule = "outer-doc-comment";
|
|
74
103
|
let lastRow = -2;
|
|
104
|
+
let currentLastCommentNode = null;
|
|
75
105
|
function flushLineBlock() {
|
|
76
106
|
if (currentLines.length > 0) {
|
|
107
|
+
const itemName = currentLastCommentNode
|
|
108
|
+
? findItemName(currentLastCommentNode, spec)
|
|
109
|
+
: undefined;
|
|
77
110
|
blocks.push({
|
|
78
111
|
lines: currentLines,
|
|
79
112
|
startLine: currentStartLine,
|
|
80
113
|
startColumn: currentStartColumn,
|
|
114
|
+
prefixWidths: currentPrefixWidths,
|
|
115
|
+
rule: currentRule,
|
|
116
|
+
itemName,
|
|
81
117
|
});
|
|
82
118
|
currentLines = [];
|
|
119
|
+
currentPrefixWidths = [];
|
|
120
|
+
currentRule = "outer-doc-comment";
|
|
121
|
+
currentLastCommentNode = null;
|
|
83
122
|
lastRow = -2;
|
|
84
123
|
}
|
|
85
124
|
}
|
|
86
125
|
for (let i = 0; i < node.childCount; i++) {
|
|
87
126
|
const child = node.child(i);
|
|
88
|
-
|
|
127
|
+
const isLineComment = spec.lineCommentTypes.includes(child.type) &&
|
|
128
|
+
spec.isDocLine(child.text);
|
|
129
|
+
if (isLineComment) {
|
|
89
130
|
const row = child.startPosition.row;
|
|
90
|
-
// Not consecutive — flush previous block
|
|
91
131
|
if (currentLines.length > 0 && row !== lastRow + 1) {
|
|
92
132
|
flushLineBlock();
|
|
93
133
|
}
|
|
94
134
|
if (currentLines.length === 0) {
|
|
95
|
-
currentStartLine = row + 1;
|
|
96
|
-
currentStartColumn = child.startPosition.column + 1;
|
|
135
|
+
currentStartLine = row + 1;
|
|
136
|
+
currentStartColumn = child.startPosition.column + 1;
|
|
97
137
|
}
|
|
98
|
-
|
|
138
|
+
const { text, prefixWidth, rule } = stripLineCommentPrefix(child);
|
|
139
|
+
if (currentLines.length === 0) {
|
|
140
|
+
currentRule = rule;
|
|
141
|
+
}
|
|
142
|
+
currentLines.push(text);
|
|
143
|
+
currentPrefixWidths.push(prefixWidth);
|
|
144
|
+
currentLastCommentNode = child;
|
|
99
145
|
lastRow = row;
|
|
100
146
|
continue;
|
|
101
147
|
}
|
|
102
|
-
|
|
148
|
+
const isBlockComment = spec.blockCommentTypes.includes(child.type) &&
|
|
149
|
+
spec.isDocBlock(child.text);
|
|
150
|
+
if (isBlockComment) {
|
|
103
151
|
flushLineBlock();
|
|
152
|
+
const { lines, prefixWidths, openerSkipped } = stripBlockCommentPrefix(child.text);
|
|
153
|
+
if (lines.length === 0)
|
|
154
|
+
continue;
|
|
155
|
+
const startRow = child.startPosition.row + (openerSkipped ? 1 : 0);
|
|
156
|
+
const itemName = findItemName(child, spec);
|
|
104
157
|
blocks.push({
|
|
105
|
-
lines
|
|
106
|
-
startLine:
|
|
158
|
+
lines,
|
|
159
|
+
startLine: startRow + 1,
|
|
107
160
|
startColumn: child.startPosition.column + 1,
|
|
161
|
+
prefixWidths,
|
|
162
|
+
rule: "block-doc-comment",
|
|
163
|
+
itemName,
|
|
108
164
|
});
|
|
109
165
|
continue;
|
|
110
166
|
}
|
|
111
167
|
// Non-comment node — flush pending line comments, then recurse.
|
|
112
168
|
flushLineBlock();
|
|
113
169
|
if (child.childCount > 0) {
|
|
114
|
-
walkForDocComments(child, blocks);
|
|
170
|
+
walkForDocComments(child, blocks, spec);
|
|
115
171
|
}
|
|
116
172
|
}
|
|
117
173
|
flushLineBlock();
|
|
118
174
|
}
|
|
119
|
-
/** Check if a line_comment node is a `///` outer doc comment. */
|
|
120
|
-
function isOuterDocComment(node) {
|
|
121
|
-
for (let i = 0; i < node.childCount; i++) {
|
|
122
|
-
if (node.child(i).type === "outer_doc_comment_marker")
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
return false;
|
|
126
|
-
}
|
|
127
175
|
/**
|
|
128
|
-
* Strip the `///` prefix from a line comment node.
|
|
176
|
+
* Strip the `///` or `//!` prefix from a line comment node.
|
|
129
177
|
* Uses the `doc_comment` child if available, otherwise strips manually.
|
|
130
178
|
*/
|
|
131
179
|
function stripLineCommentPrefix(node) {
|
|
@@ -133,53 +181,95 @@ function stripLineCommentPrefix(node) {
|
|
|
133
181
|
const child = node.child(i);
|
|
134
182
|
if (child.type === "doc_comment") {
|
|
135
183
|
let text = child.text.replace(/\n$/, "");
|
|
136
|
-
//
|
|
137
|
-
|
|
184
|
+
// The line_comment node's text starts with `///` (or `//!`); the
|
|
185
|
+
// doc_comment child is the substring after the marker. Compute
|
|
186
|
+
// prefixWidth as (line_comment_text_length - doc_comment_text_length)
|
|
187
|
+
// before stripping the conventional leading space.
|
|
188
|
+
const rawDoc = child.text.replace(/\n$/, "");
|
|
189
|
+
let prefixWidth = node.text.replace(/\n$/, "").length - rawDoc.length;
|
|
190
|
+
if (text.startsWith(" ")) {
|
|
138
191
|
text = text.slice(1);
|
|
139
|
-
|
|
192
|
+
prefixWidth += 1;
|
|
193
|
+
}
|
|
194
|
+
const rule = node.text.startsWith("//!") ? "inner-doc-comment" : "outer-doc-comment";
|
|
195
|
+
return { text, prefixWidth, rule };
|
|
140
196
|
}
|
|
141
197
|
}
|
|
142
198
|
// Fallback: manual prefix stripping
|
|
143
|
-
const
|
|
144
|
-
if (
|
|
145
|
-
return text.slice(4);
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
199
|
+
const raw = node.text.replace(/\n$/, "");
|
|
200
|
+
if (raw.startsWith("/// ")) {
|
|
201
|
+
return { text: raw.slice(4), prefixWidth: 4, rule: "outer-doc-comment" };
|
|
202
|
+
}
|
|
203
|
+
if (raw.startsWith("///")) {
|
|
204
|
+
return { text: raw.slice(3), prefixWidth: 3, rule: "outer-doc-comment" };
|
|
205
|
+
}
|
|
206
|
+
if (raw.startsWith("//! ")) {
|
|
207
|
+
return { text: raw.slice(4), prefixWidth: 4, rule: "inner-doc-comment" };
|
|
208
|
+
}
|
|
209
|
+
if (raw.startsWith("//!")) {
|
|
210
|
+
return { text: raw.slice(3), prefixWidth: 3, rule: "inner-doc-comment" };
|
|
211
|
+
}
|
|
212
|
+
return { text: raw, prefixWidth: 0, rule: "outer-doc-comment" };
|
|
149
213
|
}
|
|
150
214
|
/**
|
|
151
|
-
* Strip block
|
|
152
|
-
* Returns cleaned lines
|
|
215
|
+
* Strip block-comment delimiters and leading ` * ` prefixes.
|
|
216
|
+
* Returns cleaned lines, per-line prefix widths, and a flag indicating
|
|
217
|
+
* whether the opener was skipped (bare `/**\n`).
|
|
153
218
|
*/
|
|
154
219
|
function stripBlockCommentPrefix(text) {
|
|
155
220
|
const rawLines = text.split("\n");
|
|
156
|
-
const
|
|
221
|
+
const lines = [];
|
|
222
|
+
const prefixWidths = [];
|
|
223
|
+
let openerSkipped = false;
|
|
157
224
|
for (let i = 0; i < rawLines.length; i++) {
|
|
158
|
-
const
|
|
159
|
-
|
|
225
|
+
const raw = rawLines[i];
|
|
226
|
+
const trimmed = raw.trim();
|
|
227
|
+
// Opening `/**` line. May have content after it.
|
|
160
228
|
if (i === 0) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
229
|
+
// Locate the `/**` marker; for canonical javadoc it's at the line
|
|
230
|
+
// start, but be defensive.
|
|
231
|
+
const markerIdx = raw.indexOf("/**");
|
|
232
|
+
const afterMarker = markerIdx >= 0
|
|
233
|
+
? raw.slice(markerIdx + 3).replace(/^\s+/, "")
|
|
234
|
+
: "";
|
|
235
|
+
if (afterMarker && afterMarker !== "/") {
|
|
236
|
+
// Compute prefixWidth so that for "/** Title", afterMarker="Title"
|
|
237
|
+
// and prefixWidth = (raw.length - afterMarker.length) = 4 if
|
|
238
|
+
// raw="/** Title", which matches the spec table.
|
|
239
|
+
const prefixWidth = raw.length - afterMarker.length;
|
|
240
|
+
lines.push(afterMarker);
|
|
241
|
+
prefixWidths.push(prefixWidth);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
openerSkipped = true;
|
|
164
245
|
}
|
|
165
246
|
continue;
|
|
166
247
|
}
|
|
167
|
-
//
|
|
168
|
-
if (i === rawLines.length - 1 && trimmed === "*/")
|
|
248
|
+
// Closing `*/` line — skip.
|
|
249
|
+
if (i === rawLines.length - 1 && trimmed === "*/")
|
|
169
250
|
continue;
|
|
170
|
-
|
|
171
|
-
// Strip leading ` * ` or ` *`
|
|
251
|
+
// Strip leading ` * ` or ` *` or bare prose.
|
|
172
252
|
if (trimmed.startsWith("* ")) {
|
|
173
|
-
|
|
253
|
+
// Strip up through "* " — find leading-whitespace + "* "
|
|
254
|
+
const starIdx = raw.indexOf("* ");
|
|
255
|
+
const stripped = raw.slice(starIdx + 2);
|
|
256
|
+
lines.push(stripped);
|
|
257
|
+
prefixWidths.push(starIdx + 2);
|
|
174
258
|
}
|
|
175
259
|
else if (trimmed === "*") {
|
|
176
|
-
|
|
260
|
+
lines.push("");
|
|
261
|
+
prefixWidths.push(raw.indexOf("*") + 1);
|
|
262
|
+
}
|
|
263
|
+
else if (trimmed === "") {
|
|
264
|
+
lines.push("");
|
|
265
|
+
prefixWidths.push(0);
|
|
177
266
|
}
|
|
178
267
|
else {
|
|
179
|
-
|
|
268
|
+
lines.push(trimmed);
|
|
269
|
+
prefixWidths.push(raw.length - trimmed.length);
|
|
180
270
|
}
|
|
181
271
|
}
|
|
182
|
-
return
|
|
272
|
+
return { lines, prefixWidths, openerSkipped };
|
|
183
273
|
}
|
|
184
274
|
/**
|
|
185
275
|
* Wrap cleaned doc comment lines as a Markdown list item so the
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module parser/translate
|
|
3
|
+
*
|
|
4
|
+
* Post-pass that walks parsed `Entry[]` and applies a `LineMap` to every
|
|
5
|
+
* coordinate field — entry locations, body-AST node ranges (which carry
|
|
6
|
+
* `{line, column}` points without `file`), body tokens. Returns a fresh
|
|
7
|
+
* entries array; originals are not mutated.
|
|
8
|
+
*
|
|
9
|
+
* This is the **one translation point** required by ADR-016 §6. The
|
|
10
|
+
* upstream parser produces buffer-relative locations; this pass converts
|
|
11
|
+
* them to file-relative coordinates. When `LineMap.translate` returns
|
|
12
|
+
* `undefined` (over-run past the block's last line), the affected
|
|
13
|
+
* location safe-falls to the entry's own translated `location` with
|
|
14
|
+
* column reset to 1, and a single `console.warn` per entries-batch
|
|
15
|
+
* flags the drift.
|
|
16
|
+
*/
|
|
17
|
+
import type { Entry } from "../model/mod.js";
|
|
18
|
+
import type { LineMap } from "./line_map.js";
|
|
19
|
+
/**
|
|
20
|
+
* Translate every coordinate inside `entries` through `lineMap`.
|
|
21
|
+
* Returns a new array of new entries; input is not mutated.
|
|
22
|
+
*/
|
|
23
|
+
export declare function translateEntryLocations(entries: readonly Entry[], lineMap: LineMap): Entry[];
|
|
24
|
+
//# sourceMappingURL=translate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../src/parser/translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,iBAAiB,CAAC;AAE7D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAI7C;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,SAAS,KAAK,EAAE,EACzB,OAAO,EAAE,OAAO,GACf,KAAK,EAAE,CAoDT"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module parser/translate
|
|
4
|
+
*
|
|
5
|
+
* Post-pass that walks parsed `Entry[]` and applies a `LineMap` to every
|
|
6
|
+
* coordinate field — entry locations, body-AST node ranges (which carry
|
|
7
|
+
* `{line, column}` points without `file`), body tokens. Returns a fresh
|
|
8
|
+
* entries array; originals are not mutated.
|
|
9
|
+
*
|
|
10
|
+
* This is the **one translation point** required by ADR-016 §6. The
|
|
11
|
+
* upstream parser produces buffer-relative locations; this pass converts
|
|
12
|
+
* them to file-relative coordinates. When `LineMap.translate` returns
|
|
13
|
+
* `undefined` (over-run past the block's last line), the affected
|
|
14
|
+
* location safe-falls to the entry's own translated `location` with
|
|
15
|
+
* column reset to 1, and a single `console.warn` per entries-batch
|
|
16
|
+
* flags the drift.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.translateEntryLocations = translateEntryLocations;
|
|
20
|
+
/**
|
|
21
|
+
* Translate every coordinate inside `entries` through `lineMap`.
|
|
22
|
+
* Returns a new array of new entries; input is not mutated.
|
|
23
|
+
*/
|
|
24
|
+
function translateEntryLocations(entries, lineMap) {
|
|
25
|
+
let warned = false;
|
|
26
|
+
const warn = () => {
|
|
27
|
+
if (warned)
|
|
28
|
+
return;
|
|
29
|
+
warned = true;
|
|
30
|
+
console.warn("translateEntryLocations: LineMap.translate returned undefined " +
|
|
31
|
+
"for at least one location; falling back to entry start. " +
|
|
32
|
+
"This indicates a coordinate-translation drift.");
|
|
33
|
+
};
|
|
34
|
+
return entries.map((entry) => {
|
|
35
|
+
const translatedEntryLoc = translateLocation(entry.location, lineMap, entry.location, warn);
|
|
36
|
+
const fallbackPoint = {
|
|
37
|
+
line: translatedEntryLoc.line,
|
|
38
|
+
column: 1,
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
...entry,
|
|
42
|
+
location: translatedEntryLoc,
|
|
43
|
+
bodyAst: entry.bodyAst
|
|
44
|
+
? entry.bodyAst.map((block) => translateBlock(block, lineMap, fallbackPoint, warn))
|
|
45
|
+
: entry.bodyAst,
|
|
46
|
+
bodyTokens: entry.bodyTokens.map((token) => ({
|
|
47
|
+
...token,
|
|
48
|
+
location: translateLocation(token.location, lineMap, translatedEntryLoc, warn),
|
|
49
|
+
})),
|
|
50
|
+
properties: entry.properties?.file
|
|
51
|
+
? {
|
|
52
|
+
...entry.properties,
|
|
53
|
+
file: {
|
|
54
|
+
...entry.properties.file,
|
|
55
|
+
line: translatedEntryLoc.line,
|
|
56
|
+
column: translatedEntryLoc.column,
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
: entry.properties,
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** Translate a SourceLocation (preserves `file` field). */
|
|
64
|
+
function translateLocation(loc, lineMap, fallback, warn) {
|
|
65
|
+
const t = lineMap.translate(loc.line, loc.column);
|
|
66
|
+
if (!t) {
|
|
67
|
+
warn();
|
|
68
|
+
return { file: loc.file, line: fallback.line, column: 1 };
|
|
69
|
+
}
|
|
70
|
+
return { file: loc.file, line: t.line, column: t.column };
|
|
71
|
+
}
|
|
72
|
+
/** Translate a SourceRange point (no `file` field). */
|
|
73
|
+
function translatePoint(pt, lineMap, fallback, warn) {
|
|
74
|
+
const t = lineMap.translate(pt.line, pt.column);
|
|
75
|
+
if (!t) {
|
|
76
|
+
warn();
|
|
77
|
+
return { line: fallback.line, column: fallback.column };
|
|
78
|
+
}
|
|
79
|
+
return { line: t.line, column: t.column };
|
|
80
|
+
}
|
|
81
|
+
function translateBlock(block, lineMap, fallbackPoint, warn) {
|
|
82
|
+
const range = {
|
|
83
|
+
start: translatePoint(block.range.start, lineMap, fallbackPoint, warn),
|
|
84
|
+
end: translatePoint(block.range.end, lineMap, fallbackPoint, warn),
|
|
85
|
+
};
|
|
86
|
+
if (block.kind === "list") {
|
|
87
|
+
const list = block;
|
|
88
|
+
return {
|
|
89
|
+
...list,
|
|
90
|
+
range,
|
|
91
|
+
items: list.items.map((item) => ({
|
|
92
|
+
...item,
|
|
93
|
+
range: {
|
|
94
|
+
start: translatePoint(item.range.start, lineMap, fallbackPoint, warn),
|
|
95
|
+
end: translatePoint(item.range.end, lineMap, fallbackPoint, warn),
|
|
96
|
+
},
|
|
97
|
+
blocks: item.blocks.map((b) => translateBlock(b, lineMap, fallbackPoint, warn)),
|
|
98
|
+
})),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return { ...block, range };
|
|
102
|
+
}
|
|
@@ -23,6 +23,14 @@ export interface LoadChainResult {
|
|
|
23
23
|
export interface LoadChainOptions {
|
|
24
24
|
readonly runGit?: RunGit;
|
|
25
25
|
readonly appendFile?: AppendFile;
|
|
26
|
+
/**
|
|
27
|
+
* When true, the bundled default profile is spliced as the implicit
|
|
28
|
+
* root of the chain (the ultimate `extends:` parent of any tier that
|
|
29
|
+
* declares none). Default false — only `loadProfileForCommand` enables
|
|
30
|
+
* it, so direct `loadChain` callers (e.g. `profile add` validation)
|
|
31
|
+
* keep core-only behaviour.
|
|
32
|
+
*/
|
|
33
|
+
readonly bundledDefault?: boolean;
|
|
26
34
|
}
|
|
27
35
|
/**
|
|
28
36
|
* Load a profile chain from a specifier, walking the `extends:` pointer up
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/profile/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EAGV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../src/profile/chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EACV,UAAU,EAGV,YAAY,EACZ,gBAAgB,EACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAiBzD,yCAAyC;AACzC,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAED,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,SAAS,CAC7B,SAAS,EAAE,gBAAgB,EAC3B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,eAAe,CAAC,CA0H1B"}
|
package/script/profile/chain.js
CHANGED
|
@@ -50,6 +50,7 @@ exports.loadChain = loadChain;
|
|
|
50
50
|
const path_1 = require("@std/path");
|
|
51
51
|
const manifest_js_1 = require("./manifest.js");
|
|
52
52
|
const merge_js_1 = require("./merge.js");
|
|
53
|
+
const default_profile_js_1 = require("./default_profile.js");
|
|
53
54
|
const resolver_js_1 = require("./resolver.js");
|
|
54
55
|
/** Maximum number of tiers allowed in an `extends:` chain. */
|
|
55
56
|
const MAX_CHAIN_DEPTH = 20;
|
|
@@ -108,6 +109,13 @@ async function loadChain(specifier, contextDir, projectRoot, readFile, opts = {}
|
|
|
108
109
|
readFile,
|
|
109
110
|
});
|
|
110
111
|
}
|
|
112
|
+
else if (cursorSpec.kind === "builtin") {
|
|
113
|
+
resolved = {
|
|
114
|
+
rawYaml: default_profile_js_1.DEFAULT_PROFILE_MANIFEST,
|
|
115
|
+
sourcePath: default_profile_js_1.BUILTIN_DEFAULT_SOURCE_PATH,
|
|
116
|
+
baseDir: default_profile_js_1.BUILTIN_DEFAULT_SOURCE_PATH,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
111
119
|
else {
|
|
112
120
|
resolved = await (0, resolver_js_1.resolveLocalSpecifier)(cursorSpec, cursorDir, readFile, diagnostics);
|
|
113
121
|
}
|
|
@@ -128,11 +136,17 @@ async function loadChain(specifier, contextDir, projectRoot, readFile, opts = {}
|
|
|
128
136
|
baseDir: resolved.baseDir,
|
|
129
137
|
};
|
|
130
138
|
tiersLeafFirst.push(tier);
|
|
131
|
-
// Advance cursor to the parent, if any.
|
|
139
|
+
// Advance cursor to the parent, if any. When the tier declares no
|
|
140
|
+
// explicit parent, splice the bundled default as the implicit root
|
|
141
|
+
// (once — never below the builtin itself).
|
|
132
142
|
if (parsed.manifest.extends !== undefined) {
|
|
133
143
|
cursorSpec = parsed.manifest.extends;
|
|
134
144
|
cursorDir = resolved.baseDir;
|
|
135
145
|
}
|
|
146
|
+
else if (opts.bundledDefault && cursorSpec.kind !== "builtin") {
|
|
147
|
+
cursorSpec = default_profile_js_1.BUILTIN_DEFAULT_SPECIFIER;
|
|
148
|
+
cursorDir = resolved.baseDir;
|
|
149
|
+
}
|
|
136
150
|
else {
|
|
137
151
|
cursorSpec = undefined;
|
|
138
152
|
}
|
|
@@ -182,6 +196,9 @@ function specifierKey(spec, contextDir) {
|
|
|
182
196
|
const pkg = spec.scope ? `${spec.scope}/${spec.name}` : spec.name;
|
|
183
197
|
return `npm:${pkg}@${spec.range}`;
|
|
184
198
|
}
|
|
199
|
+
if (spec.kind === "builtin") {
|
|
200
|
+
return "builtin:@markspec/profile-default";
|
|
201
|
+
}
|
|
185
202
|
const _exhaustive = spec;
|
|
186
203
|
throw new Error(`Unknown specifier kind`);
|
|
187
204
|
}
|
|
@@ -197,6 +214,9 @@ function stringifySpec(spec) {
|
|
|
197
214
|
const pkg = spec.scope ? `${spec.scope}/${spec.name}` : spec.name;
|
|
198
215
|
return `npm:${pkg}@${spec.range}`;
|
|
199
216
|
}
|
|
217
|
+
if (spec.kind === "builtin") {
|
|
218
|
+
return "@markspec/profile-default (bundled)";
|
|
219
|
+
}
|
|
200
220
|
const _exhaustive = spec;
|
|
201
221
|
throw new Error(`Unknown specifier kind`);
|
|
202
222
|
}
|
|
@@ -207,23 +227,21 @@ function stringifySpec(spec) {
|
|
|
207
227
|
* contents are irrelevant.
|
|
208
228
|
*/
|
|
209
229
|
function buildPlaceholderEffective(tiers) {
|
|
210
|
-
const
|
|
230
|
+
const _leafOrigin = tiers[tiers.length - 1]?.id ?? "<unknown>";
|
|
211
231
|
return {
|
|
212
|
-
required: { value: [], origin: leafOrigin },
|
|
213
232
|
attributes: new Map(),
|
|
214
|
-
labels:
|
|
233
|
+
labels: new Map(),
|
|
234
|
+
conventions: new Map(),
|
|
215
235
|
colors: new Map(),
|
|
216
|
-
identified: {
|
|
217
|
-
required: { value: [], origin: leafOrigin },
|
|
218
|
-
attributes: new Map(),
|
|
219
|
-
traceability: new Map(),
|
|
220
|
-
},
|
|
221
|
-
referenced: {
|
|
222
|
-
required: { value: [], origin: leafOrigin },
|
|
223
|
-
attributes: new Map(),
|
|
224
|
-
traceability: new Map(),
|
|
225
|
-
},
|
|
226
236
|
types: new Map(),
|
|
227
237
|
documents: { types: new Map(), frontMatter: new Map() },
|
|
238
|
+
kinds: new Map(),
|
|
239
|
+
prose: {
|
|
240
|
+
lexicons: {
|
|
241
|
+
"capitalized-allow": { value: [], origin: "" },
|
|
242
|
+
"sentence-abbrev": { value: [], origin: "" },
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
disciplineMode: { value: "none", origin: "inferred" },
|
|
228
246
|
};
|
|
229
247
|
}
|
package/script/profile/colors.js
CHANGED
|
@@ -27,7 +27,7 @@ const DEFAULT_HUE = "blue";
|
|
|
27
27
|
* name) so the renderer works for files compiled without a profile.
|
|
28
28
|
*/
|
|
29
29
|
function resolveEntryColor(entry, profile) {
|
|
30
|
-
if (entry.shape === "
|
|
30
|
+
if (entry.shape === "Reference")
|
|
31
31
|
return null;
|
|
32
32
|
if (!profile || !entry.type)
|
|
33
33
|
return DEFAULT_HUE;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/profile/default_profile
|
|
3
|
+
*
|
|
4
|
+
* The bundled default profile (profile-schema §7 / §2.2). It ships as an
|
|
5
|
+
* embedded string constant — never a file on disk — so it survives
|
|
6
|
+
* `deno compile` and runs under Node without I/O. It is auto-registered as
|
|
7
|
+
* the implicit root of the `extends:` chain unless `default-profile: false`
|
|
8
|
+
* is set in `.markspec.yaml`.
|
|
9
|
+
*
|
|
10
|
+
* Scope (mechanism only): a minimal identity profile — stable id + the
|
|
11
|
+
* default colour roles, no types, no rules. The profile-schema §7.1
|
|
12
|
+
* display-ID pattern bindings, RFC 2119 hygiene, and `{{def.}}` glossary
|
|
13
|
+
* are deferred (they need a core-type-binding schema construct).
|
|
14
|
+
*/
|
|
15
|
+
import type { ProfileSpecifier } from "../model/mod.js";
|
|
16
|
+
/** Specifier that resolves to the embedded default profile. */
|
|
17
|
+
export declare const BUILTIN_DEFAULT_SPECIFIER: ProfileSpecifier;
|
|
18
|
+
/**
|
|
19
|
+
* Synthetic source path used for the embedded manifest in diagnostics and
|
|
20
|
+
* tier bookkeeping. Not a real filesystem path.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILTIN_DEFAULT_SOURCE_PATH = "<bundled:@markspec/profile-default>";
|
|
23
|
+
/** The embedded default-profile manifest, authored as YAML. */
|
|
24
|
+
export declare const DEFAULT_PROFILE_MANIFEST = "id: \"@markspec/profile-default\"\nversion: 1.0.0\nmarkspec-schema: \"1\"\ndescription: Baseline MarkSpec profile\nlicense: MIT\nprofile:\n attributes: []\n labels: []\n colors:\n primary: blue\n secondary: teal\n tertiary: cyan\n accent: purple\n muted: grey\n warning: orange\n danger: red\n types: {}\n documents:\n types: []\n frontMatter: []\n";
|
|
25
|
+
//# sourceMappingURL=default_profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default_profile.d.ts","sourceRoot":"","sources":["../../src/profile/default_profile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,EAAE,gBAAsC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,2BAA2B,wCACD,CAAC;AAExC,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,iYAoBpC,CAAC"}
|