@rcrsr/rill 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ast-nodes.d.ts +43 -10
- package/dist/ast-nodes.d.ts.map +1 -1
- package/dist/ast-unions.d.ts +1 -1
- package/dist/ast-unions.d.ts.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/error-registry.d.ts.map +1 -1
- package/dist/error-registry.js +273 -6
- package/dist/error-registry.js.map +1 -1
- package/dist/ext/crypto/index.d.ts.map +1 -1
- package/dist/ext/crypto/index.js +23 -12
- package/dist/ext/crypto/index.js.map +1 -1
- package/dist/ext/exec/index.d.ts.map +1 -1
- package/dist/ext/exec/index.js +10 -11
- package/dist/ext/exec/index.js.map +1 -1
- package/dist/ext/fetch/index.d.ts.map +1 -1
- package/dist/ext/fetch/index.js +15 -15
- package/dist/ext/fetch/index.js.map +1 -1
- package/dist/ext/fs/index.d.ts.map +1 -1
- package/dist/ext/fs/index.js +139 -47
- package/dist/ext/fs/index.js.map +1 -1
- package/dist/ext/kv/index.d.ts.map +1 -1
- package/dist/ext/kv/index.js +130 -31
- package/dist/ext/kv/index.js.map +1 -1
- package/dist/generated/introspection-data.d.ts +1 -1
- package/dist/generated/introspection-data.d.ts.map +1 -1
- package/dist/generated/introspection-data.js +109 -8
- package/dist/generated/introspection-data.js.map +1 -1
- package/dist/generated/version-data.d.ts +1 -1
- package/dist/generated/version-data.d.ts.map +1 -1
- package/dist/generated/version-data.js +2 -2
- package/dist/generated/version-data.js.map +1 -1
- package/dist/highlight-map.d.ts.map +1 -1
- package/dist/highlight-map.js +1 -0
- package/dist/highlight-map.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexer/readers.d.ts.map +1 -1
- package/dist/lexer/readers.js +1 -0
- package/dist/lexer/readers.js.map +1 -1
- package/dist/parser/index.d.ts +3 -1
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +4 -1
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/parser-control.d.ts +1 -1
- package/dist/parser/parser-control.d.ts.map +1 -1
- package/dist/parser/parser-control.js +2 -2
- package/dist/parser/parser-control.js.map +1 -1
- package/dist/parser/parser-expr.d.ts +2 -1
- package/dist/parser/parser-expr.d.ts.map +1 -1
- package/dist/parser/parser-expr.js +15 -2
- package/dist/parser/parser-expr.js.map +1 -1
- package/dist/parser/parser-extract.d.ts.map +1 -1
- package/dist/parser/parser-extract.js +10 -9
- package/dist/parser/parser-extract.js.map +1 -1
- package/dist/parser/parser-functions.js +11 -6
- package/dist/parser/parser-functions.js.map +1 -1
- package/dist/parser/parser-literals.d.ts +1 -1
- package/dist/parser/parser-literals.d.ts.map +1 -1
- package/dist/parser/parser-literals.js +61 -7
- package/dist/parser/parser-literals.js.map +1 -1
- package/dist/parser/parser-types.d.ts +22 -6
- package/dist/parser/parser-types.d.ts.map +1 -1
- package/dist/parser/parser-types.js +126 -9
- package/dist/parser/parser-types.js.map +1 -1
- package/dist/parser/parser-use.d.ts +11 -0
- package/dist/parser/parser-use.d.ts.map +1 -0
- package/dist/parser/parser-use.js +68 -0
- package/dist/parser/parser-use.js.map +1 -0
- package/dist/parser/parser-variables.d.ts.map +1 -1
- package/dist/parser/parser-variables.js +5 -4
- package/dist/parser/parser-variables.js.map +1 -1
- package/dist/runtime/core/callable.d.ts +59 -70
- package/dist/runtime/core/callable.d.ts.map +1 -1
- package/dist/runtime/core/callable.js +37 -93
- package/dist/runtime/core/callable.js.map +1 -1
- package/dist/runtime/core/context.d.ts.map +1 -1
- package/dist/runtime/core/context.js +104 -33
- package/dist/runtime/core/context.js.map +1 -1
- package/dist/runtime/core/equals.d.ts.map +1 -1
- package/dist/runtime/core/equals.js +59 -17
- package/dist/runtime/core/equals.js.map +1 -1
- package/dist/runtime/core/eval/evaluator.d.ts.map +1 -1
- package/dist/runtime/core/eval/evaluator.js +2 -1
- package/dist/runtime/core/eval/evaluator.js.map +1 -1
- package/dist/runtime/core/eval/index.d.ts +2 -2
- package/dist/runtime/core/eval/index.d.ts.map +1 -1
- package/dist/runtime/core/eval/index.js +5 -0
- package/dist/runtime/core/eval/index.js.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts +3 -5
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.js +76 -40
- package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
- package/dist/runtime/core/eval/mixins/collections.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/collections.js +4 -2
- package/dist/runtime/core/eval/mixins/collections.js.map +1 -1
- package/dist/runtime/core/eval/mixins/conversion.d.ts +9 -9
- package/dist/runtime/core/eval/mixins/conversion.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/conversion.js +51 -21
- package/dist/runtime/core/eval/mixins/conversion.js.map +1 -1
- package/dist/runtime/core/eval/mixins/core.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/core.js +8 -2
- package/dist/runtime/core/eval/mixins/core.js.map +1 -1
- package/dist/runtime/core/eval/mixins/extraction.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/extraction.js +20 -8
- package/dist/runtime/core/eval/mixins/extraction.js.map +1 -1
- package/dist/runtime/core/eval/mixins/literals.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/literals.js +32 -15
- package/dist/runtime/core/eval/mixins/literals.js.map +1 -1
- package/dist/runtime/core/eval/mixins/types.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/types.js +166 -21
- package/dist/runtime/core/eval/mixins/types.js.map +1 -1
- package/dist/runtime/core/eval/mixins/use.d.ts +25 -0
- package/dist/runtime/core/eval/mixins/use.d.ts.map +1 -0
- package/dist/runtime/core/eval/mixins/use.js +152 -0
- package/dist/runtime/core/eval/mixins/use.js.map +1 -0
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.js +67 -32
- package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
- package/dist/runtime/core/execute.d.ts.map +1 -1
- package/dist/runtime/core/execute.js +11 -1
- package/dist/runtime/core/execute.js.map +1 -1
- package/dist/runtime/core/field-descriptor.d.ts +6 -6
- package/dist/runtime/core/field-descriptor.d.ts.map +1 -1
- package/dist/runtime/core/field-descriptor.js +2 -2
- package/dist/runtime/core/field-descriptor.js.map +1 -1
- package/dist/runtime/core/introspection.d.ts +16 -0
- package/dist/runtime/core/introspection.d.ts.map +1 -1
- package/dist/runtime/core/introspection.js +102 -7
- package/dist/runtime/core/introspection.js.map +1 -1
- package/dist/runtime/core/resolvers.d.ts +39 -0
- package/dist/runtime/core/resolvers.d.ts.map +1 -0
- package/dist/runtime/core/resolvers.js +89 -0
- package/dist/runtime/core/resolvers.js.map +1 -0
- package/dist/runtime/core/types.d.ts +54 -5
- package/dist/runtime/core/types.d.ts.map +1 -1
- package/dist/runtime/core/types.js.map +1 -1
- package/dist/runtime/core/values.d.ts +43 -29
- package/dist/runtime/core/values.d.ts.map +1 -1
- package/dist/runtime/core/values.js +153 -68
- package/dist/runtime/core/values.js.map +1 -1
- package/dist/runtime/ext/builtins.d.ts +3 -4
- package/dist/runtime/ext/builtins.d.ts.map +1 -1
- package/dist/runtime/ext/builtins.js +621 -444
- package/dist/runtime/ext/builtins.js.map +1 -1
- package/dist/runtime/ext/extensions.d.ts +43 -43
- package/dist/runtime/ext/extensions.d.ts.map +1 -1
- package/dist/runtime/ext/extensions.js.map +1 -1
- package/dist/runtime/index.d.ts +8 -5
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +6 -2
- package/dist/runtime/index.js.map +1 -1
- package/dist/signature-parser.d.ts +43 -0
- package/dist/signature-parser.d.ts.map +1 -0
- package/dist/signature-parser.js +289 -0
- package/dist/signature-parser.js.map +1 -0
- package/dist/token-types.d.ts +1 -0
- package/dist/token-types.d.ts.map +1 -1
- package/dist/token-types.js +1 -0
- package/dist/token-types.js.map +1 -1
- package/dist/value-types.d.ts +20 -6
- package/dist/value-types.d.ts.map +1 -1
- package/dist/value-types.js +1 -1
- package/dist/value-types.js.map +1 -1
- package/package.json +4 -1
|
@@ -1,2 +1,2 @@
|
|
|
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**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: string, number, bool, list, dict, any, vector, shape(...), $shapeVar.\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## Type Operations\n\n`:type` \u2014 assert type (error if wrong): `42:number` passes; `\"x\":number` errors.\n`:?type` \u2014 check type (boolean): `42:?number` is true; `\"x\":?number` is false.\n\nTypes: `string`, `number`, `boolean`, `list`, `dict`, `tuple`, `closure`.\n\nComparison 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\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| `.str` | convert to string |\n| `.num` | parse to number |\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";
|
|
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
2
|
//# sourceMappingURL=introspection-data.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspection-data.d.ts","sourceRoot":"","sources":["../../src/generated/introspection-data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"introspection-data.d.ts","sourceRoot":"","sources":["../../src/generated/introspection-data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,wv2BAgqB9B,CAAC"}
|
|
@@ -297,6 +297,17 @@ Two ways to create closures:
|
|
|
297
297
|
|x = 0|(\$x + 1) => \$inc_or_one # default value
|
|
298
298
|
|x: number|(\$x + 1) => \$typed # type annotation
|
|
299
299
|
|
|
300
|
+
**Anonymous typed closures:** \`|type|{ body }\` — reserved type keyword as param, \`\$\` is type-checked piped input
|
|
301
|
+
|
|
302
|
+
"hello" -> |string|{ \$ -> .upper } # \$ is string, checked at call
|
|
303
|
+
5 -> |number|{ \$ * 2 } # 10
|
|
304
|
+
|number|{ \$ * 2 }:number => \$double # stored with return type assertion
|
|
305
|
+
5 -> \$double # 10
|
|
306
|
+
"hi" -> \$double # RILL-R001: expected number, got string
|
|
307
|
+
|
|
308
|
+
All 11 type names valid: string, number, bool, list, dict, ordered, tuple, closure, vector, any, type
|
|
309
|
+
Parameterized: |list(number)|{ \$ -> each { \$ * 2 } }
|
|
310
|
+
|
|
300
311
|
**Return type assertions** (enforced at runtime — RILL-R004 on mismatch):
|
|
301
312
|
|
|
302
313
|
|x: number| { "{\$x}" }:string => \$fn # asserts string return type
|
|
@@ -305,7 +316,9 @@ Two ways to create closures:
|
|
|
305
316
|
|x: number| { \$x * 2 }:string => \$fn # mismatch halts with RILL-R004
|
|
306
317
|
\$fn(5) # RILL-R004: expected string, got number
|
|
307
318
|
|
|
308
|
-
Valid return type targets: string, number, bool, list, dict,
|
|
319
|
+
Valid return type targets: any type name (string, number, bool, closure, list, dict, tuple,
|
|
320
|
+
ordered, vector, any, type), or a parameterized type constructor (list(string),
|
|
321
|
+
dict(a: number, b: string)).
|
|
309
322
|
Declared return type accessible via \$fn.^output annotation.
|
|
310
323
|
|
|
311
324
|
**Description shorthand** (bare string in \`^(...)\` expands to \`description: <string>\`):
|
|
@@ -383,14 +396,100 @@ Note: lists require same-type elements. For mixed paths (strings and numbers), u
|
|
|
383
396
|
dict[users: list[dict[name: "Alice"]]] => \$d
|
|
384
397
|
\$d.users[0].name # "Alice"
|
|
385
398
|
|
|
386
|
-
## Type
|
|
399
|
+
## Types and Type Expressions
|
|
400
|
+
|
|
401
|
+
**Type names:**
|
|
402
|
+
|
|
403
|
+
string number bool list dict ordered
|
|
404
|
+
tuple closure vector any type
|
|
405
|
+
|
|
406
|
+
**Type names are first-class values** — assign to variables, use in dynamic expressions:
|
|
407
|
+
|
|
408
|
+
number => \$t # store a type value
|
|
409
|
+
42 -> :\$t # dynamic assertion (same as :number)
|
|
410
|
+
42 -> :?\$t # dynamic check: true
|
|
411
|
+
42 -> :>\$t # dynamic conversion (same as :>number)
|
|
412
|
+
\$val.^type == \$t # compare against stored type
|
|
413
|
+
|
|
414
|
+
**Parameterized type constructors** (structural types):
|
|
415
|
+
|
|
416
|
+
list(string) # list of strings
|
|
417
|
+
dict(name: string, age: number) # dict with named fields
|
|
418
|
+
tuple(number, string) # positional tuple
|
|
419
|
+
ordered(x: number, y: number) # named ordered args
|
|
420
|
+
|x: number, y: string| :any # closure signature type
|
|
421
|
+
|
|
422
|
+
Closure signatures include parameter names — \`|x: number|\` and \`|y: number|\` are different types.
|
|
423
|
+
|
|
424
|
+
**Type assertion** \`:type\` — errors if value does not match:
|
|
425
|
+
|
|
426
|
+
42:number # passes
|
|
427
|
+
"x":number # RILL-R002: expected number, got string
|
|
428
|
+
\$val:list(string) # assert parameterized type
|
|
429
|
+
|
|
430
|
+
**Enforcing dict shapes** with \`dict(field: type, ...)\`:
|
|
431
|
+
|
|
432
|
+
\$data -> :dict(name: string, age: number) # assert exact fields and types
|
|
433
|
+
\$data:?dict(name: string, age: number) # check without error
|
|
434
|
+
\$data:dict(name: string) -> .name # assert then access
|
|
435
|
+
|
|
436
|
+
Use in closure params to validate input structure:
|
|
437
|
+
|
|
438
|
+
|d: dict(name: string, age: number)| {
|
|
439
|
+
"{\$d.name} is {\$d.age}"
|
|
440
|
+
} => \$format_person
|
|
441
|
+
|
|
442
|
+
**Type check** \`:?type\` — returns boolean, never errors:
|
|
443
|
+
|
|
444
|
+
42:?number # true
|
|
445
|
+
"x":?number # false
|
|
446
|
+
\$val:?list(string) # structural check
|
|
447
|
+
|
|
448
|
+
Both forms work as pipe targets:
|
|
449
|
+
|
|
450
|
+
\$val -> :number # assert in pipe
|
|
451
|
+
\$val -> :?number # check in pipe
|
|
452
|
+
|
|
453
|
+
**\`^type\` operator** — returns a type value for inspection:
|
|
454
|
+
|
|
455
|
+
42.^type # type value for number
|
|
456
|
+
42.^type.name # "number"
|
|
457
|
+
list[1, 2].^type.name # "list"
|
|
458
|
+
list[1, 2].^type.signature # "list(number)"
|
|
459
|
+
|
|
460
|
+
**Type value equality:**
|
|
461
|
+
|
|
462
|
+
\$val.^type == list(number) # true if \$val is list(number)
|
|
463
|
+
\$val.^type == \$other.^type # compare structural types
|
|
464
|
+
|
|
465
|
+
**Type conversion** \`:>type\` — explicit conversion between compatible types:
|
|
466
|
+
|
|
467
|
+
42 -> :>string # "42"
|
|
468
|
+
"3.14" -> :>number # 3.14
|
|
469
|
+
list[1, 2] -> :>tuple # tuple[1, 2]
|
|
470
|
+
tuple[1, 2] -> :>list # list[1, 2]
|
|
471
|
+
ordered[a: 1] -> :>dict # dict[a: 1]
|
|
472
|
+
dict[x: 1, y: 2] -> :>ordered(x: number, y: number) # structural
|
|
473
|
+
|
|
474
|
+
Compatibility matrix (error = halts with RILL-R036, no-op = same-type identity):
|
|
387
475
|
|
|
388
|
-
|
|
389
|
-
|
|
476
|
+
Source | :>list | :>dict | :>tuple | :>ordered(sig) | :>number | :>string | :>bool
|
|
477
|
+
---------|---------|---------|---------|----------------|----------|----------|-------
|
|
478
|
+
list | no-op | error | valid | error | error | valid¹ | error
|
|
479
|
+
dict | error | no-op | error | valid | error | valid¹ | error
|
|
480
|
+
tuple | valid | error | no-op | error | error | valid¹ | error
|
|
481
|
+
ordered | error | valid | error | no-op | error | valid¹ | error
|
|
482
|
+
string | error | error | error | error | valid² | no-op | valid³
|
|
483
|
+
number | error | error | error | error | no-op | valid¹ | valid⁵
|
|
484
|
+
bool | error | error | error | error | valid⁴ | valid¹ | no-op
|
|
390
485
|
|
|
391
|
-
|
|
486
|
+
¹ Uses formatValue semantics for formatted output
|
|
487
|
+
² Parseable strings only; halts with RILL-R038 on failure
|
|
488
|
+
³ Accepts only "true" and "false"; halts with RILL-R036 otherwise
|
|
489
|
+
⁴ true maps to 1, false maps to 0
|
|
490
|
+
⁵ 0 maps to false, 1 maps to true; all other values halt with RILL-R036
|
|
392
491
|
|
|
393
|
-
Comparison
|
|
492
|
+
## Comparison Methods
|
|
394
493
|
|
|
395
494
|
.eq(val) == .ne(val) != .lt(val) < .gt(val) > .le(val) <= .ge(val) >=
|
|
396
495
|
Example: \$age -> .ge(18) ? "adult" ! "minor"
|
|
@@ -438,6 +537,10 @@ Slice (\`slice<start:stop:step>\`):
|
|
|
438
537
|
tuple[1, 2, 3] -> \$fn(...) # positional spread: \$fn(1, 2, 3)
|
|
439
538
|
ordered[a: 10, b: 2] -> \$fn(...) # named spread: keys must match parameter order
|
|
440
539
|
tuple[...\$list, 3] -> \$fn(...) # spread in tuple then spread into call
|
|
540
|
+
tuple[1, 2, 3] => \$args
|
|
541
|
+
\$args -> \$fn(...) # spread stored tuple
|
|
542
|
+
ordered[a: 1, b: 2] => \$named
|
|
543
|
+
\$named -> \$fn(...) # spread stored ordered
|
|
441
544
|
|
|
442
545
|
## String Methods
|
|
443
546
|
|
|
@@ -448,8 +551,6 @@ Slice (\`slice<start:stop:step>\`):
|
|
|
448
551
|
| \`.trim\` | remove whitespace |
|
|
449
552
|
| \`.upper\` | uppercase |
|
|
450
553
|
| \`.lower\` | lowercase |
|
|
451
|
-
| \`.str\` | convert to string |
|
|
452
|
-
| \`.num\` | parse to number |
|
|
453
554
|
| \`.head\` | first character |
|
|
454
555
|
| \`.tail\` | last character |
|
|
455
556
|
| \`.at(i)\` | character at index |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"introspection-data.js","sourceRoot":"","sources":["../../src/generated/introspection-data.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,mFAAmF;AAEnF,MAAM,CAAC,MAAM,kBAAkB,GAAG
|
|
1
|
+
{"version":3,"file":"introspection-data.js","sourceRoot":"","sources":["../../src/generated/introspection-data.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,mFAAmF;AAEnF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgqBjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-data.d.ts","sourceRoot":"","sources":["../../src/generated/version-data.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version-data.d.ts","sourceRoot":"","sources":["../../src/generated/version-data.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,WAAW,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,WAK1B,CAAC"}
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Version string from package.json
|
|
5
5
|
*/
|
|
6
|
-
export const VERSION = '0.
|
|
6
|
+
export const VERSION = '0.11.0';
|
|
7
7
|
/**
|
|
8
8
|
* Parsed version components
|
|
9
9
|
*/
|
|
10
10
|
export const VERSION_INFO = {
|
|
11
11
|
major: 0,
|
|
12
|
-
minor:
|
|
12
|
+
minor: 11,
|
|
13
13
|
patch: 0,
|
|
14
14
|
prerelease: undefined,
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-data.js","sourceRoot":"","sources":["../../src/generated/version-data.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,2EAA2E;AAY3E;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version-data.js","sourceRoot":"","sources":["../../src/generated/version-data.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,2EAA2E;AAY3E;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAgB;IACvC,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,SAAS;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight-map.d.ts","sourceRoot":"","sources":["../src/highlight-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,SAAS,GACT,cAAc,GACd,aAAa,GACb,SAAS,GACT,MAAM,CAAC;AAMX,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,SAAS,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"highlight-map.d.ts","sourceRoot":"","sources":["../src/highlight-map.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAM5C,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,UAAU,GACV,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,SAAS,GACT,cAAc,GACd,aAAa,GACb,SAAS,GACT,MAAM,CAAC;AAMX,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,SAAS,EAAE,iBAAiB,CAmFtE,CAAC"}
|
package/dist/highlight-map.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlight-map.js","sourceRoot":"","sources":["../src/highlight-map.ts"],"names":[],"mappings":"AAkBA,+DAA+D;AAC/D,sBAAsB;AACtB,+DAA+D;AAE/D,MAAM,CAAC,MAAM,mBAAmB,GAC9B,IAAI,GAAG,CAA+B;IACpC,WAAW;IACX,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpB,CAAC,MAAM,EAAE,MAAM,CAAC;IAChB,CAAC,OAAO,EAAE,MAAM,CAAC;IAEjB,WAAW;IACX,CAAC,SAAS,EAAE,SAAS,CAAC;IAEtB,oBAAoB;IACpB,CAAC,eAAe,EAAE,SAAS,CAAC;IAC5B,CAAC,eAAe,EAAE,SAAS,CAAC;IAC5B,CAAC,gBAAgB,EAAE,SAAS,CAAC;IAC7B,CAAC,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,EAAE,SAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,QAAQ,EAAE,SAAS,CAAC;IACrB,CAAC,UAAU,EAAE,SAAS,CAAC;IACvB,CAAC,UAAU,EAAE,SAAS,CAAC;IAEvB,OAAO;IACP,CAAC,mBAAmB,EAAE,MAAM,CAAC;IAE7B,uCAAuC;CACxC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
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 { type ApplicationCallable, BreakSignal, callable, type CallableFn, type
|
|
8
|
+
export { type ApplicationCallable, BreakSignal, callable, type CallableFn, type CallFrame, type CaptureEvent, type ConfigFieldDescriptor, createRuntimeContext, createStepper, createTuple, createVector, type DocumentationCoverageResult, emitExtensionEvent, extResolver, type ErrorEvent, execute, type ExecutionResult, type ExecutionStepper, type ExtensionConfigSchema, type ExtensionEvent, type ExtensionFactory, type ExtensionResult, type FsExtensionContract, type FunctionMetadata, hoistExtension, type HoistedExtension, type HostCallEvent, type FunctionReturnEvent, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, 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, ReturnSignal, type RillCallable, type RillCallableSignature, type RillFunction, type RillFunctionSignature, type RillMethodSignature, 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';
|
|
9
11
|
export { type ErrorCategory, type ErrorDefinition, type ErrorSeverity, ERROR_REGISTRY, renderMessage, getHelpUrl, createError, } from './types.js';
|
|
10
12
|
export { VALID_TYPE_NAMES } from './constants.js';
|
|
11
13
|
export { type HighlightCategory, TOKEN_HIGHLIGHT_MAP, } from './highlight-map.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EACL,KAAK,mBAAmB,EACxB,WAAW,EACX,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,Y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AAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,mFAAmF;AACnF,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAK7D,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAKpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAKlD,OAAO,EACL,KAAK,iBAAiB,EACtB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,YAAY,CAAC"}
|
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 { BreakSignal, callable, createRuntimeContext, createStepper, createTuple, createVector, emitExtensionEvent, execute, hoistExtension, getCallStack, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, ReturnSignal, structuralTypeEquals, structuralTypeMatches, toNative,
|
|
7
|
+
export { BreakSignal, callable, createRuntimeContext, createStepper, createTuple, createVector, emitExtensionEvent, extResolver, execute, hoistExtension, getCallStack, generateManifest, getDocumentationCoverage, getFunctions, getLanguageReference, buildFieldDescriptor, formatStructuralType, inferElementType, inferStructuralType, inferType, invokeCallable, isApplicationCallable, moduleResolver, isTuple, isCallable, isDict, isReservedMethod, isRillIterator, isRuntimeCallable, isScriptCallable, isTypeValue, isVector, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, ReturnSignal, structuralTypeEquals, structuralTypeMatches, toNative, VERSION, VERSION_INFO, } from './runtime/index.js';
|
|
8
8
|
// ============================================================
|
|
9
9
|
// ERROR TAXONOMY
|
|
10
10
|
// ============================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAwB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAEL,WAAW,EACX,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAwB,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAEL,WAAW,EACX,QAAQ,EAKR,oBAAoB,EACpB,aAAa,EACb,WAAW,EACX,YAAY,EAEZ,kBAAkB,EAClB,WAAW,EAEX,OAAO,EASP,cAAc,EAId,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,OAAO,EACP,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,QAAQ,EAUR,YAAY,EACZ,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,YAAY,EAwBZ,oBAAoB,EACpB,qBAAqB,EACrB,QAAQ,EACR,OAAO,EACP,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAK5B,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAC/D,OAAO,EAIL,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAEpB,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,+DAA+D;AAC/D,sBAAsB;AACtB,+DAA+D;AAC/D,OAAO,EAEL,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.d.ts","sourceRoot":"","sources":["../../src/lexer/readers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUpD,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAC;AAMpB,uDAAuD;AACvD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;
|
|
1
|
+
{"version":3,"file":"readers.d.ts","sourceRoot":"","sources":["../../src/lexer/readers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAUpD,OAAO,EAIL,KAAK,UAAU,EAEhB,MAAM,YAAY,CAAC;AAMpB,uDAAuD;AACvD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAmBF,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,aAAa,GAAG,IAAI,CAatB;AAyBD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAoCnD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAmF9D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAgBnD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAmCvD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAiBrD"}
|
package/dist/lexer/readers.js
CHANGED
|
@@ -18,6 +18,7 @@ const COMPOUND_KEYWORD_MAP = {
|
|
|
18
18
|
ordered: { bracket: '[', tokenType: TOKEN_TYPES.ORDERED_LBRACKET },
|
|
19
19
|
destruct: { bracket: '<', tokenType: TOKEN_TYPES.DESTRUCT_LANGLE },
|
|
20
20
|
slice: { bracket: '<', tokenType: TOKEN_TYPES.SLICE_LANGLE },
|
|
21
|
+
use: { bracket: '<', tokenType: TOKEN_TYPES.USE_LANGLE },
|
|
21
22
|
};
|
|
22
23
|
/** Returns true when the identifier is one of the six collection keywords. */
|
|
23
24
|
export function isCollectionKeyword(identifier) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readers.js","sourceRoot":"","sources":["../../src/lexer/readers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,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AC,CAAC,YAAY;QAC5B,OAAO,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC5E,CAAC;IAED,6DAA6D;IAC7D,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QACnC,OAAO,SAAS,CAAC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,0DAA0D;IAC1D,OAAO,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7E,CAAC"}
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import './parser-functions.js';
|
|
|
12
12
|
import './parser-collect.js';
|
|
13
13
|
import './parser-extract.js';
|
|
14
14
|
import './parser-shape.js';
|
|
15
|
+
import './parser-use.js';
|
|
15
16
|
/**
|
|
16
17
|
* Parse rill source code into an AST.
|
|
17
18
|
*
|
|
@@ -45,6 +46,7 @@ export declare function parse(source: string): ScriptNode;
|
|
|
45
46
|
* ```
|
|
46
47
|
*/
|
|
47
48
|
export declare function parseWithRecovery(source: string): ParseResult;
|
|
48
|
-
export { createParserState, type ParserState } from './state.js';
|
|
49
|
+
export { createParserState, type ParserState, advance, check, current, expect, skipNewlines, isAtEnd, } from './state.js';
|
|
50
|
+
export { parseTypeRef } from './parser-types.js';
|
|
49
51
|
export { Parser } from './parser.js';
|
|
50
52
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAK5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAc,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAK5E,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,iBAAiB,CAAC;AAMzB;;;;;;;;;;;;GAYG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAIhD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,CAkD7D;AAOD,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,EAChB,OAAO,EACP,KAAK,EACL,OAAO,EACP,MAAM,EACN,YAAY,EACZ,OAAO,GACR,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/parser/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import './parser-functions.js';
|
|
|
16
16
|
import './parser-collect.js';
|
|
17
17
|
import './parser-extract.js';
|
|
18
18
|
import './parser-shape.js';
|
|
19
|
+
import './parser-use.js';
|
|
19
20
|
// ============================================================
|
|
20
21
|
// MAIN ENTRY POINT
|
|
21
22
|
// ============================================================
|
|
@@ -101,7 +102,9 @@ export function parseWithRecovery(source) {
|
|
|
101
102
|
// RE-EXPORTS
|
|
102
103
|
// ============================================================
|
|
103
104
|
// State (for advanced usage)
|
|
104
|
-
export { createParserState } from './state.js';
|
|
105
|
+
export { createParserState, advance, check, current, expect, skipNewlines, isAtEnd, } from './state.js';
|
|
106
|
+
// Type parsing (for advanced usage)
|
|
107
|
+
export { parseTypeRef } from './parser-types.js';
|
|
105
108
|
// Parser class (for advanced usage)
|
|
106
109
|
export { Parser } from './parser.js';
|
|
107
110
|
//# sourceMappingURL=index.js.map
|
package/dist/parser/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAqC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,oEAAoE;AACpE,yEAAyE;AACzE,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAqC,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,M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ConditionalNode;
|
|
15
15
|
parseLoop(condition: ExpressionNode | null): WhileLoopNode | DoWhileLoopNode;
|
|
16
16
|
parseLoopWithInput(condition: BodyNode): WhileLoopNode | DoWhileLoopNode;
|
|
17
|
-
parseBlock(): BlockNode;
|
|
17
|
+
parseBlock(allowEmpty?: boolean): BlockNode;
|
|
18
18
|
parseAssert(): AssertNode;
|
|
19
19
|
parseError(requireMessage?: boolean): ErrorNode;
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-control.d.ts","sourceRoot":"","sources":["../../src/parser/parser-control.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAGV,UAAU,EACV,SAAS,EACT,eAAe,EACf,eAAe,EACf,SAAS,EACT,cAAc,EAEd,aAAa,EACb,QAAQ,EAET,MAAM,aAAa,CAAC;AAcrB,OAAO,QAAQ,aAAa,CAAC;IAC3B,UAAU,MAAM;QACd,qBAAqB,IAAI,eAAe,CAAC;QACzC,6BAA6B,CAAC,aAAa,EAAE,QAAQ,GAAG,eAAe,CAAC;QACxE,oBAAoB,CAClB,SAAS,EAAE,QAAQ,GAAG,IAAI,EAC1B,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GACtD,eAAe,CAAC;QACnB,SAAS,CACP,SAAS,EAAE,cAAc,GAAG,IAAI,GAC/B,aAAa,GAAG,eAAe,CAAC;QACnC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,aAAa,GAAG,eAAe,CAAC;QACzE,UAAU,
|
|
1
|
+
{"version":3,"file":"parser-control.d.ts","sourceRoot":"","sources":["../../src/parser/parser-control.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAGV,UAAU,EACV,SAAS,EACT,eAAe,EACf,eAAe,EACf,SAAS,EACT,cAAc,EAEd,aAAa,EACb,QAAQ,EAET,MAAM,aAAa,CAAC;AAcrB,OAAO,QAAQ,aAAa,CAAC;IAC3B,UAAU,MAAM;QACd,qBAAqB,IAAI,eAAe,CAAC;QACzC,6BAA6B,CAAC,aAAa,EAAE,QAAQ,GAAG,eAAe,CAAC;QACxE,oBAAoB,CAClB,SAAS,EAAE,QAAQ,GAAG,IAAI,EAC1B,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,GACtD,eAAe,CAAC;QACnB,SAAS,CACP,SAAS,EAAE,cAAc,GAAG,IAAI,GAC/B,aAAa,GAAG,eAAe,CAAC;QACnC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,aAAa,GAAG,eAAe,CAAC;QACzE,UAAU,CAAC,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC5C,WAAW,IAAI,UAAU,CAAC;QAC1B,UAAU,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACjD;CACF"}
|
|
@@ -111,7 +111,7 @@ Parser.prototype.parseLoopWithInput = function (condition) {
|
|
|
111
111
|
// ============================================================
|
|
112
112
|
// BLOCKS
|
|
113
113
|
// ============================================================
|
|
114
|
-
Parser.prototype.parseBlock = function () {
|
|
114
|
+
Parser.prototype.parseBlock = function (allowEmpty) {
|
|
115
115
|
const start = current(this.state).span.start;
|
|
116
116
|
expect(this.state, TOKEN_TYPES.LBRACE, 'Expected {');
|
|
117
117
|
skipNewlines(this.state);
|
|
@@ -120,7 +120,7 @@ Parser.prototype.parseBlock = function () {
|
|
|
120
120
|
statements.push(this.parseStatement());
|
|
121
121
|
skipNewlines(this.state);
|
|
122
122
|
}
|
|
123
|
-
if (statements.length === 0) {
|
|
123
|
+
if (statements.length === 0 && !allowEmpty) {
|
|
124
124
|
throw new ParseError('RILL-P004', 'Empty blocks are not allowed', start);
|
|
125
125
|
}
|
|
126
126
|
const rbrace = expect(this.state, TOKEN_TYPES.RBRACE, 'Expected }');
|