@rcrsr/rill 0.6.2 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- 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 +19 -20
- package/dist/generated/introspection-data.js.map +1 -1
- package/dist/generated/version-data.d.ts +1 -1
- package/dist/generated/version-data.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexer/index.d.ts +1 -1
- package/dist/lexer/index.d.ts.map +1 -1
- package/dist/lexer/index.js.map +1 -1
- package/dist/lexer/tokenizer.d.ts +4 -1
- package/dist/lexer/tokenizer.d.ts.map +1 -1
- package/dist/lexer/tokenizer.js +21 -7
- package/dist/lexer/tokenizer.js.map +1 -1
- package/dist/parser/helpers.d.ts.map +1 -1
- package/dist/parser/helpers.js +16 -18
- package/dist/parser/helpers.js.map +1 -1
- package/dist/parser/parser-control.d.ts.map +1 -1
- package/dist/parser/parser-control.js +5 -2
- package/dist/parser/parser-control.js.map +1 -1
- package/dist/parser/parser-expr.d.ts.map +1 -1
- package/dist/parser/parser-expr.js +15 -5
- package/dist/parser/parser-expr.js.map +1 -1
- package/dist/parser/state.d.ts +6 -0
- package/dist/parser/state.d.ts.map +1 -1
- package/dist/parser/state.js +24 -0
- package/dist/parser/state.js.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/closures.js +8 -1
- package/dist/runtime/core/eval/mixins/closures.js.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.d.ts.map +1 -1
- package/dist/runtime/core/eval/mixins/variables.js +2 -9
- package/dist/runtime/core/eval/mixins/variables.js.map +1 -1
- package/dist/runtime/ext/builtins.d.ts.map +1 -1
- package/dist/runtime/ext/builtins.js +0 -72
- package/dist/runtime/ext/builtins.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/types.js +3 -3
- package/dist/types.js.map +1 -1
- package/package.json +12 -6
- package/dist/runtime/ext/content-parser.d.ts +0 -83
- package/dist/runtime/ext/content-parser.d.ts.map +0 -1
- package/dist/runtime/ext/content-parser.js +0 -536
- package/dist/runtime/ext/content-parser.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# @rcrsr/rill
|
|
2
2
|
|
|
3
|
-
Embeddable runtime for
|
|
3
|
+
Embeddable, sandboxed scripting runtime for [rill](https://rill.run). Zero dependencies. Browser and Node.js compatible.
|
|
4
4
|
|
|
5
|
-
> **Experimental.** Breaking changes will occur
|
|
5
|
+
> **Experimental.** Breaking changes will occur before stabilization.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const LANGUAGE_REFERENCE = "RILL LANGUAGE REFERENCE\n=======================\n\nRill is designed to be generated by LLMs and understood by humans. The focus is\non auditable LLM output, not ergonomic human authoring.\n\nESSENTIALS\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 # ERROR\n5. Loops cannot modify outer vars: use fold, each(init), or $ as state dict\n\nSTRENGTHS AND USE CASES\n-----------------------\nStrengths:\n - Unambiguous syntax: $ prefix, explicit operators, no implicit coercion\n - Single-pass parseable: LLMs generate correct code without symbol tables\n - Readable by humans: pipe chains show data flow left-to-right\n - Safe defaults: immutable values, type locking, no null/undefined\n\nUse cases:\n - Workflow orchestration: chain LLM calls, API requests, transformations\n - State machines: (cond) @ { } loops with $ as state dict\n - Data pipelines: each/map/filter/fold process collections declaratively\n - Prompt engineering: parse LLM output with parse_json, parse_xml, parse_fence\n\nState machine pattern ($ carries state through iterations):\n [state: \"init\", data: $input]\n -> ($.state != \"done\") @ {\n $.state -> [\n init: { [state: \"process\", data: transform($.data)] },\n process: { [state: \"done\", data: finalize($.data)] }\n ]\n }\n\nNAMING CONVENTION: snake_case\n-----------------------------\nUse snake_case for all identifiers:\n $user_name, $item_list, $is_valid # variables\n $double_value, $cleanup_text # closures\n [first_name: \"x\", last_name: \"y\"] # dict keys\n\nWHY VARIABLES USE $ PREFIX\n--------------------------\nThe $ prefix enables single-pass parsing without a symbol table:\n\n name() -> 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 host function or stored\nclosure? Is data a variable or key? This would require tracking all declarations.\n\nSPACING RULES\n-------------\nOperators: space both sides 5 + 3, $x -> .upper, \"a\" => $b\nParentheses: no inner space ($x + 1), ($ > 3) ? \"yes\"\nBraces: space inside { $x + 1 }, each { $ * 2 }\nBrackets: no inner space $list[0], $dict.items[1]\nLiterals: space after , and : [1, 2, 3], [name: \"x\", age: 30]\nClosures: space after params |x| ($x * 2), |a, b| { $a + $b }\nMethods: no space before . or ( $str.upper(), $list.join(\", \")\nPipes: space both sides \"x\" -> .upper -> .len\nContinuations: indent 2 spaces $data\n -> .filter { $.active }\n -> map { $.name }\n\nIMPLICIT $ SHORTHAND (always prefer)\n------------------------------------\n$.method() -> .method \"x\" -> .upper (not $.upper())\nfunc($) -> func \"x\" -> log (not log($))\n$fn($) -> $fn 5 -> $double (not $double($))\n\nDon't capture just to continue - use line continuation instead:\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\nCRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES\n----------------------------------------------\n\n1. NO ASSIGNMENT OPERATOR\n Wrong: x = 5 Mainstream: x = value\n Right: 5 => $x Rill: value => $x\n\n Pipe (->): passes value to next operation\n Capture (=>): stores value AND continues chain\n Example: \"hello\" => $x -> .upper => $y # $x=\"hello\", $y=\"HELLO\"\n\n2. NO NULL/UNDEFINED\n Empty values (\"\", [], [:]) exist. \"No value\" cannot be represented.\n Use ?? for defaults: $dict.field ?? \"default\"\n Use .empty to check: $str -> .empty ? \"was empty\"\n Mainstream: null/undefined Rill: ?? default, .? existence check\n\n3. NO TRUTHINESS\n Conditions MUST be boolean. No implicit coercion.\n Wrong: \"\" ? \"yes\" ! \"no\" Right: \"\" -> .empty ? \"yes\" ! \"no\"\n Wrong: 0 ? \"yes\" ! \"no\" Right: (0 == 0) ? \"yes\" ! \"no\"\n Negation (!) also requires boolean:\n Right: !true # false\n Right: \"hello\" -> .empty -> (!$) # true (negates boolean from .empty)\n Wrong: !\"hello\" # ERROR: Negation requires boolean\n Mainstream: if \"\" / if 0 Rill: .empty, == 0, :?type\n\n4. VARIABLES LOCK TO FIRST TYPE\n \"hello\" => $x\n 42 => $x # ERROR: cannot assign number to string variable\n\n5. NO VARIABLE SHADOWING (CRITICAL FOR LOOPS)\n Child scopes can READ parent variables but cannot WRITE or redeclare them.\n Variables created inside blocks/loops do NOT leak out.\n\n WRONG - outer variable modification (NEVER works):\n 0 => $count\n [1, 2, 3] -> each { $count + 1 => $count } # creates LOCAL $count\n $count # still 0!\n\n WRONG - \"while\" keyword does not exist:\n while ($i < 10) { $i + 1 => $i } # SYNTAX ERROR\n\n RIGHT - use fold for reduction:\n [1, 2, 3] -> fold(0) { $@ + $ } # 6 ($@ is accumulator)\n\n RIGHT - use each(init) for results AND accumulator:\n [1, 2, 3] -> each(0) { $@ + $ } # [1, 3, 6] (running totals)\n\n RIGHT - use (cond) @ { } with $ as state dict for multiple values:\n [iter: 0, max: 3, text: $input, done: false]\n -> (!$.done && $.iter < $.max) @ {\n $.iter + 1 => $i\n process($.text) => $result\n $result.finished ? [iter: $i, max: $.max, text: $.text, done: true]\n ! [iter: $i, max: $.max, text: $result.text, done: false]\n }\n\n Pattern summary:\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 Mainstream: count += 1 in loop Rill: fold(0) { $@ + 1 } or $ accumulator\n\n6. NO EXCEPTIONS\n Errors halt execution. No try/catch. Use conditionals for error handling.\n Built-in: assert (validate condition), error (halt with message).\n Mainstream: try { } catch { } Rill: assert, conditionals, error\n\n7. VALUE SEMANTICS (no references)\n All copies are deep. All comparisons are by value. No object identity.\n [1, 2, 3] == [1, 2, 3] # true (content equality)\n [1, 2] => $a\n $a => $b # $b is an independent deep copy\n Mainstream: a === b (reference) Rill: == always compares by value\n Mainstream: a = b (shared ref) Rill: => always deep-copies\n\nSYNTAX QUICK REFERENCE\n----------------------\n\nVariables: $name (always prefixed with $)\nStrings: \"hello {$var}\" # interpolation with {}\n \"\"\"...\"\"\" # multiline (also interpolates)\nNumbers: 42, 3.14, -7\nBooleans: true, false\nLists: [1, 2, 3]\n [...$list, 4] # spread: inline list elements\nDicts: [name: \"alice\", age: 30] # identifier keys\n [1: \"one\", 2: \"two\"] # number keys (incl. negative: [-1: \"neg\"])\n [true: \"yes\", false: \"no\"] # boolean keys\n [[\"a\", \"b\"]: 1] # multi-key: [a: 1, b: 1]\n [$keyVar: value] # variable key (must eval to string)\n [($expr): value] # computed key (must eval to string)\nTuples: *[1, 2, 3] # for argument unpacking\nClosures: |x|($x + 1) # like lambda/arrow functions\nType annot: \"hi\" => $x:string # lock type on capture\nComments: # single line only\n\nPIPES AND $ BINDING\n-------------------\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 - use parameters |\n\nImplied $: bare .method() means $ -> .method()\nExample: \"hello\" -> .upper # same as \"hello\" -> $.upper()\n\nCONTROL FLOW\n------------\n\nConditional (if-else):\n cond ? then_expr ! else_expr\n cond ? then_expr # else returns \"\"\n\nPiped conditional ($ becomes condition):\n value -> ? then_expr ! else_expr\n\nCondition loop (NO \"while\" keyword - use @ operator):\n init_value -> ($ < 10) @ { $ + 1 } # $ is accumulator\n\nDo-condition loop (body runs at least once):\n init_value -> @ { $ + 1 } ? ($ < 10)\n\nBreak (exits loop, returns collected results before break):\n [1,2,3,4,5] -> each { ($ == 3) ? break; $ } # returns [1, 2]\n\nReturn (exits block or script with value):\n { 5 => $x; ($x > 3) ? (\"big\" -> return); \"small\" } # returns \"big\"\n \"done\" -> return # exits script with \"done\"\n\nAssert (validate condition, halt if false, pass through if true):\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 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 cond ? pass ! \"fallback\" # preserve $ when condition true\n cond ? \"value\" ! pass # preserve $ when condition false\n \"data\" -> { [status: pass] } # include $ in dict: [status: \"data\"]\n [1, -2, 3] -> map { ($ > 0) ? pass ! 0 } # [1, 0, 3]\n Note: pass requires pipe context. Using pass without $ throws error.\n\nCOLLECTION OPERATORS\n--------------------\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 [\"a\", \"b\"] -> map .upper # [\"A\", \"B\"]\n [\"\", \"x\"] -> filter (!.empty) # [\"x\"]\n [\"a\", \"b\"] -> map .pad_start(3, \"0\") # [\"00a\", \"00b\"] (with args)\n [\" HI \"] -> map .trim.lower # [\"hi\"] (chained methods)\n\nBody forms (all operators accept these):\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 # host function\n\nDict iteration ($ contains key and value fields):\n [a: 1, b: 2] -> each { \"{$.key}={$.value}\" } # [\"a=1\", \"b=2\"]\n [a: 1, b: 5] -> filter { $.value > 2 } # entries where value > 2\n\nString iteration (iterates over characters):\n \"abc\" -> each { \"{$}!\" } # [\"a!\", \"b!\", \"c!\"]\n \"hello\" -> filter { $ != \"l\" } # [\"h\", \"e\", \"o\"]\n\nCLOSURES\n--------\n\nBLOCK-CLOSURES vs EXPLICIT CLOSURES:\n\nTwo ways to create closures:\n\n1. Block-closures: { body } in expression position\n { $ + 1 } => $inc # implicit $ parameter\n $inc(5) # 6\n 5 -> $inc # 6 (pipe invocation)\n [x: { $ * 2 }] # dict value is closure\n type({ \"hi\" }) # \"closure\"\n\n2. Explicit closures: |params| body\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\nCRITICAL: { } vs ( ) distinction\n\n| Syntax | Semantics | Example |\n|--------------|------------------------|----------------------------|\n| { body } | Deferred (closure) | { $ + 1 } => $fn # closure |\n| ( expr ) | Eager (immediate eval) | ( 5 + 1 ) => $x # 6 |\n\nWhen to use:\n { body } => $fn # store closure for later use\n ( expr ) => $x # store result value immediately\n\nPIPE TARGET: { } creates closure then immediately invokes it:\n 5 -> { $ + 1 } # 6 (create closure, invoke with 5)\n 5 -> ($ + 1) # 6 (evaluate expression with $=5)\n Same observable result, different mechanism. Error messages differ.\n\nBlock-closure invocation:\n { $ + 1 } => $inc\n $inc(5) # direct call: 6\n 5 -> $inc # pipe call: 6\n [1,2,3] -> map $inc # in collection op\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 [count: 3, double: ||{ $.count * 2 }] => $obj\n $obj.double # 6 ($ is bound to dict)\n\nPROPERTY ACCESS\n---------------\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\nDISPATCH OPERATORS\n------------------\n\nDICT DISPATCH (single key):\nPipe a value to a dict to match keys and return associated values:\n $val -> [apple: \"fruit\", carrot: \"veg\"] # returns \"fruit\" if $val is \"apple\"\n $val -> [apple: \"fruit\"] ?? \"not found\" # default if no match\n $method -> [[\"GET\", \"HEAD\"]: \"safe\", [\"POST\", \"PUT\"]: \"unsafe\"] # multi-key dispatch\n\nType-aware matching (keys matched by value AND type):\n 1 -> [1: \"number\", \"1\": \"string\"] # \"number\" (number key matches)\n \"1\" -> [1: \"number\", \"1\": \"string\"] # \"string\" (string key matches)\n true -> [true: \"bool\", \"true\": \"str\"] # \"bool\" (boolean key matches)\n\nLIST DISPATCH (index):\nPipe a number to a list to get element at index:\n 0 -> [\"first\", \"second\"] # \"first\"\n -1 -> [\"first\", \"second\"] # \"second\" (last)\n 5 -> [\"a\", \"b\"] ?? \"not found\" # default if out of bounds\n\nHIERARCHICAL DISPATCH (path navigation):\nPipe a list of keys/indexes to navigate nested structures:\n [\"name\", \"first\"] -> [name: [first: \"Alice\"]] # \"Alice\" (dict path)\n [0, 1] -> [[1, 2, 3], [4, 5, 6]] # 2 (list path)\n [\"users\", 0, \"name\"] -> [users: [[name: \"Alice\"]]] # \"Alice\" (mixed)\n [] -> [a: 1] # [a: 1] (empty path = unchanged)\n [\"a\", \"missing\"] -> [a: [x: 1]] ?? \"default\" # \"default\" (missing key)\n\nTYPE OPERATIONS\n---------------\n\n:type - assert type (error if wrong): 42:number passes; \"x\":number errors\n:?type - check type (boolean): 42:?number is true; \"x\":?number is false\n\nTypes: string, number, boolean, list, dict, tuple, closure\n\nComparison methods (for readable conditionals):\n .eq(val) == .ne(val) != .lt(val) < .gt(val) > .le(val) <= .ge(val) >=\n Example: $age -> .ge(18) ? \"adult\" ! \"minor\"\n\nOPERATOR PRECEDENCE (highest to lowest)\n---------------------------------------\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\nEXTRACTION OPERATORS\n--------------------\n\nDestructure (*<>):\n [1, 2, 3] -> *<$a, $b, $c> # $a=1, $b=2, $c=3\n [x: 1, y: 2] -> *<x: $a, y: $b> # $a=1, $b=2\n [1, 2, 3] -> *<$first, _, $third> # _ skips element\n\nSlice (/<start:stop:step>):\n [0,1,2,3,4] -> /<1:3> # [1, 2]\n [0,1,2,3,4] -> /<-2:> # [3, 4]\n [0,1,2,3,4] -> /<::-1> # [4,3,2,1,0] (reverse)\n \"hello\" -> /<1:4> # \"ell\"\n\nLIST SPREAD IN LITERALS\n-----------------------\n\nInline list elements into a new list using ... (spread operator):\n [1, 2] => $a\n [...$a, 3] # [1, 2, 3]\n [...$a, ...$b] # concatenate lists\n [...($nums -> map {$ * 2})] # spread expression result\n\nMULTI-KEY DICT LITERALS\n-----------------------\n\nMap multiple keys to the same value using list syntax:\n [[\"a\", \"b\"]: 1] # [a: 1, b: 1]\n [[1, \"1\"]: \"x\"] # [1: \"x\", \"1\": \"x\"] (mixed types)\n [a: 0, [\"b\", \"c\"]: 1] # [a: 0, b: 1, c: 1] (mixed entries)\n\nTUPLES FOR ARGUMENT UNPACKING\n-----------------------------\n\n*[1, 2, 3] -> $fn() # positional: $fn(1, 2, 3)\n*[b: 2, a: 1] -> $fn() # named: $fn(a=1, b=2)\n*[...$list, 3] -> $fn() # spread in tuple: combines elements\n\nCLOSURE CHAIN (@)\n-----------------\n\nChains closures sequentially (each receives previous result):\n 5 -> @[$inc, $double, $add10] # (5+1)*2+10 = 22\n\nSTRING METHODS\n--------------\n\n.len length .empty is empty string\n.trim remove whitespace .upper uppercase\n.lower lowercase .str convert to string\n.num parse to number .head first character\n.tail last character .at(i) character at index\n.split(sep) split into list (default: newline)\n.lines split on newlines .join(sep) join list with separator\n.contains(s) substring check .starts_with(s) prefix check\n.ends_with(s) suffix check .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: \"ab\" -> .repeat(3) # \"ababab\"\n.pad_start(n,f) pad start: \"42\" -> .pad_start(5, \"0\") # \"00042\"\n.pad_end(n,f) pad end: \"42\" -> .pad_end(5, \"0\") # \"42000\"\n\nLIST/DICT METHODS\n-----------------\n\n.len length .empty is empty\n.head first element .tail last element\n.at(i) element at index .keys dict keys as list\n.values dict values as list .entries dict as list of [k, v] tuples\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\nPARSING FUNCTIONS (for LLM output)\n----------------------------------\n\nparse_auto(str) auto-detect format\nparse_json(str) parse JSON (repairs common errors)\nparse_xml(str, tag?) extract XML tag content\nparse_fence(str, lang?) extract fenced code block\nparse_fences(str) all fenced blocks as list\nparse_frontmatter(str) parse --- delimited YAML + body\nparse_checklist(str) parse markdown task lists\n\nGLOBAL FUNCTIONS\n----------------\n\ntype(val) returns type name (string, number, boolean, list, dict, closure, tuple)\nlog(val) print and pass through\njson(val) convert to JSON string\nidentity(val) returns input unchanged\nrange(start, end, step?) number sequence (iterator)\nrepeat(val, count) repeat value n times (iterator)\nenumerate(coll) lists: [index, value]; dicts: [index, key, value]\n\nITERATORS\n---------\n\nLazy sequence generation. Collection operators auto-expand iterators.\n\nBuilt-in iterators:\n range(0, 5) -> each { $ * 2 } # [0, 2, 4, 6, 8]\n repeat(\"x\", 3) -> each { $ } # [\"x\", \"x\", \"x\"]\n\n.first() method (returns iterator for any collection):\n [1, 2, 3] -> .first() # iterator at 1\n \"abc\" -> .first() # iterator at \"a\"\n\nIterator protocol (dict with value, done, next):\n $it.done # bool: is exhausted?\n $it.value # current element\n $it.next() # returns new iterator at next position\n\nITERATION LIMITS\n----------------\n\nDefault: 10,000 iterations max for loops.\nOverride: ^(limit: N) statement\n\n ^(limit: 100) 0 -> ($ < 50) @ { $ + 1 }\n ^(limit: 3) $items -> map { slow_process($) } # concurrency limit\n\nSCRIPT RETURN VALUES\n--------------------\n\ntrue / non-empty string -> exit code 0\nfalse / empty string -> exit code 1\n[0, \"message\"] -> exit code 0 with message\n[1, \"message\"] -> exit code 1 with message\n";
|
|
1
|
+
export declare const LANGUAGE_REFERENCE = "RILL LANGUAGE REFERENCE\n=======================\n\nrill is designed to be generated by LLMs and understood by humans. The focus is\non auditable LLM output, not ergonomic human authoring.\n\nESSENTIALS\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 # ERROR\n5. Loops cannot modify outer vars: use fold, each(init), or $ as state dict\n\nSTRENGTHS AND USE CASES\n-----------------------\nStrengths:\n - Unambiguous syntax: $ prefix, explicit operators, no implicit coercion\n - Single-pass parseable: LLMs generate correct code without symbol tables\n - Readable by humans: pipe chains show data flow left-to-right\n - Safe defaults: immutable values, type locking, no null/undefined\n\nUse cases:\n - Workflow orchestration: chain LLM calls, API requests, transformations\n - State machines: (cond) @ { } loops with $ as state dict\n - Data pipelines: each/map/filter/fold process collections declaratively\n\nState machine pattern ($ carries state through iterations):\n [state: \"init\", data: $input]\n -> ($.state != \"done\") @ {\n $.state -> [\n init: { [state: \"process\", data: transform($.data)] },\n process: { [state: \"done\", data: finalize($.data)] }\n ]\n }\n\nNAMING CONVENTION: snake_case\n-----------------------------\nUse snake_case for all identifiers:\n $user_name, $item_list, $is_valid # variables\n $double_value, $cleanup_text # closures\n [first_name: \"x\", last_name: \"y\"] # dict keys\n\nWHY VARIABLES USE $ PREFIX\n--------------------------\nThe $ prefix enables single-pass parsing without a symbol table:\n\n name() -> 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 host function or stored\nclosure? Is data a variable or key? This would require tracking all declarations.\n\nSPACING RULES\n-------------\nOperators: space both sides 5 + 3, $x -> .upper, \"a\" => $b\nParentheses: no inner space ($x + 1), ($ > 3) ? \"yes\"\nBraces: space inside { $x + 1 }, each { $ * 2 }\nBrackets: no inner space $list[0], $dict.items[1]\nLiterals: space after , and : [1, 2, 3], [name: \"x\", age: 30]\nClosures: space after params |x| ($x * 2), |a, b| { $a + $b }\nMethods: no space before . or ( $str.upper(), $list.join(\", \")\nPipes: space both sides \"x\" -> .upper -> .len\nContinuations: indent 2 spaces $data\n -> .filter { $.active }\n -> map { $.name }\n\nIMPLICIT $ SHORTHAND (always prefer)\n------------------------------------\n$.method() -> .method \"x\" -> .upper (not $.upper())\nfunc($) -> func \"x\" -> log (not log($))\n$fn($) -> $fn 5 -> $double (not $double($))\n\nDon't capture just to continue - use line continuation instead:\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\nCRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES\n----------------------------------------------\n\n1. NO ASSIGNMENT OPERATOR\n Wrong: x = 5 Mainstream: x = value\n Right: 5 => $x rill: value => $x\n\n Pipe (->): passes value to next operation\n Capture (=>): stores value AND continues chain\n Example: \"hello\" => $x -> .upper => $y # $x=\"hello\", $y=\"HELLO\"\n\n2. NO NULL/UNDEFINED\n Empty values (\"\", [], [:]) exist. \"No value\" cannot be represented.\n Use ?? for defaults: $dict.field ?? \"default\"\n Use .empty to check: $str -> .empty ? \"was empty\"\n Mainstream: null/undefined rill: ?? default, .? existence check\n\n3. NO TRUTHINESS\n Conditions MUST be boolean. No implicit coercion.\n Wrong: \"\" ? \"yes\" ! \"no\" Right: \"\" -> .empty ? \"yes\" ! \"no\"\n Wrong: 0 ? \"yes\" ! \"no\" Right: (0 == 0) ? \"yes\" ! \"no\"\n Negation (!) also requires boolean:\n Right: !true # false\n Right: \"hello\" -> .empty -> (!$) # true (negates boolean from .empty)\n Wrong: !\"hello\" # ERROR: Negation requires boolean\n Mainstream: if \"\" / if 0 rill: .empty, == 0, :?type\n\n4. VARIABLES LOCK TO FIRST TYPE\n \"hello\" => $x\n 42 => $x # ERROR: cannot assign number to string variable\n\n5. NO VARIABLE SHADOWING (CRITICAL FOR LOOPS)\n Child scopes can READ parent variables but cannot WRITE or redeclare them.\n Variables created inside blocks/loops do NOT leak out.\n\n WRONG - outer variable modification (NEVER works):\n 0 => $count\n [1, 2, 3] -> each { $count + 1 => $count } # creates LOCAL $count\n $count # still 0!\n\n WRONG - \"while\" keyword does not exist:\n while ($i < 10) { $i + 1 => $i } # SYNTAX ERROR\n\n RIGHT - use fold for reduction:\n [1, 2, 3] -> fold(0) { $@ + $ } # 6 ($@ is accumulator)\n\n RIGHT - use each(init) for results AND accumulator:\n [1, 2, 3] -> each(0) { $@ + $ } # [1, 3, 6] (running totals)\n\n RIGHT - use (cond) @ { } with $ as state dict for multiple values:\n [iter: 0, max: 3, text: $input, done: false]\n -> (!$.done && $.iter < $.max) @ {\n $.iter + 1 => $i\n process($.text) => $result\n $result.finished ? [iter: $i, max: $.max, text: $.text, done: true]\n ! [iter: $i, max: $.max, text: $result.text, done: false]\n }\n\n Pattern summary:\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 Mainstream: count += 1 in loop rill: fold(0) { $@ + 1 } or $ accumulator\n\n6. NO EXCEPTIONS\n Errors halt execution. No try/catch. Use conditionals for error handling.\n Built-in: assert (validate condition), error (halt with message).\n Mainstream: try { } catch { } rill: assert, conditionals, error\n\n7. VALUE SEMANTICS (no references)\n All copies are deep. All comparisons are by value. No object identity.\n [1, 2, 3] == [1, 2, 3] # true (content equality)\n [1, 2] => $a\n $a => $b # $b is an independent deep copy\n Mainstream: a === b (reference) rill: == always compares by value\n Mainstream: a = b (shared ref) rill: => always deep-copies\n\nSYNTAX QUICK REFERENCE\n----------------------\n\nVariables: $name (always prefixed with $)\nStrings: \"hello {$var}\" # interpolation with {}\n \"\"\"...\"\"\" # multiline (also interpolates)\nNumbers: 42, 3.14, -7\nBooleans: true, false\nLists: [1, 2, 3]\n [...$list, 4] # spread: inline list elements\nDicts: [name: \"alice\", age: 30] # identifier keys\n [1: \"one\", 2: \"two\"] # number keys (incl. negative: [-1: \"neg\"])\n [true: \"yes\", false: \"no\"] # boolean keys\n [[\"a\", \"b\"]: 1] # multi-key: [a: 1, b: 1]\n [$keyVar: value] # variable key (must eval to string)\n [($expr): value] # computed key (must eval to string)\nTuples: *[1, 2, 3] # for argument unpacking\nClosures: |x|($x + 1) # like lambda/arrow functions\nType annot: \"hi\" => $x:string # lock type on capture\nComments: # single line only\n\nPIPES AND $ BINDING\n-------------------\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 - use parameters |\n\nImplied $: bare .method() means $ -> .method()\nExample: \"hello\" -> .upper # same as \"hello\" -> $.upper()\n\nCONTROL FLOW\n------------\n\nConditional (if-else):\n cond ? then_expr ! else_expr\n cond ? then_expr # else returns \"\"\n\nPiped conditional ($ becomes condition):\n value -> ? then_expr ! else_expr\n\nMulti-line conditionals (? and ! work as line continuations):\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 - use @ operator):\n init_value -> ($ < 10) @ { $ + 1 } # $ is accumulator\n\nDo-condition loop (body runs at least once):\n init_value -> @ { $ + 1 } ? ($ < 10)\n\nBreak (exits loop, returns collected results before break):\n [1,2,3,4,5] -> each { ($ == 3) ? break; $ } # returns [1, 2]\n\nReturn (exits block or script with value):\n { 5 => $x; ($x > 3) ? (\"big\" -> return); \"small\" } # returns \"big\"\n \"done\" -> return # exits script with \"done\"\n\nAssert (validate condition, halt if false, pass through if true):\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 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 cond ? pass ! \"fallback\" # preserve $ when condition true\n cond ? \"value\" ! pass # preserve $ when condition false\n \"data\" -> { [status: pass] } # include $ in dict: [status: \"data\"]\n [1, -2, 3] -> map { ($ > 0) ? pass ! 0 } # [1, 0, 3]\n Note: pass requires pipe context. Using pass without $ throws error.\n\nCOLLECTION OPERATORS\n--------------------\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 [\"a\", \"b\"] -> map .upper # [\"A\", \"B\"]\n [\"\", \"x\"] -> filter (!.empty) # [\"x\"]\n [\"a\", \"b\"] -> map .pad_start(3, \"0\") # [\"00a\", \"00b\"] (with args)\n [\" HI \"] -> map .trim.lower # [\"hi\"] (chained methods)\n\nBody forms (all operators accept these):\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 # host function\n\nDict iteration ($ contains key and value fields):\n [a: 1, b: 2] -> each { \"{$.key}={$.value}\" } # [\"a=1\", \"b=2\"]\n [a: 1, b: 5] -> filter { $.value > 2 } # entries where value > 2\n\nString iteration (iterates over characters):\n \"abc\" -> each { \"{$}!\" } # [\"a!\", \"b!\", \"c!\"]\n \"hello\" -> filter { $ != \"l\" } # [\"h\", \"e\", \"o\"]\n\nCLOSURES\n--------\n\nBLOCK-CLOSURES vs EXPLICIT CLOSURES:\n\nTwo ways to create closures:\n\n1. Block-closures: { body } in expression position\n { $ + 1 } => $inc # implicit $ parameter\n $inc(5) # 6\n 5 -> $inc # 6 (pipe invocation)\n [x: { $ * 2 }] # dict value is closure\n type({ \"hi\" }) # \"closure\"\n\n2. Explicit closures: |params| body\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\nCRITICAL: { } vs ( ) distinction\n\n| Syntax | Semantics | Example |\n|--------------|------------------------|----------------------------|\n| { body } | Deferred (closure) | { $ + 1 } => $fn # closure |\n| ( expr ) | Eager (immediate eval) | ( 5 + 1 ) => $x # 6 |\n\nWhen to use:\n { body } => $fn # store closure for later use\n ( expr ) => $x # store result value immediately\n\nPIPE TARGET: { } creates closure then immediately invokes it:\n 5 -> { $ + 1 } # 6 (create closure, invoke with 5)\n 5 -> ($ + 1) # 6 (evaluate expression with $=5)\n Same observable result, different mechanism. Error messages differ.\n\nBlock-closure invocation:\n { $ + 1 } => $inc\n $inc(5) # direct call: 6\n 5 -> $inc # pipe call: 6\n [1,2,3] -> map $inc # in collection op\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 [count: 3, double: ||{ $.count * 2 }] => $obj\n $obj.double # 6 ($ is bound to dict)\n\nPROPERTY ACCESS\n---------------\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\nDISPATCH OPERATORS\n------------------\n\nDICT DISPATCH (single key):\nPipe a value to a dict to match keys and return associated values:\n $val -> [apple: \"fruit\", carrot: \"veg\"] # returns \"fruit\" if $val is \"apple\"\n $val -> [apple: \"fruit\"] ?? \"not found\" # default if no match\n $method -> [[\"GET\", \"HEAD\"]: \"safe\", [\"POST\", \"PUT\"]: \"unsafe\"] # multi-key dispatch\n\nType-aware matching (keys matched by value AND type):\n 1 -> [1: \"number\", \"1\": \"string\"] # \"number\" (number key matches)\n \"1\" -> [1: \"number\", \"1\": \"string\"] # \"string\" (string key matches)\n true -> [true: \"bool\", \"true\": \"str\"] # \"bool\" (boolean key matches)\n\nLIST DISPATCH (index):\nPipe a number to a list to get element at index:\n 0 -> [\"first\", \"second\"] # \"first\"\n -1 -> [\"first\", \"second\"] # \"second\" (last)\n 5 -> [\"a\", \"b\"] ?? \"not found\" # default if out of bounds\n\nHIERARCHICAL DISPATCH (path navigation):\nPipe a list of keys/indexes to navigate nested structures:\n [\"name\", \"first\"] -> [name: [first: \"Alice\"]] # \"Alice\" (dict path)\n [0, 1] -> [[1, 2, 3], [4, 5, 6]] # 2 (list path)\n [\"users\", 0, \"name\"] -> [users: [[name: \"Alice\"]]] # \"Alice\" (mixed)\n [] -> [a: 1] # [a: 1] (empty path = unchanged)\n [\"a\", \"missing\"] -> [a: [x: 1]] ?? \"default\" # \"default\" (missing key)\n\nTYPE OPERATIONS\n---------------\n\n:type - assert type (error if wrong): 42:number passes; \"x\":number errors\n:?type - check type (boolean): 42:?number is true; \"x\":?number is false\n\nTypes: string, number, boolean, list, dict, tuple, closure\n\nComparison methods (for readable conditionals):\n .eq(val) == .ne(val) != .lt(val) < .gt(val) > .le(val) <= .ge(val) >=\n Example: $age -> .ge(18) ? \"adult\" ! \"minor\"\n\nOPERATOR PRECEDENCE (highest to lowest)\n---------------------------------------\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\nEXTRACTION OPERATORS\n--------------------\n\nDestructure (*<>):\n [1, 2, 3] -> *<$a, $b, $c> # $a=1, $b=2, $c=3\n [x: 1, y: 2] -> *<x: $a, y: $b> # $a=1, $b=2\n [1, 2, 3] -> *<$first, _, $third> # _ skips element\n\nSlice (/<start:stop:step>):\n [0,1,2,3,4] -> /<1:3> # [1, 2]\n [0,1,2,3,4] -> /<-2:> # [3, 4]\n [0,1,2,3,4] -> /<::-1> # [4,3,2,1,0] (reverse)\n \"hello\" -> /<1:4> # \"ell\"\n\nLIST SPREAD IN LITERALS\n-----------------------\n\nInline list elements into a new list using ... (spread operator):\n [1, 2] => $a\n [...$a, 3] # [1, 2, 3]\n [...$a, ...$b] # concatenate lists\n [...($nums -> map {$ * 2})] # spread expression result\n\nMULTI-KEY DICT LITERALS\n-----------------------\n\nMap multiple keys to the same value using list syntax:\n [[\"a\", \"b\"]: 1] # [a: 1, b: 1]\n [[1, \"1\"]: \"x\"] # [1: \"x\", \"1\": \"x\"] (mixed types)\n [a: 0, [\"b\", \"c\"]: 1] # [a: 0, b: 1, c: 1] (mixed entries)\n\nTUPLES FOR ARGUMENT UNPACKING\n-----------------------------\n\n*[1, 2, 3] -> $fn() # positional: $fn(1, 2, 3)\n*[b: 2, a: 1] -> $fn() # named: $fn(a=1, b=2)\n*[...$list, 3] -> $fn() # spread in tuple: combines elements\n\nCLOSURE CHAIN (@)\n-----------------\n\nChains closures sequentially (each receives previous result):\n 5 -> @[$inc, $double, $add10] # (5+1)*2+10 = 22\n\nSTRING METHODS\n--------------\n\n.len length .empty is empty string\n.trim remove whitespace .upper uppercase\n.lower lowercase .str convert to string\n.num parse to number .head first character\n.tail last character .at(i) character at index\n.split(sep) split into list (default: newline)\n.lines split on newlines .join(sep) join list with separator\n.contains(s) substring check .starts_with(s) prefix check\n.ends_with(s) suffix check .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: \"ab\" -> .repeat(3) # \"ababab\"\n.pad_start(n,f) pad start: \"42\" -> .pad_start(5, \"0\") # \"00042\"\n.pad_end(n,f) pad end: \"42\" -> .pad_end(5, \"0\") # \"42000\"\n\nLIST/DICT METHODS\n-----------------\n\n.len length .empty is empty\n.head first element .tail last element\n.at(i) element at index .keys dict keys as list\n.values dict values as list .entries dict as list of [k, v] tuples\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\nGLOBAL FUNCTIONS\n----------------\n\ntype(val) returns type name (string, number, boolean, list, dict, closure, tuple)\nlog(val) print and pass through\njson(val) convert to JSON string\nidentity(val) returns input unchanged\nrange(start, end, step?) number sequence (iterator)\nrepeat(val, count) repeat value n times (iterator)\nenumerate(coll) lists: [index, value]; dicts: [index, key, value]\n\nITERATORS\n---------\n\nLazy sequence generation. Collection operators auto-expand iterators.\n\nBuilt-in iterators:\n range(0, 5) -> each { $ * 2 } # [0, 2, 4, 6, 8]\n repeat(\"x\", 3) -> each { $ } # [\"x\", \"x\", \"x\"]\n\n.first() method (returns iterator for any collection):\n [1, 2, 3] -> .first() # iterator at 1\n \"abc\" -> .first() # iterator at \"a\"\n\nIterator protocol (dict with value, done, next):\n $it.done # bool: is exhausted?\n $it.value # current element\n $it.next() # returns new iterator at next position\n\nITERATION LIMITS\n----------------\n\nDefault: 10,000 iterations max for loops.\nOverride: ^(limit: N) statement\n\n ^(limit: 100) 0 -> ($ < 50) @ { $ + 1 }\n ^(limit: 3) $items -> map { slow_process($) } # concurrency limit\n\nSCRIPT RETURN VALUES\n--------------------\n\ntrue / non-empty string -> exit code 0\nfalse / empty string -> exit code 1\n[0, \"message\"] -> exit code 0 with message\n[1, \"message\"] -> exit code 1 with message\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,krsBAshB9B,CAAC"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
export const LANGUAGE_REFERENCE = `RILL LANGUAGE REFERENCE
|
|
4
4
|
=======================
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
rill is designed to be generated by LLMs and understood by humans. The focus is
|
|
7
7
|
on auditable LLM output, not ergonomic human authoring.
|
|
8
8
|
|
|
9
9
|
ESSENTIALS
|
|
@@ -26,7 +26,6 @@ Use cases:
|
|
|
26
26
|
- Workflow orchestration: chain LLM calls, API requests, transformations
|
|
27
27
|
- State machines: (cond) @ { } loops with \$ as state dict
|
|
28
28
|
- Data pipelines: each/map/filter/fold process collections declaratively
|
|
29
|
-
- Prompt engineering: parse LLM output with parse_json, parse_xml, parse_fence
|
|
30
29
|
|
|
31
30
|
State machine pattern (\$ carries state through iterations):
|
|
32
31
|
[state: "init", data: \$input]
|
|
@@ -89,7 +88,7 @@ CRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES
|
|
|
89
88
|
|
|
90
89
|
1. NO ASSIGNMENT OPERATOR
|
|
91
90
|
Wrong: x = 5 Mainstream: x = value
|
|
92
|
-
Right: 5 => \$x
|
|
91
|
+
Right: 5 => \$x rill: value => \$x
|
|
93
92
|
|
|
94
93
|
Pipe (->): passes value to next operation
|
|
95
94
|
Capture (=>): stores value AND continues chain
|
|
@@ -99,7 +98,7 @@ CRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES
|
|
|
99
98
|
Empty values ("", [], [:]) exist. "No value" cannot be represented.
|
|
100
99
|
Use ?? for defaults: \$dict.field ?? "default"
|
|
101
100
|
Use .empty to check: \$str -> .empty ? "was empty"
|
|
102
|
-
Mainstream: null/undefined
|
|
101
|
+
Mainstream: null/undefined rill: ?? default, .? existence check
|
|
103
102
|
|
|
104
103
|
3. NO TRUTHINESS
|
|
105
104
|
Conditions MUST be boolean. No implicit coercion.
|
|
@@ -109,7 +108,7 @@ CRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES
|
|
|
109
108
|
Right: !true # false
|
|
110
109
|
Right: "hello" -> .empty -> (!\$) # true (negates boolean from .empty)
|
|
111
110
|
Wrong: !"hello" # ERROR: Negation requires boolean
|
|
112
|
-
Mainstream: if "" / if 0
|
|
111
|
+
Mainstream: if "" / if 0 rill: .empty, == 0, :?type
|
|
113
112
|
|
|
114
113
|
4. VARIABLES LOCK TO FIRST TYPE
|
|
115
114
|
"hello" => \$x
|
|
@@ -147,20 +146,20 @@ CRITICAL DIFFERENCES FROM MAINSTREAM LANGUAGES
|
|
|
147
146
|
Per-item results + running -> each(init) { ... \$@ ... }
|
|
148
147
|
Multiple state values / while -> (cond) @ { } with \$ as state dict
|
|
149
148
|
"while" and "for" keywords -> DO NOT EXIST
|
|
150
|
-
Mainstream: count += 1 in loop
|
|
149
|
+
Mainstream: count += 1 in loop rill: fold(0) { \$@ + 1 } or \$ accumulator
|
|
151
150
|
|
|
152
151
|
6. NO EXCEPTIONS
|
|
153
152
|
Errors halt execution. No try/catch. Use conditionals for error handling.
|
|
154
153
|
Built-in: assert (validate condition), error (halt with message).
|
|
155
|
-
Mainstream: try { } catch { }
|
|
154
|
+
Mainstream: try { } catch { } rill: assert, conditionals, error
|
|
156
155
|
|
|
157
156
|
7. VALUE SEMANTICS (no references)
|
|
158
157
|
All copies are deep. All comparisons are by value. No object identity.
|
|
159
158
|
[1, 2, 3] == [1, 2, 3] # true (content equality)
|
|
160
159
|
[1, 2] => \$a
|
|
161
160
|
\$a => \$b # \$b is an independent deep copy
|
|
162
|
-
Mainstream: a === b (reference)
|
|
163
|
-
Mainstream: a = b (shared ref)
|
|
161
|
+
Mainstream: a === b (reference) rill: == always compares by value
|
|
162
|
+
Mainstream: a = b (shared ref) rill: => always deep-copies
|
|
164
163
|
|
|
165
164
|
SYNTAX QUICK REFERENCE
|
|
166
165
|
----------------------
|
|
@@ -212,6 +211,17 @@ Conditional (if-else):
|
|
|
212
211
|
Piped conditional (\$ becomes condition):
|
|
213
212
|
value -> ? then_expr ! else_expr
|
|
214
213
|
|
|
214
|
+
Multi-line conditionals (? and ! work as line continuations):
|
|
215
|
+
condition
|
|
216
|
+
? "yes"
|
|
217
|
+
! "no"
|
|
218
|
+
value -> is_valid
|
|
219
|
+
? "ok"
|
|
220
|
+
! "error"
|
|
221
|
+
\$val -> .eq("A") ? "a"
|
|
222
|
+
! .eq("B") ? "b"
|
|
223
|
+
! "c"
|
|
224
|
+
|
|
215
225
|
Condition loop (NO "while" keyword - use @ operator):
|
|
216
226
|
init_value -> (\$ < 10) @ { \$ + 1 } # \$ is accumulator
|
|
217
227
|
|
|
@@ -479,17 +489,6 @@ LIST/DICT METHODS
|
|
|
479
489
|
.has_any(list) list contains any value from candidates
|
|
480
490
|
.has_all(list) list contains all values from candidates
|
|
481
491
|
|
|
482
|
-
PARSING FUNCTIONS (for LLM output)
|
|
483
|
-
----------------------------------
|
|
484
|
-
|
|
485
|
-
parse_auto(str) auto-detect format
|
|
486
|
-
parse_json(str) parse JSON (repairs common errors)
|
|
487
|
-
parse_xml(str, tag?) extract XML tag content
|
|
488
|
-
parse_fence(str, lang?) extract fenced code block
|
|
489
|
-
parse_fences(str) all fenced blocks as list
|
|
490
|
-
parse_frontmatter(str) parse --- delimited YAML + body
|
|
491
|
-
parse_checklist(str) parse markdown task lists
|
|
492
|
-
|
|
493
492
|
GLOBAL FUNCTIONS
|
|
494
493
|
----------------
|
|
495
494
|
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAshBjC,CAAC"}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Version string from package.json
|
|
5
5
|
*/
|
|
6
|
-
export const VERSION = '0.
|
|
6
|
+
export const VERSION = '0.7.1';
|
|
7
7
|
/**
|
|
8
8
|
* Parsed version components
|
|
9
9
|
*/
|
|
10
10
|
export const VERSION_INFO = {
|
|
11
11
|
major: 0,
|
|
12
|
-
minor:
|
|
13
|
-
patch:
|
|
12
|
+
minor: 7,
|
|
13
|
+
patch: 1,
|
|
14
14
|
prerelease: undefined,
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=version-data.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Rill Module
|
|
3
3
|
* Exports lexer, parser, runtime, and AST types
|
|
4
4
|
*/
|
|
5
|
-
export { LexerError, tokenize } from './lexer/index.js';
|
|
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
8
|
export { type ApplicationCallable, BreakSignal, callable, type CallableFn, type CallFrame, type CaptureEvent, createRuntimeContext, createStepper, type DocumentationCoverageResult, emitExtensionEvent, type ErrorEvent, execute, type ExecutionResult, type ExecutionStepper, type ExtensionEvent, type ExtensionFactory, type ExtensionResult, type FunctionMetadata, type HostCallEvent, type HostFunctionDefinition, type HostFunctionParam, type FunctionReturnEvent, getCallStack, getDocumentationCoverage, getFunctions, getLanguageReference, isApplicationCallable, isTuple, isCallable, isDict, isReservedMethod, isRuntimeCallable, isScriptCallable, type ObservabilityCallbacks, type ParamMetadata, popCallFrame, prefixFunctions, pushCallFrame, RESERVED_DICT_METHODS, ReturnSignal, type RillTuple, type RillCallable, type RillFunctionReturnType, type RillValue, type RuntimeCallable, type RuntimeCallbacks, type RuntimeContext, type RuntimeOptions, type ScriptCallable, type StepEndEvent, type StepResult, type StepStartEvent, validateHostFunctionArgs, validateReturnType, VERSION, VERSION_INFO, type VersionInfo, } from './runtime/index.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,MAAM,kBAAkB,CAAC;
|
|
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,SAAS,EACd,KAAK,YAAY,EACjB,oBAAoB,EACpB,aAAa,EACb,KAAK,2BAA2B,EAChC,kBAAkB,EAClB,KAAK,UAAU,EACf,OAAO,EACP,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACP,YAAY,EACZ,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,YAAY,CAAC;AAKpB,OAAO,EACL,KAAK,iBAAiB,EACtB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,YAAY,CAAC"}
|
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,
|
|
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,EAIR,oBAAoB,EACpB,aAAa,EAEb,kBAAkB,EAElB,OAAO,EAWP,YAAY,EACZ,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,OAAO,EACP,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAGhB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,qBAAqB,EACrB,YAAY,EAaZ,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACP,YAAY,GAEb,MAAM,oBAAoB,CAAC;AAE5B,+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,sBAAsB;AACtB,+DAA+D;AAC/D,OAAO,EAEL,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAE5B,cAAc,YAAY,CAAC"}
|
package/dist/lexer/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { LexerError } from './errors.js';
|
|
6
6
|
export { createLexerState, type LexerState } from './state.js';
|
|
7
|
-
export { nextToken, tokenize } from './tokenizer.js';
|
|
7
|
+
export { nextToken, tokenize, type TokenizeOptions } from './tokenizer.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lexer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lexer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/lexer/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lexer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lexer/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAmB,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAwB,MAAM,gBAAgB,CAAC"}
|
|
@@ -5,5 +5,8 @@
|
|
|
5
5
|
import type { Token, SourceLocation } from '../types.js';
|
|
6
6
|
import { type LexerState } from './state.js';
|
|
7
7
|
export declare function nextToken(state: LexerState): Token;
|
|
8
|
-
export
|
|
8
|
+
export interface TokenizeOptions {
|
|
9
|
+
includeComments?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function tokenize(source: string, baseLocation?: SourceLocation, options?: TokenizeOptions): Token[];
|
|
9
12
|
//# sourceMappingURL=tokenizer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../src/lexer/tokenizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAkBzD,OAAO,EAKL,KAAK,UAAU,EAGhB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../src/lexer/tokenizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAkBzD,OAAO,EAKL,KAAK,UAAU,EAGhB,MAAM,YAAY,CAAC;AAyBpB,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CA+GlD;AAED,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,cAAc,EAC7B,OAAO,CAAC,EAAE,eAAe,GACxB,KAAK,EAAE,CAgBT"}
|
package/dist/lexer/tokenizer.js
CHANGED
|
@@ -13,16 +13,26 @@ function skipWhitespace(state) {
|
|
|
13
13
|
advance(state);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
if (peek(state)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
function readComment(state) {
|
|
17
|
+
if (peek(state) !== '#') {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const start = currentLocation(state);
|
|
21
|
+
let value = '';
|
|
22
|
+
while (!isAtEnd(state) && peek(state) !== '\n') {
|
|
23
|
+
value += peek(state);
|
|
24
|
+
advance(state);
|
|
21
25
|
}
|
|
26
|
+
const end = currentLocation(state);
|
|
27
|
+
return makeToken(TOKEN_TYPES.COMMENT, value, start, end);
|
|
22
28
|
}
|
|
23
29
|
export function nextToken(state) {
|
|
24
30
|
skipWhitespace(state);
|
|
25
|
-
|
|
31
|
+
// Check for comment token
|
|
32
|
+
const commentToken = readComment(state);
|
|
33
|
+
if (commentToken !== null) {
|
|
34
|
+
return commentToken;
|
|
35
|
+
}
|
|
26
36
|
skipWhitespace(state);
|
|
27
37
|
if (isAtEnd(state)) {
|
|
28
38
|
const loc = currentLocation(state);
|
|
@@ -98,7 +108,7 @@ export function nextToken(state) {
|
|
|
98
108
|
}
|
|
99
109
|
throw new LexerError('RILL-L002', `Unexpected character: ${ch}`, start);
|
|
100
110
|
}
|
|
101
|
-
export function tokenize(source, baseLocation) {
|
|
111
|
+
export function tokenize(source, baseLocation, options) {
|
|
102
112
|
const state = createLexerState(source, baseLocation);
|
|
103
113
|
const tokens = [];
|
|
104
114
|
let token;
|
|
@@ -106,6 +116,10 @@ export function tokenize(source, baseLocation) {
|
|
|
106
116
|
token = nextToken(state);
|
|
107
117
|
tokens.push(token);
|
|
108
118
|
} while (token.type !== TOKEN_TYPES.EOF);
|
|
119
|
+
// Filter out COMMENT tokens unless includeComments is true
|
|
120
|
+
if (options?.includeComments !== true) {
|
|
121
|
+
return tokens.filter((t) => t.type !== TOKEN_TYPES.COMMENT);
|
|
122
|
+
}
|
|
109
123
|
return tokens;
|
|
110
124
|
}
|
|
111
125
|
//# sourceMappingURL=tokenizer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../../src/lexer/tokenizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,iBAA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W,GAAG,YAAY,CA6BlE"}
|
package/dist/parser/helpers.js
CHANGED
|
@@ -134,29 +134,27 @@ export function isNegativeNumber(state) {
|
|
|
134
134
|
return (check(state, TOKEN_TYPES.MINUS) &&
|
|
135
135
|
peek(state, 1).type === TOKEN_TYPES.NUMBER);
|
|
136
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Check if current token is one of the given types and followed by colon
|
|
139
|
+
* @internal
|
|
140
|
+
*/
|
|
141
|
+
function isKeyValueStart(state, tokenTypes) {
|
|
142
|
+
return (tokenTypes.some((type) => check(state, type)) &&
|
|
143
|
+
peek(state, 1).type === TOKEN_TYPES.COLON);
|
|
144
|
+
}
|
|
137
145
|
/**
|
|
138
146
|
* Check for dict start: identifier followed by colon OR list literal followed by colon
|
|
139
147
|
* @internal
|
|
140
148
|
*/
|
|
141
149
|
export function isDictStart(state) {
|
|
142
|
-
// Dict can start with
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
// Dict can start with number followed by colon: [42: value]
|
|
153
|
-
if (check(state, TOKEN_TYPES.NUMBER) &&
|
|
154
|
-
peek(state, 1).type === TOKEN_TYPES.COLON) {
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
// Dict can start with boolean followed by colon: [true: value] or [false: value]
|
|
158
|
-
if ((check(state, TOKEN_TYPES.TRUE) || check(state, TOKEN_TYPES.FALSE)) &&
|
|
159
|
-
peek(state, 1).type === TOKEN_TYPES.COLON) {
|
|
150
|
+
// Dict can start with simple key-value pairs: [key: value]
|
|
151
|
+
if (isKeyValueStart(state, [
|
|
152
|
+
TOKEN_TYPES.IDENTIFIER,
|
|
153
|
+
TOKEN_TYPES.STRING,
|
|
154
|
+
TOKEN_TYPES.NUMBER,
|
|
155
|
+
TOKEN_TYPES.TRUE,
|
|
156
|
+
TOKEN_TYPES.FALSE,
|
|
157
|
+
])) {
|
|
160
158
|
return true;
|
|
161
159
|
}
|
|
162
160
|
// Dict can start with negative number followed by colon: [-42: value]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/parser/helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAoB,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5E,+DAA+D;AAC/D,mBAAmB;AACnB,+DAA+D;AAE/D,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,SAAS;IACT,MAAM;IACN,MAAM;IACN,OAAO;CACC,CAAC;AAEX,gBAAgB;AAChB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAEtE,+DAA+D;AAC/D,uBAAuB;AACvB,+DAA+D;AAE/D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAuB;IAC3D,OAAO,CACL,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,UAAU;QACrC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;QAC/B,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,KAAK;QAChC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,KAAK;QAChC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM;QACjC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,MAAM;QACjC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,KAAK;QAChC,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,IAAI;QAC/B,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,GAAG;QAC9B,KAAK,CAAC,IAAI,KAAK,WAAW,CAAC,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parser-control.d.ts","sourceRoot":"","sources":["../../src/parser/parser-control.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAEV,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,IAAI,SAAS,CAAC;QACxB,WAAW,IAAI,UAAU,CAAC;QAC1B,UAAU,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACjD;CACF"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Parser } from './parser.js';
|
|
6
6
|
import { ParseError, TOKEN_TYPES } from '../types.js';
|
|
7
|
-
import { check, advance, expect, current, isAtEnd, skipNewlines, makeSpan, } from './state.js';
|
|
7
|
+
import { check, advance, expect, current, isAtEnd, skipNewlines, skipNewlinesIfFollowedBy, makeSpan, } from './state.js';
|
|
8
8
|
// ============================================================
|
|
9
9
|
// CONDITIONALS
|
|
10
10
|
// ============================================================
|
|
@@ -21,10 +21,13 @@ Parser.prototype.parseConditionalWithCondition = function (conditionBody) {
|
|
|
21
21
|
Parser.prototype.parseConditionalRest = function (condition, start) {
|
|
22
22
|
const thenBranch = this.parseBody();
|
|
23
23
|
let elseBranch = null;
|
|
24
|
+
// Site 4: Add skipNewlines before ! check (safe because we're inside conditional)
|
|
25
|
+
skipNewlines(this.state);
|
|
24
26
|
if (check(this.state, TOKEN_TYPES.BANG)) {
|
|
25
27
|
advance(this.state);
|
|
26
28
|
const elseBody = this.parseBody();
|
|
27
|
-
|
|
29
|
+
// Site 5: Add newline lookahead before ? check for else-if
|
|
30
|
+
if (skipNewlinesIfFollowedBy(this.state, TOKEN_TYPES.QUESTION)) {
|
|
28
31
|
elseBranch = this.parseConditionalWithCondition(elseBody);
|
|
29
32
|
}
|
|
30
33
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-control.js","sourceRoot":"","sources":["../../src/parser/parser-control.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAcrC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,YAAY,EACZ,QAAQ,GACT,MAAM,YAAY,CAAC;AAqBpB,+DAA+D;AAC/D,eAAe;AACf,+DAA+D;AAE/D,MAAM,CAAC,SAAS,CAAC,qBAAqB,GAAG;IAGvC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IAEvD,OAAO,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,6BAA6B,GAAG,UAE/C,aAAuB;IAEvB,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC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