@rcrsr/rill 0.14.0 → 0.16.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 (305) hide show
  1. package/dist/ast-nodes.d.ts +2 -11
  2. package/dist/ast-nodes.js +0 -1
  3. package/dist/ast-unions.d.ts +0 -1
  4. package/dist/ast-unions.js +0 -1
  5. package/dist/constants.d.ts +0 -1
  6. package/dist/constants.js +0 -1
  7. package/dist/error-classes.d.ts +0 -1
  8. package/dist/error-classes.js +0 -1
  9. package/dist/error-formatter.d.ts +0 -1
  10. package/dist/error-formatter.js +0 -1
  11. package/dist/error-registry.d.ts +0 -1
  12. package/dist/error-registry.js +50 -1
  13. package/dist/ext/crypto/index.d.ts +0 -1
  14. package/dist/ext/crypto/index.js +5 -6
  15. package/dist/ext/exec/index.d.ts +0 -1
  16. package/dist/ext/exec/index.js +3 -4
  17. package/dist/ext/exec/runner.d.ts +0 -1
  18. package/dist/ext/exec/runner.js +0 -1
  19. package/dist/ext/fetch/index.d.ts +0 -1
  20. package/dist/ext/fetch/index.js +8 -39
  21. package/dist/ext/fetch/request.d.ts +0 -1
  22. package/dist/ext/fetch/request.js +0 -1
  23. package/dist/ext/fs/index.d.ts +0 -1
  24. package/dist/ext/fs/index.js +26 -27
  25. package/dist/ext/fs/sandbox.d.ts +0 -1
  26. package/dist/ext/fs/sandbox.js +0 -1
  27. package/dist/ext/kv/index.d.ts +0 -1
  28. package/dist/ext/kv/index.js +19 -20
  29. package/dist/ext/kv/store.d.ts +0 -1
  30. package/dist/ext/kv/store.js +0 -1
  31. package/dist/generated/introspection-data.d.ts +0 -1
  32. package/dist/generated/introspection-data.js +0 -1
  33. package/dist/generated/version-data.d.ts +1 -2
  34. package/dist/generated/version-data.js +2 -3
  35. package/dist/highlight-map.d.ts +0 -1
  36. package/dist/highlight-map.js +0 -1
  37. package/dist/index.d.ts +1 -2
  38. package/dist/index.js +1 -2
  39. package/dist/lexer/errors.d.ts +0 -1
  40. package/dist/lexer/errors.js +0 -1
  41. package/dist/lexer/helpers.d.ts +0 -1
  42. package/dist/lexer/helpers.js +0 -1
  43. package/dist/lexer/index.d.ts +0 -1
  44. package/dist/lexer/index.js +0 -1
  45. package/dist/lexer/operators.d.ts +0 -1
  46. package/dist/lexer/operators.js +0 -1
  47. package/dist/lexer/readers.d.ts +0 -1
  48. package/dist/lexer/readers.js +0 -1
  49. package/dist/lexer/state.d.ts +0 -1
  50. package/dist/lexer/state.js +0 -1
  51. package/dist/lexer/tokenizer.d.ts +0 -1
  52. package/dist/lexer/tokenizer.js +0 -1
  53. package/dist/parser/helpers.d.ts +0 -1
  54. package/dist/parser/helpers.js +0 -1
  55. package/dist/parser/index.d.ts +0 -1
  56. package/dist/parser/index.js +0 -1
  57. package/dist/parser/parser-collect.d.ts +0 -1
  58. package/dist/parser/parser-collect.js +0 -1
  59. package/dist/parser/parser-control.d.ts +0 -1
  60. package/dist/parser/parser-control.js +0 -1
  61. package/dist/parser/parser-expr.d.ts +0 -1
  62. package/dist/parser/parser-expr.js +0 -1
  63. package/dist/parser/parser-extract.d.ts +0 -1
  64. package/dist/parser/parser-extract.js +0 -1
  65. package/dist/parser/parser-functions.d.ts +0 -1
  66. package/dist/parser/parser-functions.js +0 -1
  67. package/dist/parser/parser-literals.d.ts +0 -1
  68. package/dist/parser/parser-literals.js +4 -2
  69. package/dist/parser/parser-script.d.ts +0 -1
  70. package/dist/parser/parser-script.js +0 -1
  71. package/dist/parser/parser-shape.d.ts +2 -3
  72. package/dist/parser/parser-shape.js +8 -40
  73. package/dist/parser/parser-types.d.ts +28 -2
  74. package/dist/parser/parser-types.js +64 -13
  75. package/dist/parser/parser-use.d.ts +0 -1
  76. package/dist/parser/parser-use.js +0 -1
  77. package/dist/parser/parser-variables.d.ts +0 -1
  78. package/dist/parser/parser-variables.js +0 -1
  79. package/dist/parser/parser.d.ts +0 -1
  80. package/dist/parser/parser.js +0 -1
  81. package/dist/parser/state.d.ts +0 -1
  82. package/dist/parser/state.js +0 -1
  83. package/dist/runtime/core/callable.d.ts +40 -13
  84. package/dist/runtime/core/callable.js +137 -31
  85. package/dist/runtime/core/context.d.ts +0 -1
  86. package/dist/runtime/core/context.js +1 -2
  87. package/dist/runtime/core/equals.d.ts +0 -1
  88. package/dist/runtime/core/equals.js +35 -3
  89. package/dist/runtime/core/eval/base.d.ts +0 -1
  90. package/dist/runtime/core/eval/base.js +0 -1
  91. package/dist/runtime/core/eval/evaluator.d.ts +0 -1
  92. package/dist/runtime/core/eval/evaluator.js +0 -1
  93. package/dist/runtime/core/eval/index.d.ts +0 -1
  94. package/dist/runtime/core/eval/index.js +0 -1
  95. package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
  96. package/dist/runtime/core/eval/mixins/annotations.js +0 -1
  97. package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
  98. package/dist/runtime/core/eval/mixins/closures.js +82 -69
  99. package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
  100. package/dist/runtime/core/eval/mixins/collections.js +9 -4
  101. package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
  102. package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
  103. package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
  104. package/dist/runtime/core/eval/mixins/conversion.js +263 -16
  105. package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
  106. package/dist/runtime/core/eval/mixins/core.js +0 -1
  107. package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
  108. package/dist/runtime/core/eval/mixins/expressions.js +0 -1
  109. package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
  110. package/dist/runtime/core/eval/mixins/extraction.js +8 -9
  111. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
  112. package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
  113. package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
  114. package/dist/runtime/core/eval/mixins/literals.js +3 -7
  115. package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
  116. package/dist/runtime/core/eval/mixins/types.js +222 -200
  117. package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
  118. package/dist/runtime/core/eval/mixins/use.js +0 -1
  119. package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
  120. package/dist/runtime/core/eval/mixins/variables.js +6 -7
  121. package/dist/runtime/core/eval/types.d.ts +0 -1
  122. package/dist/runtime/core/eval/types.js +0 -1
  123. package/dist/runtime/core/execute.d.ts +0 -1
  124. package/dist/runtime/core/execute.js +0 -1
  125. package/dist/runtime/core/field-descriptor.d.ts +2 -3
  126. package/dist/runtime/core/field-descriptor.js +0 -1
  127. package/dist/runtime/core/introspection.d.ts +0 -1
  128. package/dist/runtime/core/introspection.js +0 -1
  129. package/dist/runtime/core/resolvers.d.ts +0 -1
  130. package/dist/runtime/core/resolvers.js +0 -1
  131. package/dist/runtime/core/signals.d.ts +0 -1
  132. package/dist/runtime/core/signals.js +0 -1
  133. package/dist/runtime/core/types.d.ts +0 -1
  134. package/dist/runtime/core/types.js +0 -1
  135. package/dist/runtime/core/values.d.ts +59 -8
  136. package/dist/runtime/core/values.js +338 -36
  137. package/dist/runtime/ext/builtins.d.ts +0 -1
  138. package/dist/runtime/ext/builtins.js +43 -17
  139. package/dist/runtime/ext/extensions.d.ts +0 -1
  140. package/dist/runtime/ext/extensions.js +0 -1
  141. package/dist/runtime/index.d.ts +2 -3
  142. package/dist/runtime/index.js +1 -2
  143. package/dist/signature-parser.d.ts +0 -1
  144. package/dist/signature-parser.js +8 -4
  145. package/dist/source-location.d.ts +0 -1
  146. package/dist/source-location.js +0 -1
  147. package/dist/token-types.d.ts +0 -1
  148. package/dist/token-types.js +0 -1
  149. package/dist/types.d.ts +0 -1
  150. package/dist/types.js +0 -1
  151. package/dist/value-types.d.ts +15 -12
  152. package/dist/value-types.js +0 -1
  153. package/package.json +2 -1
  154. package/dist/ast-nodes.d.ts.map +0 -1
  155. package/dist/ast-nodes.js.map +0 -1
  156. package/dist/ast-unions.d.ts.map +0 -1
  157. package/dist/ast-unions.js.map +0 -1
  158. package/dist/constants.d.ts.map +0 -1
  159. package/dist/constants.js.map +0 -1
  160. package/dist/error-classes.d.ts.map +0 -1
  161. package/dist/error-classes.js.map +0 -1
  162. package/dist/error-formatter.d.ts.map +0 -1
  163. package/dist/error-formatter.js.map +0 -1
  164. package/dist/error-registry.d.ts.map +0 -1
  165. package/dist/error-registry.js.map +0 -1
  166. package/dist/ext/crypto/index.d.ts.map +0 -1
  167. package/dist/ext/crypto/index.js.map +0 -1
  168. package/dist/ext/exec/index.d.ts.map +0 -1
  169. package/dist/ext/exec/index.js.map +0 -1
  170. package/dist/ext/exec/runner.d.ts.map +0 -1
  171. package/dist/ext/exec/runner.js.map +0 -1
  172. package/dist/ext/fetch/index.d.ts.map +0 -1
  173. package/dist/ext/fetch/index.js.map +0 -1
  174. package/dist/ext/fetch/request.d.ts.map +0 -1
  175. package/dist/ext/fetch/request.js.map +0 -1
  176. package/dist/ext/fs/index.d.ts.map +0 -1
  177. package/dist/ext/fs/index.js.map +0 -1
  178. package/dist/ext/fs/sandbox.d.ts.map +0 -1
  179. package/dist/ext/fs/sandbox.js.map +0 -1
  180. package/dist/ext/kv/index.d.ts.map +0 -1
  181. package/dist/ext/kv/index.js.map +0 -1
  182. package/dist/ext/kv/store.d.ts.map +0 -1
  183. package/dist/ext/kv/store.js.map +0 -1
  184. package/dist/generated/introspection-data.d.ts.map +0 -1
  185. package/dist/generated/introspection-data.js.map +0 -1
  186. package/dist/generated/version-data.d.ts.map +0 -1
  187. package/dist/generated/version-data.js.map +0 -1
  188. package/dist/highlight-map.d.ts.map +0 -1
  189. package/dist/highlight-map.js.map +0 -1
  190. package/dist/index.d.ts.map +0 -1
  191. package/dist/index.js.map +0 -1
  192. package/dist/lexer/errors.d.ts.map +0 -1
  193. package/dist/lexer/errors.js.map +0 -1
  194. package/dist/lexer/helpers.d.ts.map +0 -1
  195. package/dist/lexer/helpers.js.map +0 -1
  196. package/dist/lexer/index.d.ts.map +0 -1
  197. package/dist/lexer/index.js.map +0 -1
  198. package/dist/lexer/operators.d.ts.map +0 -1
  199. package/dist/lexer/operators.js.map +0 -1
  200. package/dist/lexer/readers.d.ts.map +0 -1
  201. package/dist/lexer/readers.js.map +0 -1
  202. package/dist/lexer/state.d.ts.map +0 -1
  203. package/dist/lexer/state.js.map +0 -1
  204. package/dist/lexer/tokenizer.d.ts.map +0 -1
  205. package/dist/lexer/tokenizer.js.map +0 -1
  206. package/dist/parser/helpers.d.ts.map +0 -1
  207. package/dist/parser/helpers.js.map +0 -1
  208. package/dist/parser/index.d.ts.map +0 -1
  209. package/dist/parser/index.js.map +0 -1
  210. package/dist/parser/parser-collect.d.ts.map +0 -1
  211. package/dist/parser/parser-collect.js.map +0 -1
  212. package/dist/parser/parser-control.d.ts.map +0 -1
  213. package/dist/parser/parser-control.js.map +0 -1
  214. package/dist/parser/parser-expr.d.ts.map +0 -1
  215. package/dist/parser/parser-expr.js.map +0 -1
  216. package/dist/parser/parser-extract.d.ts.map +0 -1
  217. package/dist/parser/parser-extract.js.map +0 -1
  218. package/dist/parser/parser-functions.d.ts.map +0 -1
  219. package/dist/parser/parser-functions.js.map +0 -1
  220. package/dist/parser/parser-literals.d.ts.map +0 -1
  221. package/dist/parser/parser-literals.js.map +0 -1
  222. package/dist/parser/parser-script.d.ts.map +0 -1
  223. package/dist/parser/parser-script.js.map +0 -1
  224. package/dist/parser/parser-shape.d.ts.map +0 -1
  225. package/dist/parser/parser-shape.js.map +0 -1
  226. package/dist/parser/parser-types.d.ts.map +0 -1
  227. package/dist/parser/parser-types.js.map +0 -1
  228. package/dist/parser/parser-use.d.ts.map +0 -1
  229. package/dist/parser/parser-use.js.map +0 -1
  230. package/dist/parser/parser-variables.d.ts.map +0 -1
  231. package/dist/parser/parser-variables.js.map +0 -1
  232. package/dist/parser/parser.d.ts.map +0 -1
  233. package/dist/parser/parser.js.map +0 -1
  234. package/dist/parser/state.d.ts.map +0 -1
  235. package/dist/parser/state.js.map +0 -1
  236. package/dist/runtime/core/callable.d.ts.map +0 -1
  237. package/dist/runtime/core/callable.js.map +0 -1
  238. package/dist/runtime/core/context.d.ts.map +0 -1
  239. package/dist/runtime/core/context.js.map +0 -1
  240. package/dist/runtime/core/equals.d.ts.map +0 -1
  241. package/dist/runtime/core/equals.js.map +0 -1
  242. package/dist/runtime/core/eval/base.d.ts.map +0 -1
  243. package/dist/runtime/core/eval/base.js.map +0 -1
  244. package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
  245. package/dist/runtime/core/eval/evaluator.js.map +0 -1
  246. package/dist/runtime/core/eval/index.d.ts.map +0 -1
  247. package/dist/runtime/core/eval/index.js.map +0 -1
  248. package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
  249. package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
  250. package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
  251. package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
  252. package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
  253. package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
  254. package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
  255. package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
  256. package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
  257. package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
  258. package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
  259. package/dist/runtime/core/eval/mixins/core.js.map +0 -1
  260. package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
  261. package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
  262. package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
  263. package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
  264. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
  265. package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
  266. package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
  267. package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
  268. package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
  269. package/dist/runtime/core/eval/mixins/types.js.map +0 -1
  270. package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
  271. package/dist/runtime/core/eval/mixins/use.js.map +0 -1
  272. package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
  273. package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
  274. package/dist/runtime/core/eval/types.d.ts.map +0 -1
  275. package/dist/runtime/core/eval/types.js.map +0 -1
  276. package/dist/runtime/core/execute.d.ts.map +0 -1
  277. package/dist/runtime/core/execute.js.map +0 -1
  278. package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
  279. package/dist/runtime/core/field-descriptor.js.map +0 -1
  280. package/dist/runtime/core/introspection.d.ts.map +0 -1
  281. package/dist/runtime/core/introspection.js.map +0 -1
  282. package/dist/runtime/core/resolvers.d.ts.map +0 -1
  283. package/dist/runtime/core/resolvers.js.map +0 -1
  284. package/dist/runtime/core/signals.d.ts.map +0 -1
  285. package/dist/runtime/core/signals.js.map +0 -1
  286. package/dist/runtime/core/types.d.ts.map +0 -1
  287. package/dist/runtime/core/types.js.map +0 -1
  288. package/dist/runtime/core/values.d.ts.map +0 -1
  289. package/dist/runtime/core/values.js.map +0 -1
  290. package/dist/runtime/ext/builtins.d.ts.map +0 -1
  291. package/dist/runtime/ext/builtins.js.map +0 -1
  292. package/dist/runtime/ext/extensions.d.ts.map +0 -1
  293. package/dist/runtime/ext/extensions.js.map +0 -1
  294. package/dist/runtime/index.d.ts.map +0 -1
  295. package/dist/runtime/index.js.map +0 -1
  296. package/dist/signature-parser.d.ts.map +0 -1
  297. package/dist/signature-parser.js.map +0 -1
  298. package/dist/source-location.d.ts.map +0 -1
  299. package/dist/source-location.js.map +0 -1
  300. package/dist/token-types.d.ts.map +0 -1
  301. package/dist/token-types.js.map +0 -1
  302. package/dist/types.d.ts.map +0 -1
  303. package/dist/types.js.map +0 -1
  304. package/dist/value-types.d.ts.map +0 -1
  305. package/dist/value-types.js.map +0 -1
@@ -1,2 +1 @@
1
1
  export declare const LANGUAGE_REFERENCE = "# rill\n\n> Scripting language designed for machine-generated code. LLMs generate rill scripts; humans review and debug. Data flows through pipes (`->`), not assignment. Variables use `$` prefix. No null, no exceptions, no truthiness.\n\n## Essentials\n\n1. Variables use `$` prefix ALWAYS: `5 => $x` (no assignment operator `=`)\n2. Pipe with `->`, capture with `=>`: `\"hello\" => $x -> .upper => $y`\n3. No null/undefined, no try/catch, no truthiness (conditions must be boolean)\n4. Variables lock to first type: `\"hi\" => $x; 42 => $x` is an ERROR\n5. Loops cannot modify outer vars: use `fold`, `each(init)`, or `$` as state dict\n\n## Critical Differences from Mainstream Languages\n\n### 1. No Assignment Operator\n\n Wrong: x = 5 Mainstream: x = value\n Right: 5 => $x rill: value => $x\n\nPipe (`->`): passes value to next operation.\nCapture (`=>`): stores value AND continues chain.\nExample: `\"hello\" => $x -> .upper => $y` \u2014 `$x=\"hello\"`, `$y=\"HELLO\"`.\n\n### 2. No Null/Undefined\n\nEmpty values (`\"\"`, `list[]`, `dict[]`) exist. \"No value\" cannot be represented.\nUse `??` for defaults: `$dict.field ?? \"default\"`.\nUse `.empty` to check: `$str -> .empty ? \"was empty\"`.\n\n### 3. No Truthiness\n\nConditions MUST be boolean. No implicit coercion.\n\n Wrong: \"\" ? \"yes\" ! \"no\" Right: \"\" -> .empty ? \"yes\" ! \"no\"\n Wrong: 0 ? \"yes\" ! \"no\" Right: (0 == 0) ? \"yes\" ! \"no\"\n\nNegation (`!`) also requires boolean:\n\n !true # false\n \"hello\" -> .empty -> (!$) # true (negates boolean from .empty)\n !\"hello\" # ERROR: Negation requires boolean\n\n### 4. Variables Lock to First Type\n\n \"hello\" => $x\n 42 => $x # ERROR: cannot assign number to string variable\n\n### 5. No Variable Shadowing (Critical for Loops)\n\nChild scopes can READ parent variables but cannot WRITE or redeclare them.\nVariables created inside blocks/loops do NOT leak out.\n\nWRONG \u2014 outer variable modification (runtime error):\n\n 0 => $count\n list[1, 2, 3] -> each { $count + 1 => $count } # ERROR: Cannot reassign outer variable\n\nRIGHT \u2014 use `fold` for reduction:\n\n list[1, 2, 3] -> fold(0) { $@ + $ } # 6 ($@ is accumulator)\n\nRIGHT \u2014 use `each(init)` for results AND accumulator:\n\n list[1, 2, 3] -> each(0) { $@ + $ } # list[1, 3, 6] (running totals)\n\nRIGHT \u2014 use `(cond) @ { }` with `$` as state dict for multiple values:\n\n dict[iter: 0, max: 3, text: $input, done: false]\n -> (!$.done && $.iter < $.max) @ {\n $.iter + 1 => $i\n process($.text) => $result\n $result.finished ? dict[iter: $i, max: $.max, text: $.text, done: true]\n ! dict[iter: $i, max: $.max, text: $result.text, done: false]\n }\n\nPattern summary:\n\n Single value accumulation -> fold(init) { $@ + $ }\n Per-item results + running -> each(init) { ... $@ ... }\n Multiple state values / while -> (cond) @ { } with $ as state dict\n \"while\" and \"for\" keywords -> DO NOT EXIST\n\n### 6. No Exceptions\n\nErrors halt execution. No try/catch. Use conditionals for error handling.\nBuilt-in: `assert` (validate condition), `error` (halt with message).\n\n### 7. Value Semantics (No References)\n\nAll copies are deep. All comparisons are by value. No object identity.\n\n list[1, 2, 3] == list[1, 2, 3] # true (content equality)\n list[1, 2] => $a\n $a => $b # $b is an independent deep copy\n\n## Grammar Patterns\n\nrill uses two bracket forms as grammar constructs (not function calls):\n\n**`keyword[...]`** \u2014 collection literals. Keyword and `[` must be adjacent (no space):\n\n list[1, 2, 3] # list\n dict[name: \"alice\", age: 30] # dict (key: value pairs)\n tuple[1, 2, 3] # positional argument unpacking\n ordered[a: 1, b: 2] # named argument unpacking\n\n list [1, 2] # ERROR: RILL-P007 (space before bracket)\n\n**`keyword<...>`** \u2014 extraction operators. Custom grammar with `,` or `:` separators:\n\n list[1, 2, 3] -> destruct<$a, $b, $c> # destructure into variables\n list[0,1,2,3] -> slice<1:3> # slice with start:stop:step\n\nThese are NOT function calls. They are parsed as special syntax by the compiler.\n\n## Callable Types\n\nrill has three callable types:\n\n| Type | Source | Examples |\n|------|--------|---------|\n| Closure | Script-defined | `\\|x\\| { $x * 2 }`, `{ $ + 1 }` |\n| Built-in function | Shipped with runtime | `log`, `json`, `range`, `chain`, `error` |\n| Host function | Registered by host app | `app::fetch()`, `app::prompt()` |\n\nThe `$` prefix disambiguates callables from variables and keys:\n\n name() -> built-in or host function call\n $name() -> closure invocation\n $name -> variable reference\n name -> dict key literal\n\nWithout `$`, `process(data)` is ambiguous: is `process` a function or stored closure? Is `data` a variable or key? This would require tracking all declarations.\n\n## Syntax Quick Reference\n\n Variables: $name (always prefixed with $)\n Strings: \"hello {$var}\" # interpolation with {}\n \"\"\"...\"\"\" # multiline (also interpolates)\n Numbers: 42, 3.14, -7\n Booleans: true, false\n Lists: list[1, 2, 3]\n list[...$list, 4] # spread: inline list elements\n Dicts: dict[name: \"alice\", age: 30] # identifier keys\n dict[1: \"one\", 2: \"two\"] # number keys (incl. negative: dict[-1: \"neg\"])\n dict[true: \"yes\", false: \"no\"] # boolean keys\n dict[list[\"a\", \"b\"]: 1] # multi-key: dict[a: 1, b: 1]\n dict[$keyVar: value] # variable key (must eval to string)\n dict[(\"{$a}{$b}\"): value] # computed key (must eval to string)\n Tuples: tuple[1, 2, 3] # positional argument unpacking\n Ordered: ordered[a: 1, b: 2] # named argument unpacking (preserves order)\n Closures: |x|($x + 1) # like lambda/arrow functions\n Type annot: \"hi\" => $x:string # lock type on capture\n Comments: # single line only\n\n## Pipes and $ Binding\n\n`$` is the current piped value. Its meaning depends on context:\n\n| Context | `$` contains |\n|---|---|\n| `-> { body }` | piped value |\n| `-> each { }` | current item |\n| `(cond) @ { }` | accumulated value |\n| `@ { } ? cond` | accumulated value |\n| `cond ? { } ! { }` | tested value |\n| `-> ? { } ! { }` | piped value |\n| `\\|\\|{ $.field }` in dict | the containing dict |\n| `\\|x\\|{ }` stored closure | N/A \u2014 use parameters |\n\nImplied `$`: bare `.method()` means `$ -> .method()`.\nExample: `\"hello\" -> .upper` is the same as `\"hello\" -> $.upper()`.\n\n## Control Flow\n\nConditional (if-else):\n\n cond ? then_expr ! else_expr\n cond ? then_expr # else returns null\n\nPiped conditional (`$` becomes condition):\n\n value -> ? then_expr ! else_expr\n\nMulti-line conditionals (`?` and `!` work as line continuations):\n\n condition\n ? \"yes\"\n ! \"no\"\n value -> is_valid\n ? \"ok\"\n ! \"error\"\n $val -> .eq(\"A\") ? \"a\"\n ! .eq(\"B\") ? \"b\"\n ! \"c\"\n\nCondition loop (NO `while` keyword \u2014 use `@` operator):\n\n init_value -> ($ < 10) @ { $ + 1 } # $ is accumulator\n\nDo-condition loop (body runs at least once):\n\n init_value -> @ { $ + 1 } ? ($ < 10)\n\nBreak (exits loop, returns collected results before break):\n\n list[1,2,3,4,5] -> each {\n ($ == 3) ? break\n $\n } # returns list[1, 2]\n\nReturn (exits block or script with value):\n\n 5 => $x\n ($x > 3) ? (\"big\" -> return)\n \"small\" # returns \"big\"\n \"done\" -> return # exits script with \"done\"\n\nAssert (validate condition, halt if false, pass through if true):\n\n 5 -> assert ($ > 0) # returns 5\n -1 -> assert ($ > 0) # ERROR: Assertion failed\n \"\" -> assert !.empty \"Input required\" # ERROR: Input required\n $val -> assert $:?list \"Expected list\" # type validation\n\nError (halt execution immediately with message):\n\n error \"Something went wrong\" # halt with message\n \"Operation failed\" -> error # piped form (must be string)\n error \"Status: {$code}\" # interpolation works\n\nPass (returns `$` unchanged, explicit no-op):\n\n cond ? pass ! \"fallback\" # preserve $ when condition true\n cond ? \"value\" ! pass # preserve $ when condition false\n \"data\" -> { dict[status: pass] } # include $ in dict: dict[status: \"data\"]\n list[1, -2, 3] -> map { ($ > 0) ? pass ! 0 } # list[1, 0, 3]\n\nNote: `pass` requires pipe context. Using `pass` without `$` throws error.\n\n## Collection Operators\n\n| Operator | Execution | Returns | Break? |\n|---|---|---|---|\n| `-> each { }` | sequential | all body results | yes |\n| `-> each(i) { $@ + $ }` | sequential | all with accumulator | yes |\n| `-> map { }` | parallel | all body results | NO |\n| `-> filter { }` | parallel | matching elements | NO |\n| `-> fold(i) { $@ + $ }` | sequential | final result only | yes |\n\n`$@` is the accumulator in `each(init)` and `fold(init)`.\n\nMethod shorthand in collection operators:\n\n list[\"a\", \"b\"] -> map .upper # list[\"A\", \"B\"]\n list[\"\", \"x\"] -> filter (!.empty) # list[\"x\"]\n list[\"a\", \"b\"] -> map .pad_start(3, \"0\") # list[\"00a\", \"00b\"] (with args)\n list[\" HI \"] -> map .trim.lower # list[\"hi\"] (chained methods)\n\nBody forms (all operators accept these):\n\n -> each { $ * 2 } # block ($ is current element)\n -> each ($ + 10) # grouped expression\n -> each |x| ($x * 2) # inline closure\n -> each $double # variable closure\n -> each .upper # method shorthand\n -> each log # built-in function\n\nDict iteration (`$` contains `key` and `value` fields):\n\n dict[a: 1, b: 2] -> each { \"{$.key}={$.value}\" } # list[\"a=1\", \"b=2\"]\n dict[a: 1, b: 5] -> filter { $.value > 2 } # entries where value > 2\n\nString iteration (iterates over characters):\n\n \"abc\" -> each { \"{$}!\" } # list[\"a!\", \"b!\", \"c!\"]\n \"hello\" -> filter { $ != \"l\" } # list[\"h\", \"e\", \"o\"]\n\n## Closures\n\nTwo ways to create closures:\n\n**Block-closures:** `{ body }` in expression position\n\n { $ + 1 } => $inc # implicit $ parameter\n $inc(5) # 6\n 5 -> $inc # 6 (pipe invocation)\n dict[x: { $ * 2 }] # dict value is closure\n { \"hi\" }:?closure # true\n\n**Explicit closures:** `|params| body`\n\n |x|($x + 1) => $inc # named parameter\n |a, b|($a + $b) => $add # multiple params\n |x = 0|($x + 1) => $inc_or_one # default value\n |x: number|($x + 1) => $typed # type annotation\n\n**Anonymous typed closures:** `|type|{ body }` \u2014 reserved type keyword as param, `$` is type-checked piped input\n\n \"hello\" -> |string|{ $ -> .upper } # $ is string, checked at call\n 5 -> |number|{ $ * 2 } # 10\n |number|{ $ * 2 }:number => $double # stored with return type assertion\n 5 -> $double # 10\n \"hi\" -> $double # RILL-R001: expected number, got string\n\nAll 11 type names valid: string, number, bool, list, dict, ordered, tuple, closure, vector, any, type\nParameterized: |list(number)|{ $ -> each { $ * 2 } }\n\n**Return type assertions** (enforced at runtime \u2014 RILL-R004 on mismatch):\n\n |x: number| { \"{$x}\" }:string => $fn # asserts string return type\n $fn(42) # \"42\" (passes assertion)\n\n |x: number| { $x * 2 }:string => $fn # mismatch halts with RILL-R004\n $fn(5) # RILL-R004: expected string, got number\n\nValid return type targets: any type name (string, number, bool, closure, list, dict, tuple,\nordered, vector, any, type), or a parameterized type constructor (list(string),\ndict(a: number, b: string)).\nDeclared return type accessible via $fn.^output annotation.\n\n**Description shorthand** (bare string in `^(...)` expands to `description: <string>`):\n\n ^(\"Get weather for city\") |city: string|($city) => $weather\n $weather.^description # \"Get weather for city\"\n\n ^(\"Fetch profile\", cache: true) |id|($id) => $get_user\n $get_user.^description # \"Fetch profile\"\n $get_user.^cache # true\n\n`{ body }` vs `( expr )` distinction:\n\n| Syntax | Semantics | Example |\n|---|---|---|\n| `{ body }` | Deferred (closure) | `{ $ + 1 } => $fn` |\n| `( expr )` | Eager (immediate eval) | `( 5 + 1 ) => $x` gives 6 |\n\nLATE BINDING: closures capture scope, not values. Variables resolve at call time.\n\n`$` vs named params:\n- Use `$` in inline pipes and loops: `\"hello\" -> { .upper }`\n- Use named params in stored closures: `|x| ($x * 2) => $double`\n- `$` is undefined when a stored closure is called later \u2014 always use params.\n\nZero-param dict closures (methods):\n\n dict[count: 3, double: ||{ $.count * 2 }] => $obj\n $obj.double # 6 ($ is bound to dict)\n\n## Property Access\n\n $data.field # dict field\n $data[0], $data[-1] # list index (negative from end)\n $data.$key # variable as key\n $data.($i + 1) # computed key\n $data.(a || b) # try keys left-to-right\n $data.field ?? \"default\" # default if missing\n $data.?field # existence check (boolean)\n $data.?$keyVar # variable existence check\n $data.?($expr) # computed existence check\n $data.?field&string # existence AND type check\n $data.?$key&number # variable existence + type check\n $data.?($a -> \"{$}_b\")&list # computed existence + type check\n\n## Dispatch Operators\n\n**Dict dispatch** (single key) \u2014 pipe a value to a dict to match keys:\n\n $val -> dict[apple: \"fruit\", carrot: \"veg\"] # \"fruit\" if $val is \"apple\"\n $val -> dict[apple: \"fruit\"] ?? \"not found\" # default if no match\n $method -> dict[list[\"GET\", \"HEAD\"]: \"safe\", list[\"POST\", \"PUT\"]: \"unsafe\"] # multi-key\n\nType-aware matching (keys matched by value AND type):\n\n 1 -> dict[1: \"number\", \"1\": \"string\"] # \"number\"\n \"1\" -> dict[1: \"number\", \"1\": \"string\"] # \"string\"\n true -> dict[true: \"bool\", \"true\": \"str\"] # \"bool\"\n\n**List dispatch** (index) \u2014 pipe a number to a list:\n\n 0 -> list[\"first\", \"second\"] # \"first\"\n -1 -> list[\"first\", \"second\"] # \"second\" (last)\n 5 -> list[\"a\", \"b\"] ?? \"not found\" # default if out of bounds\n\n**Hierarchical dispatch** (path navigation) \u2014 pipe a list of keys/indexes:\n\n list[\"name\", \"first\"] -> dict[name: dict[first: \"Alice\"]] # \"Alice\"\n list[0, 1] -> list[list[1, 2, 3], list[4, 5, 6]] # 2\n list[] -> dict[a: 1] # dict[a: 1] (empty path = unchanged)\n list[\"a\", \"missing\"] -> dict[a: dict[x: 1]] ?? \"default\" # \"default\"\n\nNote: lists require same-type elements. For mixed paths (strings and numbers), use property access:\n\n dict[users: list[dict[name: \"Alice\"]]] => $d\n $d.users[0].name # \"Alice\"\n\n## Types and Type Expressions\n\n**Type names:**\n\n string number bool list dict ordered\n tuple closure vector any type\n\n**Type names are first-class values** \u2014 assign to variables, use in dynamic expressions:\n\n number => $t # store a type value\n 42 -> :$t # dynamic assertion (same as :number)\n 42 -> :?$t # dynamic check: true\n 42 -> :>$t # dynamic conversion (same as :>number)\n $val.^type == $t # compare against stored type\n\n**Parameterized type constructors** (structural types):\n\n list(string) # list of strings\n dict(name: string, age: number) # dict with named fields\n tuple(number, string) # positional tuple\n ordered(x: number, y: number) # named ordered args\n |x: number, y: string| :any # closure signature type\n\nClosure signatures include parameter names \u2014 `|x: number|` and `|y: number|` are different types.\n\n**Type assertion** `:type` \u2014 errors if value does not match:\n\n 42:number # passes\n \"x\":number # RILL-R002: expected number, got string\n $val:list(string) # assert parameterized type\n\n**Enforcing dict shapes** with `dict(field: type, ...)`:\n\n $data -> :dict(name: string, age: number) # assert exact fields and types\n $data:?dict(name: string, age: number) # check without error\n $data:dict(name: string) -> .name # assert then access\n\nUse in closure params to validate input structure:\n\n |d: dict(name: string, age: number)| {\n \"{$d.name} is {$d.age}\"\n } => $format_person\n\n**Type check** `:?type` \u2014 returns boolean, never errors:\n\n 42:?number # true\n \"x\":?number # false\n $val:?list(string) # structural check\n\nBoth forms work as pipe targets:\n\n $val -> :number # assert in pipe\n $val -> :?number # check in pipe\n\n**`^type` operator** \u2014 returns a type value for inspection:\n\n 42.^type # type value for number\n 42.^type.name # \"number\"\n list[1, 2].^type.name # \"list\"\n list[1, 2].^type.signature # \"list(number)\"\n\n**Type value equality:**\n\n $val.^type == list(number) # true if $val is list(number)\n $val.^type == $other.^type # compare structural types\n\n**Type conversion** `:>type` \u2014 explicit conversion between compatible types:\n\n 42 -> :>string # \"42\"\n \"3.14\" -> :>number # 3.14\n list[1, 2] -> :>tuple # tuple[1, 2]\n tuple[1, 2] -> :>list # list[1, 2]\n ordered[a: 1] -> :>dict # dict[a: 1]\n dict[x: 1, y: 2] -> :>ordered(x: number, y: number) # structural\n\nCompatibility matrix (error = halts with RILL-R036, no-op = same-type identity):\n\n Source | :>list | :>dict | :>tuple | :>ordered(sig) | :>number | :>string | :>bool\n ---------|---------|---------|---------|----------------|----------|----------|-------\n list | no-op | error | valid | error | error | valid\u00B9 | error\n dict | error | no-op | error | valid | error | valid\u00B9 | error\n tuple | valid | error | no-op | error | error | valid\u00B9 | error\n ordered | error | valid | error | no-op | error | valid\u00B9 | error\n string | error | error | error | error | valid\u00B2 | no-op | valid\u00B3\n number | error | error | error | error | no-op | valid\u00B9 | valid\u2075\n bool | error | error | error | error | valid\u2074 | valid\u00B9 | no-op\n\n \u00B9 Uses formatValue semantics for formatted output\n \u00B2 Parseable strings only; halts with RILL-R038 on failure\n \u00B3 Accepts only \"true\" and \"false\"; halts with RILL-R036 otherwise\n \u2074 true maps to 1, false maps to 0\n \u2075 0 maps to false, 1 maps to true; all other values halt with RILL-R036\n\n## Comparison Methods\n\n .eq(val) == .ne(val) != .lt(val) < .gt(val) > .le(val) <= .ge(val) >=\n Example: $age -> .ge(18) ? \"adult\" ! \"minor\"\n\n## Operator Precedence (Highest to Lowest)\n\n1. Member access: `.field`, `[index]`\n2. Type operators: `:type`, `:?type`\n3. Unary: `-`, `!`\n4. Multiplicative: `*`, `/`, `%`\n5. Additive: `+`, `-`\n6. Comparison: `==`, `!=`, `<`, `>`, `<=`, `>=`\n7. Logical AND: `&&`\n8. Logical OR: `||`\n9. Default: `??`\n10. Pipe: `->`\n11. Capture: `=>`\n\nUse parentheses to override: `(2 + 3) * 4`\n\n## Extraction Operators\n\nDestructure (`destruct<>`):\n\n list[1, 2, 3] -> destruct<$a, $b, $c> # $a=1, $b=2, $c=3\n dict[x: 1, y: 2] -> destruct<x: $a, y: $b> # $a=1, $b=2\n list[1, 2, 3] -> destruct<$first, _, $third> # _ skips element\n\nSlice (`slice<start:stop:step>`):\n\n list[0,1,2,3,4] -> slice<1:3> # list[1, 2]\n list[0,1,2,3,4] -> slice<-2:> # list[3, 4]\n list[0,1,2,3,4] -> slice<::-1> # list[4,3,2,1,0] (reverse)\n \"hello\" -> slice<1:4> # \"ell\"\n\n## List Spread in Literals\n\n list[1, 2] => $a\n list[...$a, 3] # list[1, 2, 3]\n list[...$a, ...$b] # concatenate lists\n list[...($nums -> map {$ * 2})] # spread expression result\n\n## Tuples and Ordered for Argument Unpacking\n\n tuple[1, 2, 3] -> $fn(...) # positional spread: $fn(1, 2, 3)\n ordered[a: 10, b: 2] -> $fn(...) # named spread: keys must match parameter order\n tuple[...$list, 3] -> $fn(...) # spread in tuple then spread into call\n tuple[1, 2, 3] => $args\n $args -> $fn(...) # spread stored tuple\n ordered[a: 1, b: 2] => $named\n $named -> $fn(...) # spread stored ordered\n\n## String Methods\n\n| Method | Description |\n|---|---|\n| `.len` | length |\n| `.empty` | is empty string |\n| `.trim` | remove whitespace |\n| `.upper` | uppercase |\n| `.lower` | lowercase |\n| `.head` | first character |\n| `.tail` | last character |\n| `.at(i)` | character at index |\n| `.split(sep)` | split into list (default: newline) |\n| `.lines` | split on newlines |\n| `.join(sep)` | join list with separator |\n| `.contains(s)` | substring check |\n| `.starts_with(s)` | prefix check |\n| `.ends_with(s)` | suffix check |\n| `.index_of(s)` | first match position (-1 if none) |\n| `.replace(p, r)` | replace first regex match |\n| `.replace_all(p, r)` | replace all regex matches |\n| `.match(regex)` | first match info (dict with matched, index, groups) |\n| `.is_match(regex)` | boolean regex check |\n| `.repeat(n)` | repeat n times |\n| `.pad_start(n, f)` | pad start |\n| `.pad_end(n, f)` | pad end |\n\n## List/Dict Methods\n\n| Method | Description |\n|---|---|\n| `.len` | length |\n| `.empty` | is empty |\n| `.head` | first element |\n| `.tail` | last element |\n| `.at(i)` | element at index |\n| `.keys` | dict keys as list |\n| `.values` | dict values as list |\n| `.entries` | dict as list of `tuple[k, v]` pairs |\n| `.has(val)` | list contains value (deep equality) |\n| `.has_any(list)` | list contains any value from candidates |\n| `.has_all(list)` | list contains all values from candidates |\n\n## Built-in Functions\n\n| Function | Description |\n|---|---|\n| `log(val)` | print and pass through |\n| `json(val)` | convert to JSON string |\n| `identity(val)` | returns input unchanged |\n| `range(start, end, step?)` | number sequence (iterator) |\n| `repeat(val, count)` | repeat value n times (iterator) |\n| `enumerate(coll)` | lists: `tuple[index, value]`; dicts: `tuple[index, key, value]` |\n| `chain($fn)` | apply single closure; chain(val, list[$f, $g]) applies in sequence |\n\n## Iterators\n\nLazy sequence generation. Collection operators auto-expand iterators.\n\n range(0, 5) -> each { $ * 2 } # list[0, 2, 4, 6, 8]\n repeat(\"x\", 3) -> each { $ } # list[\"x\", \"x\", \"x\"]\n\n`.first()` method (returns iterator for any collection):\n\n list[1, 2, 3] -> .first() # iterator at 1\n \"abc\" -> .first() # iterator at \"a\"\n\nIterator protocol (dict with `value`, `done`, `next`):\n\n $it.done # bool: is exhausted?\n $it.value # current element\n $it.next() # returns new iterator at next position\n\n## Iteration Limits\n\nDefault: 10,000 iterations max for loops.\nOverride: `^(limit: N)` at operator level (between operator name and body).\n\n 0 -> ($ < 50) @ ^(limit: 100) { $ + 1 } # while loop\n $items -> each ^(limit: 1000) { process($) } # each operator\n $items -> map ^(limit: 3) { slow_process($) } # concurrency limit\n\nInvalid annotation keys produce a runtime error.\n\n## Script Return Values\n\n| Return value | Exit code |\n|---|---|\n| `true` / non-empty string | 0 |\n| `false` / empty string | 1 |\n| `list[0, \"message\"]` | 0 with message |\n| `list[1, \"message\"]` | 1 with message |\n\n## Style\n\n### Naming: snake_case\n\n $user_name, $item_list, $is_valid # variables\n $double_value, $cleanup_text # closures\n dict[first_name: \"x\", last_name: \"y\"] # dict keys\n\n### Spacing\n\n Operators: space both sides 5 + 3, $x -> .upper, \"a\" => $b\n Parentheses: no inner space ($x + 1), ($ > 3) ? \"yes\"\n Braces: space inside { $x + 1 }, each { $ * 2 }\n Brackets: no inner space $list[0], $dict.items[1]\n Literals: space after , and : list[1, 2, 3], dict[name: \"x\", age: 30]\n Keyword+[ NO space between list[1, 2] (not list [1, 2] \u2014 RILL-P007)\n Closures: space after params |x| ($x * 2), |a, b| { $a + $b }\n Methods: no space before . or ( $str.upper(), $list.join(\", \")\n Pipes: space both sides \"x\" -> .upper -> .len\n Continuations: indent 2 spaces $data\n -> .filter { $.active }\n -> map { $.name }\n\n### Implicit $ Shorthand (Always Prefer)\n\n $.method() -> .method \"x\" -> .upper (not $.upper())\n func($) -> func \"x\" -> log (not log($))\n $fn($) -> $fn 5 -> $double (not $double($))\n\nDon't capture just to continue \u2014 use line continuation instead:\n\n # avoid # good\n \"x\" => $a \"x\"\n $a -> .upper => $b -> .upper\n $b -> .len -> .len\n\nOnly capture when the variable is reused later in the code.\n";
2
- //# sourceMappingURL=introspection-data.d.ts.map
@@ -673,4 +673,3 @@ Don't capture just to continue — use line continuation instead:
673
673
 
674
674
  Only capture when the variable is reused later in the code.
675
675
  `;
676
- //# sourceMappingURL=introspection-data.js.map
@@ -10,9 +10,8 @@ export interface VersionInfo {
10
10
  /**
11
11
  * Version string from package.json
12
12
  */
13
- export declare const VERSION = "0.14.0";
13
+ export declare const VERSION = "0.16.0";
14
14
  /**
15
15
  * Parsed version components
16
16
  */
17
17
  export declare const VERSION_INFO: VersionInfo;
18
- //# sourceMappingURL=version-data.d.ts.map
@@ -3,14 +3,13 @@
3
3
  /**
4
4
  * Version string from package.json
5
5
  */
6
- export const VERSION = '0.14.0';
6
+ export const VERSION = '0.16.0';
7
7
  /**
8
8
  * Parsed version components
9
9
  */
10
10
  export const VERSION_INFO = {
11
11
  major: 0,
12
- minor: 14,
12
+ minor: 16,
13
13
  patch: 0,
14
14
  prerelease: undefined,
15
15
  };
16
- //# sourceMappingURL=version-data.js.map
@@ -1,4 +1,3 @@
1
1
  import type { TokenType } from './types.js';
2
2
  export type HighlightCategory = 'keyword' | 'operator' | 'string' | 'number' | 'bool' | 'comment' | 'variableName' | 'punctuation' | 'bracket' | 'meta';
3
3
  export declare const TOKEN_HIGHLIGHT_MAP: ReadonlyMap<TokenType, HighlightCategory>;
4
- //# sourceMappingURL=highlight-map.d.ts.map
@@ -75,4 +75,3 @@ export const TOKEN_HIGHLIGHT_MAP = new Map([
75
75
  ['FRONTMATTER_DELIM', 'meta'],
76
76
  // Intentionally unmapped: NEWLINE, EOF
77
77
  ]);
78
- //# sourceMappingURL=highlight-map.js.map
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  export { LexerError, tokenize, type TokenizeOptions } from './lexer/index.js';
6
6
  export { parse, parseWithRecovery } from './parser/index.js';
7
7
  export type { ParseResult, RecoveryErrorNode, ErrorNode } from './types.js';
8
- export { anyTypeValue, type ApplicationCallable, BreakSignal, callable, type CallableFn, type CallFrame, type CaptureEvent, type ConfigFieldDescriptor, createRuntimeContext, createStepper, createTuple, createVector, type DocumentationCoverageResult, emitExtensionEvent, contextResolver, extResolver, type ErrorEvent, execute, type ExecutionResult, type ExecutionStepper, type ExtensionConfigSchema, type ExtensionEvent, type ExtensionFactory, type ExtensionManifest, type ExtensionResult, type FsExtensionContract, type FunctionMetadata, hoistExtension, type HoistedExtension, type HostCallEvent, type FunctionReturnEvent, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, buildTypeMethodDicts, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, moduleResolver, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, type KvExtensionContract, type NativeArray, type NativePlainObject, type NativeResult, type NativeValue, type LlmExtensionContract, type SchemaEntry, type ObservabilityCallbacks, type ParamMetadata, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, rillTypeToTypeValue, ReturnSignal, type RillCallable, type RillFunction, type RillParam, type RillIterator, type RillTuple, type RillType, type RillTypeValue, type RillValue, type RillVector, type RuntimeCallable, type ResolverResult, type RuntimeCallbacks, type RuntimeContext, type RuntimeOptions, type SchemeResolver, type ScriptCallable, type StepEndEvent, type StepResult, type StepStartEvent, type VectorExtensionContract, structuralTypeEquals, structuralTypeMatches, toNative, VERSION, VERSION_INFO, type VersionInfo, } from './runtime/index.js';
8
+ export { anyTypeValue, type ApplicationCallable, BreakSignal, callable, type CallableFn, type CallFrame, commonType, type CaptureEvent, type ConfigFieldDescriptor, createRuntimeContext, createStepper, createTuple, createVector, type DocumentationCoverageResult, emitExtensionEvent, contextResolver, extResolver, type ErrorEvent, execute, type ExecutionResult, type ExecutionStepper, type ExtensionConfigSchema, type ExtensionEvent, type ExtensionFactory, type ExtensionManifest, type ExtensionResult, type FsExtensionContract, type FunctionMetadata, hoistExtension, type HoistedExtension, type HostCallEvent, type FunctionReturnEvent, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, buildTypeMethodDicts, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, moduleResolver, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, type KvExtensionContract, type NativeArray, type NativePlainObject, type NativeResult, type NativeValue, type LlmExtensionContract, type SchemaEntry, type ObservabilityCallbacks, type ParamMetadata, paramToFieldDef, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, rillTypeToTypeValue, ReturnSignal, type RillCallable, type RillFieldDef, type RillFunction, type RillParam, type RillIterator, type RillTuple, type RillType, type RillTypeValue, type RillValue, type RillVector, type RuntimeCallable, type ResolverResult, type RuntimeCallbacks, type RuntimeContext, type RuntimeOptions, type SchemeResolver, type ScriptCallable, type StepEndEvent, type StepResult, type StepStartEvent, type VectorExtensionContract, structuralTypeEquals, structuralTypeMatches, toNative, VERSION, VERSION_INFO, type VersionInfo, } from './runtime/index.js';
9
9
  /** @deprecated Use RillType instead. Will be removed in the next major version. */
10
10
  export type { RillStructuralType } from './runtime/index.js';
11
11
  export { type ErrorCategory, type ErrorDefinition, type ErrorSeverity, ERROR_REGISTRY, renderMessage, getHelpUrl, createError, } from './types.js';
@@ -13,4 +13,3 @@ export { formatRillError, formatRillErrorJson, type FormatErrorOptions, type For
13
13
  export { VALID_TYPE_NAMES } from './constants.js';
14
14
  export { type HighlightCategory, TOKEN_HIGHLIGHT_MAP, } from './highlight-map.js';
15
15
  export * from './types.js';
16
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  export { LexerError, tokenize } from './lexer/index.js';
6
6
  export { parse, parseWithRecovery } from './parser/index.js';
7
- export { anyTypeValue, BreakSignal, callable, createRuntimeContext, createStepper, createTuple, createVector, emitExtensionEvent, contextResolver, extResolver, execute, hoistExtension, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, buildTypeMethodDicts, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, moduleResolver, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, rillTypeToTypeValue, ReturnSignal, structuralTypeEquals, structuralTypeMatches, toNative, VERSION, VERSION_INFO, } from './runtime/index.js';
7
+ export { anyTypeValue, BreakSignal, callable, commonType, createRuntimeContext, createStepper, createTuple, createVector, emitExtensionEvent, contextResolver, extResolver, execute, hoistExtension, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, buildTypeMethodDicts, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, moduleResolver, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, paramToFieldDef, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, rillTypeToTypeValue, ReturnSignal, structuralTypeEquals, structuralTypeMatches, toNative, VERSION, VERSION_INFO, } from './runtime/index.js';
8
8
  // ============================================================
9
9
  // ERROR TAXONOMY
10
10
  // ============================================================
@@ -22,4 +22,3 @@ export { VALID_TYPE_NAMES } from './constants.js';
22
22
  // ============================================================
23
23
  export { TOKEN_HIGHLIGHT_MAP, } from './highlight-map.js';
24
24
  export * from './types.js';
25
- //# sourceMappingURL=index.js.map
@@ -7,4 +7,3 @@ export declare class LexerError extends RillError {
7
7
  readonly location: SourceLocation;
8
8
  constructor(errorId: string, message: string, location: SourceLocation, context?: Record<string, unknown>);
9
9
  }
10
- //# sourceMappingURL=errors.d.ts.map
@@ -30,4 +30,3 @@ export class LexerError extends RillError {
30
30
  this.location = location;
31
31
  }
32
32
  }
33
- //# sourceMappingURL=errors.js.map
@@ -11,4 +11,3 @@ export declare function isWhitespace(ch: string): boolean;
11
11
  export declare function makeToken(type: TokenType, value: string, start: SourceLocation, end: SourceLocation): Token;
12
12
  /** Advance n times and return a token */
13
13
  export declare function advanceAndMakeToken(state: LexerState, n: number, type: TokenType, value: string, start: SourceLocation): Token;
14
- //# sourceMappingURL=helpers.d.ts.map
@@ -27,4 +27,3 @@ export function advanceAndMakeToken(state, n, type, value, start) {
27
27
  advance(state);
28
28
  return makeToken(type, value, start, currentLocation(state));
29
29
  }
30
- //# sourceMappingURL=helpers.js.map
@@ -5,4 +5,3 @@
5
5
  export { LexerError } from './errors.js';
6
6
  export { createLexerState, type LexerState } from './state.js';
7
7
  export { nextToken, tokenize, type TokenizeOptions } from './tokenizer.js';
8
- //# sourceMappingURL=index.d.ts.map
@@ -5,4 +5,3 @@
5
5
  export { LexerError } from './errors.js';
6
6
  export { createLexerState } from './state.js';
7
7
  export { nextToken, tokenize } from './tokenizer.js';
8
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ export declare const TWO_CHAR_OPERATORS: Record<string, TokenType>;
8
8
  export declare const SINGLE_CHAR_OPERATORS: Record<string, TokenType>;
9
9
  /** Keyword lookup table */
10
10
  export declare const KEYWORDS: Record<string, TokenType>;
11
- //# sourceMappingURL=operators.d.ts.map
@@ -56,4 +56,3 @@ export const KEYWORDS = {
56
56
  fold: TOKEN_TYPES.FOLD,
57
57
  filter: TOKEN_TYPES.FILTER,
58
58
  };
59
- //# sourceMappingURL=operators.js.map
@@ -26,4 +26,3 @@ export declare function readTripleQuoteString(state: LexerState): Token;
26
26
  export declare function readNumber(state: LexerState): Token;
27
27
  export declare function readIdentifier(state: LexerState): Token;
28
28
  export declare function readVariable(state: LexerState): Token;
29
- //# sourceMappingURL=readers.d.ts.map
@@ -227,4 +227,3 @@ export function readVariable(state) {
227
227
  // Lone $ is the pipe variable (current item in iteration)
228
228
  return makeToken(TOKEN_TYPES.PIPE_VAR, '$', start, currentLocation(state));
229
229
  }
230
- //# sourceMappingURL=readers.js.map
@@ -17,4 +17,3 @@ export declare function peek(state: LexerState, offset?: number): string;
17
17
  export declare function peekString(state: LexerState, length: number): string;
18
18
  export declare function advance(state: LexerState): string;
19
19
  export declare function isAtEnd(state: LexerState): boolean;
20
- //# sourceMappingURL=state.d.ts.map
@@ -40,4 +40,3 @@ export function advance(state) {
40
40
  export function isAtEnd(state) {
41
41
  return state.pos >= state.source.length;
42
42
  }
43
- //# sourceMappingURL=state.js.map
@@ -9,4 +9,3 @@ export interface TokenizeOptions {
9
9
  includeComments?: boolean;
10
10
  }
11
11
  export declare function tokenize(source: string, baseLocation?: SourceLocation, options?: TokenizeOptions): Token[];
12
- //# sourceMappingURL=tokenizer.d.ts.map
@@ -122,4 +122,3 @@ export function tokenize(source, baseLocation, options) {
122
122
  }
123
123
  return tokens;
124
124
  }
125
- //# sourceMappingURL=tokenizer.js.map
@@ -95,4 +95,3 @@ export declare function makeBoolLiteralBlock(value: boolean, span: SourceSpan):
95
95
  * @internal
96
96
  */
97
97
  export declare function parseBareHostCall(state: ParserState): HostCallNode | HostRefNode;
98
- //# sourceMappingURL=helpers.d.ts.map
@@ -302,4 +302,3 @@ export function parseBareHostCall(state) {
302
302
  span,
303
303
  };
304
304
  }
305
- //# sourceMappingURL=helpers.js.map
@@ -49,4 +49,3 @@ export declare function parseWithRecovery(source: string): ParseResult;
49
49
  export { createParserState, type ParserState, advance, check, current, expect, skipNewlines, isAtEnd, } from './state.js';
50
50
  export { parseTypeRef } from './parser-types.js';
51
51
  export { Parser } from './parser.js';
52
- //# sourceMappingURL=index.d.ts.map
@@ -107,4 +107,3 @@ export { createParserState, advance, check, current, expect, skipNewlines, isAtE
107
107
  export { parseTypeRef } from './parser-types.js';
108
108
  // Parser class (for advanced usage)
109
109
  export { Parser } from './parser.js';
110
- //# sourceMappingURL=index.js.map
@@ -13,4 +13,3 @@ declare module './parser.js' {
13
13
  parseFilterExpr(): FilterExprNode;
14
14
  }
15
15
  }
16
- //# sourceMappingURL=parser-collect.d.ts.map
@@ -151,4 +151,3 @@ Parser.prototype.parseFilterExpr = function () {
151
151
  span: makeSpan(start, current(this.state).span.end),
152
152
  };
153
153
  };
154
- //# sourceMappingURL=parser-collect.js.map
@@ -19,4 +19,3 @@ declare module './parser.js' {
19
19
  parseError(requireMessage?: boolean): ErrorNode;
20
20
  }
21
21
  }
22
- //# sourceMappingURL=parser-control.d.ts.map
@@ -224,4 +224,3 @@ Parser.prototype.parseError = function (requireMessage = false) {
224
224
  span: makeSpan(start, current(this.state).span.end),
225
225
  };
226
226
  };
227
- //# sourceMappingURL=parser-control.js.map
@@ -37,4 +37,3 @@ declare module './parser.js' {
37
37
  }
38
38
  }
39
39
  export {};
40
- //# sourceMappingURL=parser-expr.d.ts.map
@@ -1084,4 +1084,3 @@ Parser.prototype.parseConvert = function () {
1084
1084
  span: makeSpan(start, current(this.state).span.end),
1085
1085
  };
1086
1086
  };
1087
- //# sourceMappingURL=parser-expr.js.map
@@ -12,4 +12,3 @@ declare module './parser.js' {
12
12
  parseSliceBound(): SliceBoundNode;
13
13
  }
14
14
  }
15
- //# sourceMappingURL=parser-extract.d.ts.map
@@ -192,4 +192,3 @@ Parser.prototype.parseSliceBound = function () {
192
192
  }
193
193
  throw new ParseError('RILL-P001', `Expected slice bound (number, variable, or grouped expression), got: ${current(this.state).value}`, current(this.state).span.start);
194
194
  };
195
- //# sourceMappingURL=parser-extract.js.map
@@ -18,4 +18,3 @@ declare module './parser.js' {
18
18
  }): TypeAssertionNode | TypeCheckNode;
19
19
  }
20
20
  }
21
- //# sourceMappingURL=parser-functions.d.ts.map
@@ -243,4 +243,3 @@ Parser.prototype.parsePostfixTypeOperation = function (primary, start) {
243
243
  }
244
244
  return { type: 'TypeAssertion', operand, typeRef, span };
245
245
  };
246
- //# sourceMappingURL=parser-functions.js.map
@@ -21,4 +21,3 @@ declare module './parser.js' {
21
21
  parseCollectionLiteral(collectionType: 'list' | 'dict' | 'tuple' | 'ordered'): ListLiteralNode | DictLiteralNode | TupleLiteralNode | OrderedLiteralNode;
22
22
  }
23
23
  }
24
- //# sourceMappingURL=parser-literals.d.ts.map
@@ -525,7 +525,10 @@ Parser.prototype.parseClosureParam = function () {
525
525
  if (check(this.state, TOKEN_TYPES.COLON)) {
526
526
  advance(this.state);
527
527
  skipNewlines(this.state);
528
- typeRef = parseTypeRef(this.state, { allowTrailingPipe: true });
528
+ typeRef = parseTypeRef(this.state, {
529
+ allowTrailingPipe: true,
530
+ parseLiteral: () => this.parseLiteral(),
531
+ });
529
532
  }
530
533
  skipNewlines(this.state);
531
534
  if (check(this.state, TOKEN_TYPES.ASSIGN)) {
@@ -702,4 +705,3 @@ Parser.prototype.parseCollectionLiteral = function (collectionType) {
702
705
  }
703
706
  return { type: 'OrderedLiteral', entries, span };
704
707
  };
705
- //# sourceMappingURL=parser-literals.js.map
@@ -18,4 +18,3 @@ declare module './parser.js' {
18
18
  }, message: string): RecoveryErrorNode;
19
19
  }
20
20
  }
21
- //# sourceMappingURL=parser-script.d.ts.map
@@ -233,4 +233,3 @@ Parser.prototype.parseAnnotationArg = function () {
233
233
  span: makeSpan(start, current(this.state).span.end),
234
234
  };
235
235
  };
236
- //# sourceMappingURL=parser-script.js.map
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Parser Extension: Type Constructor Parsing
3
3
  * type-constructor = ("list" | "dict" | "tuple" | "ordered") "(" [type-arg-list] ")" ;
4
- * type-arg-list = type-arg ("," type-arg)* [","] ;
5
- * type-arg = identifier ":" expression | expression ;
4
+ * type-arg-list = field-arg ("," field-arg)* [","] ;
5
+ * field-arg = identifier ":" type-ref | type-ref ;
6
6
  */
7
7
  import type { TypeConstructorNode } from '../types.js';
8
8
  declare module './parser.js' {
@@ -10,4 +10,3 @@ declare module './parser.js' {
10
10
  parseTypeConstructor(constructorName: string): TypeConstructorNode;
11
11
  }
12
12
  }
13
- //# sourceMappingURL=parser-shape.d.ts.map
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Parser Extension: Type Constructor Parsing
3
3
  * type-constructor = ("list" | "dict" | "tuple" | "ordered") "(" [type-arg-list] ")" ;
4
- * type-arg-list = type-arg ("," type-arg)* [","] ;
5
- * type-arg = identifier ":" expression | expression ;
4
+ * type-arg-list = field-arg ("," field-arg)* [","] ;
5
+ * field-arg = identifier ":" type-ref | type-ref ;
6
6
  */
7
7
  import { Parser } from './parser.js';
8
8
  import { ParseError, TOKEN_TYPES } from '../types.js';
9
- import { check, advance, expect, current, skipNewlines, makeSpan, peek, } from './state.js';
9
+ import { advance, expect, current, makeSpan } from './state.js';
10
+ import { parseFieldArgList } from './parser-types.js';
10
11
  // ============================================================
11
12
  // TYPE CONSTRUCTOR PARSING
12
13
  // ============================================================
@@ -25,20 +26,10 @@ Parser.prototype.parseTypeConstructor = function (constructorName) {
25
26
  // Consume the constructor name identifier token
26
27
  advance(this.state);
27
28
  expect(this.state, TOKEN_TYPES.LPAREN, 'Expected (');
28
- skipNewlines(this.state);
29
- const args = [];
30
- if (!check(this.state, TOKEN_TYPES.RPAREN)) {
31
- args.push(parseTypeArg(this));
32
- skipNewlines(this.state);
33
- while (check(this.state, TOKEN_TYPES.COMMA)) {
34
- advance(this.state);
35
- skipNewlines(this.state);
36
- if (check(this.state, TOKEN_TYPES.RPAREN))
37
- break; // trailing comma
38
- args.push(parseTypeArg(this));
39
- skipNewlines(this.state);
40
- }
41
- }
29
+ const parseLiteral = () => this.parseLiteral();
30
+ const args = parseFieldArgList(this.state, {
31
+ parseLiteral,
32
+ });
42
33
  const rparen = expect(this.state, TOKEN_TYPES.RPAREN, 'Expected )', 'RILL-P005');
43
34
  return {
44
35
  type: 'TypeConstructor',
@@ -47,26 +38,3 @@ Parser.prototype.parseTypeConstructor = function (constructorName) {
47
38
  span: makeSpan(start, rparen.span.end),
48
39
  };
49
40
  };
50
- // ============================================================
51
- // TYPE ARG PARSING (internal)
52
- // ============================================================
53
- /**
54
- * Parse a single type argument: `identifier ":" expression` (named) or `expression` (positional).
55
- * Lookahead: if current is IDENTIFIER and next is COLON, parse as named arg.
56
- * Otherwise parse as positional.
57
- */
58
- function parseTypeArg(parser) {
59
- // Named arg: identifier ":" expression
60
- if (check(parser.state, TOKEN_TYPES.IDENTIFIER) &&
61
- peek(parser.state, 1).type === TOKEN_TYPES.COLON) {
62
- const nameToken = advance(parser.state); // consume identifier
63
- advance(parser.state); // consume ':'
64
- skipNewlines(parser.state);
65
- const value = parser.parseExpression();
66
- return { kind: 'named', name: nameToken.value, value };
67
- }
68
- // Positional arg: expression
69
- const value = parser.parseExpression();
70
- return { kind: 'positional', value };
71
- }
72
- //# sourceMappingURL=parser-shape.js.map
@@ -4,7 +4,7 @@
4
4
  * parameterized) or a dynamic $variable.
5
5
  * @internal
6
6
  */
7
- import { type TypeRef } from '../types.js';
7
+ import { type TypeRef, type FieldArg, type LiteralNode } from '../types.js';
8
8
  import { type ParserState } from './state.js';
9
9
  /**
10
10
  * Parse a type reference from the current position in the token stream.
@@ -33,5 +33,31 @@ import { type ParserState } from './state.js';
33
33
  */
34
34
  export declare function parseTypeRef(state: ParserState, opts?: {
35
35
  allowTrailingPipe?: boolean;
36
+ parseLiteral?: () => LiteralNode;
36
37
  }): TypeRef;
37
- //# sourceMappingURL=parser-types.d.ts.map
38
+ /**
39
+ * Parse a comma-separated list of field arguments between `(` and `)`.
40
+ *
41
+ * Caller has already consumed the opening `(`. This function parses zero
42
+ * or more arguments up to the closing `)` but does NOT consume it.
43
+ *
44
+ * Supports:
45
+ * - Named args: `name: type` → `{ name, value }`
46
+ * - Positional args: `type` → `{ value }`
47
+ * - Default values: `= literal` → `{ ..., defaultValue }` (when parseLiteral provided)
48
+ * - Union types in value position via `parseTypeRef`
49
+ * - Trailing commas before `)`
50
+ *
51
+ * Named arg detection: IDENTIFIER followed by COLON lookahead.
52
+ *
53
+ * @param state - Parser state (positioned after opening paren)
54
+ * @param opts - Optional parseLiteral callback for default value support
55
+ *
56
+ * @throws ParseError RILL-P014 if token after arg is not `,` or `)` (EC-1)
57
+ * @throws ParseError RILL-P014 if missing closing `)` (EC-2)
58
+ *
59
+ * @internal
60
+ */
61
+ export declare function parseFieldArgList(state: ParserState, opts?: {
62
+ parseLiteral?: () => LiteralNode;
63
+ }): FieldArg[];