mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-15 21:23:57 +00:00
parse and format pattern as
This commit is contained in:
parent
ea53a50447
commit
e9196f3c0b
13 changed files with 189 additions and 7 deletions
|
|
@ -0,0 +1,31 @@
|
|||
When(
|
||||
@5-6 Num(
|
||||
"0",
|
||||
),
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@14-20 SpaceBefore(
|
||||
As(
|
||||
@14-15 SpaceAfter(
|
||||
Underscore(
|
||||
"",
|
||||
),
|
||||
[],
|
||||
),
|
||||
[],
|
||||
@19-20 "n",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
value: @24-25 Var {
|
||||
module_name: "",
|
||||
ident: "n",
|
||||
},
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
when 0 is
|
||||
_ as n -> n
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
When(
|
||||
@5-6 Num(
|
||||
"0",
|
||||
),
|
||||
[
|
||||
WhenBranch {
|
||||
patterns: [
|
||||
@14-54 SpaceBefore(
|
||||
As(
|
||||
@14-15 SpaceAfter(
|
||||
NumLiteral(
|
||||
"0",
|
||||
),
|
||||
[
|
||||
LineComment(
|
||||
" foobar",
|
||||
),
|
||||
],
|
||||
),
|
||||
[
|
||||
LineComment(
|
||||
" barfoo",
|
||||
),
|
||||
],
|
||||
@53-54 "n",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
value: @58-60 Record(
|
||||
[],
|
||||
),
|
||||
guard: None,
|
||||
},
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
when 0 is
|
||||
0 # foobar
|
||||
as # barfoo
|
||||
n -> {}
|
||||
|
|
@ -354,6 +354,8 @@ mod test_snapshots {
|
|||
pass/parenthetical_var.expr,
|
||||
pass/parse_alias.expr,
|
||||
pass/parse_as_ann.expr,
|
||||
pass/pattern_as.expr,
|
||||
pass/pattern_as_spaces.expr,
|
||||
pass/pattern_with_space_in_parens.expr, // https://github.com/roc-lang/roc/issues/929
|
||||
pass/plus_if.expr,
|
||||
pass/plus_when.expr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue