@driftsys/markspec 0.10.3 → 0.11.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 (376) hide show
  1. package/README.md +2 -2
  2. package/esm/compiler/deserialize.d.ts +49 -0
  3. package/esm/compiler/deserialize.d.ts.map +1 -0
  4. package/esm/compiler/deserialize.js +139 -0
  5. package/esm/compiler/manifest.d.ts +3 -0
  6. package/esm/compiler/manifest.d.ts.map +1 -1
  7. package/esm/compiler/manifest.js +9 -3
  8. package/esm/compiler/mod.d.ts.map +1 -1
  9. package/esm/compiler/mod.js +16 -7
  10. package/esm/config/markspec.d.ts +38 -1
  11. package/esm/config/markspec.d.ts.map +1 -1
  12. package/esm/config/markspec.js +127 -2
  13. package/esm/config/mod.d.ts.map +1 -1
  14. package/esm/config/mod.js +143 -147
  15. package/esm/decl/duplicates.d.ts +29 -0
  16. package/esm/decl/duplicates.d.ts.map +1 -0
  17. package/esm/decl/duplicates.js +28 -0
  18. package/esm/decl/mod.d.ts +4 -2
  19. package/esm/decl/mod.d.ts.map +1 -1
  20. package/esm/decl/mod.js +2 -1
  21. package/esm/decl/surfaces.d.ts +29 -7
  22. package/esm/decl/surfaces.d.ts.map +1 -1
  23. package/esm/decl/surfaces.js +31 -18
  24. package/esm/gates/mod.d.ts +13 -2
  25. package/esm/gates/mod.d.ts.map +1 -1
  26. package/esm/gates/mod.js +38 -11
  27. package/esm/lint/runner.d.ts.map +1 -1
  28. package/esm/lint/runner.js +3 -1
  29. package/esm/lock/acquire_compile.d.ts +31 -0
  30. package/esm/lock/acquire_compile.d.ts.map +1 -0
  31. package/esm/lock/acquire_compile.js +83 -0
  32. package/esm/lock/cache_check.d.ts +28 -0
  33. package/esm/lock/cache_check.d.ts.map +1 -0
  34. package/esm/lock/cache_check.js +51 -0
  35. package/esm/lock/check.d.ts +14 -3
  36. package/esm/lock/check.d.ts.map +1 -1
  37. package/esm/lock/check.js +41 -3
  38. package/esm/lock/git_intent.d.ts +46 -0
  39. package/esm/lock/git_intent.d.ts.map +1 -0
  40. package/esm/lock/git_intent.js +111 -0
  41. package/esm/lock/mod.d.ts +10 -3
  42. package/esm/lock/mod.d.ts.map +1 -1
  43. package/esm/lock/mod.js +7 -1
  44. package/esm/lock/model.d.ts +24 -1
  45. package/esm/lock/model.d.ts.map +1 -1
  46. package/esm/lock/parser.d.ts.map +1 -1
  47. package/esm/lock/parser.js +32 -0
  48. package/esm/lock/pin_assurance.d.ts +20 -0
  49. package/esm/lock/pin_assurance.d.ts.map +1 -0
  50. package/esm/lock/pin_assurance.js +34 -0
  51. package/esm/lock/resolve.d.ts +8 -17
  52. package/esm/lock/resolve.d.ts.map +1 -1
  53. package/esm/lock/resolve.js +7 -67
  54. package/esm/lock/serializer.d.ts.map +1 -1
  55. package/esm/lock/serializer.js +23 -0
  56. package/esm/lock/upstream_common.d.ts +29 -0
  57. package/esm/lock/upstream_common.d.ts.map +1 -0
  58. package/esm/lock/upstream_common.js +38 -0
  59. package/esm/lock/upstream_deps.d.ts +63 -0
  60. package/esm/lock/upstream_deps.d.ts.map +1 -0
  61. package/esm/lock/upstream_deps.js +172 -0
  62. package/esm/lock/upstream_refs.d.ts +69 -0
  63. package/esm/lock/upstream_refs.d.ts.map +1 -0
  64. package/esm/lock/upstream_refs.js +238 -0
  65. package/esm/mod.d.ts +16 -8
  66. package/esm/mod.d.ts.map +1 -1
  67. package/esm/mod.js +15 -5
  68. package/esm/model/mod.d.ts +93 -28
  69. package/esm/model/mod.d.ts.map +1 -1
  70. package/esm/model/mod.js +66 -13
  71. package/esm/model/profile.d.ts +13 -0
  72. package/esm/model/profile.d.ts.map +1 -1
  73. package/esm/parser/markdown.d.ts.map +1 -1
  74. package/esm/parser/markdown.js +7 -51
  75. package/esm/profile/manifest.d.ts.map +1 -1
  76. package/esm/profile/manifest.js +20 -3
  77. package/esm/profile/merge.js +7 -0
  78. package/esm/reporter/mod.d.ts +11 -0
  79. package/esm/reporter/mod.d.ts.map +1 -1
  80. package/esm/reporter/mod.js +19 -8
  81. package/esm/typl/assemble.d.ts +53 -0
  82. package/esm/typl/assemble.d.ts.map +1 -0
  83. package/esm/typl/assemble.js +238 -0
  84. package/esm/typl/ast.d.ts +7 -1
  85. package/esm/typl/ast.d.ts.map +1 -1
  86. package/esm/typl/ast.js +3 -0
  87. package/esm/typl/bullet.d.ts +9 -7
  88. package/esm/typl/bullet.d.ts.map +1 -1
  89. package/esm/typl/bullet.js +6 -4
  90. package/esm/typl/citations.d.ts +27 -0
  91. package/esm/typl/citations.d.ts.map +1 -0
  92. package/esm/typl/citations.js +16 -0
  93. package/esm/typl/diagnostics.d.ts +2 -2
  94. package/esm/typl/diagnostics.d.ts.map +1 -1
  95. package/esm/typl/diagnostics.js +18 -0
  96. package/esm/typl/grammar.d.ts.map +1 -1
  97. package/esm/typl/grammar.js +6 -0
  98. package/esm/typl/lexer.d.ts.map +1 -1
  99. package/esm/typl/lexer.js +25 -4
  100. package/esm/typl/mod.d.ts +8 -2
  101. package/esm/typl/mod.d.ts.map +1 -1
  102. package/esm/typl/mod.js +5 -1
  103. package/esm/typl/recognize.js +2 -2
  104. package/esm/typl/registry.d.ts +1 -1
  105. package/esm/typl/resolve.d.ts +31 -0
  106. package/esm/typl/resolve.d.ts.map +1 -0
  107. package/esm/typl/resolve.js +27 -0
  108. package/esm/typl/table.d.ts +52 -0
  109. package/esm/typl/table.d.ts.map +1 -0
  110. package/esm/typl/table.js +69 -0
  111. package/esm/typl/validator.d.ts +24 -5
  112. package/esm/typl/validator.d.ts.map +1 -1
  113. package/esm/typl/validator.js +55 -75
  114. package/esm/upstream/mod.d.ts +45 -0
  115. package/esm/upstream/mod.d.ts.map +1 -0
  116. package/esm/upstream/mod.js +98 -0
  117. package/esm/upstream/project.d.ts +33 -0
  118. package/esm/upstream/project.d.ts.map +1 -0
  119. package/esm/upstream/project.js +38 -0
  120. package/esm/upstream/refs.d.ts +23 -0
  121. package/esm/upstream/refs.d.ts.map +1 -0
  122. package/esm/upstream/refs.js +71 -0
  123. package/esm/util/paths.d.ts +14 -0
  124. package/esm/util/paths.d.ts.map +1 -0
  125. package/esm/util/paths.js +22 -0
  126. package/esm/uxil/assemble.d.ts +38 -0
  127. package/esm/uxil/assemble.d.ts.map +1 -0
  128. package/esm/uxil/assemble.js +268 -0
  129. package/esm/uxil/ast.d.ts +63 -0
  130. package/esm/uxil/ast.d.ts.map +1 -0
  131. package/esm/uxil/ast.js +9 -0
  132. package/esm/uxil/citations.d.ts +27 -0
  133. package/esm/uxil/citations.d.ts.map +1 -0
  134. package/esm/uxil/citations.js +25 -0
  135. package/esm/uxil/diagnostics.d.ts +39 -0
  136. package/esm/uxil/diagnostics.d.ts.map +1 -0
  137. package/esm/uxil/diagnostics.js +135 -0
  138. package/esm/uxil/grammar.d.ts +72 -0
  139. package/esm/uxil/grammar.d.ts.map +1 -0
  140. package/esm/uxil/grammar.js +505 -0
  141. package/esm/uxil/lexer.d.ts +23 -0
  142. package/esm/uxil/lexer.d.ts.map +1 -0
  143. package/esm/uxil/lexer.js +58 -0
  144. package/esm/uxil/mod.d.ts +32 -0
  145. package/esm/uxil/mod.d.ts.map +1 -0
  146. package/esm/uxil/mod.js +11 -0
  147. package/esm/uxil/projection.d.ts +40 -0
  148. package/esm/uxil/projection.d.ts.map +1 -0
  149. package/esm/uxil/projection.js +41 -0
  150. package/esm/uxil/recognize.d.ts +16 -0
  151. package/esm/uxil/recognize.d.ts.map +1 -0
  152. package/esm/uxil/recognize.js +28 -0
  153. package/esm/uxil/registry.d.ts +37 -0
  154. package/esm/uxil/registry.d.ts.map +1 -0
  155. package/esm/uxil/registry.js +29 -0
  156. package/esm/uxil/surfaces.d.ts +36 -0
  157. package/esm/uxil/surfaces.d.ts.map +1 -0
  158. package/esm/uxil/surfaces.js +34 -0
  159. package/esm/uxil/validator.d.ts +36 -0
  160. package/esm/uxil/validator.d.ts.map +1 -0
  161. package/esm/uxil/validator.js +139 -0
  162. package/esm/uxil/vocab.d.ts +33 -0
  163. package/esm/uxil/vocab.d.ts.map +1 -0
  164. package/esm/uxil/vocab.js +36 -0
  165. package/esm/validator/caption_convention.d.ts +2 -1
  166. package/esm/validator/caption_convention.d.ts.map +1 -1
  167. package/esm/validator/caption_convention.js +2 -1
  168. package/esm/validator/corpus.d.ts.map +1 -1
  169. package/esm/validator/corpus.js +40 -17
  170. package/esm/validator/discipline.d.ts +6 -4
  171. package/esm/validator/discipline.d.ts.map +1 -1
  172. package/esm/validator/discipline.js +6 -4
  173. package/esm/validator/mod.d.ts.map +1 -1
  174. package/esm/validator/mod.js +28 -15
  175. package/esm/validator/pipeline.d.ts +11 -1
  176. package/esm/validator/pipeline.d.ts.map +1 -1
  177. package/esm/validator/pipeline.js +68 -18
  178. package/esm/validator/trace_types.d.ts +9 -2
  179. package/esm/validator/trace_types.d.ts.map +1 -1
  180. package/esm/validator/trace_types.js +21 -5
  181. package/esm/validator/traceability.d.ts +15 -3
  182. package/esm/validator/traceability.d.ts.map +1 -1
  183. package/esm/validator/traceability.js +39 -4
  184. package/esm/validator/types.d.ts.map +1 -1
  185. package/esm/validator/types.js +11 -1
  186. package/esm/validator/uxil_family.d.ts +43 -0
  187. package/esm/validator/uxil_family.d.ts.map +1 -0
  188. package/esm/validator/uxil_family.js +52 -0
  189. package/package.json +1 -1
  190. package/script/compiler/deserialize.d.ts +49 -0
  191. package/script/compiler/deserialize.d.ts.map +1 -0
  192. package/script/compiler/deserialize.js +144 -0
  193. package/script/compiler/manifest.d.ts +3 -0
  194. package/script/compiler/manifest.d.ts.map +1 -1
  195. package/script/compiler/manifest.js +10 -3
  196. package/script/compiler/mod.d.ts.map +1 -1
  197. package/script/compiler/mod.js +15 -6
  198. package/script/config/markspec.d.ts +38 -1
  199. package/script/config/markspec.d.ts.map +1 -1
  200. package/script/config/markspec.js +129 -3
  201. package/script/config/mod.d.ts.map +1 -1
  202. package/script/config/mod.js +143 -147
  203. package/script/decl/duplicates.d.ts +29 -0
  204. package/script/decl/duplicates.d.ts.map +1 -0
  205. package/script/decl/duplicates.js +31 -0
  206. package/script/decl/mod.d.ts +4 -2
  207. package/script/decl/mod.d.ts.map +1 -1
  208. package/script/decl/mod.js +4 -2
  209. package/script/decl/surfaces.d.ts +29 -7
  210. package/script/decl/surfaces.d.ts.map +1 -1
  211. package/script/decl/surfaces.js +32 -19
  212. package/script/gates/mod.d.ts +13 -2
  213. package/script/gates/mod.d.ts.map +1 -1
  214. package/script/gates/mod.js +37 -10
  215. package/script/lint/runner.d.ts.map +1 -1
  216. package/script/lint/runner.js +3 -1
  217. package/script/lock/acquire_compile.d.ts +31 -0
  218. package/script/lock/acquire_compile.d.ts.map +1 -0
  219. package/script/lock/acquire_compile.js +86 -0
  220. package/script/lock/cache_check.d.ts +28 -0
  221. package/script/lock/cache_check.d.ts.map +1 -0
  222. package/script/lock/cache_check.js +54 -0
  223. package/script/lock/check.d.ts +14 -3
  224. package/script/lock/check.d.ts.map +1 -1
  225. package/script/lock/check.js +41 -3
  226. package/script/lock/git_intent.d.ts +46 -0
  227. package/script/lock/git_intent.d.ts.map +1 -0
  228. package/script/lock/git_intent.js +115 -0
  229. package/script/lock/mod.d.ts +10 -3
  230. package/script/lock/mod.d.ts.map +1 -1
  231. package/script/lock/mod.js +16 -2
  232. package/script/lock/model.d.ts +24 -1
  233. package/script/lock/model.d.ts.map +1 -1
  234. package/script/lock/parser.d.ts.map +1 -1
  235. package/script/lock/parser.js +32 -0
  236. package/script/lock/pin_assurance.d.ts +20 -0
  237. package/script/lock/pin_assurance.d.ts.map +1 -0
  238. package/script/lock/pin_assurance.js +37 -0
  239. package/script/lock/resolve.d.ts +8 -17
  240. package/script/lock/resolve.d.ts.map +1 -1
  241. package/script/lock/resolve.js +7 -68
  242. package/script/lock/serializer.d.ts.map +1 -1
  243. package/script/lock/serializer.js +23 -0
  244. package/script/lock/upstream_common.d.ts +29 -0
  245. package/script/lock/upstream_common.d.ts.map +1 -0
  246. package/script/lock/upstream_common.js +42 -0
  247. package/script/lock/upstream_deps.d.ts +63 -0
  248. package/script/lock/upstream_deps.d.ts.map +1 -0
  249. package/script/lock/upstream_deps.js +175 -0
  250. package/script/lock/upstream_refs.d.ts +69 -0
  251. package/script/lock/upstream_refs.d.ts.map +1 -0
  252. package/script/lock/upstream_refs.js +244 -0
  253. package/script/mod.d.ts +16 -8
  254. package/script/mod.d.ts.map +1 -1
  255. package/script/mod.js +40 -7
  256. package/script/model/mod.d.ts +93 -28
  257. package/script/model/mod.d.ts.map +1 -1
  258. package/script/model/mod.js +70 -14
  259. package/script/model/profile.d.ts +13 -0
  260. package/script/model/profile.d.ts.map +1 -1
  261. package/script/parser/markdown.d.ts.map +1 -1
  262. package/script/parser/markdown.js +6 -50
  263. package/script/profile/manifest.d.ts.map +1 -1
  264. package/script/profile/manifest.js +20 -3
  265. package/script/profile/merge.js +7 -0
  266. package/script/reporter/mod.d.ts +11 -0
  267. package/script/reporter/mod.d.ts.map +1 -1
  268. package/script/reporter/mod.js +18 -7
  269. package/script/typl/assemble.d.ts +53 -0
  270. package/script/typl/assemble.d.ts.map +1 -0
  271. package/script/typl/assemble.js +241 -0
  272. package/script/typl/ast.d.ts +7 -1
  273. package/script/typl/ast.d.ts.map +1 -1
  274. package/script/typl/ast.js +3 -0
  275. package/script/typl/bullet.d.ts +9 -7
  276. package/script/typl/bullet.d.ts.map +1 -1
  277. package/script/typl/bullet.js +6 -4
  278. package/script/typl/citations.d.ts +27 -0
  279. package/script/typl/citations.d.ts.map +1 -0
  280. package/script/typl/citations.js +20 -0
  281. package/script/typl/diagnostics.d.ts +2 -2
  282. package/script/typl/diagnostics.d.ts.map +1 -1
  283. package/script/typl/diagnostics.js +18 -0
  284. package/script/typl/grammar.d.ts.map +1 -1
  285. package/script/typl/grammar.js +6 -0
  286. package/script/typl/lexer.d.ts.map +1 -1
  287. package/script/typl/lexer.js +25 -4
  288. package/script/typl/mod.d.ts +8 -2
  289. package/script/typl/mod.d.ts.map +1 -1
  290. package/script/typl/mod.js +14 -2
  291. package/script/typl/recognize.js +2 -2
  292. package/script/typl/registry.d.ts +1 -1
  293. package/script/typl/resolve.d.ts +31 -0
  294. package/script/typl/resolve.d.ts.map +1 -0
  295. package/script/typl/resolve.js +33 -0
  296. package/script/typl/table.d.ts +52 -0
  297. package/script/typl/table.d.ts.map +1 -0
  298. package/script/typl/table.js +75 -0
  299. package/script/typl/validator.d.ts +24 -5
  300. package/script/typl/validator.d.ts.map +1 -1
  301. package/script/typl/validator.js +55 -75
  302. package/script/upstream/mod.d.ts +45 -0
  303. package/script/upstream/mod.d.ts.map +1 -0
  304. package/script/upstream/mod.js +101 -0
  305. package/script/upstream/project.d.ts +33 -0
  306. package/script/upstream/project.d.ts.map +1 -0
  307. package/script/upstream/project.js +41 -0
  308. package/script/upstream/refs.d.ts +23 -0
  309. package/script/upstream/refs.d.ts.map +1 -0
  310. package/script/upstream/refs.js +74 -0
  311. package/script/util/paths.d.ts +14 -0
  312. package/script/util/paths.d.ts.map +1 -0
  313. package/script/util/paths.js +25 -0
  314. package/script/uxil/assemble.d.ts +38 -0
  315. package/script/uxil/assemble.d.ts.map +1 -0
  316. package/script/uxil/assemble.js +272 -0
  317. package/script/uxil/ast.d.ts +63 -0
  318. package/script/uxil/ast.d.ts.map +1 -0
  319. package/script/uxil/ast.js +10 -0
  320. package/script/uxil/citations.d.ts +27 -0
  321. package/script/uxil/citations.d.ts.map +1 -0
  322. package/script/uxil/citations.js +29 -0
  323. package/script/uxil/diagnostics.d.ts +39 -0
  324. package/script/uxil/diagnostics.d.ts.map +1 -0
  325. package/script/uxil/diagnostics.js +140 -0
  326. package/script/uxil/grammar.d.ts +72 -0
  327. package/script/uxil/grammar.d.ts.map +1 -0
  328. package/script/uxil/grammar.js +511 -0
  329. package/script/uxil/lexer.d.ts +23 -0
  330. package/script/uxil/lexer.d.ts.map +1 -0
  331. package/script/uxil/lexer.js +61 -0
  332. package/script/uxil/mod.d.ts +32 -0
  333. package/script/uxil/mod.d.ts.map +1 -0
  334. package/script/uxil/mod.js +37 -0
  335. package/script/uxil/projection.d.ts +40 -0
  336. package/script/uxil/projection.d.ts.map +1 -0
  337. package/script/uxil/projection.js +44 -0
  338. package/script/uxil/recognize.d.ts +16 -0
  339. package/script/uxil/recognize.d.ts.map +1 -0
  340. package/script/uxil/recognize.js +31 -0
  341. package/script/uxil/registry.d.ts +37 -0
  342. package/script/uxil/registry.d.ts.map +1 -0
  343. package/script/uxil/registry.js +32 -0
  344. package/script/uxil/surfaces.d.ts +36 -0
  345. package/script/uxil/surfaces.d.ts.map +1 -0
  346. package/script/uxil/surfaces.js +39 -0
  347. package/script/uxil/validator.d.ts +36 -0
  348. package/script/uxil/validator.d.ts.map +1 -0
  349. package/script/uxil/validator.js +142 -0
  350. package/script/uxil/vocab.d.ts +33 -0
  351. package/script/uxil/vocab.d.ts.map +1 -0
  352. package/script/uxil/vocab.js +41 -0
  353. package/script/validator/caption_convention.d.ts +2 -1
  354. package/script/validator/caption_convention.d.ts.map +1 -1
  355. package/script/validator/caption_convention.js +2 -1
  356. package/script/validator/corpus.d.ts.map +1 -1
  357. package/script/validator/corpus.js +39 -16
  358. package/script/validator/discipline.d.ts +6 -4
  359. package/script/validator/discipline.d.ts.map +1 -1
  360. package/script/validator/discipline.js +6 -4
  361. package/script/validator/mod.d.ts.map +1 -1
  362. package/script/validator/mod.js +27 -14
  363. package/script/validator/pipeline.d.ts +11 -1
  364. package/script/validator/pipeline.d.ts.map +1 -1
  365. package/script/validator/pipeline.js +67 -17
  366. package/script/validator/trace_types.d.ts +9 -2
  367. package/script/validator/trace_types.d.ts.map +1 -1
  368. package/script/validator/trace_types.js +20 -4
  369. package/script/validator/traceability.d.ts +15 -3
  370. package/script/validator/traceability.d.ts.map +1 -1
  371. package/script/validator/traceability.js +38 -3
  372. package/script/validator/types.d.ts.map +1 -1
  373. package/script/validator/types.js +10 -0
  374. package/script/validator/uxil_family.d.ts +43 -0
  375. package/script/validator/uxil_family.d.ts.map +1 -0
  376. package/script/validator/uxil_family.js +56 -0
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UX_REF_OPS = void 0;
4
+ exports.assembleUxSurface = assembleUxSurface;
5
+ const mod_js_1 = require("../decl/mod.js");
6
+ const diagnostics_js_1 = require("./diagnostics.js");
7
+ const grammar_js_1 = require("./grammar.js");
8
+ const recognize_js_1 = require("./recognize.js");
9
+ const surfaces_js_1 = require("./surfaces.js");
10
+ /** Reference operations for uxil's dotted internal surface paths. Child
11
+ * surfaces are always relative (the leading-dot grammar has no absolute
12
+ * form), so `isAbsolute` never fires in practice for a child-surface join —
13
+ * kept for API symmetry with the DSL-agnostic `core/decl` engine. */
14
+ exports.UX_REF_OPS = {
15
+ isAbsolute: (r) => r.startsWith("ux:"),
16
+ join: (b, r) => `${b}.${r}`,
17
+ };
18
+ function toLocation(entry, range) {
19
+ return {
20
+ file: entry.location.file,
21
+ line: (entry.bodyStartLine ?? 1) + range.start.line - 1,
22
+ column: range.start.column,
23
+ };
24
+ }
25
+ /**
26
+ * Anchor a span-relative grammar diagnostic at its inline span's file
27
+ * location (#727). Line always composes; column composes only on the
28
+ * diagnostic's first line (grammar positions currently always carry
29
+ * line 1 — the line math is defensive).
30
+ */
31
+ function anchorSpanDiagnostic(file, span, d) {
32
+ return {
33
+ code: d.code,
34
+ severity: d.severity,
35
+ message: d.message,
36
+ location: {
37
+ file,
38
+ line: span.location.line + (d.position.line - 1),
39
+ column: d.position.line === 1
40
+ ? span.innerColumn + (d.position.column - 1)
41
+ : d.position.column,
42
+ },
43
+ };
44
+ }
45
+ /**
46
+ * Anchor a paragraph-relative grammar diagnostic (#781) at its bullet's
47
+ * file location (#727). Columns are body-indent-relative — the same
48
+ * accepted dedent wart typl's bridge documents; line math is exact.
49
+ */
50
+ function anchorBulletDiagnostic(entry, range, d) {
51
+ const base = toLocation(entry, range);
52
+ return {
53
+ code: d.code,
54
+ severity: d.severity,
55
+ message: d.message,
56
+ location: {
57
+ file: base.file,
58
+ line: base.line + (d.position.line - 1),
59
+ column: d.position.line === 1
60
+ ? base.column + (d.position.column - 1)
61
+ : d.position.column,
62
+ },
63
+ };
64
+ }
65
+ /**
66
+ * Assemble one entry's uxil declarations into its surface tree. Reads
67
+ * `entry.bodyTokens` (root spans) and `entry.bodyAst` (element/child
68
+ * bullets) — no parser or model change; S8 is a pure downstream reader.
69
+ */
70
+ function assembleUxSurface(entry) {
71
+ const diagnostics = [];
72
+ // ── Root ──────────────────────────────────────────────────────────────
73
+ const rootSpans = (0, surfaces_js_1.extractUxRootSpans)(entry.bodyTokens);
74
+ const rootCandidates = [];
75
+ for (const span of rootSpans) {
76
+ const { decl, diagnostics: parseDiags } = (0, grammar_js_1.parseRootDecl)(span.source);
77
+ diagnostics.push(...parseDiags.map((d) => anchorSpanDiagnostic(entry.location.file, span, d)));
78
+ if (decl && parseDiags.length === 0) {
79
+ rootCandidates.push({
80
+ surface: decl.surface,
81
+ kind: decl.kind,
82
+ states: decl.states,
83
+ location: span.location,
84
+ });
85
+ }
86
+ }
87
+ let rootPath;
88
+ let rootKind;
89
+ let rootStates = [];
90
+ let rootLocation;
91
+ const bullets = (0, surfaces_js_1.extractUxBullets)(entry.bodyAst ?? []);
92
+ if (rootCandidates.length === 0) {
93
+ // A malformed root span already reports its own specific parse
94
+ // diagnostic (e.g. UXIL-004) — adding "no root found" on top would be
95
+ // redundant noise for the same defect. UXIL-011 is reserved for the
96
+ // distinct case: uxil content exists (bullets) but no root span was
97
+ // ever written at all. An entry with no uxil content whatsoever is not
98
+ // this module's concern (ADR-009: entry-type policy is S9/profile's).
99
+ if (rootSpans.length === 0 && bullets.length > 0) {
100
+ diagnostics.push((0, diagnostics_js_1.uxilDiagnosticAt)("UXIL-011", {}, {
101
+ file: entry.location.file,
102
+ line: entry.bodyStartLine ?? 1,
103
+ column: 1,
104
+ }));
105
+ }
106
+ }
107
+ else {
108
+ const check = (0, mod_js_1.checkSingleRoot)(rootCandidates);
109
+ const first = rootCandidates[0];
110
+ rootPath = first.surface.join(".");
111
+ rootKind = first.kind;
112
+ rootStates = first.states;
113
+ rootLocation = first.location;
114
+ if (!check.ok) {
115
+ // multiple-roots: first wins (source order); every extra is UXIL-012.
116
+ for (let k = 1; k < check.roots.length; k++) {
117
+ const extra = check.roots[k];
118
+ diagnostics.push((0, diagnostics_js_1.uxilDiagnosticAt)("UXIL-012", { first: `ux:${rootPath}` }, extra.location));
119
+ }
120
+ }
121
+ }
122
+ // ── Element / child-surface bullets ─────────────────────────────────────
123
+ const bulletInfo = bullets.map((bullet) => {
124
+ const span = (0, surfaces_js_1.stripUxilLeadingSpan)(bullet.source);
125
+ const form = span !== undefined ? (0, recognize_js_1.classifyUxilForm)(span) : undefined;
126
+ if (form === "child") {
127
+ const { decl, diagnostics: parseDiags } = (0, grammar_js_1.parseChildSurfaceDecl)(span);
128
+ diagnostics.push(...parseDiags.map((d) => anchorBulletDiagnostic(entry, bullet.range, d)));
129
+ if (decl && parseDiags.length === 0) {
130
+ return {
131
+ form: "child",
132
+ childPath: decl.path,
133
+ childStates: decl.states,
134
+ };
135
+ }
136
+ return { form: "child" };
137
+ }
138
+ // form === "element" (extractUxBullets only returns element/child spans).
139
+ const { decl, diagnostics: parseDiags } = (0, grammar_js_1.parseElementBullet)(bullet.source);
140
+ diagnostics.push(...parseDiags.map((d) => anchorBulletDiagnostic(entry, bullet.range, d)));
141
+ if (decl && parseDiags.length === 0) {
142
+ return {
143
+ form: "element",
144
+ elementName: decl.element,
145
+ verbs: decl.verbs,
146
+ keyTemplate: decl.keyTemplate,
147
+ navTarget: decl.nav ? decl.nav.surface.join(".") : undefined,
148
+ elementStates: decl.states,
149
+ eventDictionary: decl.eventDictionary,
150
+ };
151
+ }
152
+ return { form: "element" };
153
+ });
154
+ // Nearest ancestor base for a bullet's `.parent` chain: the closest
155
+ // "child" ancestor (skipping over "element" ancestors, which never
156
+ // establish a base — core/decl/resolve rule 1), or root when there is
157
+ // none. A "child" ancestor whose OWN declaration failed to resolve
158
+ // reports `blocked: true` rather than being skipped past — everything
159
+ // nested beneath a broken intermediate declaration is unscopeable, and
160
+ // must not silently reattach to a grandparent or root (that would
161
+ // produce a plausible-looking but wrong path with no diagnostic
162
+ // explaining the reparenting). `resolveRef` only ever consults the
163
+ // single nearest base (rule 3, "not accumulated up the chain"), so
164
+ // finding just this one ancestor is sufficient — no chain to build.
165
+ const nearestAncestorBase = (parent) => {
166
+ let p = parent;
167
+ while (p !== undefined) {
168
+ const info = bulletInfo[p];
169
+ if (info.form === "child") {
170
+ return info.resolvedPath !== undefined
171
+ ? { path: info.resolvedPath }
172
+ : { blocked: true };
173
+ }
174
+ p = bullets[p].parent;
175
+ }
176
+ return undefined;
177
+ };
178
+ const scopeFor = (parent) => {
179
+ const nearest = nearestAncestorBase(parent);
180
+ if (nearest && "blocked" in nearest)
181
+ return undefined;
182
+ const base = nearest?.path ?? rootPath;
183
+ return base !== undefined ? { base } : undefined;
184
+ };
185
+ // Resolve child-surface paths in source order. Parents always precede
186
+ // children in the depth-first extraction order (core/decl/surfaces.ts
187
+ // guarantee), so a single forward pass suffices — no fixpoint needed.
188
+ for (let i = 0; i < bullets.length; i++) {
189
+ const info = bulletInfo[i];
190
+ if (info.form !== "child" || info.childPath === undefined)
191
+ continue;
192
+ const res = (0, mod_js_1.resolveRef)(info.childPath.join("."), scopeFor(bullets[i].parent), exports.UX_REF_OPS);
193
+ if (res.ok) {
194
+ info.resolvedPath = res.ref;
195
+ continue;
196
+ }
197
+ // UXIL-024 (S9 #727), reserved: emitted only when a relative ref's
198
+ // failure is NOT attributable to a missing/broken root (already
199
+ // UXIL-011 or a root parse diagnostic) or a blocked ancestor (its own
200
+ // diagnostic) — the cascade suppression S8 chose. With the root as the
201
+ // universal fallback base this branch is structurally unreachable
202
+ // today; it becomes live when a surface with a non-root base (the
203
+ // table caption base, epic §A) lands.
204
+ const nearest = nearestAncestorBase(bullets[i].parent);
205
+ const blocked = nearest !== undefined && "blocked" in nearest;
206
+ if (!blocked && rootCandidates.length > 0) {
207
+ diagnostics.push((0, diagnostics_js_1.uxilDiagnosticAt)("UXIL-024", { ref: `.${info.childPath.join(".")}` }, toLocation(entry, bullets[i].range)));
208
+ }
209
+ }
210
+ // Nearest enclosing surface path for a bullet's `.parent` — the closest
211
+ // resolved child-surface ancestor, or the root when there is none (or
212
+ // `undefined` when the nearest ancestor is itself unresolved — see
213
+ // nearestAncestorBase).
214
+ const enclosingSurfacePath = (parent) => {
215
+ const nearest = nearestAncestorBase(parent);
216
+ if (nearest && "blocked" in nearest)
217
+ return undefined;
218
+ return nearest?.path ?? rootPath;
219
+ };
220
+ // ── Group elements under their enclosing surface ────────────────────────
221
+ const elementsByPath = new Map();
222
+ for (let i = 0; i < bullets.length; i++) {
223
+ const info = bulletInfo[i];
224
+ if (info.form !== "element" || info.elementName === undefined)
225
+ continue;
226
+ const path = enclosingSurfacePath(bullets[i].parent);
227
+ if (path === undefined)
228
+ continue; // no root in scope — see note above
229
+ const element = {
230
+ name: info.elementName,
231
+ verbs: info.verbs ?? [],
232
+ ...(info.keyTemplate ? { keyTemplate: info.keyTemplate } : {}),
233
+ ...(info.navTarget !== undefined ? { navTarget: info.navTarget } : {}),
234
+ states: info.elementStates ?? [],
235
+ eventDictionary: info.eventDictionary ?? "",
236
+ location: toLocation(entry, bullets[i].range),
237
+ };
238
+ const list = elementsByPath.get(path);
239
+ if (list)
240
+ list.push(element);
241
+ else
242
+ elementsByPath.set(path, [element]);
243
+ }
244
+ // ── Build the surface list ───────────────────────────────────────────────
245
+ const surfaces = [];
246
+ if (rootPath !== undefined && rootKind !== undefined &&
247
+ rootLocation !== undefined) {
248
+ surfaces.push({
249
+ path: rootPath,
250
+ kind: rootKind,
251
+ states: rootStates,
252
+ elements: elementsByPath.get(rootPath) ?? [],
253
+ location: rootLocation,
254
+ });
255
+ }
256
+ for (let i = 0; i < bullets.length; i++) {
257
+ const info = bulletInfo[i];
258
+ if (info.form !== "child" || info.resolvedPath === undefined)
259
+ continue;
260
+ surfaces.push({
261
+ path: info.resolvedPath,
262
+ // A resolved child-surface implies rootPath (hence rootKind) is
263
+ // defined — the only source of a base in this model is the root
264
+ // fallback (see scopeFor); every resolved path traces back to it.
265
+ kind: rootKind,
266
+ states: info.childStates ?? [],
267
+ elements: elementsByPath.get(info.resolvedPath) ?? [],
268
+ location: toLocation(entry, bullets[i].range),
269
+ });
270
+ }
271
+ return { surfaces, diagnostics };
272
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @module uxil/ast
3
+ *
4
+ * AST node types for the uxil DSL (parse-only, S7 #725). A `UxRef` is a
5
+ * parsed `ux:` reference (citation, nav target, or the surface head of a
6
+ * declaration); the three `*Decl` shapes are the authored declaration forms.
7
+ * All values are captured raw — kind/verb/state vocabulary checks are S8.
8
+ */
9
+ /** 1-based source position within a single uxil source string (line is always 1). */
10
+ export interface Position {
11
+ readonly line: number;
12
+ readonly column: number;
13
+ }
14
+ /** A ref key: a concrete value or a `{name}` template. */
15
+ export type UxKey = {
16
+ readonly kind: "concrete";
17
+ readonly value: string;
18
+ } | {
19
+ readonly kind: "template";
20
+ readonly name: string;
21
+ };
22
+ /**
23
+ * A parsed `ux:` reference. `hasScheme` records whether the literal `ux:`
24
+ * scheme was present; the scheme-less wire form parses to an otherwise
25
+ * identical node (wire-compatibility contract).
26
+ */
27
+ export interface UxRef {
28
+ readonly hasScheme: boolean;
29
+ readonly surface: readonly string[];
30
+ readonly state?: string;
31
+ readonly element?: string;
32
+ readonly key?: UxKey;
33
+ readonly verb?: string;
34
+ readonly position: Position;
35
+ }
36
+ /** Root declaration: `ux:surface : kind @ state, state, …` (exactly one per entry — enforced in S8). */
37
+ export interface RootDecl {
38
+ readonly form: "root";
39
+ readonly surface: readonly string[];
40
+ readonly kind: string;
41
+ readonly states: readonly string[];
42
+ readonly position: Position;
43
+ }
44
+ /** Element declaration from a bullet: `/element : verb, … : {key} @state -> nav` plus a trailing event dictionary. */
45
+ export interface ElementDecl {
46
+ readonly form: "element";
47
+ readonly element: string;
48
+ readonly keyTemplate?: UxKey;
49
+ readonly verbs: readonly string[];
50
+ readonly states?: readonly string[];
51
+ readonly nav?: UxRef;
52
+ readonly eventDictionary: string;
53
+ readonly position: Position;
54
+ }
55
+ /** Child-surface declaration from a bullet: `.path @state` (its nested bullets are its elements — stitched in S8). */
56
+ export interface ChildSurfaceDecl {
57
+ readonly form: "child";
58
+ readonly path: readonly string[];
59
+ readonly states?: readonly string[];
60
+ readonly position: Position;
61
+ }
62
+ export type UxilDecl = RootDecl | ElementDecl | ChildSurfaceDecl;
63
+ //# sourceMappingURL=ast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/uxil/ast.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,0DAA0D;AAC1D,MAAM,MAAM,KAAK,GACb;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,wGAAwG;AACxG,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,sHAAsH;AACtH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,sHAAsH;AACtH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,gBAAgB,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * @module uxil/ast
4
+ *
5
+ * AST node types for the uxil DSL (parse-only, S7 #725). A `UxRef` is a
6
+ * parsed `ux:` reference (citation, nav target, or the surface head of a
7
+ * declaration); the three `*Decl` shapes are the authored declaration forms.
8
+ * All values are captured raw — kind/verb/state vocabulary checks are S8.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module uxil/citations
3
+ *
4
+ * Citation extraction (S8 #726): a *citation* is a bare `ux:` reference in
5
+ * an inline code span with no declaration clause — e.g.
6
+ * `` `ux:media.home/play!activate` ``. Plain root/element/child
7
+ * declarations are excluded (`classifyUxilForm` recognizes them). Mirrors
8
+ * typl/citations.ts's inline half.
9
+ */
10
+ import type { BodyToken, SourceLocation } from "../model/mod.js";
11
+ import type { UxRef } from "./ast.js";
12
+ /** One `ux:` citation: the parsed ref and its file location. */
13
+ export interface UxCitation {
14
+ readonly ref: UxRef;
15
+ readonly location: SourceLocation;
16
+ }
17
+ /** True when a code span's (trimmed) text is a `ux:` citation, not a declaration. */
18
+ export declare function isUxCitationText(text: string): boolean;
19
+ /**
20
+ * Filter `Entry.bodyTokens` to `ux:` citations, in source order. Reuses
21
+ * the shared inline-declaration walker with the citation recognizer; a
22
+ * citation that fails to parse cleanly (e.g. a reserved character) is
23
+ * dropped rather than surfaced — parse-level diagnostics are S7's
24
+ * concern, not this extractor's.
25
+ */
26
+ export declare function extractUxCitations(bodyTokens: readonly BodyToken[]): readonly UxCitation[];
27
+ //# sourceMappingURL=citations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../../src/uxil/citations.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAItC,gEAAgE;AAChE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;CACnC;AAED,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGtD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,SAAS,UAAU,EAAE,CASvB"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUxCitationText = isUxCitationText;
4
+ exports.extractUxCitations = extractUxCitations;
5
+ const mod_js_1 = require("../decl/mod.js");
6
+ const grammar_js_1 = require("./grammar.js");
7
+ const recognize_js_1 = require("./recognize.js");
8
+ /** True when a code span's (trimmed) text is a `ux:` citation, not a declaration. */
9
+ function isUxCitationText(text) {
10
+ const t = text.trim();
11
+ return t.startsWith("ux:") && (0, recognize_js_1.classifyUxilForm)(t) === undefined;
12
+ }
13
+ /**
14
+ * Filter `Entry.bodyTokens` to `ux:` citations, in source order. Reuses
15
+ * the shared inline-declaration walker with the citation recognizer; a
16
+ * citation that fails to parse cleanly (e.g. a reserved character) is
17
+ * dropped rather than surfaced — parse-level diagnostics are S7's
18
+ * concern, not this extractor's.
19
+ */
20
+ function extractUxCitations(bodyTokens) {
21
+ const out = [];
22
+ for (const d of (0, mod_js_1.extractInlineDeclarations)(bodyTokens, isUxCitationText)) {
23
+ const { ref, diagnostics } = (0, grammar_js_1.parseUxRef)(d.source.trim());
24
+ if (ref && diagnostics.length === 0) {
25
+ out.push({ ref, location: d.location });
26
+ }
27
+ }
28
+ return out;
29
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module uxil/diagnostics
3
+ *
4
+ * Diagnostic codes emitted by the uxil parser and compiler (UXIL-001 through
5
+ * UXIL-026). Source-local positions only — S9 bridges these to file-anchored
6
+ * core `Diagnostic`s. Shape and helper mirror typl's `typlDiagnostic`.
7
+ */
8
+ import type { Position } from "./ast.js";
9
+ import type { Diagnostic, Severity, SourceLocation } from "../model/mod.js";
10
+ /** Union of all uxil parser + compiler diagnostic codes. */
11
+ export type UxilCode = "UXIL-001" | "UXIL-002" | "UXIL-003" | "UXIL-004" | "UXIL-005" | "UXIL-006" | "UXIL-007" | "UXIL-008" | "UXIL-009" | "UXIL-010" | "UXIL-011" | "UXIL-012" | "UXIL-013" | "UXIL-014" | "UXIL-015" | "UXIL-016" | "UXIL-017" | "UXIL-018" | "UXIL-019" | "UXIL-020" | "UXIL-021" | "UXIL-022" | "UXIL-023" | "UXIL-024" | "UXIL-025" | "UXIL-026";
12
+ /** Shape of each entry in {@linkcode UXIL_CODES}. */
13
+ export interface UxilCodeEntry {
14
+ readonly severity: Severity;
15
+ readonly template: string;
16
+ }
17
+ /** A diagnostic emitted by the uxil parser (source-local position). */
18
+ export interface UxilDiagnostic {
19
+ readonly code: UxilCode;
20
+ readonly severity: Severity;
21
+ readonly message: string;
22
+ readonly position: Position;
23
+ }
24
+ export declare const UXIL_CODES: Record<UxilCode, UxilCodeEntry>;
25
+ /**
26
+ * Construct a uxil diagnostic by substituting `${var}` placeholders in the
27
+ * code's template. A missing key leaves a raw `${key}` in the message — test
28
+ * message formatting per code.
29
+ */
30
+ export declare function uxilDiagnostic(code: UxilCode, params: Record<string, string | number>, position: Position): UxilDiagnostic;
31
+ /**
32
+ * Construct a file-anchored core {@linkcode Diagnostic} for a uxil code —
33
+ * the S9 sibling of {@linkcode uxilDiagnostic} (#727). Assembly, the
34
+ * validator, and the family orchestrator know their file coordinates, so
35
+ * they emit core diagnostics directly; only the file-agnostic grammar
36
+ * layer still uses the source-local shape.
37
+ */
38
+ export declare function uxilDiagnosticAt(code: UxilCode, params: Record<string, string | number>, location: SourceLocation): Diagnostic;
39
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/uxil/diagnostics.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE5E,4DAA4D;AAC5D,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,CAAC;AAEf,qDAAqD;AACrD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B;AAED,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,CAwHtD,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,QAAQ,EAAE,QAAQ,GACjB,cAAc,CAQhB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,QAAQ,EACd,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,EACvC,QAAQ,EAAE,cAAc,GACvB,UAAU,CAMZ"}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UXIL_CODES = void 0;
4
+ exports.uxilDiagnostic = uxilDiagnostic;
5
+ exports.uxilDiagnosticAt = uxilDiagnosticAt;
6
+ exports.UXIL_CODES = {
7
+ "UXIL-001": {
8
+ severity: "error",
9
+ template: "Malformed uxil reference: ${detail}.",
10
+ },
11
+ "UXIL-002": {
12
+ severity: "error",
13
+ template: "Reserved character ${char} is not allowed in a uxil reference.",
14
+ },
15
+ "UXIL-003": {
16
+ severity: "error",
17
+ template: "The ux://authority form is reserved; use a scheme-relative reference.",
18
+ },
19
+ "UXIL-004": {
20
+ severity: "error",
21
+ template: "Root declaration is missing its kind (expected 'ux:surface : kind').",
22
+ },
23
+ "UXIL-005": {
24
+ severity: "error",
25
+ template: "Element declaration has an empty verb set (expected '/element : verb').",
26
+ },
27
+ "UXIL-006": {
28
+ severity: "error",
29
+ template: "Element declaration is missing its trailing event dictionary.",
30
+ },
31
+ "UXIL-007": {
32
+ severity: "error",
33
+ template: "Malformed key template: ${detail}.",
34
+ },
35
+ "UXIL-008": {
36
+ severity: "error",
37
+ template: "Malformed surface: ${detail}.",
38
+ },
39
+ "UXIL-009": {
40
+ severity: "error",
41
+ template: "Unknown surface kind '${kind}' (expected screen, panel, or agent).",
42
+ },
43
+ "UXIL-010": {
44
+ severity: "error",
45
+ template: "Unknown interaction verb '${verb}'.",
46
+ },
47
+ "UXIL-011": {
48
+ severity: "error",
49
+ template: "A ux-contract entry must declare exactly one root surface; none was found.",
50
+ },
51
+ "UXIL-012": {
52
+ severity: "error",
53
+ template: "A ux-contract entry must declare exactly one root surface; found another after '${first}'.",
54
+ },
55
+ "UXIL-013": {
56
+ severity: "error",
57
+ template: "Kind '${kind}' is stateless and cannot declare @ states.",
58
+ },
59
+ "UXIL-014": {
60
+ severity: "error",
61
+ template: "'observe' is exclusive and cannot be combined with other verbs on element '${element}'.",
62
+ },
63
+ "UXIL-015": {
64
+ severity: "error",
65
+ template: "Surface '${surface}' is already declared (first at ${otherFile}:${otherLine}).",
66
+ },
67
+ "UXIL-016": {
68
+ severity: "error",
69
+ template: "Surface '${surface}' has no declared parent surface '${parent}'.",
70
+ },
71
+ "UXIL-017": {
72
+ severity: "error",
73
+ template: "navigate target '${target}' does not resolve to a navigable (screen) surface.",
74
+ },
75
+ "UXIL-018": {
76
+ severity: "error",
77
+ template: "Unknown surface '${surface}'.",
78
+ },
79
+ "UXIL-019": {
80
+ severity: "error",
81
+ template: "Unknown element '${element}' on surface '${surface}'.",
82
+ },
83
+ "UXIL-020": {
84
+ severity: "error",
85
+ template: "Verb '${verb}' is not in the declared verb set of element '${element}'.",
86
+ },
87
+ "UXIL-021": {
88
+ severity: "error",
89
+ template: "State '${state}' is not declared on surface '${surface}'.",
90
+ },
91
+ "UXIL-022": {
92
+ severity: "error",
93
+ template: "Element '${element}' declares a key template; cite it with a '{name}' template, not a concrete key.",
94
+ },
95
+ "UXIL-023": {
96
+ severity: "error",
97
+ template: "uxil declaration outside a declaring entry type: '${entry}' (type '${type}') may not declare surfaces (requires 'declares: ux-surface').",
98
+ },
99
+ "UXIL-024": {
100
+ severity: "error",
101
+ template: "Relative reference '${ref}' has no base in scope.",
102
+ },
103
+ "UXIL-025": {
104
+ severity: "error",
105
+ template: "Element '${element}' declares 'observe' but surface '${surface}' has non-visual kind '${kind}'.",
106
+ },
107
+ "UXIL-026": {
108
+ severity: "error",
109
+ template: "Element '${element}' declares 'navigate' without a '-> target' clause.",
110
+ },
111
+ };
112
+ /**
113
+ * Construct a uxil diagnostic by substituting `${var}` placeholders in the
114
+ * code's template. A missing key leaves a raw `${key}` in the message — test
115
+ * message formatting per code.
116
+ */
117
+ function uxilDiagnostic(code, params, position) {
118
+ const entry = exports.UXIL_CODES[code];
119
+ if (!entry)
120
+ throw new Error(`Unknown UXIL code: ${code}`);
121
+ let message = entry.template;
122
+ for (const [k, v] of Object.entries(params)) {
123
+ message = message.replaceAll(`\${${k}}`, String(v));
124
+ }
125
+ return { code, severity: entry.severity, message, position };
126
+ }
127
+ /**
128
+ * Construct a file-anchored core {@linkcode Diagnostic} for a uxil code —
129
+ * the S9 sibling of {@linkcode uxilDiagnostic} (#727). Assembly, the
130
+ * validator, and the family orchestrator know their file coordinates, so
131
+ * they emit core diagnostics directly; only the file-agnostic grammar
132
+ * layer still uses the source-local shape.
133
+ */
134
+ function uxilDiagnosticAt(code, params, location) {
135
+ const d = uxilDiagnostic(code, params, {
136
+ line: location.line,
137
+ column: location.column,
138
+ });
139
+ return { code: d.code, severity: d.severity, message: d.message, location };
140
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * @module uxil/grammar
3
+ *
4
+ * Recursive-descent parsers for the uxil DSL: one reference parser
5
+ * ({@linkcode parseUxRef}) plus the three declaration-form parsers (added in
6
+ * later tasks). Each returns a best-effort AST node and a list of
7
+ * source-local {@linkcode UxilDiagnostic}s. Parse-only — no resolution.
8
+ *
9
+ * Diagnostics policy (#780): a single malformed region reports one specific
10
+ * code. After a parse error fires, leftover-token noise from the same
11
+ * region is suppressed (see {@linkcode expectEof}) rather than re-flagged
12
+ * as a redundant or contradictory second code, and a reserved character
13
+ * stops structural parsing outright (the lexer dropped the char, so the
14
+ * token stream is corrupt). Orthogonal region checks — the nav tail's
15
+ * reserved-char scan, the missing event dictionary (UXIL-006) — still
16
+ * co-report. Editors reparse per keystroke, so within a region errors
17
+ * surface progressively.
18
+ */
19
+ import type { ChildSurfaceDecl, ElementDecl, RootDecl, UxRef } from "./ast.js";
20
+ import { type UxilDiagnostic } from "./diagnostics.js";
21
+ /**
22
+ * Parse a `ux:` reference (citation / nav target). The scheme is optional;
23
+ * `media.home/play` and `ux:media.home/play` yield identical AST except for
24
+ * `hasScheme`. Returns `ref` undefined only for a wholly malformed input
25
+ * (reserved char, reserved authority, no surface).
26
+ */
27
+ export declare function parseUxRef(source: string): {
28
+ ref?: UxRef;
29
+ diagnostics: UxilDiagnostic[];
30
+ };
31
+ /**
32
+ * Parse a root declaration: `[ux:]surface : kind [@state, …]`. The `:` here
33
+ * introduces the kind (not a ref key). Returns `decl` undefined only when no
34
+ * surface is present or a reserved char corrupted the source. A missing kind
35
+ * (no `:`, or a `:` with nothing after it) is UXIL-004 with a best-effort
36
+ * partial decl (`kind: ""`, surface and states still captured) — S8's
37
+ * assemble must gate uxRegistry registration on a clean parse, never on the
38
+ * partial decl alone (#780).
39
+ */
40
+ export declare function parseRootDecl(source: string): {
41
+ decl?: RootDecl;
42
+ diagnostics: UxilDiagnostic[];
43
+ };
44
+ /**
45
+ * Parse a child-surface declaration: `.path[.seg…] [@state, …]`. The leading
46
+ * dot marks containment; nested bullets (its elements) are stitched in S8.
47
+ * There is no kind or verb set — kind is inherited (S8).
48
+ */
49
+ export declare function parseChildSurfaceDecl(source: string): {
50
+ decl?: ChildSurfaceDecl;
51
+ diagnostics: UxilDiagnostic[];
52
+ };
53
+ /**
54
+ * Parse an element bullet: a leading code span
55
+ * `/element : verb[, verb…] [: {key}] [@state, …] [-> nav]` followed by a
56
+ * mandatory trailing prose event dictionary. Grammar decision K1 (#786,
57
+ * per the epic design doc): the key template is its own `:` clause after
58
+ * the verb set — never attached to the element name, so declarations
59
+ * cannot collide with the ref grammar's `element:{key}` form.
60
+ *
61
+ * Diagnostic columns are paragraph-relative (#781): the parser receives the
62
+ * whole paragraph and splits the leading code span itself, so every
63
+ * span-derived column is shifted by the span's start offset
64
+ * ({@linkcode splitLeadingCodeSpan}'s `spanStart`). The two whole-bullet
65
+ * diagnostics — no leading code span, and the missing event dictionary —
66
+ * anchor at paragraph column 1.
67
+ */
68
+ export declare function parseElementBullet(paragraph: string): {
69
+ decl?: ElementDecl;
70
+ diagnostics: UxilDiagnostic[];
71
+ };
72
+ //# sourceMappingURL=grammar.d.ts.map