mirror of https://github.com/Wilfred/difftastic/
79 lines
2.0 KiB
Plaintext
79 lines
2.0 KiB
Plaintext
================================================================================
|
|
Case with spread
|
|
================================================================================
|
|
|
|
pub fn main() {
|
|
case xs {
|
|
[[]] -> io.println("one")
|
|
[[], ..] -> io.println("many")
|
|
}
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(function
|
|
(visibility_modifier)
|
|
(identifier)
|
|
(function_parameters)
|
|
(block
|
|
(case
|
|
(case_subjects
|
|
(identifier))
|
|
(case_clauses
|
|
(case_clause
|
|
(case_clause_patterns
|
|
(case_clause_pattern
|
|
(list_pattern
|
|
(list_pattern))))
|
|
(function_call
|
|
(field_access
|
|
(identifier)
|
|
(label))
|
|
(arguments
|
|
(argument
|
|
(string
|
|
(quoted_content))))))
|
|
(case_clause
|
|
(case_clause_patterns
|
|
(case_clause_pattern
|
|
(list_pattern
|
|
(list_pattern)
|
|
(list_pattern_tail))))
|
|
(function_call
|
|
(field_access
|
|
(identifier)
|
|
(label))
|
|
(arguments
|
|
(argument
|
|
(string
|
|
(quoted_content)))))))))))
|
|
|
|
================================================================================
|
|
Pattern with label shorthand
|
|
================================================================================
|
|
|
|
pub fn main() {
|
|
let Wibble(arg1:, arg2:) = todo as "a"
|
|
}
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
(source_file
|
|
(function
|
|
(visibility_modifier)
|
|
(identifier)
|
|
(function_parameters)
|
|
(block
|
|
(let
|
|
(record_pattern
|
|
(constructor_name)
|
|
(record_pattern_arguments
|
|
(record_pattern_argument
|
|
(label))
|
|
(record_pattern_argument
|
|
(label))))
|
|
(todo
|
|
(string
|
|
(quoted_content)))))))
|