1
0

Roll back changes to match syntax; Fix match tests

This commit is contained in:
Jeff 2024-02-18 10:53:34 -05:00
parent 979335f497
commit 2bbbfa34a4
5 changed files with 25202 additions and 29982 deletions

View File

@ -5,9 +5,9 @@ fn match_value() {
let test = interpret(
"
match 1 {
3 => false
2 => { false }
1 => true
3 -> false
2 -> { false }
1 -> true
}
",
)
@ -21,9 +21,9 @@ fn match_assignment() {
let test = interpret(
"
x = match 1 {
3 => false
2 => { false }
1 => true
3 -> false
2 -> { false }
1 -> true
}
x
",
@ -40,8 +40,8 @@ fn match_enum() {
foobar = Option::Some(true)
match foobar {
Option::None => false,
Option::Some(content) => content,
Option::None -> false,
Option::Some(content) -> content,
}
",
);

View File

@ -2,12 +2,12 @@
Match Values
================================================================================
match x
match x {
1 -> {
true
}
2 -> false
}
--------------------------------------------------------------------------------
@ -41,10 +41,10 @@ match x
Match Enum
================================================================================
match foobar
match foobar {
FooBar::Foo -> true
FooBar::Bar -> false
}
--------------------------------------------------------------------------------

View File

@ -294,6 +294,7 @@ module.exports = grammar({
seq(
'match',
$.expression,
'{',
repeat1(
seq(
$.match_pattern,
@ -302,6 +303,7 @@ module.exports = grammar({
optional(','),
),
),
'}',
),
),

View File

@ -872,6 +872,10 @@
"type": "SYMBOL",
"name": "expression"
},
{
"type": "STRING",
"value": "{"
},
{
"type": "REPEAT1",
"content": {
@ -903,6 +907,10 @@
}
]
}
},
{
"type": "STRING",
"value": "}"
}
]
}

File diff suppressed because it is too large Load Diff