@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
package/esm/parser/markdown.js
CHANGED
|
@@ -4,11 +4,13 @@
|
|
|
4
4
|
* CommonMark + MarkSpec extension parser. Walks the mdast AST to detect
|
|
5
5
|
* `- [DISPLAY_ID] Title` entry blocks and extract structured attributes.
|
|
6
6
|
*/
|
|
7
|
-
import { IDENTITY_KEY, shapeFromIdValue } from "../model/mod.js";
|
|
7
|
+
import { IDENTITY_KEY, makeDisplayId, shapeFromIdValue } from "../model/mod.js";
|
|
8
8
|
import { ATTR_LINE_RE, collateAttributes, parseAttributes, splitBodyAndAttributes, } from "./attributes.js";
|
|
9
|
-
import {
|
|
9
|
+
import { extractBodyTokens } from "./body_tokens.js";
|
|
10
10
|
import { processor } from "./remark.js";
|
|
11
|
-
import {
|
|
11
|
+
import { buildBodyAstWithTree } from "../ast/build.js";
|
|
12
|
+
import { translateEntryLocations } from "./translate.js";
|
|
13
|
+
import { bridgeTyplDiagnostic, extractTyplBullets, extractTyplFences, extractTyplInlines, parseTyplBlock, } from "../typl/mod.js";
|
|
12
14
|
/**
|
|
13
15
|
* Slug pattern for referenced-entry display IDs.
|
|
14
16
|
*
|
|
@@ -53,6 +55,9 @@ export function parseMarkdown(markdown, options) {
|
|
|
53
55
|
const tree = processor.parse(markdown);
|
|
54
56
|
const entries = [];
|
|
55
57
|
const diagnostics = [];
|
|
58
|
+
// Pre-split once so every extractBodyContent call shares the same array
|
|
59
|
+
// instead of re-splitting for each list item (O(N×L) → O(N+L)).
|
|
60
|
+
const markdownLines = markdown.split("\n");
|
|
56
61
|
// Collect link definition identifiers for shortcut reference exclusion.
|
|
57
62
|
const definitions = new Set(tree.children
|
|
58
63
|
.filter((n) => n.type === "definition")
|
|
@@ -65,31 +70,32 @@ export function parseMarkdown(markdown, options) {
|
|
|
65
70
|
if (list.ordered)
|
|
66
71
|
continue;
|
|
67
72
|
for (const item of list.children) {
|
|
68
|
-
const entry = extractEntry(item,
|
|
73
|
+
const entry = extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, !!options?.lineMap);
|
|
69
74
|
if (entry)
|
|
70
75
|
entries.push(entry);
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
|
-
|
|
78
|
+
const finalEntries = options?.lineMap
|
|
79
|
+
? translateEntryLocations(entries, options.lineMap)
|
|
80
|
+
: entries;
|
|
81
|
+
return { entries: finalEntries, diagnostics };
|
|
74
82
|
}
|
|
75
83
|
/**
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
84
|
+
* Resolve whether this is a references document.
|
|
85
|
+
*
|
|
86
|
+
* The caller (`parseFile` in `parser/mod.ts`) always passes an explicit
|
|
87
|
+
* value computed via the canonical `isReferencesDocument` helper, so the
|
|
88
|
+
* auto-detection fallback is never needed here.
|
|
80
89
|
*/
|
|
81
|
-
function detectReferencesDocument(
|
|
82
|
-
|
|
83
|
-
return explicit;
|
|
84
|
-
const basename = file.split("/").pop() ?? "";
|
|
85
|
-
return basename === "references.md" || file.includes("/references/");
|
|
90
|
+
function detectReferencesDocument(_file, explicit) {
|
|
91
|
+
return explicit ?? false;
|
|
86
92
|
}
|
|
87
93
|
/**
|
|
88
94
|
* Attempt to extract a MarkSpec entry from a list item.
|
|
89
95
|
* Returns undefined if the list item is not an entry block.
|
|
90
96
|
* Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
|
|
91
97
|
*/
|
|
92
|
-
function extractEntry(item,
|
|
98
|
+
function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, hasLineMap = false) {
|
|
93
99
|
// Task list items (remark-gfm sets checked to true/false) are not entries.
|
|
94
100
|
if (item.checked != null)
|
|
95
101
|
return undefined;
|
|
@@ -197,10 +203,10 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
|
|
|
197
203
|
// validation (MSL-P010 also fires from the validator for empty titles).
|
|
198
204
|
}
|
|
199
205
|
// Extract body content and attributes.
|
|
200
|
-
const bodyContent = extractBodyContent(item,
|
|
206
|
+
const bodyContent = extractBodyContent(item, markdownLines);
|
|
201
207
|
const [body, attrLines] = splitBodyAndAttributes(bodyContent);
|
|
202
208
|
const attributes = parseAttributes(attrLines);
|
|
203
|
-
const bodyAst =
|
|
209
|
+
const { blocks: bodyAst, tree: mdastTree } = buildBodyAstWithTree(body);
|
|
204
210
|
const entryLine = item.position?.start.line ?? 1;
|
|
205
211
|
// MSL-P020: trailers block is not the final indented code block.
|
|
206
212
|
// Detect `Key: Value` lines in the body that likely should be trailers
|
|
@@ -397,19 +403,87 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
|
|
|
397
403
|
const line = item.position?.start.line ?? 1;
|
|
398
404
|
const column = item.position?.start.column ?? 1;
|
|
399
405
|
const entryLocation = { file, line, column };
|
|
400
|
-
// Inline
|
|
401
|
-
//
|
|
402
|
-
//
|
|
403
|
-
//
|
|
404
|
-
|
|
406
|
+
// Inline-construct tokens (ADR-016). Reuses the already-built bodyAst to
|
|
407
|
+
// avoid a redundant mdast parse.
|
|
408
|
+
//
|
|
409
|
+
// bodyStartLine: when a lineMap is present (source-file path), use the
|
|
410
|
+
// mdast position of the second child (the body paragraph) — the actual
|
|
411
|
+
// buffer line where the body starts. CommonMark loose lists have a blank
|
|
412
|
+
// line between title and body, so the body is at (entry_line + 2), not
|
|
413
|
+
// (entry_line + 1). Without a lineMap we keep the legacy (entry_line + 1)
|
|
414
|
+
// behaviour to avoid shifting existing markdown-file token locations.
|
|
415
|
+
//
|
|
416
|
+
// columnOffset: when a lineMap is present, body text has been stripped of
|
|
417
|
+
// the list-item indent (e.g., " " for column-1 items), so each token
|
|
418
|
+
// column must be bumped by that indent width for the LineMap to translate
|
|
419
|
+
// to the correct source column. Without a lineMap, no offset is applied
|
|
420
|
+
// (legacy behaviour unchanged).
|
|
421
|
+
const bodyIndent = hasLineMap
|
|
422
|
+
// + 2 = the " " continuation indent prepended by wrapAsListItem to
|
|
423
|
+
// every non-title line. Mirrors the indent computation in
|
|
424
|
+
// extractBodyContent below.
|
|
425
|
+
? (item.position?.start.column ?? 1) - 1 + 2
|
|
426
|
+
: 0;
|
|
427
|
+
const bodyStartLine = hasLineMap
|
|
428
|
+
? (item.children[1]?.position?.start.line ?? (line + 1))
|
|
429
|
+
: line + 1;
|
|
430
|
+
const bodyTokens = extractBodyTokens(body, bodyAst, {
|
|
405
431
|
file,
|
|
406
|
-
|
|
407
|
-
// emitted line numbers 1-based relative to the file.
|
|
408
|
-
line: line + 1,
|
|
432
|
+
line: bodyStartLine,
|
|
409
433
|
column: 1,
|
|
410
|
-
},
|
|
434
|
+
}, bodyIndent, mdastTree);
|
|
435
|
+
// Extract typl declarations from all three surfaces in the body:
|
|
436
|
+
// (1) ```typl fences, (2) bullet-glossary items, (3) inline code spans.
|
|
437
|
+
// Per-surface diagnostics are bridged to file-relative positions and
|
|
438
|
+
// pushed into the parser's diagnostic stream. Cross-entry collision
|
|
439
|
+
// detection lands in a later PR; this PR aggregates all intra-entry
|
|
440
|
+
// bindings + typedefs from every surface.
|
|
441
|
+
let types;
|
|
442
|
+
const allBindings = [];
|
|
443
|
+
const allTypedefs = [];
|
|
444
|
+
for (const fence of extractTyplFences(bodyAst)) {
|
|
445
|
+
const result = parseTyplBlock(fence.source);
|
|
446
|
+
allBindings.push(...result.ast.bindings);
|
|
447
|
+
allTypedefs.push(...result.ast.typedefs);
|
|
448
|
+
// Fence content starts on the line AFTER the opening ```, so the
|
|
449
|
+
// bridge offset is the file line of the opening fence.
|
|
450
|
+
const fenceFileStartLine = bodyStartLine + fence.range.start.line - 1;
|
|
451
|
+
for (const td of result.diagnostics) {
|
|
452
|
+
diagnostics.push(bridgeTyplDiagnostic(td, file, fenceFileStartLine));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
for (const bullet of extractTyplBullets(bodyAst)) {
|
|
456
|
+
const result = parseTyplBlock(bullet.source);
|
|
457
|
+
allBindings.push(...result.ast.bindings);
|
|
458
|
+
allTypedefs.push(...result.ast.typedefs);
|
|
459
|
+
// A bullet item IS the typl content (single line). The bridge
|
|
460
|
+
// computes line as `offset + diag.position.line`; we want diag
|
|
461
|
+
// position.line 1 to map to the item's file line, so offset is
|
|
462
|
+
// `itemFileLine - 1` = `bodyStartLine + bullet.range.start.line - 2`.
|
|
463
|
+
const bulletFileOffset = bodyStartLine + bullet.range.start.line - 2;
|
|
464
|
+
for (const td of result.diagnostics) {
|
|
465
|
+
diagnostics.push(bridgeTyplDiagnostic(td, file, bulletFileOffset));
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
for (const inline of extractTyplInlines(bodyTokens)) {
|
|
469
|
+
const result = parseTyplBlock(inline.source);
|
|
470
|
+
allBindings.push(...result.ast.bindings);
|
|
471
|
+
allTypedefs.push(...result.ast.typedefs);
|
|
472
|
+
// inline.location is already file-relative (translated by the
|
|
473
|
+
// bodyTokens extractor). The bridge computes file line as
|
|
474
|
+
// `offset + diag.position.line`; for inline content where
|
|
475
|
+
// diag.position.line is 1 (single-line span), offset is
|
|
476
|
+
// `inline.location.line - 1`.
|
|
477
|
+
const inlineFileOffset = inline.location.line - 1;
|
|
478
|
+
for (const td of result.diagnostics) {
|
|
479
|
+
diagnostics.push(bridgeTyplDiagnostic(td, inline.location.file, inlineFileOffset));
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
if (allBindings.length > 0 || allTypedefs.length > 0) {
|
|
483
|
+
types = { bindings: allBindings, typedefs: allTypedefs };
|
|
484
|
+
}
|
|
411
485
|
return {
|
|
412
|
-
displayId,
|
|
486
|
+
displayId: makeDisplayId(displayId),
|
|
413
487
|
title: title ?? "",
|
|
414
488
|
body,
|
|
415
489
|
bodyAst,
|
|
@@ -419,9 +493,11 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
|
|
|
419
493
|
type,
|
|
420
494
|
shape,
|
|
421
495
|
location: entryLocation,
|
|
422
|
-
|
|
496
|
+
bodyStartLine,
|
|
497
|
+
source: { kind: "markdown" },
|
|
423
498
|
properties: { file: { path: file, line, column } },
|
|
424
|
-
|
|
499
|
+
bodyTokens,
|
|
500
|
+
...(types ? { types } : {}),
|
|
425
501
|
};
|
|
426
502
|
}
|
|
427
503
|
/**
|
|
@@ -429,12 +505,12 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
|
|
|
429
505
|
* which contains the display ID and title).
|
|
430
506
|
*
|
|
431
507
|
* Reconstructs the text content from the source markdown using position info.
|
|
508
|
+
* Accepts a pre-split lines array to avoid redundant splits across entries.
|
|
432
509
|
*/
|
|
433
|
-
function extractBodyContent(item,
|
|
510
|
+
function extractBodyContent(item, lines) {
|
|
434
511
|
const children = item.children.slice(1); // Skip title paragraph
|
|
435
512
|
if (!children.length)
|
|
436
513
|
return "";
|
|
437
|
-
const lines = markdown.split("\n");
|
|
438
514
|
// Get the range from the second child's start to the last child's end
|
|
439
515
|
const startLine = children[0].position?.start.line;
|
|
440
516
|
const endLine = children[children.length - 1].position?.end.line;
|
package/esm/parser/mod.d.ts
CHANGED
|
@@ -22,6 +22,10 @@ export { parseSource } from "./source.js";
|
|
|
22
22
|
export type { ParseSourceOptions, ParseSourceResult } from "./source.js";
|
|
23
23
|
export { stripBlockCommentPrefix, stripLineCommentPrefix, wrapAsListItem, } from "./source.js";
|
|
24
24
|
export { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
25
|
+
export type { DocCommentBlockMeta, LineMap } from "./line_map.js";
|
|
26
|
+
export { buildBlockLineMap } from "./line_map.js";
|
|
27
|
+
export type { LanguageDocCommentSpec, SupportedLanguage, } from "./language_spec.js";
|
|
28
|
+
export { LANGUAGE_SPECS, languageIdForExtension } from "./language_spec.js";
|
|
25
29
|
/** Options for {@linkcode parse}. */
|
|
26
30
|
export interface ParseOptions {
|
|
27
31
|
/** File path used in source locations. */
|
package/esm/parser/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/parser/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/parser/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAU5E,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EACV,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,GACf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAElE,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,YAAY,EACV,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,qCAAqC;AACrC,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,YAAY,GACrB,KAAK,EAAE,CAOT;AAED,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;CAC7C;AAeD;;;;;;;GAOG;AACH,wBAAsB,SAAS,CAC7B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACjC,OAAO,CAAC,eAAe,CAAC,CA6C1B;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,EAAE,CAEX"}
|
package/esm/parser/mod.js
CHANGED
|
@@ -9,9 +9,10 @@
|
|
|
9
9
|
* - directives: HTML comment directive extraction
|
|
10
10
|
* - source: doc comment extraction from Rust, Kotlin, C, C++, Java
|
|
11
11
|
*/
|
|
12
|
-
import { extname } from "@std/path";
|
|
12
|
+
import { basename as pathBasename, extname } from "@std/path";
|
|
13
|
+
import { normalizeLineEndings } from "../util/line_endings.js";
|
|
13
14
|
import { parseMarkdown } from "./markdown.js";
|
|
14
|
-
import { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
15
|
+
import { isSupportedExtension, languageIdForExtension, loadGrammar, } from "./grammars.js";
|
|
15
16
|
import { parseSource } from "./source.js";
|
|
16
17
|
import { extractFrontMatter } from "./frontmatter.js";
|
|
17
18
|
import { detectCaptions as detectCaptionsImpl, } from "./captions.js";
|
|
@@ -21,6 +22,8 @@ export { detectInlineRefs } from "./references.js";
|
|
|
21
22
|
export { parseSource } from "./source.js";
|
|
22
23
|
export { stripBlockCommentPrefix, stripLineCommentPrefix, wrapAsListItem, } from "./source.js";
|
|
23
24
|
export { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
25
|
+
export { buildBlockLineMap } from "./line_map.js";
|
|
26
|
+
export { LANGUAGE_SPECS, languageIdForExtension } from "./language_spec.js";
|
|
24
27
|
/**
|
|
25
28
|
* Parse a Markdown string and return all MarkSpec entries found.
|
|
26
29
|
*
|
|
@@ -29,7 +32,12 @@ export { isSupportedExtension, loadGrammar } from "./grammars.js";
|
|
|
29
32
|
* @returns Array of parsed entries
|
|
30
33
|
*/
|
|
31
34
|
export function parse(markdown, options) {
|
|
32
|
-
|
|
35
|
+
const file = options?.file;
|
|
36
|
+
const normalised = normalizeLineEndings(markdown);
|
|
37
|
+
return parseMarkdown(normalised, {
|
|
38
|
+
...options,
|
|
39
|
+
isReferencesDoc: file !== undefined ? isReferencesDocument(file) : false,
|
|
40
|
+
}).entries;
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
43
|
* Detect if a file is a references document.
|
|
@@ -37,8 +45,12 @@ export function parse(markdown, options) {
|
|
|
37
45
|
* @param file - File path
|
|
38
46
|
*/
|
|
39
47
|
function isReferencesDocument(file) {
|
|
40
|
-
|
|
41
|
-
|
|
48
|
+
if (pathBasename(file) === "references.md")
|
|
49
|
+
return true;
|
|
50
|
+
// Detect a `/references/` (or `\references\`) directory anywhere in the
|
|
51
|
+
// path, in a separator-agnostic way so Windows checkouts behave the
|
|
52
|
+
// same as POSIX.
|
|
53
|
+
return /[\\/]references[\\/]/.test(file);
|
|
42
54
|
}
|
|
43
55
|
/**
|
|
44
56
|
* Parse a file and return entries, annotation links, and (for Markdown
|
|
@@ -50,16 +62,26 @@ function isReferencesDocument(file) {
|
|
|
50
62
|
*/
|
|
51
63
|
export async function parseFile(content, options) {
|
|
52
64
|
const ext = extname(options.file);
|
|
65
|
+
const normalised = normalizeLineEndings(content);
|
|
53
66
|
if (isSupportedExtension(ext)) {
|
|
54
67
|
const language = await loadGrammar(ext);
|
|
55
|
-
const
|
|
68
|
+
const languageId = languageIdForExtension(ext);
|
|
69
|
+
if (!languageId) {
|
|
70
|
+
// Defensive — isSupportedExtension and languageIdForExtension are kept
|
|
71
|
+
// in sync via their shared extension lists, so this branch should be
|
|
72
|
+
// unreachable. Throwing surfaces the drift immediately rather than
|
|
73
|
+
// silently falling through to wrong grammar dispatch.
|
|
74
|
+
throw new Error(`internal: no languageId for supported extension '${ext}'`);
|
|
75
|
+
}
|
|
76
|
+
const result = parseSource(normalised, {
|
|
56
77
|
file: options.file,
|
|
57
78
|
language,
|
|
79
|
+
languageId,
|
|
58
80
|
});
|
|
59
81
|
return { entries: result.entries, diagnostics: [] };
|
|
60
82
|
}
|
|
61
|
-
const fm = extractFrontMatter(
|
|
62
|
-
const body = fm.hadFrontMatter ? fm.markdown :
|
|
83
|
+
const fm = extractFrontMatter(normalised, { file: options.file });
|
|
84
|
+
const body = fm.hadFrontMatter ? fm.markdown : normalised;
|
|
63
85
|
const isReferencesDoc = isReferencesDocument(options.file);
|
|
64
86
|
const { entries, diagnostics: parseDiagnostics } = parseMarkdown(body, {
|
|
65
87
|
file: options.file,
|
package/esm/parser/source.d.ts
CHANGED
|
@@ -5,15 +5,23 @@
|
|
|
5
5
|
* comments in Rust, Kotlin, C, C++, and Java source files. Delegates parsed
|
|
6
6
|
* content to the markdown parser for entry extraction.
|
|
7
7
|
*/
|
|
8
|
-
import type { SyntaxNode } from "web-tree-sitter";
|
|
9
|
-
import
|
|
8
|
+
import type { Node as SyntaxNode } from "web-tree-sitter";
|
|
9
|
+
import { type Language } from "web-tree-sitter";
|
|
10
10
|
import type { Entry } from "../model/mod.js";
|
|
11
|
+
import type { SupportedLanguage } from "./language_spec.js";
|
|
11
12
|
/** Options for {@linkcode parseSource}. */
|
|
12
13
|
export interface ParseSourceOptions {
|
|
13
14
|
/** File path used in source locations. */
|
|
14
15
|
readonly file?: string;
|
|
15
16
|
/** Pre-loaded tree-sitter language grammar. */
|
|
16
|
-
readonly language:
|
|
17
|
+
readonly language: Language;
|
|
18
|
+
/**
|
|
19
|
+
* Language id for the active grammar — used by the walker to look up
|
|
20
|
+
* the doc-comment dispatch row in `LANGUAGE_SPECS`. The caller maps
|
|
21
|
+
* file extension → languageId via `languageIdForExtension` before
|
|
22
|
+
* calling `parseSource`.
|
|
23
|
+
*/
|
|
24
|
+
readonly languageId: SupportedLanguage;
|
|
17
25
|
}
|
|
18
26
|
/** Result of parsing a source file. */
|
|
19
27
|
export interface ParseSourceResult {
|
|
@@ -31,16 +39,38 @@ export interface ParseSourceResult {
|
|
|
31
39
|
* @param options - Parse options (language grammar, file path)
|
|
32
40
|
*/
|
|
33
41
|
export declare function parseSource(content: string, options: ParseSourceOptions): ParseSourceResult;
|
|
42
|
+
/** Result of stripping a prefix from one source line. */
|
|
43
|
+
interface PrefixStripResult {
|
|
44
|
+
readonly text: string;
|
|
45
|
+
/** Number of source characters stripped to produce `text`. */
|
|
46
|
+
readonly prefixWidth: number;
|
|
47
|
+
/** Which rule the line-comment strip helper matched: "outer-doc-comment"
|
|
48
|
+
* for `///`, "inner-doc-comment" for `//!`. */
|
|
49
|
+
readonly rule: "outer-doc-comment" | "inner-doc-comment";
|
|
50
|
+
}
|
|
34
51
|
/**
|
|
35
|
-
* Strip the `///` prefix from a line comment node.
|
|
52
|
+
* Strip the `///` or `//!` prefix from a line comment node.
|
|
36
53
|
* Uses the `doc_comment` child if available, otherwise strips manually.
|
|
37
54
|
*/
|
|
38
|
-
export declare function stripLineCommentPrefix(node: SyntaxNode):
|
|
55
|
+
export declare function stripLineCommentPrefix(node: SyntaxNode): PrefixStripResult;
|
|
56
|
+
/** Result of stripping a block comment. */
|
|
57
|
+
interface BlockStripResult {
|
|
58
|
+
readonly lines: string[];
|
|
59
|
+
/** One value per element of `lines` — chars stripped per emitted line. */
|
|
60
|
+
readonly prefixWidths: number[];
|
|
61
|
+
/**
|
|
62
|
+
* True when the block's opener line (`/**`) had no content after the
|
|
63
|
+
* marker and was therefore not emitted into `lines`. Used by the walker
|
|
64
|
+
* to advance `startLine` by 1.
|
|
65
|
+
*/
|
|
66
|
+
readonly openerSkipped: boolean;
|
|
67
|
+
}
|
|
39
68
|
/**
|
|
40
|
-
* Strip block
|
|
41
|
-
* Returns cleaned lines
|
|
69
|
+
* Strip block-comment delimiters and leading ` * ` prefixes.
|
|
70
|
+
* Returns cleaned lines, per-line prefix widths, and a flag indicating
|
|
71
|
+
* whether the opener was skipped (bare `/**\n`).
|
|
42
72
|
*/
|
|
43
|
-
export declare function stripBlockCommentPrefix(text: string):
|
|
73
|
+
export declare function stripBlockCommentPrefix(text: string): BlockStripResult;
|
|
44
74
|
/**
|
|
45
75
|
* Wrap cleaned doc comment lines as a Markdown list item so the
|
|
46
76
|
* existing `parseMarkdown()` can extract entries.
|
|
@@ -50,4 +80,5 @@ export declare function stripBlockCommentPrefix(text: string): string[];
|
|
|
50
80
|
* recognizes as an entry block.
|
|
51
81
|
*/
|
|
52
82
|
export declare function wrapAsListItem(lines: string[]): string;
|
|
83
|
+
export {};
|
|
53
84
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/parser/source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/parser/source.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,iBAAiB,CAAC;AAG5D,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAG5B,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;CACxC;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;CAC3B;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CAgDnB;AAyHD,yDAAyD;AACzD,UAAU,iBAAiB;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;mDAC+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,GAAG,mBAAmB,CAAC;CAC1D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAmC1E;AAED,2CAA2C;AAC3C,UAAU,gBAAgB;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAsDtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAKtD"}
|