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>
20 lines
446 B
Plaintext
20 lines
446 B
Plaintext
numbers := [1, 2, 3]
|
|
more_numbers := [0, ...numbers, 4]
|
|
|
|
codes := ['ok' => 200, 'missing' => 404]
|
|
more_codes := [...codes, 'failed' => 500]
|
|
|
|
empty_numbers: []i32: []
|
|
empty_codes: [str]i32: []
|
|
optional_numbers: []i32?: nil
|
|
optional_elements: []{i32?}: [nil, some 1]
|
|
|
|
Options :: &{
|
|
name: str: 'default'
|
|
count: i32 = 0
|
|
}
|
|
|
|
defaults := &Options.{}
|
|
overridden := &Options.{ ...defaults; count = 2 }
|
|
anonymous := &.{ label: 'value'; count = 1 }
|