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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff