Track the LScript changes since the grammar was first written: - some, ok and err are reserved prefix operators and wrapper patterns; the old |.some/|.ok/|.err forms and postfix/prefix ! are rejected - function literal inputs may omit their type annotation, and tuple components may omit theirs; an empty typed tuple pattern is now just the unit pattern - migrate fixtures, corpus, queries, CST contract and Rust tests Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
25 lines
509 B
Plaintext
25 lines
509 B
Plaintext
present: i32?: some 1
|
|
absent: i32?: nil
|
|
success: i32 ! str: ok 1
|
|
failure: i32 ! str: err 'failed'
|
|
piped: i32?: some 4->double
|
|
grouped: i32?: some {4->double}
|
|
|
|
double :: @ value { value * 2 }
|
|
describe :: @ (label: str, count) -> str { label }
|
|
|
|
unwrap_or: i32? -> i32: @ value {
|
|
match value {
|
|
some inner => inner
|
|
nil => 0
|
|
}
|
|
}
|
|
|
|
handle: i32 ! str -> i32: @ result {
|
|
match result {
|
|
ok value if value > 0 => value
|
|
ok _ => 0
|
|
err message => message->length
|
|
}
|
|
}
|