aboutsummaryrefslogtreecommitdiff
path: root/crates/libsyntax2/src/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-08-13 16:30:56 +0100
committerAleksey Kladov <[email protected]>2018-08-13 16:30:56 +0100
commit51f7f937a569680ddb0b2bbca2a74f861802898b (patch)
tree16844f4f6216587f87add068cffc7d1ad0461be0 /crates/libsyntax2/src/grammar
parentc1a7b72fb7c9b69779e490e1d692ddfccec8b57a (diff)
Safer errors
Diffstat (limited to 'crates/libsyntax2/src/grammar')
-rw-r--r--crates/libsyntax2/src/grammar/mod.rs4
-rw-r--r--crates/libsyntax2/src/grammar/patterns.rs5
2 files changed, 3 insertions, 6 deletions
diff --git a/crates/libsyntax2/src/grammar/mod.rs b/crates/libsyntax2/src/grammar/mod.rs
index e1329044d..d9443f24f 100644
--- a/crates/libsyntax2/src/grammar/mod.rs
+++ b/crates/libsyntax2/src/grammar/mod.rs
@@ -129,7 +129,7 @@ fn name(p: &mut Parser) {
129 p.bump(); 129 p.bump();
130 m.complete(p, NAME); 130 m.complete(p, NAME);
131 } else { 131 } else {
132 p.error("expected a name"); 132 p.err_and_bump("expected a name");
133 } 133 }
134} 134}
135 135
@@ -139,7 +139,7 @@ fn name_ref(p: &mut Parser) {
139 p.bump(); 139 p.bump();
140 m.complete(p, NAME_REF); 140 m.complete(p, NAME_REF);
141 } else { 141 } else {
142 p.error("expected identifier"); 142 p.err_and_bump("expected identifier");
143 } 143 }
144} 144}
145 145
diff --git a/crates/libsyntax2/src/grammar/patterns.rs b/crates/libsyntax2/src/grammar/patterns.rs
index 220f36db7..71a1d5445 100644
--- a/crates/libsyntax2/src/grammar/patterns.rs
+++ b/crates/libsyntax2/src/grammar/patterns.rs
@@ -117,11 +117,8 @@ fn struct_pat_fields(p: &mut Parser) {
117 p.bump(); 117 p.bump();
118 pattern(p); 118 pattern(p);
119 } 119 }
120 REF_KW | MUT_KW | IDENT => {
121 bind_pat(p, false);
122 },
123 _ => { 120 _ => {
124 p.err_and_bump("expected ident"); 121 bind_pat(p, false);
125 } 122 }
126 } 123 }
127 if !p.at(R_CURLY) { 124 if !p.at(R_CURLY) {