@rcrsr/rill 0.15.0 → 0.17.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 (316) hide show
  1. package/README.md +37 -21
  2. package/dist/ast-nodes.d.ts +2 -13
  3. package/dist/ast-nodes.js +0 -1
  4. package/dist/ast-unions.d.ts +0 -1
  5. package/dist/ast-unions.js +0 -1
  6. package/dist/constants.d.ts +0 -1
  7. package/dist/constants.js +0 -1
  8. package/dist/error-classes.d.ts +0 -1
  9. package/dist/error-classes.js +0 -1
  10. package/dist/error-formatter.d.ts +0 -1
  11. package/dist/error-formatter.js +0 -1
  12. package/dist/error-registry.d.ts +0 -1
  13. package/dist/error-registry.js +32 -1
  14. package/dist/ext/crypto/index.d.ts +3 -4
  15. package/dist/ext/crypto/index.js +66 -64
  16. package/dist/ext/exec/index.d.ts +3 -4
  17. package/dist/ext/exec/index.js +17 -12
  18. package/dist/ext/exec/runner.d.ts +0 -1
  19. package/dist/ext/exec/runner.js +0 -1
  20. package/dist/ext/fetch/index.d.ts +3 -4
  21. package/dist/ext/fetch/index.js +23 -49
  22. package/dist/ext/fetch/request.d.ts +0 -1
  23. package/dist/ext/fetch/request.js +0 -1
  24. package/dist/ext/fs/index.d.ts +3 -4
  25. package/dist/ext/fs/index.js +268 -266
  26. package/dist/ext/fs/sandbox.d.ts +0 -1
  27. package/dist/ext/fs/sandbox.js +0 -1
  28. package/dist/ext/kv/index.d.ts +3 -4
  29. package/dist/ext/kv/index.js +216 -215
  30. package/dist/ext/kv/store.d.ts +0 -1
  31. package/dist/ext/kv/store.js +2 -2
  32. package/dist/ext-parse-bridge.d.ts +10 -0
  33. package/dist/ext-parse-bridge.js +10 -0
  34. package/dist/generated/introspection-data.d.ts +1 -2
  35. package/dist/generated/introspection-data.js +385 -297
  36. package/dist/generated/version-data.d.ts +1 -2
  37. package/dist/generated/version-data.js +2 -3
  38. package/dist/highlight-map.d.ts +0 -1
  39. package/dist/highlight-map.js +0 -1
  40. package/dist/index.d.ts +15 -5
  41. package/dist/index.js +14 -6
  42. package/dist/lexer/errors.d.ts +0 -1
  43. package/dist/lexer/errors.js +0 -1
  44. package/dist/lexer/helpers.d.ts +0 -1
  45. package/dist/lexer/helpers.js +0 -1
  46. package/dist/lexer/index.d.ts +0 -1
  47. package/dist/lexer/index.js +0 -1
  48. package/dist/lexer/operators.d.ts +0 -1
  49. package/dist/lexer/operators.js +0 -1
  50. package/dist/lexer/readers.d.ts +0 -1
  51. package/dist/lexer/readers.js +0 -1
  52. package/dist/lexer/state.d.ts +0 -1
  53. package/dist/lexer/state.js +0 -1
  54. package/dist/lexer/tokenizer.d.ts +0 -1
  55. package/dist/lexer/tokenizer.js +0 -1
  56. package/dist/parser/helpers.d.ts +0 -1
  57. package/dist/parser/helpers.js +0 -1
  58. package/dist/parser/index.d.ts +0 -1
  59. package/dist/parser/index.js +0 -1
  60. package/dist/parser/parser-collect.d.ts +0 -1
  61. package/dist/parser/parser-collect.js +0 -1
  62. package/dist/parser/parser-control.d.ts +0 -1
  63. package/dist/parser/parser-control.js +0 -1
  64. package/dist/parser/parser-expr.d.ts +0 -1
  65. package/dist/parser/parser-expr.js +0 -1
  66. package/dist/parser/parser-extract.d.ts +0 -1
  67. package/dist/parser/parser-extract.js +0 -1
  68. package/dist/parser/parser-functions.d.ts +0 -1
  69. package/dist/parser/parser-functions.js +0 -1
  70. package/dist/parser/parser-literals.d.ts +0 -1
  71. package/dist/parser/parser-literals.js +4 -2
  72. package/dist/parser/parser-script.d.ts +0 -1
  73. package/dist/parser/parser-script.js +0 -1
  74. package/dist/parser/parser-shape.d.ts +2 -3
  75. package/dist/parser/parser-shape.js +8 -52
  76. package/dist/parser/parser-types.d.ts +28 -2
  77. package/dist/parser/parser-types.js +76 -13
  78. package/dist/parser/parser-use.d.ts +0 -1
  79. package/dist/parser/parser-use.js +7 -2
  80. package/dist/parser/parser-variables.d.ts +0 -1
  81. package/dist/parser/parser-variables.js +0 -1
  82. package/dist/parser/parser.d.ts +0 -1
  83. package/dist/parser/parser.js +0 -1
  84. package/dist/parser/state.d.ts +0 -1
  85. package/dist/parser/state.js +0 -1
  86. package/dist/runtime/core/callable.d.ts +59 -20
  87. package/dist/runtime/core/callable.js +188 -39
  88. package/dist/runtime/core/context.d.ts +0 -12
  89. package/dist/runtime/core/context.js +77 -77
  90. package/dist/runtime/core/equals.d.ts +0 -1
  91. package/dist/runtime/core/equals.js +35 -3
  92. package/dist/runtime/core/eval/base.d.ts +0 -1
  93. package/dist/runtime/core/eval/base.js +0 -1
  94. package/dist/runtime/core/eval/evaluator.d.ts +0 -1
  95. package/dist/runtime/core/eval/evaluator.js +0 -1
  96. package/dist/runtime/core/eval/index.d.ts +2 -3
  97. package/dist/runtime/core/eval/index.js +11 -1
  98. package/dist/runtime/core/eval/mixins/annotations.d.ts +0 -1
  99. package/dist/runtime/core/eval/mixins/annotations.js +0 -1
  100. package/dist/runtime/core/eval/mixins/closures.d.ts +0 -1
  101. package/dist/runtime/core/eval/mixins/closures.js +92 -70
  102. package/dist/runtime/core/eval/mixins/collections.d.ts +0 -1
  103. package/dist/runtime/core/eval/mixins/collections.js +9 -4
  104. package/dist/runtime/core/eval/mixins/control-flow.d.ts +0 -1
  105. package/dist/runtime/core/eval/mixins/control-flow.js +0 -1
  106. package/dist/runtime/core/eval/mixins/conversion.d.ts +0 -1
  107. package/dist/runtime/core/eval/mixins/conversion.js +196 -188
  108. package/dist/runtime/core/eval/mixins/core.d.ts +0 -1
  109. package/dist/runtime/core/eval/mixins/core.js +2 -3
  110. package/dist/runtime/core/eval/mixins/expressions.d.ts +0 -1
  111. package/dist/runtime/core/eval/mixins/expressions.js +35 -28
  112. package/dist/runtime/core/eval/mixins/extraction.d.ts +0 -1
  113. package/dist/runtime/core/eval/mixins/extraction.js +8 -9
  114. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts +0 -1
  115. package/dist/runtime/core/eval/mixins/list-dispatch.js +0 -1
  116. package/dist/runtime/core/eval/mixins/literals.d.ts +0 -1
  117. package/dist/runtime/core/eval/mixins/literals.js +6 -10
  118. package/dist/runtime/core/eval/mixins/types.d.ts +2 -1
  119. package/dist/runtime/core/eval/mixins/types.js +231 -261
  120. package/dist/runtime/core/eval/mixins/use.d.ts +0 -1
  121. package/dist/runtime/core/eval/mixins/use.js +0 -1
  122. package/dist/runtime/core/eval/mixins/variables.d.ts +0 -1
  123. package/dist/runtime/core/eval/mixins/variables.js +16 -15
  124. package/dist/runtime/core/eval/types.d.ts +0 -1
  125. package/dist/runtime/core/eval/types.js +0 -1
  126. package/dist/runtime/core/execute.d.ts +0 -1
  127. package/dist/runtime/core/execute.js +0 -1
  128. package/dist/runtime/core/field-descriptor.d.ts +4 -5
  129. package/dist/runtime/core/field-descriptor.js +2 -2
  130. package/dist/runtime/core/introspection.d.ts +0 -1
  131. package/dist/runtime/core/introspection.js +6 -7
  132. package/dist/runtime/core/markers.d.ts +12 -0
  133. package/dist/runtime/core/markers.js +7 -0
  134. package/dist/runtime/core/resolvers.d.ts +0 -1
  135. package/dist/runtime/core/resolvers.js +0 -1
  136. package/dist/runtime/core/signals.d.ts +0 -1
  137. package/dist/runtime/core/signals.js +0 -1
  138. package/dist/runtime/core/type-registrations.d.ts +136 -0
  139. package/dist/runtime/core/type-registrations.js +749 -0
  140. package/dist/runtime/core/type-structures.d.ts +128 -0
  141. package/dist/runtime/core/type-structures.js +12 -0
  142. package/dist/runtime/core/types.d.ts +15 -4
  143. package/dist/runtime/core/types.js +0 -1
  144. package/dist/runtime/core/values.d.ts +88 -146
  145. package/dist/runtime/core/values.js +466 -470
  146. package/dist/runtime/ext/builtins.d.ts +0 -1
  147. package/dist/runtime/ext/builtins.js +125 -80
  148. package/dist/runtime/ext/extensions.d.ts +30 -125
  149. package/dist/runtime/ext/extensions.js +0 -94
  150. package/dist/runtime/ext/test-context.d.ts +28 -0
  151. package/dist/runtime/ext/test-context.js +154 -0
  152. package/dist/runtime/index.d.ts +22 -9
  153. package/dist/runtime/index.js +18 -5
  154. package/dist/signature-parser.d.ts +2 -3
  155. package/dist/signature-parser.js +19 -17
  156. package/dist/source-location.d.ts +0 -1
  157. package/dist/source-location.js +0 -1
  158. package/dist/token-types.d.ts +0 -1
  159. package/dist/token-types.js +0 -1
  160. package/dist/types.d.ts +0 -1
  161. package/dist/types.js +0 -1
  162. package/dist/value-types.d.ts +15 -12
  163. package/dist/value-types.js +0 -1
  164. package/package.json +2 -1
  165. package/dist/ast-nodes.d.ts.map +0 -1
  166. package/dist/ast-nodes.js.map +0 -1
  167. package/dist/ast-unions.d.ts.map +0 -1
  168. package/dist/ast-unions.js.map +0 -1
  169. package/dist/constants.d.ts.map +0 -1
  170. package/dist/constants.js.map +0 -1
  171. package/dist/error-classes.d.ts.map +0 -1
  172. package/dist/error-classes.js.map +0 -1
  173. package/dist/error-formatter.d.ts.map +0 -1
  174. package/dist/error-formatter.js.map +0 -1
  175. package/dist/error-registry.d.ts.map +0 -1
  176. package/dist/error-registry.js.map +0 -1
  177. package/dist/ext/crypto/index.d.ts.map +0 -1
  178. package/dist/ext/crypto/index.js.map +0 -1
  179. package/dist/ext/exec/index.d.ts.map +0 -1
  180. package/dist/ext/exec/index.js.map +0 -1
  181. package/dist/ext/exec/runner.d.ts.map +0 -1
  182. package/dist/ext/exec/runner.js.map +0 -1
  183. package/dist/ext/fetch/index.d.ts.map +0 -1
  184. package/dist/ext/fetch/index.js.map +0 -1
  185. package/dist/ext/fetch/request.d.ts.map +0 -1
  186. package/dist/ext/fetch/request.js.map +0 -1
  187. package/dist/ext/fs/index.d.ts.map +0 -1
  188. package/dist/ext/fs/index.js.map +0 -1
  189. package/dist/ext/fs/sandbox.d.ts.map +0 -1
  190. package/dist/ext/fs/sandbox.js.map +0 -1
  191. package/dist/ext/kv/index.d.ts.map +0 -1
  192. package/dist/ext/kv/index.js.map +0 -1
  193. package/dist/ext/kv/store.d.ts.map +0 -1
  194. package/dist/ext/kv/store.js.map +0 -1
  195. package/dist/generated/introspection-data.d.ts.map +0 -1
  196. package/dist/generated/introspection-data.js.map +0 -1
  197. package/dist/generated/version-data.d.ts.map +0 -1
  198. package/dist/generated/version-data.js.map +0 -1
  199. package/dist/highlight-map.d.ts.map +0 -1
  200. package/dist/highlight-map.js.map +0 -1
  201. package/dist/index.d.ts.map +0 -1
  202. package/dist/index.js.map +0 -1
  203. package/dist/lexer/errors.d.ts.map +0 -1
  204. package/dist/lexer/errors.js.map +0 -1
  205. package/dist/lexer/helpers.d.ts.map +0 -1
  206. package/dist/lexer/helpers.js.map +0 -1
  207. package/dist/lexer/index.d.ts.map +0 -1
  208. package/dist/lexer/index.js.map +0 -1
  209. package/dist/lexer/operators.d.ts.map +0 -1
  210. package/dist/lexer/operators.js.map +0 -1
  211. package/dist/lexer/readers.d.ts.map +0 -1
  212. package/dist/lexer/readers.js.map +0 -1
  213. package/dist/lexer/state.d.ts.map +0 -1
  214. package/dist/lexer/state.js.map +0 -1
  215. package/dist/lexer/tokenizer.d.ts.map +0 -1
  216. package/dist/lexer/tokenizer.js.map +0 -1
  217. package/dist/parser/helpers.d.ts.map +0 -1
  218. package/dist/parser/helpers.js.map +0 -1
  219. package/dist/parser/index.d.ts.map +0 -1
  220. package/dist/parser/index.js.map +0 -1
  221. package/dist/parser/parser-collect.d.ts.map +0 -1
  222. package/dist/parser/parser-collect.js.map +0 -1
  223. package/dist/parser/parser-control.d.ts.map +0 -1
  224. package/dist/parser/parser-control.js.map +0 -1
  225. package/dist/parser/parser-expr.d.ts.map +0 -1
  226. package/dist/parser/parser-expr.js.map +0 -1
  227. package/dist/parser/parser-extract.d.ts.map +0 -1
  228. package/dist/parser/parser-extract.js.map +0 -1
  229. package/dist/parser/parser-functions.d.ts.map +0 -1
  230. package/dist/parser/parser-functions.js.map +0 -1
  231. package/dist/parser/parser-literals.d.ts.map +0 -1
  232. package/dist/parser/parser-literals.js.map +0 -1
  233. package/dist/parser/parser-script.d.ts.map +0 -1
  234. package/dist/parser/parser-script.js.map +0 -1
  235. package/dist/parser/parser-shape.d.ts.map +0 -1
  236. package/dist/parser/parser-shape.js.map +0 -1
  237. package/dist/parser/parser-types.d.ts.map +0 -1
  238. package/dist/parser/parser-types.js.map +0 -1
  239. package/dist/parser/parser-use.d.ts.map +0 -1
  240. package/dist/parser/parser-use.js.map +0 -1
  241. package/dist/parser/parser-variables.d.ts.map +0 -1
  242. package/dist/parser/parser-variables.js.map +0 -1
  243. package/dist/parser/parser.d.ts.map +0 -1
  244. package/dist/parser/parser.js.map +0 -1
  245. package/dist/parser/state.d.ts.map +0 -1
  246. package/dist/parser/state.js.map +0 -1
  247. package/dist/runtime/core/callable.d.ts.map +0 -1
  248. package/dist/runtime/core/callable.js.map +0 -1
  249. package/dist/runtime/core/context.d.ts.map +0 -1
  250. package/dist/runtime/core/context.js.map +0 -1
  251. package/dist/runtime/core/equals.d.ts.map +0 -1
  252. package/dist/runtime/core/equals.js.map +0 -1
  253. package/dist/runtime/core/eval/base.d.ts.map +0 -1
  254. package/dist/runtime/core/eval/base.js.map +0 -1
  255. package/dist/runtime/core/eval/evaluator.d.ts.map +0 -1
  256. package/dist/runtime/core/eval/evaluator.js.map +0 -1
  257. package/dist/runtime/core/eval/index.d.ts.map +0 -1
  258. package/dist/runtime/core/eval/index.js.map +0 -1
  259. package/dist/runtime/core/eval/mixins/annotations.d.ts.map +0 -1
  260. package/dist/runtime/core/eval/mixins/annotations.js.map +0 -1
  261. package/dist/runtime/core/eval/mixins/closures.d.ts.map +0 -1
  262. package/dist/runtime/core/eval/mixins/closures.js.map +0 -1
  263. package/dist/runtime/core/eval/mixins/collections.d.ts.map +0 -1
  264. package/dist/runtime/core/eval/mixins/collections.js.map +0 -1
  265. package/dist/runtime/core/eval/mixins/control-flow.d.ts.map +0 -1
  266. package/dist/runtime/core/eval/mixins/control-flow.js.map +0 -1
  267. package/dist/runtime/core/eval/mixins/conversion.d.ts.map +0 -1
  268. package/dist/runtime/core/eval/mixins/conversion.js.map +0 -1
  269. package/dist/runtime/core/eval/mixins/core.d.ts.map +0 -1
  270. package/dist/runtime/core/eval/mixins/core.js.map +0 -1
  271. package/dist/runtime/core/eval/mixins/expressions.d.ts.map +0 -1
  272. package/dist/runtime/core/eval/mixins/expressions.js.map +0 -1
  273. package/dist/runtime/core/eval/mixins/extraction.d.ts.map +0 -1
  274. package/dist/runtime/core/eval/mixins/extraction.js.map +0 -1
  275. package/dist/runtime/core/eval/mixins/list-dispatch.d.ts.map +0 -1
  276. package/dist/runtime/core/eval/mixins/list-dispatch.js.map +0 -1
  277. package/dist/runtime/core/eval/mixins/literals.d.ts.map +0 -1
  278. package/dist/runtime/core/eval/mixins/literals.js.map +0 -1
  279. package/dist/runtime/core/eval/mixins/types.d.ts.map +0 -1
  280. package/dist/runtime/core/eval/mixins/types.js.map +0 -1
  281. package/dist/runtime/core/eval/mixins/use.d.ts.map +0 -1
  282. package/dist/runtime/core/eval/mixins/use.js.map +0 -1
  283. package/dist/runtime/core/eval/mixins/variables.d.ts.map +0 -1
  284. package/dist/runtime/core/eval/mixins/variables.js.map +0 -1
  285. package/dist/runtime/core/eval/types.d.ts.map +0 -1
  286. package/dist/runtime/core/eval/types.js.map +0 -1
  287. package/dist/runtime/core/execute.d.ts.map +0 -1
  288. package/dist/runtime/core/execute.js.map +0 -1
  289. package/dist/runtime/core/field-descriptor.d.ts.map +0 -1
  290. package/dist/runtime/core/field-descriptor.js.map +0 -1
  291. package/dist/runtime/core/introspection.d.ts.map +0 -1
  292. package/dist/runtime/core/introspection.js.map +0 -1
  293. package/dist/runtime/core/resolvers.d.ts.map +0 -1
  294. package/dist/runtime/core/resolvers.js.map +0 -1
  295. package/dist/runtime/core/signals.d.ts.map +0 -1
  296. package/dist/runtime/core/signals.js.map +0 -1
  297. package/dist/runtime/core/types.d.ts.map +0 -1
  298. package/dist/runtime/core/types.js.map +0 -1
  299. package/dist/runtime/core/values.d.ts.map +0 -1
  300. package/dist/runtime/core/values.js.map +0 -1
  301. package/dist/runtime/ext/builtins.d.ts.map +0 -1
  302. package/dist/runtime/ext/builtins.js.map +0 -1
  303. package/dist/runtime/ext/extensions.d.ts.map +0 -1
  304. package/dist/runtime/ext/extensions.js.map +0 -1
  305. package/dist/runtime/index.d.ts.map +0 -1
  306. package/dist/runtime/index.js.map +0 -1
  307. package/dist/signature-parser.d.ts.map +0 -1
  308. package/dist/signature-parser.js.map +0 -1
  309. package/dist/source-location.d.ts.map +0 -1
  310. package/dist/source-location.js.map +0 -1
  311. package/dist/token-types.d.ts.map +0 -1
  312. package/dist/token-types.js.map +0 -1
  313. package/dist/types.d.ts.map +0 -1
  314. package/dist/types.js.map +0 -1
  315. package/dist/value-types.d.ts.map +0 -1
  316. package/dist/value-types.js.map +0 -1
@@ -10,9 +10,8 @@ export interface VersionInfo {
10
10
  /**
11
11
  * Version string from package.json
12
12
  */
13
- export declare const VERSION = "0.15.0";
13
+ export declare const VERSION = "0.17.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.15.0';
6
+ export const VERSION = '0.17.0';
7
7
  /**
8
8
  * Parsed version components
9
9
  */
10
10
  export const VERSION_INFO = {
11
11
  major: 0,
12
- minor: 15,
12
+ minor: 17,
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,12 +5,22 @@
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, isFieldTypeWithDefault, 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 RillFieldType, 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
- /** @deprecated Use RillType instead. Will be removed in the next major version. */
10
- export type { RillStructuralType } from './runtime/index.js';
8
+ export { anyTypeValue, type ApplicationCallable, BreakSignal, buildFieldDescriptor, callable, type CallableFn, type CallFrame, commonType, type CaptureEvent, type ConfigFieldDescriptor, contextResolver, createRuntimeContext, createStepper, createTestContext, createTuple, createVector, type DocumentationCoverageResult, emitExtensionEvent, type ErrorEvent, execute, type ExecutionResult, type ExecutionStepper, ExtensionBindingError, type ExtensionConfigSchema, type ExtensionEvent, type ExtensionFactory, type ExtensionFactoryResult, type ExtensionManifest, extResolver, formatStructure, type FsExtensionContract, type FunctionMetadata, type FunctionReturnEvent, generateManifest, getCallStack, getDocumentationCoverage, getFunctions, getLanguageReference, type HostCallEvent, inferElementType, inferStructure, inferType, invokeCallable, isApplicationCallable, isCallable, isDict, isIterator, isReservedMethod, isRuntimeCallable, isScriptCallable, isTuple, isTypeValue, isVector, type KvExtensionContract, moduleResolver, type NativeArray, type NativePlainObject, type NativeResult, type NativeValue, type ObservabilityCallbacks, type ParamMetadata, paramToFieldDef, popCallFrame, pushCallFrame, RESERVED_DICT_METHODS, type ResolverResult, ReturnSignal, type RillCallable, type RillFieldDef, type RillFunction, type RillIterator, type RillParam, type RillTuple, type RillTypeValue, type RillValue, type RillVector, type RuntimeCallable, type RuntimeCallbacks, type RuntimeContext, type RuntimeOptions, type SchemaEntry, type SchemeResolver, type ScriptCallable, type StepEndEvent, type StepResult, type StepStartEvent, structureEquals, structureMatches, structureToTypeValue, toCallable, toNative, type TypeDefinition, type TypeProtocol, type TypeStructure, VERSION, VERSION_INFO, type VersionInfo, } from './runtime/index.js';
9
+ /** @deprecated Use TypeStructure instead. Will be removed in the next major version. */
10
+ export type { RillType } from './runtime/index.js';
11
+ /** @deprecated Use formatStructure instead. */
12
+ export { formatStructuralType } from './runtime/index.js';
13
+ /** @deprecated Use inferStructure instead. */
14
+ export { inferStructuralType } from './runtime/index.js';
15
+ /** @deprecated Use isIterator instead. */
16
+ export { isRillIterator } from './runtime/index.js';
17
+ /** @deprecated Use structureToTypeValue instead. */
18
+ export { rillTypeToTypeValue } from './runtime/index.js';
19
+ /** @deprecated Use structureEquals instead. */
20
+ export { structuralTypeEquals } from './runtime/index.js';
21
+ /** @deprecated Use structureMatches instead. */
22
+ export { structuralTypeMatches } from './runtime/index.js';
11
23
  export { type ErrorCategory, type ErrorDefinition, type ErrorSeverity, ERROR_REGISTRY, renderMessage, getHelpUrl, createError, } from './types.js';
12
24
  export { formatRillError, formatRillErrorJson, type FormatErrorOptions, type FormatErrorJsonOptions, type SourceMap, } from './error-formatter.js';
13
- export { VALID_TYPE_NAMES } from './constants.js';
14
25
  export { type HighlightCategory, TOKEN_HIGHLIGHT_MAP, } from './highlight-map.js';
15
26
  export * from './types.js';
16
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -4,7 +4,20 @@
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, isFieldTypeWithDefault, 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, buildFieldDescriptor, callable, commonType, contextResolver, createRuntimeContext, createStepper, createTestContext, createTuple, createVector, emitExtensionEvent, execute, ExtensionBindingError, extResolver, formatStructure, generateManifest, getCallStack, getDocumentationCoverage, getFunctions, getLanguageReference, inferElementType, inferStructure, inferType, invokeCallable, isApplicationCallable, isCallable, isDict, isIterator, isReservedMethod, isRuntimeCallable, isScriptCallable, isTuple, isTypeValue, isVector, moduleResolver, paramToFieldDef, popCallFrame, pushCallFrame, RESERVED_DICT_METHODS, ReturnSignal, structureEquals, structureMatches, structureToTypeValue, toCallable, toNative, VERSION, VERSION_INFO, } from './runtime/index.js';
8
+ // Deprecated aliases — old names kept for one release
9
+ /** @deprecated Use formatStructure instead. */
10
+ export { formatStructuralType } from './runtime/index.js';
11
+ /** @deprecated Use inferStructure instead. */
12
+ export { inferStructuralType } from './runtime/index.js';
13
+ /** @deprecated Use isIterator instead. */
14
+ export { isRillIterator } from './runtime/index.js';
15
+ /** @deprecated Use structureToTypeValue instead. */
16
+ export { rillTypeToTypeValue } from './runtime/index.js';
17
+ /** @deprecated Use structureEquals instead. */
18
+ export { structuralTypeEquals } from './runtime/index.js';
19
+ /** @deprecated Use structureMatches instead. */
20
+ export { structuralTypeMatches } from './runtime/index.js';
8
21
  // ============================================================
9
22
  // ERROR TAXONOMY
10
23
  // ============================================================
@@ -14,12 +27,7 @@ export { ERROR_REGISTRY, renderMessage, getHelpUrl, createError, } from './types
14
27
  // ============================================================
15
28
  export { formatRillError, formatRillErrorJson, } from './error-formatter.js';
16
29
  // ============================================================
17
- // CONSTANTS
18
- // ============================================================
19
- export { VALID_TYPE_NAMES } from './constants.js';
20
- // ============================================================
21
30
  // SYNTAX HIGHLIGHTING
22
31
  // ============================================================
23
32
  export { TOKEN_HIGHLIGHT_MAP, } from './highlight-map.js';
24
33
  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,38 +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 [= literal]
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
- if (check(parser.state, TOKEN_TYPES.ASSIGN)) {
67
- advance(parser.state); // consume =
68
- skipNewlines(parser.state);
69
- const defaultValue = parser.parseLiteral();
70
- return { kind: 'named', name: nameToken.value, value, defaultValue };
71
- }
72
- return { kind: 'named', name: nameToken.value, value };
73
- }
74
- // Positional arg: expression [= literal]
75
- const value = parser.parseExpression();
76
- if (check(parser.state, TOKEN_TYPES.ASSIGN)) {
77
- advance(parser.state); // consume =
78
- skipNewlines(parser.state);
79
- const defaultValue = parser.parseLiteral();
80
- return { kind: 'positional', value, defaultValue };
81
- }
82
- return { kind: 'positional', value };
83
- }
84
- //# 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[];
@@ -5,7 +5,7 @@
5
5
  * @internal
6
6
  */
7
7
  import { TOKEN_TYPES, ParseError, } from '../types.js';
8
- import { check, advance, expect, current, peek, } from './state.js';
8
+ import { check, advance, expect, current, peek, skipNewlines, } from './state.js';
9
9
  import { VALID_TYPE_NAMES, parseTypeName } from './helpers.js';
10
10
  /**
11
11
  * Parse a type reference from the current position in the token stream.
@@ -33,7 +33,7 @@ import { VALID_TYPE_NAMES, parseTypeName } from './helpers.js';
33
33
  * @internal
34
34
  */
35
35
  export function parseTypeRef(state, opts) {
36
- const first = parseSingleType(state);
36
+ const first = parseSingleType(state, opts);
37
37
  // Union accumulation: collect additional members after each "|"
38
38
  if (!check(state, TOKEN_TYPES.PIPE_BAR)) {
39
39
  return first;
@@ -75,7 +75,7 @@ export function parseTypeRef(state, opts) {
75
75
  throw new ParseError('RILL-P011', "Expected type name after '|'", current(state).span.start);
76
76
  }
77
77
  advance(state); // consume "|"
78
- const next = parseSingleType(state);
78
+ const next = parseSingleType(state, opts);
79
79
  // Flatten nested unions
80
80
  if (next.kind === 'union') {
81
81
  members.push(...next.members);
@@ -97,7 +97,19 @@ export function parseTypeRef(state, opts) {
97
97
  * Grammar: `single-type = "$" identifier | type-name [ "(" type-ref-arg-list ")" ]`
98
98
  * @internal
99
99
  */
100
- function parseSingleType(state) {
100
+ function parseSingleType(state, opts) {
101
+ // Zero-param closure type: || :returnType or bare ||
102
+ if (check(state, TOKEN_TYPES.OR)) {
103
+ advance(state); // consume || (OR token)
104
+ // Check for :returnType
105
+ if (check(state, TOKEN_TYPES.COLON)) {
106
+ advance(state); // consume :
107
+ const ret = parseSingleType(state, opts);
108
+ return { kind: 'static', typeName: 'closure', args: [{ value: ret }] };
109
+ }
110
+ // Bare || without :returnType — equivalent to 'closure'
111
+ return { kind: 'static', typeName: 'closure' };
112
+ }
101
113
  if (check(state, TOKEN_TYPES.DOLLAR)) {
102
114
  advance(state); // consume $
103
115
  const nameToken = expect(state, TOKEN_TYPES.IDENTIFIER, 'Expected variable name after $');
@@ -109,7 +121,39 @@ function parseSingleType(state) {
109
121
  return { kind: 'static', typeName };
110
122
  }
111
123
  advance(state); // consume "("
124
+ const args = parseFieldArgList(state, opts?.parseLiteral ? { parseLiteral: opts.parseLiteral } : undefined);
125
+ advance(state); // consume ")"
126
+ return { kind: 'static', typeName, args };
127
+ }
128
+ // ============================================================
129
+ // FIELD ARG LIST PARSING
130
+ // ============================================================
131
+ /**
132
+ * Parse a comma-separated list of field arguments between `(` and `)`.
133
+ *
134
+ * Caller has already consumed the opening `(`. This function parses zero
135
+ * or more arguments up to the closing `)` but does NOT consume it.
136
+ *
137
+ * Supports:
138
+ * - Named args: `name: type` → `{ name, value }`
139
+ * - Positional args: `type` → `{ value }`
140
+ * - Default values: `= literal` → `{ ..., defaultValue }` (when parseLiteral provided)
141
+ * - Union types in value position via `parseTypeRef`
142
+ * - Trailing commas before `)`
143
+ *
144
+ * Named arg detection: IDENTIFIER followed by COLON lookahead.
145
+ *
146
+ * @param state - Parser state (positioned after opening paren)
147
+ * @param opts - Optional parseLiteral callback for default value support
148
+ *
149
+ * @throws ParseError RILL-P014 if token after arg is not `,` or `)` (EC-1)
150
+ * @throws ParseError RILL-P014 if missing closing `)` (EC-2)
151
+ *
152
+ * @internal
153
+ */
154
+ export function parseFieldArgList(state, opts) {
112
155
  const args = [];
156
+ skipNewlines(state);
113
157
  // Parse arg list: allow empty "()" and trailing commas
114
158
  while (!check(state, TOKEN_TYPES.RPAREN)) {
115
159
  // Check for named arg: identifier ":" type-ref
@@ -120,28 +164,47 @@ function parseSingleType(state) {
120
164
  const name = tok.value;
121
165
  advance(state); // consume identifier
122
166
  advance(state); // consume ":"
123
- const ref = parseTypeRef(state);
124
- args.push({ name, ref });
167
+ skipNewlines(state);
168
+ const typeRefOpts = opts?.parseLiteral
169
+ ? { parseLiteral: opts.parseLiteral }
170
+ : undefined;
171
+ const value = parseTypeRef(state, typeRefOpts);
172
+ const arg = { name, value };
173
+ if (opts?.parseLiteral && check(state, TOKEN_TYPES.ASSIGN)) {
174
+ advance(state); // consume =
175
+ skipNewlines(state);
176
+ arg.defaultValue = opts.parseLiteral();
177
+ }
178
+ args.push(arg);
125
179
  }
126
180
  else {
127
181
  // Positional arg: type-ref
128
- const ref = parseTypeRef(state);
129
- args.push({ ref });
182
+ const typeRefOpts = opts?.parseLiteral
183
+ ? { parseLiteral: opts.parseLiteral }
184
+ : undefined;
185
+ const value = parseTypeRef(state, typeRefOpts);
186
+ const arg = { value };
187
+ if (opts?.parseLiteral && check(state, TOKEN_TYPES.ASSIGN)) {
188
+ advance(state); // consume =
189
+ skipNewlines(state);
190
+ arg.defaultValue = opts.parseLiteral();
191
+ }
192
+ args.push(arg);
130
193
  }
194
+ skipNewlines(state);
131
195
  // Consume trailing or separating comma
132
196
  if (check(state, TOKEN_TYPES.COMMA)) {
133
197
  advance(state);
198
+ skipNewlines(state);
134
199
  }
135
200
  else if (!check(state, TOKEN_TYPES.RPAREN)) {
136
- // Neither comma nor closing paren — malformed arg list (EC-14)
201
+ // Neither comma nor closing paren — malformed arg list (EC-1)
137
202
  throw new ParseError('RILL-P014', "Expected ',' or ')' in type argument list", current(state).span.start);
138
203
  }
139
204
  }
140
- // Consume ")"
205
+ // Verify closing ")" is present (EC-2)
141
206
  if (!check(state, TOKEN_TYPES.RPAREN)) {
142
207
  throw new ParseError('RILL-P014', "Expected ')' to close type argument list", current(state).span.start);
143
208
  }
144
- advance(state); // consume ")"
145
- return { kind: 'static', typeName, args };
209
+ return args;
146
210
  }
147
- //# sourceMappingURL=parser-types.js.map
@@ -8,4 +8,3 @@ declare module './parser.js' {
8
8
  parseUseExpr(): UseExprNode;
9
9
  }
10
10
  }
11
- //# sourceMappingURL=parser-use.d.ts.map