@driftsys/markspec 0.5.0 → 0.6.1

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 (484) hide show
  1. package/README.md +74 -20
  2. package/esm/ast/build.d.ts +11 -21
  3. package/esm/ast/build.d.ts.map +1 -1
  4. package/esm/ast/build.js +50 -139
  5. package/esm/ast/nodes.d.ts +11 -43
  6. package/esm/ast/nodes.d.ts.map +1 -1
  7. package/esm/ast/nodes.js +6 -1
  8. package/esm/ast/normalize.d.ts +8 -17
  9. package/esm/ast/normalize.d.ts.map +1 -1
  10. package/esm/ast/normalize.js +14 -72
  11. package/esm/compiler/constants.d.ts +16 -0
  12. package/esm/compiler/constants.d.ts.map +1 -0
  13. package/esm/compiler/constants.js +26 -0
  14. package/esm/compiler/discipline_classifier.d.ts +55 -0
  15. package/esm/compiler/discipline_classifier.d.ts.map +1 -0
  16. package/esm/compiler/discipline_classifier.js +191 -0
  17. package/esm/compiler/inverses.d.ts +7 -0
  18. package/esm/compiler/inverses.d.ts.map +1 -1
  19. package/esm/compiler/inverses.js +1 -18
  20. package/esm/compiler/mod.d.ts +30 -1
  21. package/esm/compiler/mod.d.ts.map +1 -1
  22. package/esm/compiler/mod.js +198 -65
  23. package/esm/compiler/schema.d.ts +15 -0
  24. package/esm/compiler/schema.d.ts.map +1 -1
  25. package/esm/compiler/schema.js +12 -0
  26. package/esm/config/markspec.d.ts +5 -0
  27. package/esm/config/markspec.d.ts.map +1 -1
  28. package/esm/config/markspec.js +17 -2
  29. package/esm/formatter/mod.d.ts +9 -3
  30. package/esm/formatter/mod.d.ts.map +1 -1
  31. package/esm/formatter/mod.js +97 -49
  32. package/esm/lexicons/loader.d.ts +35 -0
  33. package/esm/lexicons/loader.d.ts.map +1 -0
  34. package/esm/lexicons/loader.js +51 -0
  35. package/esm/lexicons/mod.d.ts +13 -0
  36. package/esm/lexicons/mod.d.ts.map +1 -0
  37. package/esm/lexicons/mod.js +12 -0
  38. package/esm/lint/glossary.d.ts +45 -0
  39. package/esm/lint/glossary.d.ts.map +1 -0
  40. package/esm/lint/glossary.js +85 -0
  41. package/esm/lint/mod.d.ts +4 -0
  42. package/esm/lint/mod.d.ts.map +1 -1
  43. package/esm/lint/mod.js +2 -0
  44. package/esm/lint/range_util.d.ts +25 -0
  45. package/esm/lint/range_util.d.ts.map +1 -0
  46. package/esm/lint/range_util.js +50 -0
  47. package/esm/lint/rules/ears.d.ts +39 -0
  48. package/esm/lint/rules/ears.d.ts.map +1 -0
  49. package/esm/lint/rules/ears.js +316 -0
  50. package/esm/lint/rules/incose_sentence.d.ts +46 -0
  51. package/esm/lint/rules/incose_sentence.d.ts.map +1 -0
  52. package/esm/lint/rules/incose_sentence.js +417 -0
  53. package/esm/lint/rules/modal_sentence.d.ts +46 -0
  54. package/esm/lint/rules/modal_sentence.d.ts.map +1 -0
  55. package/esm/lint/rules/modal_sentence.js +146 -0
  56. package/esm/lint/rules/passive.d.ts +64 -0
  57. package/esm/lint/rules/passive.d.ts.map +1 -0
  58. package/esm/lint/rules/passive.js +282 -0
  59. package/esm/lint/rules/suppression.d.ts +38 -3
  60. package/esm/lint/rules/suppression.d.ts.map +1 -1
  61. package/esm/lint/rules/suppression.js +58 -4
  62. package/esm/lint/rules/xref.d.ts +19 -0
  63. package/esm/lint/rules/xref.d.ts.map +1 -0
  64. package/esm/lint/rules/xref.js +248 -0
  65. package/esm/lint/runner.d.ts +31 -11
  66. package/esm/lint/runner.d.ts.map +1 -1
  67. package/esm/lint/runner.js +67 -26
  68. package/esm/lint/score.d.ts +64 -0
  69. package/esm/lint/score.d.ts.map +1 -0
  70. package/esm/lint/score.js +163 -0
  71. package/esm/lint/segmenter.d.ts +32 -0
  72. package/esm/lint/segmenter.d.ts.map +1 -0
  73. package/esm/lint/segmenter.js +79 -0
  74. package/esm/lint/types.d.ts +12 -0
  75. package/esm/lint/types.d.ts.map +1 -1
  76. package/esm/lock/canonical_edges.d.ts +31 -0
  77. package/esm/lock/canonical_edges.d.ts.map +1 -0
  78. package/esm/lock/canonical_edges.js +57 -0
  79. package/esm/lock/check.d.ts +24 -0
  80. package/esm/lock/check.d.ts.map +1 -0
  81. package/esm/lock/check.js +127 -0
  82. package/esm/lock/hash.d.ts +12 -0
  83. package/esm/lock/hash.d.ts.map +1 -0
  84. package/esm/lock/hash.js +32 -0
  85. package/esm/lock/mod.d.ts +19 -0
  86. package/esm/lock/mod.d.ts.map +1 -0
  87. package/esm/lock/mod.js +14 -0
  88. package/esm/lock/model.d.ts +81 -0
  89. package/esm/lock/model.d.ts.map +1 -0
  90. package/esm/lock/model.js +7 -0
  91. package/esm/lock/parser.d.ts +26 -0
  92. package/esm/lock/parser.d.ts.map +1 -0
  93. package/esm/lock/parser.js +195 -0
  94. package/esm/lock/resolve.d.ts +142 -0
  95. package/esm/lock/resolve.d.ts.map +1 -0
  96. package/esm/lock/resolve.js +389 -0
  97. package/esm/lock/serializer.d.ts +14 -0
  98. package/esm/lock/serializer.d.ts.map +1 -0
  99. package/esm/lock/serializer.js +104 -0
  100. package/esm/mod.d.ts +16 -9
  101. package/esm/mod.d.ts.map +1 -1
  102. package/esm/mod.js +12 -4
  103. package/esm/model/attributes.d.ts +6 -0
  104. package/esm/model/attributes.d.ts.map +1 -1
  105. package/esm/model/attributes.js +37 -0
  106. package/esm/model/discipline.d.ts +53 -0
  107. package/esm/model/discipline.d.ts.map +1 -0
  108. package/esm/model/discipline.js +50 -0
  109. package/esm/model/mod.d.ts +188 -30
  110. package/esm/model/mod.d.ts.map +1 -1
  111. package/esm/model/mod.js +42 -1
  112. package/esm/model/profile.d.ts +69 -0
  113. package/esm/model/profile.d.ts.map +1 -1
  114. package/esm/parser/attributes.d.ts.map +1 -1
  115. package/esm/parser/attributes.js +1 -10
  116. package/esm/parser/body_tokens.d.ts +35 -0
  117. package/esm/parser/body_tokens.d.ts.map +1 -0
  118. package/esm/parser/body_tokens.js +232 -0
  119. package/esm/parser/glossary.d.ts +8 -0
  120. package/esm/parser/glossary.d.ts.map +1 -1
  121. package/esm/parser/glossary.js +6 -4
  122. package/esm/parser/grammars.d.ts +5 -3
  123. package/esm/parser/grammars.d.ts.map +1 -1
  124. package/esm/parser/grammars.js +18 -4
  125. package/esm/parser/language_spec.d.ts +55 -0
  126. package/esm/parser/language_spec.d.ts.map +1 -0
  127. package/esm/parser/language_spec.js +419 -0
  128. package/esm/parser/line_map.d.ts +60 -0
  129. package/esm/parser/line_map.d.ts.map +1 -0
  130. package/esm/parser/line_map.js +41 -0
  131. package/esm/parser/markdown.d.ts +9 -0
  132. package/esm/parser/markdown.d.ts.map +1 -1
  133. package/esm/parser/markdown.js +97 -31
  134. package/esm/parser/mod.d.ts +4 -0
  135. package/esm/parser/mod.d.ts.map +1 -1
  136. package/esm/parser/mod.js +30 -8
  137. package/esm/parser/source.d.ts +39 -8
  138. package/esm/parser/source.d.ts.map +1 -1
  139. package/esm/parser/source.js +155 -65
  140. package/esm/parser/translate.d.ts +24 -0
  141. package/esm/parser/translate.d.ts.map +1 -0
  142. package/esm/parser/translate.js +99 -0
  143. package/esm/profile/chain.d.ts +8 -0
  144. package/esm/profile/chain.d.ts.map +1 -1
  145. package/esm/profile/chain.js +29 -1
  146. package/esm/profile/default_profile.d.ts +25 -0
  147. package/esm/profile/default_profile.d.ts.map +1 -0
  148. package/esm/profile/default_profile.js +43 -0
  149. package/esm/profile/discipline_mode.d.ts +64 -0
  150. package/esm/profile/discipline_mode.d.ts.map +1 -0
  151. package/esm/profile/discipline_mode.js +133 -0
  152. package/esm/profile/discipline_registry.d.ts +41 -0
  153. package/esm/profile/discipline_registry.d.ts.map +1 -0
  154. package/esm/profile/discipline_registry.js +67 -0
  155. package/esm/profile/load.d.ts +3 -1
  156. package/esm/profile/load.d.ts.map +1 -1
  157. package/esm/profile/load.js +24 -5
  158. package/esm/profile/manifest.d.ts.map +1 -1
  159. package/esm/profile/manifest.js +253 -20
  160. package/esm/profile/merge.d.ts.map +1 -1
  161. package/esm/profile/merge.js +112 -0
  162. package/esm/profile/mod.d.ts +2 -0
  163. package/esm/profile/mod.d.ts.map +1 -1
  164. package/esm/profile/mod.js +2 -0
  165. package/esm/sync/locked_attributes.d.ts +19 -0
  166. package/esm/sync/locked_attributes.d.ts.map +1 -0
  167. package/esm/sync/locked_attributes.js +27 -0
  168. package/esm/sync/log.d.ts +34 -0
  169. package/esm/sync/log.d.ts.map +1 -0
  170. package/esm/sync/log.js +48 -0
  171. package/esm/sync/mapping.d.ts +66 -0
  172. package/esm/sync/mapping.d.ts.map +1 -0
  173. package/esm/sync/mapping.js +165 -0
  174. package/esm/sync/mod.d.ts +16 -0
  175. package/esm/sync/mod.d.ts.map +1 -0
  176. package/esm/sync/mod.js +12 -0
  177. package/esm/sync/status.d.ts +23 -0
  178. package/esm/sync/status.d.ts.map +1 -0
  179. package/esm/sync/status.js +21 -0
  180. package/esm/typl/ast.d.ts +87 -0
  181. package/esm/typl/ast.d.ts.map +1 -0
  182. package/esm/typl/ast.js +21 -0
  183. package/esm/typl/bridge.d.ts +32 -0
  184. package/esm/typl/bridge.d.ts.map +1 -0
  185. package/esm/typl/bridge.js +27 -0
  186. package/esm/typl/bullet.d.ts +34 -0
  187. package/esm/typl/bullet.d.ts.map +1 -0
  188. package/esm/typl/bullet.js +44 -0
  189. package/esm/typl/diagnostics.d.ts +43 -0
  190. package/esm/typl/diagnostics.d.ts.map +1 -0
  191. package/esm/typl/diagnostics.js +61 -0
  192. package/esm/typl/fence.d.ts +31 -0
  193. package/esm/typl/fence.d.ts.map +1 -0
  194. package/esm/typl/fence.js +24 -0
  195. package/esm/typl/grammar.d.ts +20 -0
  196. package/esm/typl/grammar.d.ts.map +1 -0
  197. package/esm/typl/grammar.js +471 -0
  198. package/esm/typl/inline.d.ts +34 -0
  199. package/esm/typl/inline.d.ts.map +1 -0
  200. package/esm/typl/inline.js +48 -0
  201. package/esm/typl/lexer.d.ts +37 -0
  202. package/esm/typl/lexer.d.ts.map +1 -0
  203. package/esm/typl/lexer.js +234 -0
  204. package/esm/typl/mod.d.ts +23 -0
  205. package/esm/typl/mod.d.ts.map +1 -0
  206. package/esm/typl/mod.js +16 -0
  207. package/esm/typl/registry.d.ts +42 -0
  208. package/esm/typl/registry.d.ts.map +1 -0
  209. package/esm/typl/registry.js +26 -0
  210. package/esm/typl/validator.d.ts +29 -0
  211. package/esm/typl/validator.d.ts.map +1 -0
  212. package/esm/typl/validator.js +141 -0
  213. package/esm/util/line_endings.d.ts +33 -0
  214. package/esm/util/line_endings.d.ts.map +1 -0
  215. package/esm/util/line_endings.js +53 -0
  216. package/esm/util/modals.d.ts +29 -0
  217. package/esm/util/modals.d.ts.map +1 -0
  218. package/esm/util/modals.js +38 -0
  219. package/esm/validator/discipline.d.ts +35 -0
  220. package/esm/validator/discipline.d.ts.map +1 -0
  221. package/esm/validator/discipline.js +204 -0
  222. package/esm/validator/mod.d.ts +1 -1
  223. package/esm/validator/mod.d.ts.map +1 -1
  224. package/esm/validator/mod.js +23 -2
  225. package/esm/validator/modal_keywords.d.ts +15 -13
  226. package/esm/validator/modal_keywords.d.ts.map +1 -1
  227. package/esm/validator/modal_keywords.js +26 -109
  228. package/esm/validator/pattern.d.ts +15 -8
  229. package/esm/validator/pattern.d.ts.map +1 -1
  230. package/esm/validator/pattern.js +42 -19
  231. package/esm/validator/per_type_attrs.d.ts +2 -2
  232. package/esm/validator/per_type_attrs.d.ts.map +1 -1
  233. package/esm/validator/per_type_attrs.js +2 -2
  234. package/esm/validator/pipeline.d.ts +11 -0
  235. package/esm/validator/pipeline.d.ts.map +1 -1
  236. package/esm/validator/pipeline.js +37 -15
  237. package/esm/validator/type_resolution.d.ts +3 -3
  238. package/esm/validator/type_resolution.d.ts.map +1 -1
  239. package/esm/validator/type_resolution.js +31 -9
  240. package/package.json +2 -2
  241. package/script/ast/build.d.ts +11 -21
  242. package/script/ast/build.d.ts.map +1 -1
  243. package/script/ast/build.js +51 -140
  244. package/script/ast/nodes.d.ts +11 -43
  245. package/script/ast/nodes.d.ts.map +1 -1
  246. package/script/ast/nodes.js +6 -1
  247. package/script/ast/normalize.d.ts +8 -17
  248. package/script/ast/normalize.d.ts.map +1 -1
  249. package/script/ast/normalize.js +16 -74
  250. package/script/compiler/constants.d.ts +16 -0
  251. package/script/compiler/constants.d.ts.map +1 -0
  252. package/script/compiler/constants.js +29 -0
  253. package/script/compiler/discipline_classifier.d.ts +55 -0
  254. package/script/compiler/discipline_classifier.d.ts.map +1 -0
  255. package/script/compiler/discipline_classifier.js +196 -0
  256. package/script/compiler/inverses.d.ts +7 -0
  257. package/script/compiler/inverses.d.ts.map +1 -1
  258. package/script/compiler/inverses.js +2 -19
  259. package/script/compiler/mod.d.ts +30 -1
  260. package/script/compiler/mod.d.ts.map +1 -1
  261. package/script/compiler/mod.js +202 -69
  262. package/script/compiler/schema.d.ts +15 -0
  263. package/script/compiler/schema.d.ts.map +1 -1
  264. package/script/compiler/schema.js +12 -0
  265. package/script/config/markspec.d.ts +5 -0
  266. package/script/config/markspec.d.ts.map +1 -1
  267. package/script/config/markspec.js +17 -2
  268. package/script/formatter/mod.d.ts +9 -3
  269. package/script/formatter/mod.d.ts.map +1 -1
  270. package/script/formatter/mod.js +99 -51
  271. package/script/lexicons/loader.d.ts +35 -0
  272. package/script/lexicons/loader.d.ts.map +1 -0
  273. package/script/lexicons/loader.js +55 -0
  274. package/script/lexicons/mod.d.ts +13 -0
  275. package/script/lexicons/mod.d.ts.map +1 -0
  276. package/script/lexicons/mod.js +17 -0
  277. package/script/lint/glossary.d.ts +45 -0
  278. package/script/lint/glossary.d.ts.map +1 -0
  279. package/script/lint/glossary.js +88 -0
  280. package/script/lint/mod.d.ts +4 -0
  281. package/script/lint/mod.d.ts.map +1 -1
  282. package/script/lint/mod.js +6 -1
  283. package/script/lint/range_util.d.ts +25 -0
  284. package/script/lint/range_util.d.ts.map +1 -0
  285. package/script/lint/range_util.js +53 -0
  286. package/script/lint/rules/ears.d.ts +39 -0
  287. package/script/lint/rules/ears.d.ts.map +1 -0
  288. package/script/lint/rules/ears.js +320 -0
  289. package/script/lint/rules/incose_sentence.d.ts +46 -0
  290. package/script/lint/rules/incose_sentence.d.ts.map +1 -0
  291. package/script/lint/rules/incose_sentence.js +421 -0
  292. package/script/lint/rules/modal_sentence.d.ts +46 -0
  293. package/script/lint/rules/modal_sentence.d.ts.map +1 -0
  294. package/script/lint/rules/modal_sentence.js +150 -0
  295. package/script/lint/rules/passive.d.ts +64 -0
  296. package/script/lint/rules/passive.d.ts.map +1 -0
  297. package/script/lint/rules/passive.js +286 -0
  298. package/script/lint/rules/suppression.d.ts +38 -3
  299. package/script/lint/rules/suppression.d.ts.map +1 -1
  300. package/script/lint/rules/suppression.js +59 -3
  301. package/script/lint/rules/xref.d.ts +19 -0
  302. package/script/lint/rules/xref.d.ts.map +1 -0
  303. package/script/lint/rules/xref.js +251 -0
  304. package/script/lint/runner.d.ts +31 -11
  305. package/script/lint/runner.d.ts.map +1 -1
  306. package/script/lint/runner.js +67 -26
  307. package/script/lint/score.d.ts +64 -0
  308. package/script/lint/score.d.ts.map +1 -0
  309. package/script/lint/score.js +167 -0
  310. package/script/lint/segmenter.d.ts +32 -0
  311. package/script/lint/segmenter.d.ts.map +1 -0
  312. package/script/lint/segmenter.js +82 -0
  313. package/script/lint/types.d.ts +12 -0
  314. package/script/lint/types.d.ts.map +1 -1
  315. package/script/lock/canonical_edges.d.ts +31 -0
  316. package/script/lock/canonical_edges.d.ts.map +1 -0
  317. package/script/lock/canonical_edges.js +61 -0
  318. package/script/lock/check.d.ts +24 -0
  319. package/script/lock/check.d.ts.map +1 -0
  320. package/script/lock/check.js +130 -0
  321. package/script/lock/hash.d.ts +12 -0
  322. package/script/lock/hash.d.ts.map +1 -0
  323. package/script/lock/hash.js +36 -0
  324. package/script/lock/mod.d.ts +19 -0
  325. package/script/lock/mod.d.ts.map +1 -0
  326. package/script/lock/mod.js +31 -0
  327. package/script/lock/model.d.ts +81 -0
  328. package/script/lock/model.d.ts.map +1 -0
  329. package/script/lock/model.js +10 -0
  330. package/script/lock/parser.d.ts +26 -0
  331. package/script/lock/parser.d.ts.map +1 -0
  332. package/script/lock/parser.js +198 -0
  333. package/script/lock/resolve.d.ts +142 -0
  334. package/script/lock/resolve.d.ts.map +1 -0
  335. package/script/lock/resolve.js +397 -0
  336. package/script/lock/serializer.d.ts +14 -0
  337. package/script/lock/serializer.d.ts.map +1 -0
  338. package/script/lock/serializer.js +107 -0
  339. package/script/mod.d.ts +16 -9
  340. package/script/mod.d.ts.map +1 -1
  341. package/script/mod.js +111 -38
  342. package/script/model/attributes.d.ts +6 -0
  343. package/script/model/attributes.d.ts.map +1 -1
  344. package/script/model/attributes.js +38 -1
  345. package/script/model/discipline.d.ts +53 -0
  346. package/script/model/discipline.d.ts.map +1 -0
  347. package/script/model/discipline.js +53 -0
  348. package/script/model/mod.d.ts +188 -30
  349. package/script/model/mod.d.ts.map +1 -1
  350. package/script/model/mod.js +48 -1
  351. package/script/model/profile.d.ts +69 -0
  352. package/script/model/profile.d.ts.map +1 -1
  353. package/script/parser/attributes.d.ts.map +1 -1
  354. package/script/parser/attributes.js +1 -10
  355. package/script/parser/body_tokens.d.ts +35 -0
  356. package/script/parser/body_tokens.d.ts.map +1 -0
  357. package/script/parser/body_tokens.js +235 -0
  358. package/script/parser/glossary.d.ts +8 -0
  359. package/script/parser/glossary.d.ts.map +1 -1
  360. package/script/parser/glossary.js +7 -4
  361. package/script/parser/grammars.d.ts +5 -3
  362. package/script/parser/grammars.d.ts.map +1 -1
  363. package/script/parser/grammars.js +21 -8
  364. package/script/parser/language_spec.d.ts +55 -0
  365. package/script/parser/language_spec.d.ts.map +1 -0
  366. package/script/parser/language_spec.js +423 -0
  367. package/script/parser/line_map.d.ts +60 -0
  368. package/script/parser/line_map.d.ts.map +1 -0
  369. package/script/parser/line_map.js +44 -0
  370. package/script/parser/markdown.d.ts +9 -0
  371. package/script/parser/markdown.d.ts.map +1 -1
  372. package/script/parser/markdown.js +95 -29
  373. package/script/parser/mod.d.ts +4 -0
  374. package/script/parser/mod.d.ts.map +1 -1
  375. package/script/parser/mod.js +32 -7
  376. package/script/parser/source.d.ts +39 -8
  377. package/script/parser/source.d.ts.map +1 -1
  378. package/script/parser/source.js +156 -69
  379. package/script/parser/translate.d.ts +24 -0
  380. package/script/parser/translate.d.ts.map +1 -0
  381. package/script/parser/translate.js +102 -0
  382. package/script/profile/chain.d.ts +8 -0
  383. package/script/profile/chain.d.ts.map +1 -1
  384. package/script/profile/chain.js +29 -1
  385. package/script/profile/default_profile.d.ts +25 -0
  386. package/script/profile/default_profile.d.ts.map +1 -0
  387. package/script/profile/default_profile.js +46 -0
  388. package/script/profile/discipline_mode.d.ts +64 -0
  389. package/script/profile/discipline_mode.d.ts.map +1 -0
  390. package/script/profile/discipline_mode.js +138 -0
  391. package/script/profile/discipline_registry.d.ts +41 -0
  392. package/script/profile/discipline_registry.d.ts.map +1 -0
  393. package/script/profile/discipline_registry.js +70 -0
  394. package/script/profile/load.d.ts +3 -1
  395. package/script/profile/load.d.ts.map +1 -1
  396. package/script/profile/load.js +24 -5
  397. package/script/profile/manifest.d.ts.map +1 -1
  398. package/script/profile/manifest.js +252 -19
  399. package/script/profile/merge.d.ts.map +1 -1
  400. package/script/profile/merge.js +112 -0
  401. package/script/profile/mod.d.ts +2 -0
  402. package/script/profile/mod.d.ts.map +1 -1
  403. package/script/profile/mod.js +6 -1
  404. package/script/sync/locked_attributes.d.ts +19 -0
  405. package/script/sync/locked_attributes.d.ts.map +1 -0
  406. package/script/sync/locked_attributes.js +30 -0
  407. package/script/sync/log.d.ts +34 -0
  408. package/script/sync/log.d.ts.map +1 -0
  409. package/script/sync/log.js +52 -0
  410. package/script/sync/mapping.d.ts +66 -0
  411. package/script/sync/mapping.d.ts.map +1 -0
  412. package/script/sync/mapping.js +169 -0
  413. package/script/sync/mod.d.ts +16 -0
  414. package/script/sync/mod.d.ts.map +1 -0
  415. package/script/sync/mod.js +21 -0
  416. package/script/sync/status.d.ts +23 -0
  417. package/script/sync/status.d.ts.map +1 -0
  418. package/script/sync/status.js +24 -0
  419. package/script/typl/ast.d.ts +87 -0
  420. package/script/typl/ast.d.ts.map +1 -0
  421. package/script/typl/ast.js +24 -0
  422. package/script/typl/bridge.d.ts +32 -0
  423. package/script/typl/bridge.d.ts.map +1 -0
  424. package/script/typl/bridge.js +30 -0
  425. package/script/typl/bullet.d.ts +34 -0
  426. package/script/typl/bullet.d.ts.map +1 -0
  427. package/script/typl/bullet.js +47 -0
  428. package/script/typl/diagnostics.d.ts +43 -0
  429. package/script/typl/diagnostics.d.ts.map +1 -0
  430. package/script/typl/diagnostics.js +65 -0
  431. package/script/typl/fence.d.ts +31 -0
  432. package/script/typl/fence.d.ts.map +1 -0
  433. package/script/typl/fence.js +27 -0
  434. package/script/typl/grammar.d.ts +20 -0
  435. package/script/typl/grammar.d.ts.map +1 -0
  436. package/script/typl/grammar.js +474 -0
  437. package/script/typl/inline.d.ts +34 -0
  438. package/script/typl/inline.d.ts.map +1 -0
  439. package/script/typl/inline.js +51 -0
  440. package/script/typl/lexer.d.ts +37 -0
  441. package/script/typl/lexer.d.ts.map +1 -0
  442. package/script/typl/lexer.js +237 -0
  443. package/script/typl/mod.d.ts +23 -0
  444. package/script/typl/mod.d.ts.map +1 -0
  445. package/script/typl/mod.js +29 -0
  446. package/script/typl/registry.d.ts +42 -0
  447. package/script/typl/registry.d.ts.map +1 -0
  448. package/script/typl/registry.js +29 -0
  449. package/script/typl/validator.d.ts +29 -0
  450. package/script/typl/validator.d.ts.map +1 -0
  451. package/script/typl/validator.js +144 -0
  452. package/script/util/line_endings.d.ts +33 -0
  453. package/script/util/line_endings.d.ts.map +1 -0
  454. package/script/util/line_endings.js +58 -0
  455. package/script/util/modals.d.ts +29 -0
  456. package/script/util/modals.d.ts.map +1 -0
  457. package/script/util/modals.js +42 -0
  458. package/script/validator/discipline.d.ts +35 -0
  459. package/script/validator/discipline.d.ts.map +1 -0
  460. package/script/validator/discipline.js +207 -0
  461. package/script/validator/mod.d.ts +1 -1
  462. package/script/validator/mod.d.ts.map +1 -1
  463. package/script/validator/mod.js +23 -1
  464. package/script/validator/modal_keywords.d.ts +15 -13
  465. package/script/validator/modal_keywords.d.ts.map +1 -1
  466. package/script/validator/modal_keywords.js +26 -109
  467. package/script/validator/pattern.d.ts +15 -8
  468. package/script/validator/pattern.d.ts.map +1 -1
  469. package/script/validator/pattern.js +42 -19
  470. package/script/validator/per_type_attrs.d.ts +2 -2
  471. package/script/validator/per_type_attrs.d.ts.map +1 -1
  472. package/script/validator/per_type_attrs.js +2 -2
  473. package/script/validator/pipeline.d.ts +11 -0
  474. package/script/validator/pipeline.d.ts.map +1 -1
  475. package/script/validator/pipeline.js +40 -17
  476. package/script/validator/type_resolution.d.ts +3 -3
  477. package/script/validator/type_resolution.d.ts.map +1 -1
  478. package/script/validator/type_resolution.js +31 -9
  479. package/esm/parser/entity_refs.d.ts +0 -53
  480. package/esm/parser/entity_refs.d.ts.map +0 -1
  481. package/esm/parser/entity_refs.js +0 -151
  482. package/script/parser/entity_refs.d.ts +0 -53
  483. package/script/parser/entity_refs.d.ts.map +0 -1
  484. package/script/parser/entity_refs.js +0 -155
@@ -9,9 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.parseMarkdown = parseMarkdown;
10
10
  const mod_js_1 = require("../model/mod.js");
11
11
  const attributes_js_1 = require("./attributes.js");
12
- const entity_refs_js_1 = require("./entity_refs.js");
12
+ const body_tokens_js_1 = require("./body_tokens.js");
13
13
  const remark_js_1 = require("./remark.js");
14
14
  const build_js_1 = require("../ast/build.js");
15
+ const translate_js_1 = require("./translate.js");
16
+ const mod_js_2 = require("../typl/mod.js");
15
17
  /**
16
18
  * Slug pattern for referenced-entry display IDs.
17
19
  *
@@ -56,6 +58,9 @@ function parseMarkdown(markdown, options) {
56
58
  const tree = remark_js_1.processor.parse(markdown);
57
59
  const entries = [];
58
60
  const diagnostics = [];
61
+ // Pre-split once so every extractBodyContent call shares the same array
62
+ // instead of re-splitting for each list item (O(N×L) → O(N+L)).
63
+ const markdownLines = markdown.split("\n");
59
64
  // Collect link definition identifiers for shortcut reference exclusion.
60
65
  const definitions = new Set(tree.children
61
66
  .filter((n) => n.type === "definition")
@@ -68,31 +73,32 @@ function parseMarkdown(markdown, options) {
68
73
  if (list.ordered)
69
74
  continue;
70
75
  for (const item of list.children) {
71
- const entry = extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics);
76
+ const entry = extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, !!options?.lineMap);
72
77
  if (entry)
73
78
  entries.push(entry);
74
79
  }
75
80
  }
76
- return { entries, diagnostics };
81
+ const finalEntries = options?.lineMap
82
+ ? (0, translate_js_1.translateEntryLocations)(entries, options.lineMap)
83
+ : entries;
84
+ return { entries: finalEntries, diagnostics };
77
85
  }
78
86
  /**
79
- * Detect if a file is a references document.
80
- * References context enables recognition of reference entries (slugs).
81
- * @param file - File path
82
- * @param explicit - Explicit override (undefined = auto-detect)
87
+ * Resolve whether this is a references document.
88
+ *
89
+ * The caller (`parseFile` in `parser/mod.ts`) always passes an explicit
90
+ * value computed via the canonical `isReferencesDocument` helper, so the
91
+ * auto-detection fallback is never needed here.
83
92
  */
84
- function detectReferencesDocument(file, explicit) {
85
- if (explicit !== undefined)
86
- return explicit;
87
- const basename = file.split("/").pop() ?? "";
88
- return basename === "references.md" || file.includes("/references/");
93
+ function detectReferencesDocument(_file, explicit) {
94
+ return explicit ?? false;
89
95
  }
90
96
  /**
91
97
  * Attempt to extract a MarkSpec entry from a list item.
92
98
  * Returns undefined if the list item is not an entry block.
93
99
  * Diagnostics (e.g., deprecation warnings) are pushed into the accumulator.
94
100
  */
95
- function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagnostics) {
101
+ function extractEntry(item, markdownLines, file, definitions, isReferencesDoc, diagnostics, _hasLineMap = false) {
96
102
  // Task list items (remark-gfm sets checked to true/false) are not entries.
97
103
  if (item.checked != null)
98
104
  return undefined;
@@ -200,10 +206,10 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
200
206
  // validation (MSL-P010 also fires from the validator for empty titles).
201
207
  }
202
208
  // Extract body content and attributes.
203
- const bodyContent = extractBodyContent(item, markdown);
209
+ const bodyContent = extractBodyContent(item, markdownLines);
204
210
  const [body, attrLines] = (0, attributes_js_1.splitBodyAndAttributes)(bodyContent);
205
211
  const attributes = (0, attributes_js_1.parseAttributes)(attrLines);
206
- const bodyAst = (0, build_js_1.buildBodyAst)(body);
212
+ const { blocks: bodyAst, tree: mdastTree } = (0, build_js_1.buildBodyAstWithTree)(body);
207
213
  const entryLine = item.position?.start.line ?? 1;
208
214
  // MSL-P020: trailers block is not the final indented code block.
209
215
  // Detect `Key: Value` lines in the body that likely should be trailers
@@ -400,19 +406,77 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
400
406
  const line = item.position?.start.line ?? 1;
401
407
  const column = item.position?.start.column ?? 1;
402
408
  const entryLocation = { file, line, column };
403
- // Inline `$Identifier` entity references (spec section 2.5.2). Resolution
404
- // into the project's entity registry is left to the validator's
405
- // marker pass; the parser only emits the lexical hits.
406
- // Pass the already-built bodyAst to avoid a redundant mdast parse.
407
- const entityRefs = (0, entity_refs_js_1.extractEntityRefs)(body, {
409
+ // Inline-construct tokens (ADR-016). Reuses the already-built bodyAst to
410
+ // avoid a redundant mdast parse.
411
+ //
412
+ // bodyStartLine: use the mdast position of the second child (the body
413
+ // paragraph) — the actual buffer line where the body starts. CommonMark
414
+ // loose lists have a blank line between title and body, so the body is at
415
+ // (entry_line + 2), not (entry_line + 1).
416
+ //
417
+ // columnOffset: body text has been stripped of the list-item indent (e.g.,
418
+ // " " for column-1 items), so each token column must be bumped by that
419
+ // indent width. The + 2 accounts for the " " continuation indent
420
+ // prepended by wrapAsListItem to every non-title line.
421
+ const bodyIndent = (item.position?.start.column ?? 1) - 1 + 2;
422
+ const bodyStartLine = item.children[1]?.position?.start.line ?? (line + 1);
423
+ const bodyTokens = (0, body_tokens_js_1.extractBodyTokens)(body, bodyAst, {
408
424
  file,
409
- // Body content starts on the line after the title; +1 keeps
410
- // emitted line numbers 1-based relative to the file.
411
- line: line + 1,
425
+ line: bodyStartLine,
412
426
  column: 1,
413
- }, bodyAst);
427
+ }, bodyIndent, mdastTree);
428
+ // Extract typl declarations from all three surfaces in the body:
429
+ // (1) ```typl fences, (2) bullet-glossary items, (3) inline code spans.
430
+ // Per-surface diagnostics are bridged to file-relative positions and
431
+ // pushed into the parser's diagnostic stream. Cross-entry collision
432
+ // detection lands in a later PR; this PR aggregates all intra-entry
433
+ // bindings + typedefs from every surface.
434
+ let types;
435
+ const allBindings = [];
436
+ const allTypedefs = [];
437
+ for (const fence of (0, mod_js_2.extractTyplFences)(bodyAst)) {
438
+ const result = (0, mod_js_2.parseTyplBlock)(fence.source);
439
+ allBindings.push(...result.ast.bindings);
440
+ allTypedefs.push(...result.ast.typedefs);
441
+ // Fence content starts on the line AFTER the opening ```, so the
442
+ // bridge offset is the file line of the opening fence.
443
+ const fenceFileStartLine = bodyStartLine + fence.range.start.line - 1;
444
+ for (const td of result.diagnostics) {
445
+ diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, file, fenceFileStartLine));
446
+ }
447
+ }
448
+ for (const bullet of (0, mod_js_2.extractTyplBullets)(bodyAst)) {
449
+ const result = (0, mod_js_2.parseTyplBlock)(bullet.source);
450
+ allBindings.push(...result.ast.bindings);
451
+ allTypedefs.push(...result.ast.typedefs);
452
+ // A bullet item IS the typl content (single line). The bridge
453
+ // computes line as `offset + diag.position.line`; we want diag
454
+ // position.line 1 to map to the item's file line, so offset is
455
+ // `itemFileLine - 1` = `bodyStartLine + bullet.range.start.line - 2`.
456
+ const bulletFileOffset = bodyStartLine + bullet.range.start.line - 2;
457
+ for (const td of result.diagnostics) {
458
+ diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, file, bulletFileOffset));
459
+ }
460
+ }
461
+ for (const inline of (0, mod_js_2.extractTyplInlines)(bodyTokens)) {
462
+ const result = (0, mod_js_2.parseTyplBlock)(inline.source);
463
+ allBindings.push(...result.ast.bindings);
464
+ allTypedefs.push(...result.ast.typedefs);
465
+ // inline.location is already file-relative (translated by the
466
+ // bodyTokens extractor). The bridge computes file line as
467
+ // `offset + diag.position.line`; for inline content where
468
+ // diag.position.line is 1 (single-line span), offset is
469
+ // `inline.location.line - 1`.
470
+ const inlineFileOffset = inline.location.line - 1;
471
+ for (const td of result.diagnostics) {
472
+ diagnostics.push((0, mod_js_2.bridgeTyplDiagnostic)(td, inline.location.file, inlineFileOffset));
473
+ }
474
+ }
475
+ if (allBindings.length > 0 || allTypedefs.length > 0) {
476
+ types = { bindings: allBindings, typedefs: allTypedefs };
477
+ }
414
478
  return {
415
- displayId,
479
+ displayId: (0, mod_js_1.makeDisplayId)(displayId),
416
480
  title: title ?? "",
417
481
  body,
418
482
  bodyAst,
@@ -422,9 +486,11 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
422
486
  type,
423
487
  shape,
424
488
  location: entryLocation,
425
- source: "markdown",
489
+ bodyStartLine,
490
+ source: { kind: "markdown" },
426
491
  properties: { file: { path: file, line, column } },
427
- entityRefs: entityRefs.length > 0 ? entityRefs : undefined,
492
+ bodyTokens,
493
+ ...(types ? { types } : {}),
428
494
  };
429
495
  }
430
496
  /**
@@ -432,12 +498,12 @@ function extractEntry(item, markdown, file, definitions, isReferencesDoc, diagno
432
498
  * which contains the display ID and title).
433
499
  *
434
500
  * Reconstructs the text content from the source markdown using position info.
501
+ * Accepts a pre-split lines array to avoid redundant splits across entries.
435
502
  */
436
- function extractBodyContent(item, markdown) {
503
+ function extractBodyContent(item, lines) {
437
504
  const children = item.children.slice(1); // Skip title paragraph
438
505
  if (!children.length)
439
506
  return "";
440
- const lines = markdown.split("\n");
441
507
  // Get the range from the second child's start to the last child's end
442
508
  const startLine = children[0].position?.start.line;
443
509
  const endLine = children[children.length - 1].position?.end.line;
@@ -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. */
@@ -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,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;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AsB,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"}
@@ -11,11 +11,12 @@
11
11
  * - source: doc comment extraction from Rust, Kotlin, C, C++, Java
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.loadGrammar = exports.isSupportedExtension = exports.wrapAsListItem = exports.stripLineCommentPrefix = exports.stripBlockCommentPrefix = exports.parseSource = exports.detectInlineRefs = exports.extractFrontMatter = exports.detectDirectives = void 0;
14
+ exports.languageIdForExtension = exports.LANGUAGE_SPECS = exports.buildBlockLineMap = exports.loadGrammar = exports.isSupportedExtension = exports.wrapAsListItem = exports.stripLineCommentPrefix = exports.stripBlockCommentPrefix = exports.parseSource = exports.detectInlineRefs = exports.extractFrontMatter = exports.detectDirectives = void 0;
15
15
  exports.parse = parse;
16
16
  exports.parseFile = parseFile;
17
17
  exports.detectCaptions = detectCaptions;
18
18
  const path_1 = require("@std/path");
19
+ const line_endings_js_1 = require("../util/line_endings.js");
19
20
  const markdown_js_1 = require("./markdown.js");
20
21
  const grammars_js_1 = require("./grammars.js");
21
22
  const source_js_1 = require("./source.js");
@@ -36,6 +37,11 @@ Object.defineProperty(exports, "wrapAsListItem", { enumerable: true, get: functi
36
37
  var grammars_js_2 = require("./grammars.js");
37
38
  Object.defineProperty(exports, "isSupportedExtension", { enumerable: true, get: function () { return grammars_js_2.isSupportedExtension; } });
38
39
  Object.defineProperty(exports, "loadGrammar", { enumerable: true, get: function () { return grammars_js_2.loadGrammar; } });
40
+ var line_map_js_1 = require("./line_map.js");
41
+ Object.defineProperty(exports, "buildBlockLineMap", { enumerable: true, get: function () { return line_map_js_1.buildBlockLineMap; } });
42
+ var language_spec_js_1 = require("./language_spec.js");
43
+ Object.defineProperty(exports, "LANGUAGE_SPECS", { enumerable: true, get: function () { return language_spec_js_1.LANGUAGE_SPECS; } });
44
+ Object.defineProperty(exports, "languageIdForExtension", { enumerable: true, get: function () { return language_spec_js_1.languageIdForExtension; } });
39
45
  /**
40
46
  * Parse a Markdown string and return all MarkSpec entries found.
41
47
  *
@@ -44,7 +50,12 @@ Object.defineProperty(exports, "loadGrammar", { enumerable: true, get: function
44
50
  * @returns Array of parsed entries
45
51
  */
46
52
  function parse(markdown, options) {
47
- return (0, markdown_js_1.parseMarkdown)(markdown, options).entries;
53
+ const file = options?.file;
54
+ const normalised = (0, line_endings_js_1.normalizeLineEndings)(markdown);
55
+ return (0, markdown_js_1.parseMarkdown)(normalised, {
56
+ ...options,
57
+ isReferencesDoc: file !== undefined ? isReferencesDocument(file) : false,
58
+ }).entries;
48
59
  }
49
60
  /**
50
61
  * Detect if a file is a references document.
@@ -52,8 +63,12 @@ function parse(markdown, options) {
52
63
  * @param file - File path
53
64
  */
54
65
  function isReferencesDocument(file) {
55
- const basename = file.split("/").pop() ?? "";
56
- return basename === "references.md" || file.includes("/references/");
66
+ if ((0, path_1.basename)(file) === "references.md")
67
+ return true;
68
+ // Detect a `/references/` (or `\references\`) directory anywhere in the
69
+ // path, in a separator-agnostic way so Windows checkouts behave the
70
+ // same as POSIX.
71
+ return /[\\/]references[\\/]/.test(file);
57
72
  }
58
73
  /**
59
74
  * Parse a file and return entries, annotation links, and (for Markdown
@@ -65,16 +80,26 @@ function isReferencesDocument(file) {
65
80
  */
66
81
  async function parseFile(content, options) {
67
82
  const ext = (0, path_1.extname)(options.file);
83
+ const normalised = (0, line_endings_js_1.normalizeLineEndings)(content);
68
84
  if ((0, grammars_js_1.isSupportedExtension)(ext)) {
69
85
  const language = await (0, grammars_js_1.loadGrammar)(ext);
70
- const result = (0, source_js_1.parseSource)(content, {
86
+ const languageId = (0, grammars_js_1.languageIdForExtension)(ext);
87
+ if (!languageId) {
88
+ // Defensive — isSupportedExtension and languageIdForExtension are kept
89
+ // in sync via their shared extension lists, so this branch should be
90
+ // unreachable. Throwing surfaces the drift immediately rather than
91
+ // silently falling through to wrong grammar dispatch.
92
+ throw new Error(`internal: no languageId for supported extension '${ext}'`);
93
+ }
94
+ const result = (0, source_js_1.parseSource)(normalised, {
71
95
  file: options.file,
72
96
  language,
97
+ languageId,
73
98
  });
74
99
  return { entries: result.entries, diagnostics: [] };
75
100
  }
76
- const fm = (0, frontmatter_js_1.extractFrontMatter)(content, { file: options.file });
77
- const body = fm.hadFrontMatter ? fm.markdown : content;
101
+ const fm = (0, frontmatter_js_1.extractFrontMatter)(normalised, { file: options.file });
102
+ const body = fm.hadFrontMatter ? fm.markdown : normalised;
78
103
  const isReferencesDoc = isReferencesDocument(options.file);
79
104
  const { entries, diagnostics: parseDiagnostics } = (0, markdown_js_1.parseMarkdown)(body, {
80
105
  file: options.file,
@@ -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 Parser from "web-tree-sitter";
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: 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;
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): string;
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 comment delimiters and leading ` * ` prefixes.
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): 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;AAClD,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,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CACpC;AAED,uCAAuC;AACvC,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;CAC3B;AAYD;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB,CAsCnB;AAiFD;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAe/D;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAgC9D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAKtD"}
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,MAA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