75 lines
1.7 KiB
Plaintext
75 lines
1.7 KiB
Plaintext
================================================================================
|
|
Match Values
|
|
================================================================================
|
|
|
|
match x {
|
|
1 => {
|
|
true
|
|
}
|
|
2 => false
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(statement_kind
|
|
(match
|
|
(expression
|
|
(identifier))
|
|
(match_pattern
|
|
(value
|
|
(integer)))
|
|
(statement
|
|
(statement_kind
|
|
(block
|
|
(statement
|
|
(statement_kind
|
|
(expression
|
|
(value
|
|
(boolean))))))))
|
|
(match_pattern
|
|
(value
|
|
(integer)))
|
|
(statement
|
|
(statement_kind
|
|
(expression
|
|
(value
|
|
(boolean)))))))))
|
|
|
|
================================================================================
|
|
Match Enum
|
|
================================================================================
|
|
|
|
match foobar {
|
|
FooBar::Foo => true
|
|
FooBar::Bar => false
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(statement_kind
|
|
(match
|
|
(expression
|
|
(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)))))))))
|