68 lines
1.4 KiB
Plaintext
68 lines
1.4 KiB
Plaintext
================================================================================
|
|
Match Values
|
|
================================================================================
|
|
|
|
match x {
|
|
1 => {
|
|
true
|
|
}
|
|
2 => false
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(match
|
|
(expression
|
|
(identifier))
|
|
(match_pattern
|
|
(value
|
|
(integer)))
|
|
(statement
|
|
(block
|
|
(statement
|
|
(expression
|
|
(value
|
|
(boolean))))))
|
|
(match_pattern
|
|
(value
|
|
(integer)))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(boolean)))))))
|
|
|
|
================================================================================
|
|
Match Enum
|
|
================================================================================
|
|
|
|
match foobar {
|
|
FooBar::Foo => true
|
|
FooBar::Bar => false
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(root
|
|
(statement
|
|
(match
|
|
(expression
|
|
(identifier))
|
|
(match_pattern
|
|
(enum_pattern
|
|
(identifier)
|
|
(identifier)))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(boolean))))
|
|
(match_pattern
|
|
(enum_pattern
|
|
(identifier)
|
|
(identifier)))
|
|
(statement
|
|
(expression
|
|
(value
|
|
(boolean)))))))
|