aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-21 23:21:53 +0000
committerAleksey Kladov <[email protected]>2018-01-21 23:21:53 +0000
commit645a1b5d739e7101fc63cea7950d26addd8e7be2 (patch)
tree9e319f1614c8b6faa7d571eb7c1316946270c06a
parent05ad469ac33965f76ccc0f5b8a9959695b8979a0 (diff)
Remove high-order bits from tuple struct
-rw-r--r--src/parser/event_parser/grammar/items.rs15
-rw-r--r--tests/data/parser/ok/0017_attr_trailing_comma.rs2
-rw-r--r--tests/data/parser/ok/0017_attr_trailing_comma.txt23
3 files changed, 34 insertions, 6 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs
index 12b6d06c7..d341dce38 100644
--- a/src/parser/event_parser/grammar/items.rs
+++ b/src/parser/event_parser/grammar/items.rs
@@ -127,18 +127,21 @@ fn pos_fields(p: &mut Parser) {
127 if !p.expect(L_PAREN) { 127 if !p.expect(L_PAREN) {
128 return; 128 return;
129 } 129 }
130 comma_list(p, R_PAREN, |p| { 130 loop {
131 pos_field(p); 131 if p.at(R_PAREN) || p.at(EOF) {
132 true 132 break;
133 }); 133 }
134 p.expect(R_PAREN);
135 134
136 fn pos_field(p: &mut Parser) {
137 let pos_field = p.start(); 135 let pos_field = p.start();
138 visibility(p); 136 visibility(p);
139 types::type_ref(p); 137 types::type_ref(p);
140 pos_field.complete(p, POS_FIELD); 138 pos_field.complete(p, POS_FIELD);
139
140 if !p.at(R_PAREN) {
141 p.expect(COMMA);
142 }
141 } 143 }
144 p.expect(R_PAREN);
142} 145}
143 146
144fn generic_parameters(_: &mut Parser) {} 147fn generic_parameters(_: &mut Parser) {}
diff --git a/tests/data/parser/ok/0017_attr_trailing_comma.rs b/tests/data/parser/ok/0017_attr_trailing_comma.rs
new file mode 100644
index 000000000..fe0a7bb97
--- /dev/null
+++ b/tests/data/parser/ok/0017_attr_trailing_comma.rs
@@ -0,0 +1,2 @@
1#[foo(a,)]
2fn foo() {}
diff --git a/tests/data/parser/ok/0017_attr_trailing_comma.txt b/tests/data/parser/ok/0017_attr_trailing_comma.txt
new file mode 100644
index 000000000..1b99d7ffd
--- /dev/null
+++ b/tests/data/parser/ok/0017_attr_trailing_comma.txt
@@ -0,0 +1,23 @@
1FILE@[0; 23)
2 FN_ITEM@[0; 23)
3 ATTR@[0; 11)
4 POUND@[0; 1)
5 L_BRACK@[1; 2)
6 META_ITEM@[2; 9)
7 IDENT@[2; 5)
8 L_PAREN@[5; 6)
9 META_ITEM@[6; 7)
10 IDENT@[6; 7)
11 COMMA@[7; 8)
12 R_PAREN@[8; 9)
13 R_BRACK@[9; 10)
14 WHITESPACE@[10; 11)
15 FN_KW@[11; 13)
16 WHITESPACE@[13; 14)
17 IDENT@[14; 17)
18 L_PAREN@[17; 18)
19 R_PAREN@[18; 19)
20 WHITESPACE@[19; 20)
21 L_CURLY@[20; 21)
22 R_CURLY@[21; 22)
23 WHITESPACE@[22; 23)