2023-12-06 13:48:38 -05:00
|
|
|
================================================================================
|
|
|
|
Match Values
|
|
|
|
================================================================================
|
|
|
|
|
2024-02-18 10:53:34 -05:00
|
|
|
match x {
|
2024-02-18 10:34:59 -05:00
|
|
|
1 -> {
|
2023-12-06 13:48:38 -05:00
|
|
|
true
|
|
|
|
}
|
2024-02-18 10:34:59 -05:00
|
|
|
2 -> false
|
2024-02-18 10:53:34 -05:00
|
|
|
}
|
2023-12-06 13:48:38 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 10:55:15 -05:00
|
|
|
(statement_kind
|
|
|
|
(match
|
2023-12-06 13:48:38 -05:00
|
|
|
(expression
|
2024-02-16 10:55:15 -05:00
|
|
|
(identifier))
|
|
|
|
(match_pattern
|
|
|
|
(value
|
|
|
|
(integer)))
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(block
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean))))))))
|
|
|
|
(match_pattern
|
2023-12-06 13:48:38 -05:00
|
|
|
(value
|
2024-02-16 10:55:15 -05:00
|
|
|
(integer)))
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean)))))))))
|
2024-02-15 07:04:38 -05:00
|
|
|
|
|
|
|
================================================================================
|
|
|
|
Match Enum
|
|
|
|
================================================================================
|
|
|
|
|
2024-02-18 10:53:34 -05:00
|
|
|
match foobar {
|
2024-02-18 10:34:59 -05:00
|
|
|
FooBar::Foo -> true
|
|
|
|
FooBar::Bar -> false
|
2024-02-18 10:53:34 -05:00
|
|
|
}
|
2024-02-15 07:04:38 -05:00
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(root
|
|
|
|
(statement
|
2024-02-16 10:55:15 -05:00
|
|
|
(statement_kind
|
|
|
|
(match
|
2024-02-15 07:04:38 -05:00
|
|
|
(expression
|
2024-02-16 10:55:15 -05:00
|
|
|
(identifier))
|
|
|
|
(match_pattern
|
|
|
|
(enum_pattern
|
|
|
|
(identifier)
|
|
|
|
(identifier)))
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean)))))
|
|
|
|
(match_pattern
|
|
|
|
(enum_pattern
|
|
|
|
(identifier)
|
|
|
|
(identifier)))
|
|
|
|
(statement
|
|
|
|
(statement_kind
|
|
|
|
(expression
|
|
|
|
(value
|
|
|
|
(boolean)))))))))
|