aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-09-08 08:13:32 +0100
committerAleksey Kladov <[email protected]>2018-09-08 08:13:32 +0100
commitbd3a26493f101039fb6fe97561a15bcfffea82f0 (patch)
treef2dc8fd63c50ceed11a96fa7a0736819f8dbbf18 /crates/libsyntax2/src/grammar
parent44334f6f56bd99635f650796af0db8047e4c21c4 (diff)
fix stuck parser
Diffstat (limited to 'crates/libsyntax2/src/grammar')
-rw-r--r--crates/libsyntax2/src/grammar/expressions/atom.rs9
-rw-r--r--crates/libsyntax2/src/grammar/expressions/mod.rs4
2 files changed, 11 insertions, 2 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/atom.rs b/crates/libsyntax2/src/grammar/expressions/atom.rs
index f8b50b355..2536bac80 100644
--- a/crates/libsyntax2/src/grammar/expressions/atom.rs
+++ b/crates/libsyntax2/src/grammar/expressions/atom.rs
@@ -140,9 +140,14 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
140 } 140 }
141 while !p.at(EOF) && !p.at(R_BRACK) { 141 while !p.at(EOF) && !p.at(R_BRACK) {
142 p.expect(COMMA); 142 p.expect(COMMA);
143 if !p.at(R_BRACK) { 143 if p.at(R_BRACK) {
144 expr(p); 144 break;
145 }
146 if !EXPR_FIRST.contains(p.current()) {
147 p.error("expected expression");
148 break;
145 } 149 }
150 expr(p);
146 } 151 }
147 p.expect(R_BRACK); 152 p.expect(R_BRACK);
148 m.complete(p, ARRAY_EXPR) 153 m.complete(p, ARRAY_EXPR)
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs
index 9379ed938..f7b9f7086 100644
--- a/crates/libsyntax2/src/grammar/expressions/mod.rs
+++ b/crates/libsyntax2/src/grammar/expressions/mod.rs
@@ -376,6 +376,10 @@ fn arg_list(p: &mut Parser) {
376 let m = p.start(); 376 let m = p.start();
377 p.bump(); 377 p.bump();
378 while !p.at(R_PAREN) && !p.at(EOF) { 378 while !p.at(R_PAREN) && !p.at(EOF) {
379 if !EXPR_FIRST.contains(p.current()) {
380 p.error("expected expression");
381 break;
382 }
379 expr(p); 383 expr(p);
380 if !p.at(R_PAREN) && !p.expect(COMMA) { 384 if !p.at(R_PAREN) && !p.expect(COMMA) {
381 break; 385 break;