diff options
Diffstat (limited to 'crates/libsyntax2/src/grammar/patterns.rs')
-rw-r--r-- | crates/libsyntax2/src/grammar/patterns.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/libsyntax2/src/grammar/patterns.rs b/crates/libsyntax2/src/grammar/patterns.rs index 71a1d5445..7ddbfa318 100644 --- a/crates/libsyntax2/src/grammar/patterns.rs +++ b/crates/libsyntax2/src/grammar/patterns.rs | |||
@@ -69,7 +69,7 @@ fn path_pat(p: &mut Parser) -> CompletedMarker { | |||
69 | TUPLE_STRUCT_PAT | 69 | TUPLE_STRUCT_PAT |
70 | } | 70 | } |
71 | L_CURLY => { | 71 | L_CURLY => { |
72 | struct_pat_fields(p); | 72 | field_pat_list(p); |
73 | STRUCT_PAT | 73 | STRUCT_PAT |
74 | } | 74 | } |
75 | _ => PATH_PAT | 75 | _ => PATH_PAT |
@@ -99,15 +99,16 @@ fn tuple_pat_fields(p: &mut Parser) { | |||
99 | p.expect(R_PAREN); | 99 | p.expect(R_PAREN); |
100 | } | 100 | } |
101 | 101 | ||
102 | // test struct_pat_fields | 102 | // test field_pat_list |
103 | // fn foo() { | 103 | // fn foo() { |
104 | // let S {} = (); | 104 | // let S {} = (); |
105 | // let S { f, ref mut g } = (); | 105 | // let S { f, ref mut g } = (); |
106 | // let S { h: _, ..} = (); | 106 | // let S { h: _, ..} = (); |
107 | // let S { h: _, } = (); | 107 | // let S { h: _, } = (); |
108 | // } | 108 | // } |
109 | fn struct_pat_fields(p: &mut Parser) { | 109 | fn field_pat_list(p: &mut Parser) { |
110 | assert!(p.at(L_CURLY)); | 110 | assert!(p.at(L_CURLY)); |
111 | let m = p.start(); | ||
111 | p.bump(); | 112 | p.bump(); |
112 | while !p.at(EOF) && !p.at(R_CURLY) { | 113 | while !p.at(EOF) && !p.at(R_CURLY) { |
113 | match p.current() { | 114 | match p.current() { |
@@ -126,6 +127,7 @@ fn struct_pat_fields(p: &mut Parser) { | |||
126 | } | 127 | } |
127 | } | 128 | } |
128 | p.expect(R_CURLY); | 129 | p.expect(R_CURLY); |
130 | m.complete(p, FIELD_PAT_LIST); | ||
129 | } | 131 | } |
130 | 132 | ||
131 | // test placeholder_pat | 133 | // test placeholder_pat |