File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ supertypes:
2222 pattern :
2323 - var_pattern
2424 - apply_pattern
25+ - tuple_pattern
2526 - ignore_pattern
2627 - unsupported_node
2728named :
@@ -109,6 +110,10 @@ named:
109110 constructor : expr
110111 argument* : pattern
111112
113+ # A tuple pattern such as `(a, b)` in `let (a, b) = pair`.
114+ tuple_pattern :
115+ element* : pattern
116+
112117 # An simple unqualified identifier token
113118 identifier :
114119
Original file line number Diff line number Diff line change @@ -244,14 +244,11 @@ fn translation_rules() -> Vec<yeast::Rule> {
244244 ) ,
245245 // Tuple destructuring pattern, e.g. `let (a, b) = pair`. The parser
246246 // emits a `pattern` node whose unnamed children are themselves
247- // `pattern` nodes. We synthesize a `tuple` constructor since the
248- // syntax has no name.
247+ // `pattern` nodes.
249248 rule!(
250249 ( pattern ( pattern) + @parts)
251250 =>
252- ( apply_pattern
253- constructor: ( name_expr identifier: ( identifier "tuple" ) )
254- argument: { ..parts} )
251+ ( tuple_pattern element: { ..parts} )
255252 ) ,
256253 // ---- Variable declarations ----
257254 // Handles single (`let x = e`), multiple (`let x = 1, y = 2`),
Original file line number Diff line number Diff line change @@ -151,15 +151,12 @@ top_level
151151 name_expr
152152 identifier: identifier "pair"
153153 pattern:
154- apply_pattern
155- argument :
154+ tuple_pattern
155+ element :
156156 var_pattern
157157 identifier: identifier "a"
158158 var_pattern
159159 identifier: identifier "b"
160- constructor:
161- name_expr
162- identifier: identifier "tuple"
163160
164161===
165162Multiple bindings on one line
You can’t perform that action at this time.
0 commit comments