@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.
Files changed (632) hide show
  1. package/README.md +74 -20
  2. package/esm/ast/build.d.ts +60 -0
  3. package/esm/ast/build.d.ts.map +1 -0
  4. package/esm/ast/build.js +516 -0
  5. package/esm/ast/equivalence.d.ts +18 -0
  6. package/esm/ast/equivalence.d.ts.map +1 -0
  7. package/esm/ast/equivalence.js +56 -0
  8. package/esm/ast/nodes.d.ts +189 -0
  9. package/esm/ast/nodes.d.ts.map +1 -0
  10. package/esm/ast/nodes.js +17 -0
  11. package/esm/ast/normalize.d.ts +58 -0
  12. package/esm/ast/normalize.d.ts.map +1 -0
  13. package/esm/ast/normalize.js +197 -0
  14. package/esm/ast/render.d.ts +34 -0
  15. package/esm/ast/render.d.ts.map +1 -0
  16. package/esm/ast/render.js +215 -0
  17. package/esm/compiler/constants.d.ts +16 -0
  18. package/esm/compiler/constants.d.ts.map +1 -0
  19. package/esm/compiler/constants.js +26 -0
  20. package/esm/compiler/discipline_classifier.d.ts +55 -0
  21. package/esm/compiler/discipline_classifier.d.ts.map +1 -0
  22. package/esm/compiler/discipline_classifier.js +191 -0
  23. package/esm/compiler/inverses.d.ts +2 -1
  24. package/esm/compiler/inverses.d.ts.map +1 -1
  25. package/esm/compiler/inverses.js +33 -14
  26. package/esm/compiler/manifest.d.ts +59 -0
  27. package/esm/compiler/manifest.d.ts.map +1 -0
  28. package/esm/compiler/manifest.js +48 -0
  29. package/esm/compiler/mod.d.ts +38 -1
  30. package/esm/compiler/mod.d.ts.map +1 -1
  31. package/esm/compiler/mod.js +202 -50
  32. package/esm/compiler/ndjson_writer.d.ts +50 -0
  33. package/esm/compiler/ndjson_writer.d.ts.map +1 -0
  34. package/esm/compiler/ndjson_writer.js +73 -0
  35. package/esm/compiler/schema.d.ts +33 -1
  36. package/esm/compiler/schema.d.ts.map +1 -1
  37. package/esm/compiler/schema.js +30 -9
  38. package/esm/config/markspec.d.ts +5 -0
  39. package/esm/config/markspec.d.ts.map +1 -1
  40. package/esm/config/markspec.js +17 -2
  41. package/esm/config/mod.d.ts.map +1 -1
  42. package/esm/config/mod.js +54 -0
  43. package/esm/formatter/mod.d.ts +55 -4
  44. package/esm/formatter/mod.d.ts.map +1 -1
  45. package/esm/formatter/mod.js +423 -46
  46. package/esm/formatter/synth_ulid.d.ts +21 -0
  47. package/esm/formatter/synth_ulid.d.ts.map +1 -0
  48. package/esm/formatter/synth_ulid.js +64 -0
  49. package/esm/lexicons/loader.d.ts +35 -0
  50. package/esm/lexicons/loader.d.ts.map +1 -0
  51. package/esm/lexicons/loader.js +51 -0
  52. package/esm/lexicons/mod.d.ts +13 -0
  53. package/esm/lexicons/mod.d.ts.map +1 -0
  54. package/esm/lexicons/mod.js +12 -0
  55. package/esm/lint/glossary.d.ts +45 -0
  56. package/esm/lint/glossary.d.ts.map +1 -0
  57. package/esm/lint/glossary.js +85 -0
  58. package/esm/lint/mod.d.ts +14 -0
  59. package/esm/lint/mod.d.ts.map +1 -0
  60. package/esm/lint/mod.js +9 -0
  61. package/esm/lint/range_util.d.ts +25 -0
  62. package/esm/lint/range_util.d.ts.map +1 -0
  63. package/esm/lint/range_util.js +50 -0
  64. package/esm/lint/rules/ears.d.ts +39 -0
  65. package/esm/lint/rules/ears.d.ts.map +1 -0
  66. package/esm/lint/rules/ears.js +316 -0
  67. package/esm/lint/rules/incose_sentence.d.ts +46 -0
  68. package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
  69. package/esm/lint/rules/incose_sentence.js +417 -0
  70. package/esm/lint/rules/lexicon.d.ts +24 -0
  71. package/esm/lint/rules/lexicon.d.ts.map +1 -0
  72. package/esm/lint/rules/lexicon.js +236 -0
  73. package/esm/lint/rules/modal_sentence.d.ts +46 -0
  74. package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
  75. package/esm/lint/rules/modal_sentence.js +146 -0
  76. package/esm/lint/rules/passive.d.ts +64 -0
  77. package/esm/lint/rules/passive.d.ts.map +1 -0
  78. package/esm/lint/rules/passive.js +282 -0
  79. package/esm/lint/rules/struct.d.ts +17 -0
  80. package/esm/lint/rules/struct.d.ts.map +1 -0
  81. package/esm/lint/rules/struct.js +55 -0
  82. package/esm/lint/rules/suppression.d.ts +54 -0
  83. package/esm/lint/rules/suppression.d.ts.map +1 -0
  84. package/esm/lint/rules/suppression.js +129 -0
  85. package/esm/lint/rules/xref.d.ts +19 -0
  86. package/esm/lint/rules/xref.d.ts.map +1 -0
  87. package/esm/lint/rules/xref.js +248 -0
  88. package/esm/lint/runner.d.ts +59 -0
  89. package/esm/lint/runner.d.ts.map +1 -0
  90. package/esm/lint/runner.js +153 -0
  91. package/esm/lint/score.d.ts +64 -0
  92. package/esm/lint/score.d.ts.map +1 -0
  93. package/esm/lint/score.js +163 -0
  94. package/esm/lint/segmenter.d.ts +32 -0
  95. package/esm/lint/segmenter.d.ts.map +1 -0
  96. package/esm/lint/segmenter.js +79 -0
  97. package/esm/lint/types.d.ts +31 -0
  98. package/esm/lint/types.d.ts.map +1 -0
  99. package/esm/lint/types.js +9 -0
  100. package/esm/lock/canonical_edges.d.ts +31 -0
  101. package/esm/lock/canonical_edges.d.ts.map +1 -0
  102. package/esm/lock/canonical_edges.js +57 -0
  103. package/esm/lock/check.d.ts +24 -0
  104. package/esm/lock/check.d.ts.map +1 -0
  105. package/esm/lock/check.js +127 -0
  106. package/esm/lock/hash.d.ts +12 -0
  107. package/esm/lock/hash.d.ts.map +1 -0
  108. package/esm/lock/hash.js +32 -0
  109. package/esm/lock/mod.d.ts +19 -0
  110. package/esm/lock/mod.d.ts.map +1 -0
  111. package/esm/lock/mod.js +14 -0
  112. package/esm/lock/model.d.ts +81 -0
  113. package/esm/lock/model.d.ts.map +1 -0
  114. package/esm/lock/model.js +7 -0
  115. package/esm/lock/parser.d.ts +26 -0
  116. package/esm/lock/parser.d.ts.map +1 -0
  117. package/esm/lock/parser.js +195 -0
  118. package/esm/lock/resolve.d.ts +142 -0
  119. package/esm/lock/resolve.d.ts.map +1 -0
  120. package/esm/lock/resolve.js +389 -0
  121. package/esm/lock/serializer.d.ts +14 -0
  122. package/esm/lock/serializer.d.ts.map +1 -0
  123. package/esm/lock/serializer.js +104 -0
  124. package/esm/mod.d.ts +28 -8
  125. package/esm/mod.d.ts.map +1 -1
  126. package/esm/mod.js +23 -4
  127. package/esm/model/attributes.d.ts +6 -0
  128. package/esm/model/attributes.d.ts.map +1 -1
  129. package/esm/model/attributes.js +200 -2
  130. package/esm/model/discipline.d.ts +53 -0
  131. package/esm/model/discipline.d.ts.map +1 -0
  132. package/esm/model/discipline.js +50 -0
  133. package/esm/model/discriminating_attr.d.ts +33 -0
  134. package/esm/model/discriminating_attr.d.ts.map +1 -0
  135. package/esm/model/discriminating_attr.js +74 -0
  136. package/esm/model/mod.d.ts +267 -14
  137. package/esm/model/mod.d.ts.map +1 -1
  138. package/esm/model/mod.js +99 -3
  139. package/esm/model/profile.d.ts +102 -27
  140. package/esm/model/profile.d.ts.map +1 -1
  141. package/esm/model/source_introspection.d.ts +26 -0
  142. package/esm/model/source_introspection.d.ts.map +1 -0
  143. package/esm/model/source_introspection.js +77 -0
  144. package/esm/model/type_hierarchy.d.ts +51 -0
  145. package/esm/model/type_hierarchy.d.ts.map +1 -0
  146. package/esm/model/type_hierarchy.js +126 -0
  147. package/esm/model/uri_scheme_map.d.ts +21 -0
  148. package/esm/model/uri_scheme_map.d.ts.map +1 -0
  149. package/esm/model/uri_scheme_map.js +66 -0
  150. package/esm/parser/attributes.d.ts.map +1 -1
  151. package/esm/parser/attributes.js +10 -16
  152. package/esm/parser/body_tokens.d.ts +35 -0
  153. package/esm/parser/body_tokens.d.ts.map +1 -0
  154. package/esm/parser/body_tokens.js +232 -0
  155. package/esm/parser/glossary.d.ts +51 -0
  156. package/esm/parser/glossary.d.ts.map +1 -0
  157. package/esm/parser/glossary.js +219 -0
  158. package/esm/parser/grammars.d.ts +5 -3
  159. package/esm/parser/grammars.d.ts.map +1 -1
  160. package/esm/parser/grammars.js +12 -4
  161. package/esm/parser/language_spec.d.ts +55 -0
  162. package/esm/parser/language_spec.d.ts.map +1 -0
  163. package/esm/parser/language_spec.js +419 -0
  164. package/esm/parser/line_map.d.ts +60 -0
  165. package/esm/parser/line_map.d.ts.map +1 -0
  166. package/esm/parser/line_map.js +41 -0
  167. package/esm/parser/markdown.d.ts +9 -0
  168. package/esm/parser/markdown.d.ts.map +1 -1
  169. package/esm/parser/markdown.js +317 -25
  170. package/esm/parser/mod.d.ts +5 -0
  171. package/esm/parser/mod.d.ts.map +1 -1
  172. package/esm/parser/mod.js +31 -8
  173. package/esm/parser/source.d.ts +53 -2
  174. package/esm/parser/source.d.ts.map +1 -1
  175. package/esm/parser/source.js +158 -68
  176. package/esm/parser/translate.d.ts +24 -0
  177. package/esm/parser/translate.d.ts.map +1 -0
  178. package/esm/parser/translate.js +99 -0
  179. package/esm/profile/chain.d.ts +8 -0
  180. package/esm/profile/chain.d.ts.map +1 -1
  181. package/esm/profile/chain.js +32 -14
  182. package/esm/profile/colors.js +1 -1
  183. package/esm/profile/default_profile.d.ts +25 -0
  184. package/esm/profile/default_profile.d.ts.map +1 -0
  185. package/esm/profile/default_profile.js +43 -0
  186. package/esm/profile/discipline_mode.d.ts +64 -0
  187. package/esm/profile/discipline_mode.d.ts.map +1 -0
  188. package/esm/profile/discipline_mode.js +133 -0
  189. package/esm/profile/discipline_registry.d.ts +41 -0
  190. package/esm/profile/discipline_registry.d.ts.map +1 -0
  191. package/esm/profile/discipline_registry.js +67 -0
  192. package/esm/profile/introspect.d.ts +135 -0
  193. package/esm/profile/introspect.d.ts.map +1 -0
  194. package/esm/profile/introspect.js +378 -0
  195. package/esm/profile/load.d.ts +3 -1
  196. package/esm/profile/load.d.ts.map +1 -1
  197. package/esm/profile/load.js +91 -5
  198. package/esm/profile/manifest.d.ts.map +1 -1
  199. package/esm/profile/manifest.js +512 -90
  200. package/esm/profile/merge.d.ts.map +1 -1
  201. package/esm/profile/merge.js +251 -39
  202. package/esm/profile/mod.d.ts +4 -4
  203. package/esm/profile/mod.d.ts.map +1 -1
  204. package/esm/profile/mod.js +7 -2
  205. package/esm/reporter/mod.js +4 -4
  206. package/esm/sync/locked_attributes.d.ts +19 -0
  207. package/esm/sync/locked_attributes.d.ts.map +1 -0
  208. package/esm/sync/locked_attributes.js +27 -0
  209. package/esm/sync/log.d.ts +34 -0
  210. package/esm/sync/log.d.ts.map +1 -0
  211. package/esm/sync/log.js +48 -0
  212. package/esm/sync/mapping.d.ts +66 -0
  213. package/esm/sync/mapping.d.ts.map +1 -0
  214. package/esm/sync/mapping.js +165 -0
  215. package/esm/sync/mod.d.ts +16 -0
  216. package/esm/sync/mod.d.ts.map +1 -0
  217. package/esm/sync/mod.js +12 -0
  218. package/esm/sync/status.d.ts +23 -0
  219. package/esm/sync/status.d.ts.map +1 -0
  220. package/esm/sync/status.js +21 -0
  221. package/esm/typl/ast.d.ts +87 -0
  222. package/esm/typl/ast.d.ts.map +1 -0
  223. package/esm/typl/ast.js +21 -0
  224. package/esm/typl/bridge.d.ts +32 -0
  225. package/esm/typl/bridge.d.ts.map +1 -0
  226. package/esm/typl/bridge.js +27 -0
  227. package/esm/typl/bullet.d.ts +34 -0
  228. package/esm/typl/bullet.d.ts.map +1 -0
  229. package/esm/typl/bullet.js +44 -0
  230. package/esm/typl/diagnostics.d.ts +43 -0
  231. package/esm/typl/diagnostics.d.ts.map +1 -0
  232. package/esm/typl/diagnostics.js +61 -0
  233. package/esm/typl/fence.d.ts +31 -0
  234. package/esm/typl/fence.d.ts.map +1 -0
  235. package/esm/typl/fence.js +24 -0
  236. package/esm/typl/grammar.d.ts +20 -0
  237. package/esm/typl/grammar.d.ts.map +1 -0
  238. package/esm/typl/grammar.js +471 -0
  239. package/esm/typl/inline.d.ts +34 -0
  240. package/esm/typl/inline.d.ts.map +1 -0
  241. package/esm/typl/inline.js +48 -0
  242. package/esm/typl/lexer.d.ts +37 -0
  243. package/esm/typl/lexer.d.ts.map +1 -0
  244. package/esm/typl/lexer.js +234 -0
  245. package/esm/typl/mod.d.ts +23 -0
  246. package/esm/typl/mod.d.ts.map +1 -0
  247. package/esm/typl/mod.js +16 -0
  248. package/esm/typl/registry.d.ts +42 -0
  249. package/esm/typl/registry.d.ts.map +1 -0
  250. package/esm/typl/registry.js +26 -0
  251. package/esm/typl/validator.d.ts +29 -0
  252. package/esm/typl/validator.d.ts.map +1 -0
  253. package/esm/typl/validator.js +141 -0
  254. package/esm/util/fence.d.ts +30 -0
  255. package/esm/util/fence.d.ts.map +1 -0
  256. package/esm/util/fence.js +40 -0
  257. package/esm/util/line_endings.d.ts +33 -0
  258. package/esm/util/line_endings.d.ts.map +1 -0
  259. package/esm/util/line_endings.js +53 -0
  260. package/esm/util/modals.d.ts +29 -0
  261. package/esm/util/modals.d.ts.map +1 -0
  262. package/esm/util/modals.js +38 -0
  263. package/esm/validator/attributes.d.ts +3 -3
  264. package/esm/validator/attributes.d.ts.map +1 -1
  265. package/esm/validator/attributes.js +1 -18
  266. package/esm/validator/body_blocks.d.ts +38 -0
  267. package/esm/validator/body_blocks.d.ts.map +1 -0
  268. package/esm/validator/body_blocks.js +218 -0
  269. package/esm/validator/caption_convention.d.ts +29 -0
  270. package/esm/validator/caption_convention.d.ts.map +1 -0
  271. package/esm/validator/caption_convention.js +58 -0
  272. package/esm/validator/captions.d.ts +22 -0
  273. package/esm/validator/captions.d.ts.map +1 -0
  274. package/esm/validator/captions.js +137 -0
  275. package/esm/validator/component_schemes.d.ts +73 -0
  276. package/esm/validator/component_schemes.d.ts.map +1 -0
  277. package/esm/validator/component_schemes.js +375 -0
  278. package/esm/validator/discipline.d.ts +35 -0
  279. package/esm/validator/discipline.d.ts.map +1 -0
  280. package/esm/validator/discipline.js +204 -0
  281. package/esm/validator/feature_ac.d.ts +28 -0
  282. package/esm/validator/feature_ac.d.ts.map +1 -0
  283. package/esm/validator/feature_ac.js +102 -0
  284. package/esm/validator/listing.d.ts +42 -0
  285. package/esm/validator/listing.d.ts.map +1 -0
  286. package/esm/validator/listing.js +295 -0
  287. package/esm/validator/mod.d.ts +3 -1
  288. package/esm/validator/mod.d.ts.map +1 -1
  289. package/esm/validator/mod.js +275 -13
  290. package/esm/validator/modal_keywords.d.ts +25 -0
  291. package/esm/validator/modal_keywords.d.ts.map +1 -0
  292. package/esm/validator/modal_keywords.js +54 -0
  293. package/esm/validator/pattern.d.ts +15 -8
  294. package/esm/validator/pattern.d.ts.map +1 -1
  295. package/esm/validator/pattern.js +42 -19
  296. package/esm/validator/per_type_attrs.d.ts +29 -0
  297. package/esm/validator/per_type_attrs.d.ts.map +1 -0
  298. package/esm/validator/per_type_attrs.js +75 -0
  299. package/esm/validator/pipeline.d.ts +18 -2
  300. package/esm/validator/pipeline.d.ts.map +1 -1
  301. package/esm/validator/pipeline.js +76 -21
  302. package/esm/validator/trace_types.d.ts +26 -0
  303. package/esm/validator/trace_types.d.ts.map +1 -0
  304. package/esm/validator/trace_types.js +232 -0
  305. package/esm/validator/traceability.d.ts +3 -4
  306. package/esm/validator/traceability.d.ts.map +1 -1
  307. package/esm/validator/traceability.js +5 -10
  308. package/esm/validator/type_resolution.d.ts +67 -0
  309. package/esm/validator/type_resolution.d.ts.map +1 -0
  310. package/esm/validator/type_resolution.js +162 -0
  311. package/esm/validator/types.d.ts +45 -0
  312. package/esm/validator/types.d.ts.map +1 -1
  313. package/esm/validator/types.js +128 -16
  314. package/esm/validator/value_types.d.ts +8 -0
  315. package/esm/validator/value_types.d.ts.map +1 -1
  316. package/esm/validator/value_types.js +8 -1
  317. package/package.json +2 -2
  318. package/script/ast/build.d.ts +60 -0
  319. package/script/ast/build.d.ts.map +1 -0
  320. package/script/ast/build.js +521 -0
  321. package/script/ast/equivalence.d.ts +18 -0
  322. package/script/ast/equivalence.d.ts.map +1 -0
  323. package/script/ast/equivalence.js +59 -0
  324. package/script/ast/nodes.d.ts +189 -0
  325. package/script/ast/nodes.d.ts.map +1 -0
  326. package/script/ast/nodes.js +18 -0
  327. package/script/ast/normalize.d.ts +58 -0
  328. package/script/ast/normalize.d.ts.map +1 -0
  329. package/script/ast/normalize.js +200 -0
  330. package/script/ast/render.d.ts +34 -0
  331. package/script/ast/render.d.ts.map +1 -0
  332. package/script/ast/render.js +218 -0
  333. package/script/compiler/constants.d.ts +16 -0
  334. package/script/compiler/constants.d.ts.map +1 -0
  335. package/script/compiler/constants.js +29 -0
  336. package/script/compiler/discipline_classifier.d.ts +55 -0
  337. package/script/compiler/discipline_classifier.d.ts.map +1 -0
  338. package/script/compiler/discipline_classifier.js +196 -0
  339. package/script/compiler/inverses.d.ts +2 -1
  340. package/script/compiler/inverses.d.ts.map +1 -1
  341. package/script/compiler/inverses.js +33 -14
  342. package/script/compiler/manifest.d.ts +59 -0
  343. package/script/compiler/manifest.d.ts.map +1 -0
  344. package/script/compiler/manifest.js +51 -0
  345. package/script/compiler/mod.d.ts +38 -1
  346. package/script/compiler/mod.d.ts.map +1 -1
  347. package/script/compiler/mod.js +206 -54
  348. package/script/compiler/ndjson_writer.d.ts +50 -0
  349. package/script/compiler/ndjson_writer.d.ts.map +1 -0
  350. package/script/compiler/ndjson_writer.js +78 -0
  351. package/script/compiler/schema.d.ts +33 -1
  352. package/script/compiler/schema.d.ts.map +1 -1
  353. package/script/compiler/schema.js +30 -8
  354. package/script/config/markspec.d.ts +5 -0
  355. package/script/config/markspec.d.ts.map +1 -1
  356. package/script/config/markspec.js +17 -2
  357. package/script/config/mod.d.ts.map +1 -1
  358. package/script/config/mod.js +54 -0
  359. package/script/formatter/mod.d.ts +55 -4
  360. package/script/formatter/mod.d.ts.map +1 -1
  361. package/script/formatter/mod.js +426 -46
  362. package/script/formatter/synth_ulid.d.ts +21 -0
  363. package/script/formatter/synth_ulid.d.ts.map +1 -0
  364. package/script/formatter/synth_ulid.js +67 -0
  365. package/script/lexicons/loader.d.ts +35 -0
  366. package/script/lexicons/loader.d.ts.map +1 -0
  367. package/script/lexicons/loader.js +55 -0
  368. package/script/lexicons/mod.d.ts +13 -0
  369. package/script/lexicons/mod.d.ts.map +1 -0
  370. package/script/lexicons/mod.js +17 -0
  371. package/script/lint/glossary.d.ts +45 -0
  372. package/script/lint/glossary.d.ts.map +1 -0
  373. package/script/lint/glossary.js +88 -0
  374. package/script/lint/mod.d.ts +14 -0
  375. package/script/lint/mod.d.ts.map +1 -0
  376. package/script/lint/mod.js +17 -0
  377. package/script/lint/range_util.d.ts +25 -0
  378. package/script/lint/range_util.d.ts.map +1 -0
  379. package/script/lint/range_util.js +53 -0
  380. package/script/lint/rules/ears.d.ts +39 -0
  381. package/script/lint/rules/ears.d.ts.map +1 -0
  382. package/script/lint/rules/ears.js +320 -0
  383. package/script/lint/rules/incose_sentence.d.ts +46 -0
  384. package/script/lint/rules/incose_sentence.d.ts.map +1 -0
  385. package/script/lint/rules/incose_sentence.js +421 -0
  386. package/script/lint/rules/lexicon.d.ts +24 -0
  387. package/script/lint/rules/lexicon.d.ts.map +1 -0
  388. package/script/lint/rules/lexicon.js +240 -0
  389. package/script/lint/rules/modal_sentence.d.ts +46 -0
  390. package/script/lint/rules/modal_sentence.d.ts.map +1 -0
  391. package/script/lint/rules/modal_sentence.js +150 -0
  392. package/script/lint/rules/passive.d.ts +64 -0
  393. package/script/lint/rules/passive.d.ts.map +1 -0
  394. package/script/lint/rules/passive.js +286 -0
  395. package/script/lint/rules/struct.d.ts +17 -0
  396. package/script/lint/rules/struct.d.ts.map +1 -0
  397. package/script/lint/rules/struct.js +59 -0
  398. package/script/lint/rules/suppression.d.ts +54 -0
  399. package/script/lint/rules/suppression.d.ts.map +1 -0
  400. package/script/lint/rules/suppression.js +136 -0
  401. package/script/lint/rules/xref.d.ts +19 -0
  402. package/script/lint/rules/xref.d.ts.map +1 -0
  403. package/script/lint/rules/xref.js +251 -0
  404. package/script/lint/runner.d.ts +59 -0
  405. package/script/lint/runner.d.ts.map +1 -0
  406. package/script/lint/runner.js +157 -0
  407. package/script/lint/score.d.ts +64 -0
  408. package/script/lint/score.d.ts.map +1 -0
  409. package/script/lint/score.js +167 -0
  410. package/script/lint/segmenter.d.ts +32 -0
  411. package/script/lint/segmenter.d.ts.map +1 -0
  412. package/script/lint/segmenter.js +82 -0
  413. package/script/lint/types.d.ts +31 -0
  414. package/script/lint/types.d.ts.map +1 -0
  415. package/script/lint/types.js +10 -0
  416. package/script/lock/canonical_edges.d.ts +31 -0
  417. package/script/lock/canonical_edges.d.ts.map +1 -0
  418. package/script/lock/canonical_edges.js +61 -0
  419. package/script/lock/check.d.ts +24 -0
  420. package/script/lock/check.d.ts.map +1 -0
  421. package/script/lock/check.js +130 -0
  422. package/script/lock/hash.d.ts +12 -0
  423. package/script/lock/hash.d.ts.map +1 -0
  424. package/script/lock/hash.js +36 -0
  425. package/script/lock/mod.d.ts +19 -0
  426. package/script/lock/mod.d.ts.map +1 -0
  427. package/script/lock/mod.js +31 -0
  428. package/script/lock/model.d.ts +81 -0
  429. package/script/lock/model.d.ts.map +1 -0
  430. package/script/lock/model.js +10 -0
  431. package/script/lock/parser.d.ts +26 -0
  432. package/script/lock/parser.d.ts.map +1 -0
  433. package/script/lock/parser.js +198 -0
  434. package/script/lock/resolve.d.ts +142 -0
  435. package/script/lock/resolve.d.ts.map +1 -0
  436. package/script/lock/resolve.js +397 -0
  437. package/script/lock/serializer.d.ts +14 -0
  438. package/script/lock/serializer.d.ts.map +1 -0
  439. package/script/lock/serializer.js +107 -0
  440. package/script/mod.d.ts +28 -8
  441. package/script/mod.d.ts.map +1 -1
  442. package/script/mod.js +129 -32
  443. package/script/model/attributes.d.ts +6 -0
  444. package/script/model/attributes.d.ts.map +1 -1
  445. package/script/model/attributes.js +201 -3
  446. package/script/model/discipline.d.ts +53 -0
  447. package/script/model/discipline.d.ts.map +1 -0
  448. package/script/model/discipline.js +53 -0
  449. package/script/model/discriminating_attr.d.ts +33 -0
  450. package/script/model/discriminating_attr.d.ts.map +1 -0
  451. package/script/model/discriminating_attr.js +77 -0
  452. package/script/model/mod.d.ts +267 -14
  453. package/script/model/mod.d.ts.map +1 -1
  454. package/script/model/mod.js +111 -3
  455. package/script/model/profile.d.ts +102 -27
  456. package/script/model/profile.d.ts.map +1 -1
  457. package/script/model/source_introspection.d.ts +26 -0
  458. package/script/model/source_introspection.d.ts.map +1 -0
  459. package/script/model/source_introspection.js +80 -0
  460. package/script/model/type_hierarchy.d.ts +51 -0
  461. package/script/model/type_hierarchy.d.ts.map +1 -0
  462. package/script/model/type_hierarchy.js +130 -0
  463. package/script/model/uri_scheme_map.d.ts +21 -0
  464. package/script/model/uri_scheme_map.d.ts.map +1 -0
  465. package/script/model/uri_scheme_map.js +69 -0
  466. package/script/parser/attributes.d.ts.map +1 -1
  467. package/script/parser/attributes.js +10 -16
  468. package/script/parser/body_tokens.d.ts +35 -0
  469. package/script/parser/body_tokens.d.ts.map +1 -0
  470. package/script/parser/body_tokens.js +235 -0
  471. package/script/parser/glossary.d.ts +51 -0
  472. package/script/parser/glossary.d.ts.map +1 -0
  473. package/script/parser/glossary.js +224 -0
  474. package/script/parser/grammars.d.ts +5 -3
  475. package/script/parser/grammars.d.ts.map +1 -1
  476. package/script/parser/grammars.js +15 -8
  477. package/script/parser/language_spec.d.ts +55 -0
  478. package/script/parser/language_spec.d.ts.map +1 -0
  479. package/script/parser/language_spec.js +423 -0
  480. package/script/parser/line_map.d.ts +60 -0
  481. package/script/parser/line_map.d.ts.map +1 -0
  482. package/script/parser/line_map.js +44 -0
  483. package/script/parser/markdown.d.ts +9 -0
  484. package/script/parser/markdown.d.ts.map +1 -1
  485. package/script/parser/markdown.js +315 -23
  486. package/script/parser/mod.d.ts +5 -0
  487. package/script/parser/mod.d.ts.map +1 -1
  488. package/script/parser/mod.js +36 -7
  489. package/script/parser/source.d.ts +53 -2
  490. package/script/parser/source.d.ts.map +1 -1
  491. package/script/parser/source.js +159 -69
  492. package/script/parser/translate.d.ts +24 -0
  493. package/script/parser/translate.d.ts.map +1 -0
  494. package/script/parser/translate.js +102 -0
  495. package/script/profile/chain.d.ts +8 -0
  496. package/script/profile/chain.d.ts.map +1 -1
  497. package/script/profile/chain.js +32 -14
  498. package/script/profile/colors.js +1 -1
  499. package/script/profile/default_profile.d.ts +25 -0
  500. package/script/profile/default_profile.d.ts.map +1 -0
  501. package/script/profile/default_profile.js +46 -0
  502. package/script/profile/discipline_mode.d.ts +64 -0
  503. package/script/profile/discipline_mode.d.ts.map +1 -0
  504. package/script/profile/discipline_mode.js +138 -0
  505. package/script/profile/discipline_registry.d.ts +41 -0
  506. package/script/profile/discipline_registry.d.ts.map +1 -0
  507. package/script/profile/discipline_registry.js +70 -0
  508. package/script/profile/introspect.d.ts +135 -0
  509. package/script/profile/introspect.d.ts.map +1 -0
  510. package/script/profile/introspect.js +381 -0
  511. package/script/profile/load.d.ts +3 -1
  512. package/script/profile/load.d.ts.map +1 -1
  513. package/script/profile/load.js +91 -5
  514. package/script/profile/manifest.d.ts.map +1 -1
  515. package/script/profile/manifest.js +511 -89
  516. package/script/profile/merge.d.ts.map +1 -1
  517. package/script/profile/merge.js +251 -39
  518. package/script/profile/mod.d.ts +4 -4
  519. package/script/profile/mod.d.ts.map +1 -1
  520. package/script/profile/mod.js +12 -6
  521. package/script/reporter/mod.js +4 -4
  522. package/script/sync/locked_attributes.d.ts +19 -0
  523. package/script/sync/locked_attributes.d.ts.map +1 -0
  524. package/script/sync/locked_attributes.js +30 -0
  525. package/script/sync/log.d.ts +34 -0
  526. package/script/sync/log.d.ts.map +1 -0
  527. package/script/sync/log.js +52 -0
  528. package/script/sync/mapping.d.ts +66 -0
  529. package/script/sync/mapping.d.ts.map +1 -0
  530. package/script/sync/mapping.js +169 -0
  531. package/script/sync/mod.d.ts +16 -0
  532. package/script/sync/mod.d.ts.map +1 -0
  533. package/script/sync/mod.js +21 -0
  534. package/script/sync/status.d.ts +23 -0
  535. package/script/sync/status.d.ts.map +1 -0
  536. package/script/sync/status.js +24 -0
  537. package/script/typl/ast.d.ts +87 -0
  538. package/script/typl/ast.d.ts.map +1 -0
  539. package/script/typl/ast.js +24 -0
  540. package/script/typl/bridge.d.ts +32 -0
  541. package/script/typl/bridge.d.ts.map +1 -0
  542. package/script/typl/bridge.js +30 -0
  543. package/script/typl/bullet.d.ts +34 -0
  544. package/script/typl/bullet.d.ts.map +1 -0
  545. package/script/typl/bullet.js +47 -0
  546. package/script/typl/diagnostics.d.ts +43 -0
  547. package/script/typl/diagnostics.d.ts.map +1 -0
  548. package/script/typl/diagnostics.js +65 -0
  549. package/script/typl/fence.d.ts +31 -0
  550. package/script/typl/fence.d.ts.map +1 -0
  551. package/script/typl/fence.js +27 -0
  552. package/script/typl/grammar.d.ts +20 -0
  553. package/script/typl/grammar.d.ts.map +1 -0
  554. package/script/typl/grammar.js +474 -0
  555. package/script/typl/inline.d.ts +34 -0
  556. package/script/typl/inline.d.ts.map +1 -0
  557. package/script/typl/inline.js +51 -0
  558. package/script/typl/lexer.d.ts +37 -0
  559. package/script/typl/lexer.d.ts.map +1 -0
  560. package/script/typl/lexer.js +237 -0
  561. package/script/typl/mod.d.ts +23 -0
  562. package/script/typl/mod.d.ts.map +1 -0
  563. package/script/typl/mod.js +29 -0
  564. package/script/typl/registry.d.ts +42 -0
  565. package/script/typl/registry.d.ts.map +1 -0
  566. package/script/typl/registry.js +29 -0
  567. package/script/typl/validator.d.ts +29 -0
  568. package/script/typl/validator.d.ts.map +1 -0
  569. package/script/typl/validator.js +144 -0
  570. package/script/util/fence.d.ts +30 -0
  571. package/script/util/fence.d.ts.map +1 -0
  572. package/script/util/fence.js +44 -0
  573. package/script/util/line_endings.d.ts +33 -0
  574. package/script/util/line_endings.d.ts.map +1 -0
  575. package/script/util/line_endings.js +58 -0
  576. package/script/util/modals.d.ts +29 -0
  577. package/script/util/modals.d.ts.map +1 -0
  578. package/script/util/modals.js +42 -0
  579. package/script/validator/attributes.d.ts +3 -3
  580. package/script/validator/attributes.d.ts.map +1 -1
  581. package/script/validator/attributes.js +1 -18
  582. package/script/validator/body_blocks.d.ts +38 -0
  583. package/script/validator/body_blocks.d.ts.map +1 -0
  584. package/script/validator/body_blocks.js +221 -0
  585. package/script/validator/caption_convention.d.ts +29 -0
  586. package/script/validator/caption_convention.d.ts.map +1 -0
  587. package/script/validator/caption_convention.js +61 -0
  588. package/script/validator/captions.d.ts +22 -0
  589. package/script/validator/captions.d.ts.map +1 -0
  590. package/script/validator/captions.js +140 -0
  591. package/script/validator/component_schemes.d.ts +73 -0
  592. package/script/validator/component_schemes.d.ts.map +1 -0
  593. package/script/validator/component_schemes.js +384 -0
  594. package/script/validator/discipline.d.ts +35 -0
  595. package/script/validator/discipline.d.ts.map +1 -0
  596. package/script/validator/discipline.js +207 -0
  597. package/script/validator/feature_ac.d.ts +28 -0
  598. package/script/validator/feature_ac.d.ts.map +1 -0
  599. package/script/validator/feature_ac.js +105 -0
  600. package/script/validator/listing.d.ts +42 -0
  601. package/script/validator/listing.d.ts.map +1 -0
  602. package/script/validator/listing.js +298 -0
  603. package/script/validator/mod.d.ts +3 -1
  604. package/script/validator/mod.d.ts.map +1 -1
  605. package/script/validator/mod.js +278 -14
  606. package/script/validator/modal_keywords.d.ts +25 -0
  607. package/script/validator/modal_keywords.d.ts.map +1 -0
  608. package/script/validator/modal_keywords.js +57 -0
  609. package/script/validator/pattern.d.ts +15 -8
  610. package/script/validator/pattern.d.ts.map +1 -1
  611. package/script/validator/pattern.js +42 -19
  612. package/script/validator/per_type_attrs.d.ts +29 -0
  613. package/script/validator/per_type_attrs.d.ts.map +1 -0
  614. package/script/validator/per_type_attrs.js +78 -0
  615. package/script/validator/pipeline.d.ts +18 -2
  616. package/script/validator/pipeline.d.ts.map +1 -1
  617. package/script/validator/pipeline.js +78 -22
  618. package/script/validator/trace_types.d.ts +26 -0
  619. package/script/validator/trace_types.d.ts.map +1 -0
  620. package/script/validator/trace_types.js +235 -0
  621. package/script/validator/traceability.d.ts +3 -4
  622. package/script/validator/traceability.d.ts.map +1 -1
  623. package/script/validator/traceability.js +5 -10
  624. package/script/validator/type_resolution.d.ts +67 -0
  625. package/script/validator/type_resolution.d.ts.map +1 -0
  626. package/script/validator/type_resolution.js +168 -0
  627. package/script/validator/types.d.ts +45 -0
  628. package/script/validator/types.d.ts.map +1 -1
  629. package/script/validator/types.js +131 -16
  630. package/script/validator/value_types.d.ts +8 -0
  631. package/script/validator/value_types.d.ts.map +1 -1
  632. package/script/validator/value_types.js +10 -2
@@ -4,9 +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";
8
- import { collateAttributes, parseAttributes, splitBodyAndAttributes, } from "./attributes.js";
7
+ import { IDENTITY_KEY, makeDisplayId, shapeFromIdValue } from "../model/mod.js";
8
+ import { ATTR_LINE_RE, collateAttributes, parseAttributes, splitBodyAndAttributes, } from "./attributes.js";
9
+ import { extractBodyTokens } from "./body_tokens.js";
9
10
  import { processor } from "./remark.js";
11
+ import { buildBodyAstWithTree } from "../ast/build.js";
12
+ import { translateEntryLocations } from "./translate.js";
13
+ import { bridgeTyplDiagnostic, extractTyplBullets, extractTyplFences, extractTyplInlines, parseTyplBlock, } from "../typl/mod.js";
10
14
  /**
11
15
  * Slug pattern for referenced-entry display IDs.
12
16
  *
@@ -17,6 +21,10 @@ import { processor } from "./remark.js";
17
21
  const SLUG_RE = /^[A-Za-z]([A-Za-z0-9._/-]*[A-Za-z0-9])?$/;
18
22
  /** Match `[...]` at the start of a list item paragraph. Captures: [1] = display ID, [2] = title. */
19
23
  const ENTRY_START_RE = /^\[([^\]]+)\]\s*(.*)$/;
24
+ /** Match `[]` at the start — empty brackets. */
25
+ const EMPTY_BRACKET_RE = /^\[\]\s*(.*)$/;
26
+ /** Match `[` at the start without a closing `]` on the same logical content — unterminated. */
27
+ const UNTERMINATED_BRACKET_RE = /^\[[^\]]*$/;
20
28
  /**
21
29
  * Find the `Id:` attribute on an entry. Returns undefined when absent. If
22
30
  * more than one `Id:` is present, returns the first — the validator flags
@@ -47,6 +55,9 @@ export function parseMarkdown(markdown, options) {
47
55
  const tree = processor.parse(markdown);
48
56
  const entries = [];
49
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");
50
61
  // Collect link definition identifiers for shortcut reference exclusion.
51
62
  const definitions = new Set(tree.children
52
63
  .filter((n) => n.type === "definition")
@@ -59,31 +70,32 @@ export function parseMarkdown(markdown, options) {
59
70
  if (list.ordered)
60
71
  continue;
61
72
  for (const item of list.children) {
62
- const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics);
73
+ const entry = extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, !!options?.lineMap);
63
74
  if (entry)
64
75
  entries.push(entry);
65
76
  }
66
77
  }
67
- return { entries, diagnostics };
78
+ const finalEntries = options?.lineMap
79
+ ? translateEntryLocations(entries, options.lineMap)
80
+ : entries;
81
+ return { entries: finalEntries, diagnostics };
68
82
  }
69
83
  /**
70
- * Detect if a file is a references document.
71
- * References context enables recognition of reference entries (slugs).
72
- * @param file - File path
73
- * @param explicit - Explicit override (undefined = auto-detect)
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.
74
89
  */
75
- function detectReferencesDocument(file, explicit) {
76
- if (explicit !== undefined)
77
- return explicit;
78
- const basename = file.split("/").pop() ?? "";
79
- return basename === "references.md" || file.includes("/references/");
90
+ function detectReferencesDocument(_file, explicit) {
91
+ return explicit ?? false;
80
92
  }
81
93
  /**
82
94
  * Attempt to extract a MarkSpec entry from a list item.
83
95
  * Returns undefined if the list item is not an entry block.
84
96
  * Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
85
97
  */
86
- function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics) {
98
+ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, hasLineMap = false) {
87
99
  // Task list items (remark-gfm sets checked to true/false) are not entries.
88
100
  if (item.checked != null)
89
101
  return undefined;
@@ -105,11 +117,36 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
105
117
  let title;
106
118
  if (firstInline.type === "text") {
107
119
  // remark may parse `[ID] Title` as a single text node
108
- const match = ENTRY_START_RE.exec(firstInline.value);
120
+ const textValue = firstInline.value;
121
+ const match = ENTRY_START_RE.exec(textValue);
109
122
  if (match) {
110
123
  displayId = match[1];
111
124
  title = match[2].trim();
112
125
  }
126
+ else if (EMPTY_BRACKET_RE.test(textValue)) {
127
+ // MSL-P001: bracketed content is empty — `- [] Title`
128
+ const entryLine = item.position?.start.line ?? 1;
129
+ diagnostics.push({
130
+ code: "MSL-P001",
131
+ severity: "error",
132
+ message: "list item starts with `[]` but the bracketed content is empty " +
133
+ "(spec section 4.1)",
134
+ location: { file, line: entryLine, column: 1 },
135
+ });
136
+ return undefined;
137
+ }
138
+ else if (UNTERMINATED_BRACKET_RE.test(textValue)) {
139
+ // MSL-P003: display-ID brackets unterminated (missing `]`)
140
+ const entryLine = item.position?.start.line ?? 1;
141
+ diagnostics.push({
142
+ code: "MSL-P003",
143
+ severity: "error",
144
+ message: "display-ID brackets unterminated -- missing `]` before end of " +
145
+ "title line (spec section 4.1)",
146
+ location: { file, line: entryLine, column: 1 },
147
+ });
148
+ return undefined;
149
+ }
113
150
  }
114
151
  // Try linkReference pattern: remark sometimes parses [ID] as a linkReference
115
152
  if (!displayId && firstInline.type === "linkReference") {
@@ -140,10 +177,168 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
140
177
  // citation compatibility. Canonical slug never contains `@`.
141
178
  if (displayId.startsWith("@"))
142
179
  displayId = displayId.slice(1);
180
+ // MSL-I005: Display ID is empty (after `@` stripping).
181
+ if (displayId.length === 0) {
182
+ const entryLine = item.position?.start.line ?? 1;
183
+ diagnostics.push({
184
+ code: "MSL-I005",
185
+ severity: "error",
186
+ message: "display ID is empty (spec section 4.2)",
187
+ location: { file, line: entryLine, column: 1 },
188
+ });
189
+ return undefined;
190
+ }
191
+ // MSL-P002: title text missing after `]`. The title capture is empty
192
+ // and was not populated from subsequent nodes (linkReference path sets
193
+ // title from rest nodes).
194
+ if (title !== undefined && title.length === 0) {
195
+ const entryLine = item.position?.start.line ?? 1;
196
+ diagnostics.push({
197
+ code: "MSL-P002",
198
+ severity: "error",
199
+ message: `${displayId}: title line missing title text after ']' (spec section 4.1)`,
200
+ location: { file, line: entryLine, column: 1 },
201
+ });
202
+ // Continue parsing — entry is still structurally valid for downstream
203
+ // validation (MSL-P010 also fires from the validator for empty titles).
204
+ }
143
205
  // Extract body content and attributes.
144
- const bodyContent = extractBodyContent(item, markdown);
206
+ const bodyContent = extractBodyContent(item, markdownLines);
145
207
  const [body, attrLines] = splitBodyAndAttributes(bodyContent);
146
208
  const attributes = parseAttributes(attrLines);
209
+ const { blocks: bodyAst, tree: mdastTree } = buildBodyAstWithTree(body);
210
+ const entryLine = item.position?.start.line ?? 1;
211
+ // MSL-P020: trailers block is not the final indented code block.
212
+ // Detect `Key: Value` lines in the body that likely should be trailers
213
+ // but are not at the final position (body content follows them).
214
+ // Exclude caption keywords (Figure:, Table:, etc.) which are legitimate
215
+ // body content, not misplaced trailer attributes.
216
+ const CAPTION_KEYWORDS = new Set([
217
+ "Figure",
218
+ "Table",
219
+ "Listing",
220
+ "Feature",
221
+ "Equation",
222
+ "List",
223
+ ]);
224
+ if (body.length > 0) {
225
+ const bodyLines = body.split("\n");
226
+ let inFencedBlock = false;
227
+ for (let i = 0; i < bodyLines.length; i++) {
228
+ const trimmed = bodyLines[i].trim();
229
+ // Track fenced code blocks (``` or ~~~) to skip their contents
230
+ if (/^(`{3,}|~{3,})/.test(trimmed)) {
231
+ inFencedBlock = !inFencedBlock;
232
+ continue;
233
+ }
234
+ if (inFencedBlock)
235
+ continue;
236
+ if (!ATTR_LINE_RE.test(trimmed))
237
+ continue;
238
+ // Extract the key portion to check against caption keywords
239
+ const keyMatch = trimmed.match(/^([A-Z][A-Za-z-]*):/);
240
+ if (keyMatch && CAPTION_KEYWORDS.has(keyMatch[1]))
241
+ continue;
242
+ // Found a Key: Value line in the body — non-final position
243
+ diagnostics.push({
244
+ code: "MSL-P020",
245
+ severity: "error",
246
+ message: `${displayId}: trailers block is not the final indented code ` +
247
+ `block of the entry -- content appears after trailer-like ` +
248
+ `lines (spec section 4.1)`,
249
+ location: { file, line: entryLine, column: 1 },
250
+ });
251
+ break; // One diagnostic per entry is sufficient
252
+ }
253
+ }
254
+ // MSL-P021 / MSL-P022: validate trailer lines for syntax correctness.
255
+ // The trailer block is the final indented code block. Lines within it
256
+ // should all match `Key: Value` syntax. We check both the parsed
257
+ // attrLines AND the trailing body lines that might be in a code block
258
+ // but failed ATTR_LINE_RE (thus stayed in the body).
259
+ const TRAILER_KEY_RE = /^[A-Za-z][A-Za-z0-9-]*$/;
260
+ const COLON_SPLIT_RE = /^([^:]+):\s*(.*)$/;
261
+ // Check lines that DID end up in attrLines but might have key issues
262
+ for (const rawLine of attrLines) {
263
+ const trimmed = rawLine.trim();
264
+ if (!trimmed)
265
+ continue;
266
+ if (!ATTR_LINE_RE.test(trimmed)) {
267
+ const colonMatch = COLON_SPLIT_RE.exec(trimmed);
268
+ if (colonMatch) {
269
+ const key = colonMatch[1].trim();
270
+ if (!TRAILER_KEY_RE.test(key)) {
271
+ diagnostics.push({
272
+ code: "MSL-P022",
273
+ severity: "error",
274
+ message: `${displayId}: trailer key '${key}' contains characters ` +
275
+ `outside [A-Za-z][A-Za-z0-9-]* (spec section 4.1)`,
276
+ location: { file, line: entryLine, column: 1 },
277
+ });
278
+ }
279
+ else {
280
+ diagnostics.push({
281
+ code: "MSL-P021",
282
+ severity: "error",
283
+ message: `${displayId}: trailer line does not match 'Key: Value' ` +
284
+ `syntax (spec section 4.1): "${trimmed}"`,
285
+ location: { file, line: entryLine, column: 1 },
286
+ });
287
+ }
288
+ }
289
+ else {
290
+ diagnostics.push({
291
+ code: "MSL-P021",
292
+ severity: "error",
293
+ message: `${displayId}: trailer line does not match 'Key: Value' ` +
294
+ `syntax (spec section 4.1): "${trimmed}"`,
295
+ location: { file, line: entryLine, column: 1 },
296
+ });
297
+ }
298
+ }
299
+ }
300
+ // Also scan trailing body lines for suspected misplaced trailers.
301
+ // If the body's last non-empty lines look like they belong to an
302
+ // indented code block with colon-separated content that has invalid
303
+ // keys, emit P022. Lines without colons that appear in what looks
304
+ // like a trailer block emit P021.
305
+ if (body.length > 0) {
306
+ const bodyLines = body.split("\n");
307
+ // Walk backward from the end of the body to find lines in a trailing
308
+ // code-block-like region that have colons (suspected trailers).
309
+ for (let i = bodyLines.length - 1; i >= 0; i--) {
310
+ const trimmed = bodyLines[i].trim();
311
+ if (!trimmed)
312
+ continue; // skip trailing blanks
313
+ const colonMatch = COLON_SPLIT_RE.exec(trimmed);
314
+ if (!colonMatch)
315
+ break; // stop at non-colon line
316
+ const key = colonMatch[1].trim();
317
+ if (ATTR_LINE_RE.test(trimmed)) {
318
+ // Valid attr line in body → already caught by P020
319
+ continue;
320
+ }
321
+ if (!TRAILER_KEY_RE.test(key)) {
322
+ diagnostics.push({
323
+ code: "MSL-P022",
324
+ severity: "error",
325
+ message: `${displayId}: trailer key '${key}' contains characters ` +
326
+ `outside [A-Za-z][A-Za-z0-9-]* (spec section 4.1)`,
327
+ location: { file, line: entryLine, column: 1 },
328
+ });
329
+ }
330
+ else if (colonMatch[2].trim().length === 0) {
331
+ diagnostics.push({
332
+ code: "MSL-P021",
333
+ severity: "error",
334
+ message: `${displayId}: trailer line does not match 'Key: Value' ` +
335
+ `syntax (spec section 4.1): "${trimmed}"`,
336
+ location: { file, line: entryLine, column: 1 },
337
+ });
338
+ }
339
+ break; // one diagnostic per trailing suspect line is sufficient
340
+ }
341
+ }
147
342
  // Detect legacy paragraph + trailing-backslash attribute form and warn.
148
343
  if (attributes.length > 0 &&
149
344
  attrLines.some((line) => line.trimEnd().endsWith("\\"))) {
@@ -167,45 +362,142 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
167
362
  // `Id:` is neither a ULID nor a scheme-qualified URI. Accept as an
168
363
  // identified entry so the validator can surface MSL-R004; missing
169
364
  // shape on a parsed entry is not useful downstream.
170
- shape = "identified";
365
+ shape = "Authored";
171
366
  }
172
367
  }
173
368
  else {
174
369
  // No `Id:`. Fall back on display-ID shape + document context to decide
175
370
  // whether to admit the entry at all.
176
371
  if (isReferencesDoc && SLUG_RE.test(displayId)) {
177
- shape = "referenced";
372
+ shape = "Reference";
178
373
  }
179
374
  else {
180
375
  // No identity attribute and no references-doc context — admit as
181
376
  // identified so the validator can surface the missing-`Id:` error.
182
- shape = "identified";
377
+ shape = "Authored";
183
378
  }
184
379
  }
185
380
  // Inferred type from display-ID prefix — left to the profile layer. For
186
381
  // now the core records no type; downstream profile-aware code populates
187
382
  // this field when a profile is loaded.
188
383
  const type = undefined;
384
+ // MSL-P030: Authored entry has no body block (title + trailers only).
385
+ // For Reference shape, body is optional (ADR-002 section Part 3). For Authored,
386
+ // the body is required. We also emit P030 when the body is empty (all
387
+ // content was consumed as attributes).
388
+ if (shape === "Authored" && body.trim().length === 0) {
389
+ diagnostics.push({
390
+ code: "MSL-P030",
391
+ severity: "error",
392
+ message: `${displayId}: Authored entry has no body block -- entries must ` +
393
+ `have body content between title and trailers (spec section 4.1)`,
394
+ location: { file, line: entryLine, column: 1 },
395
+ });
396
+ }
189
397
  // Body requirement: identified entries require a body; referenced entries
190
398
  // may omit it. If there's only one child (the title paragraph), admit
191
399
  // only referenced entries.
192
- if (shape !== "referenced" && item.children.length < 2)
400
+ if (shape !== "Reference" && item.children.length < 2)
193
401
  return undefined;
194
402
  // Source location
195
403
  const line = item.position?.start.line ?? 1;
196
404
  const column = item.position?.start.column ?? 1;
405
+ const entryLocation = { file, line, column };
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, {
431
+ file,
432
+ line: bodyStartLine,
433
+ column: 1,
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
+ }
197
485
  return {
198
- displayId,
486
+ displayId: makeDisplayId(displayId),
199
487
  title: title ?? "",
200
488
  body,
489
+ bodyAst,
201
490
  rawAttributes: attributes,
202
491
  typedAttributes: collateAttributes(attributes),
203
492
  id,
204
493
  type,
205
494
  shape,
206
- location: { file, line, column },
207
- source: "markdown",
495
+ location: entryLocation,
496
+ bodyStartLine,
497
+ source: { kind: "markdown" },
208
498
  properties: { file: { path: file, line, column } },
499
+ bodyTokens,
500
+ ...(types ? { types } : {}),
209
501
  };
210
502
  }
211
503
  /**
@@ -213,12 +505,12 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
213
505
  * which contains the display ID and title).
214
506
  *
215
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.
216
509
  */
217
- function extractBodyContent(item, markdown) {
510
+ function extractBodyContent(item, lines) {
218
511
  const children = item.children.slice(1); // Skip title paragraph
219
512
  if (!children.length)
220
513
  return "";
221
- const lines = markdown.split("\n");
222
514
  // Get the range from the second child's start to the last child's end
223
515
  const startLine = children[0].position?.start.line;
224
516
  const endLine = children[children.length - 1].position?.end.line;
@@ -20,7 +20,12 @@ export { detectInlineRefs } from "./references.js";
20
20
  export type { DetectInlineRefsOptions } from "./references.js";
21
21
  export { parseSource } from "./source.js";
22
22
  export type { ParseSourceOptions, ParseSourceResult } from "./source.js";
23
+ export { stripBlockCommentPrefix, stripLineCommentPrefix, wrapAsListItem, } from "./source.js";
23
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";
24
29
  /** Options for {@linkcode parse}. */
25
30
  export interface ParseOptions {
26
31
  /** File path used in source locations. */
@@ -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;AAK5E,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAE,g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C,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";
@@ -19,7 +20,10 @@ export { detectDirectives } from "./directives.js";
19
20
  export { extractFrontMatter } from "./frontmatter.js";
20
21
  export { detectInlineRefs } from "./references.js";
21
22
  export { parseSource } from "./source.js";
23
+ export { stripBlockCommentPrefix, stripLineCommentPrefix, wrapAsListItem, } from "./source.js";
22
24
  export { isSupportedExtension, loadGrammar } from "./grammars.js";
25
+ export { buildBlockLineMap } from "./line_map.js";
26
+ export { LANGUAGE_SPECS, languageIdForExtension } from "./language_spec.js";
23
27
  /**
24
28
  * Parse a Markdown string and return all MarkSpec entries found.
25
29
  *
@@ -28,7 +32,12 @@ export { isSupportedExtension, loadGrammar } from "./grammars.js";
28
32
  * @returns Array of parsed entries
29
33
  */
30
34
  export function parse(markdown, options) {
31
- return parseMarkdown(markdown, options).entries;
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;
32
41
  }
33
42
  /**
34
43
  * Detect if a file is a references document.
@@ -36,8 +45,12 @@ export function parse(markdown, options) {
36
45
  * @param file - File path
37
46
  */
38
47
  function isReferencesDocument(file) {
39
- const basename = file.split("/").pop() ?? "";
40
- return basename === "references.md" || file.includes("/references/");
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);
41
54
  }
42
55
  /**
43
56
  * Parse a file and return entries, annotation links, and (for Markdown
@@ -49,16 +62,26 @@ function isReferencesDocument(file) {
49
62
  */
50
63
  export async function parseFile(content, options) {
51
64
  const ext = extname(options.file);
65
+ const normalised = normalizeLineEndings(content);
52
66
  if (isSupportedExtension(ext)) {
53
67
  const language = await loadGrammar(ext);
54
- const result = parseSource(content, {
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, {
55
77
  file: options.file,
56
78
  language,
79
+ languageId,
57
80
  });
58
81
  return { entries: result.entries, diagnostics: [] };
59
82
  }
60
- const fm = extractFrontMatter(content, { file: options.file });
61
- const body = fm.hadFrontMatter ? fm.markdown : content;
83
+ const fm = extractFrontMatter(normalised, { file: options.file });
84
+ const body = fm.hadFrontMatter ? fm.markdown : normalised;
62
85
  const isReferencesDoc = isReferencesDocument(options.file);
63
86
  const { entries, diagnostics: parseDiagnostics } = parseMarkdown(body, {
64
87
  file: options.file,
@@ -5,14 +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 Parser from "web-tree-sitter";
8
+ import type { Node as SyntaxNode } from "web-tree-sitter";
9
+ import { type Language } from "web-tree-sitter";
9
10
  import type { Entry } from "../model/mod.js";
11
+ import type { SupportedLanguage } from "./language_spec.js";
10
12
  /** Options for {@linkcode parseSource}. */
11
13
  export interface ParseSourceOptions {
12
14
  /** File path used in source locations. */
13
15
  readonly file?: string;
14
16
  /** Pre-loaded tree-sitter language grammar. */
15
- readonly language: Parser.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;
16
25
  }
17
26
  /** Result of parsing a source file. */
18
27
  export interface ParseSourceResult {
@@ -30,4 +39,46 @@ export interface ParseSourceResult {
30
39
  * @param options - Parse options (language grammar, file path)
31
40
  */
32
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
+ }
51
+ /**
52
+ * Strip the `///` or `//!` prefix from a line comment node.
53
+ * Uses the `doc_comment` child if available, otherwise strips manually.
54
+ */
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
+ }
68
+ /**
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`).
72
+ */
73
+ export declare function stripBlockCommentPrefix(text: string): BlockStripResult;
74
+ /**
75
+ * Wrap cleaned doc comment lines as a Markdown list item so the
76
+ * existing `parseMarkdown()` can extract entries.
77
+ *
78
+ * Doc comments use `[DISPLAY_ID] Title` without the `- ` bullet.
79
+ * This wraps to `- [DISPLAY_ID] Title\n\n body...` which parseMarkdown
80
+ * recognizes as an entry block.
81
+ */
82
+ export declare function wrapAsListItem(lines: string[]): string;
83
+ export {};
33
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;AAGH,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAG7C,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,0CAA0C;IAC1C,QAAQ,CAAC,IAAI,CAAC,EAAE,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