aboutsummaryrefslogtreecommitdiff
path: root/src/parser/grammar
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-02-09 19:44:50 +0000
committerAleksey Kladov <[email protected]>2018-02-09 19:44:50 +0000
commit0ae26c344aa7477a18c2019cfa0062a9a745d70d (patch)
tree6a3659da778ee7c07f7a487694b09070c0451f45 /src/parser/grammar
parent351107d0b143e2c3497bd0f424f0d76bc51df0c0 (diff)
Drop ErrorBuilder nonsense
Diffstat (limited to 'src/parser/grammar')
-rw-r--r--src/parser/grammar/attributes.rs8
-rw-r--r--src/parser/grammar/expressions.rs2
-rw-r--r--src/parser/grammar/items/mod.rs8
-rw-r--r--src/parser/grammar/items/structs.rs4
-rw-r--r--src/parser/grammar/items/use_item.rs2
-rw-r--r--src/parser/grammar/mod.rs6
-rw-r--r--src/parser/grammar/paths.rs4
7 files changed, 18 insertions, 16 deletions
diff --git a/src/parser/grammar/attributes.rs b/src/parser/grammar/attributes.rs
index 8bf04afce..92dfb99ef 100644
--- a/src/parser/grammar/attributes.rs
+++ b/src/parser/grammar/attributes.rs
@@ -37,7 +37,7 @@ fn meta_item(p: &mut Parser) {
37 EQ => { 37 EQ => {
38 p.bump(); 38 p.bump();
39 if !expressions::literal(p) { 39 if !expressions::literal(p) {
40 p.error().message("expected literal").emit(); 40 p.error("expected literal");
41 } 41 }
42 } 42 }
43 L_PAREN => meta_item_arg_list(p), 43 L_PAREN => meta_item_arg_list(p),
@@ -45,7 +45,7 @@ fn meta_item(p: &mut Parser) {
45 } 45 }
46 meta_item.complete(p, META_ITEM); 46 meta_item.complete(p, META_ITEM);
47 } else { 47 } else {
48 p.error().message("expected attribute value").emit() 48 p.error("expected attribute value");
49 } 49 }
50} 50}
51 51
@@ -60,12 +60,12 @@ fn meta_item_arg_list(p: &mut Parser) {
60 let message = "expected attribute"; 60 let message = "expected attribute";
61 61
62 if items::ITEM_FIRST.contains(c) { 62 if items::ITEM_FIRST.contains(c) {
63 p.error().message(message).emit(); 63 p.error(message);
64 return; 64 return;
65 } 65 }
66 66
67 let err = p.start(); 67 let err = p.start();
68 p.error().message(message).emit(); 68 p.error(message);
69 p.bump(); 69 p.bump();
70 err.complete(p, ERROR); 70 err.complete(p, ERROR);
71 continue; 71 continue;
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs
index 8caaf3553..3704cb16f 100644
--- a/src/parser/grammar/expressions.rs
+++ b/src/parser/grammar/expressions.rs
@@ -15,6 +15,6 @@ pub(super) fn literal(p: &mut Parser) -> bool {
15 15
16pub(super) fn expr(p: &mut Parser) { 16pub(super) fn expr(p: &mut Parser) {
17 if !literal(p) { 17 if !literal(p) {
18 p.error().message("expected expression").emit(); 18 p.error("expected expression");
19 } 19 }
20} 20}
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs
index 37f2ab132..b73628ec0 100644
--- a/src/parser/grammar/items/mod.rs
+++ b/src/parser/grammar/items/mod.rs
@@ -51,7 +51,7 @@ fn item(p: &mut Parser) {
51 // extern struct Foo; 51 // extern struct Foo;
52 _ => { 52 _ => {
53 item.abandon(p); 53 item.abandon(p);
54 p.error().message("expected `fn` or `{`").emit(); 54 p.error("expected `fn` or `{`");
55 return; 55 return;
56 } 56 }
57 } 57 }
@@ -121,7 +121,7 @@ fn item(p: &mut Parser) {
121 abi(p); 121 abi(p);
122 if !p.at(FN_KW) { 122 if !p.at(FN_KW) {
123 item.abandon(p); 123 item.abandon(p);
124 p.error().message("expected function").emit(); 124 p.error("expected function");
125 return; 125 return;
126 } 126 }
127 fn_item(p); 127 fn_item(p);
@@ -144,7 +144,7 @@ fn item(p: &mut Parser) {
144 if t == L_CURLY { 144 if t == L_CURLY {
145 error_block(p, message); 145 error_block(p, message);
146 } else { 146 } else {
147 p.error().message(message).emit(); 147 p.error(message);
148 } 148 }
149 return; 149 return;
150 } 150 }
@@ -234,7 +234,7 @@ fn fn_item(p: &mut Parser) {
234 if p.at(L_PAREN) { 234 if p.at(L_PAREN) {
235 fn_value_parameters(p); 235 fn_value_parameters(p);
236 } else { 236 } else {
237 p.error().message("expected function arguments").emit(); 237 p.error("expected function arguments");
238 } 238 }
239 239
240 if p.at(L_CURLY) { 240 if p.at(L_CURLY) {
diff --git a/src/parser/grammar/items/structs.rs b/src/parser/grammar/items/structs.rs
index 69d95c698..640b940e4 100644
--- a/src/parser/grammar/items/structs.rs
+++ b/src/parser/grammar/items/structs.rs
@@ -19,7 +19,7 @@ pub(super) fn struct_item(p: &mut Parser) {
19 L_CURLY => named_fields(p), 19 L_CURLY => named_fields(p),
20 _ => { 20 _ => {
21 //TODO: special case `(` error message 21 //TODO: special case `(` error message
22 p.error().message("expected `;` or `{`").emit(); 22 p.error("expected `;` or `{`");
23 return; 23 return;
24 } 24 }
25 } 25 }
@@ -34,7 +34,7 @@ pub(super) fn struct_item(p: &mut Parser) {
34 p.expect(SEMI); 34 p.expect(SEMI);
35 } 35 }
36 _ => { 36 _ => {
37 p.error().message("expected `;`, `{`, or `(`").emit(); 37 p.error("expected `;`, `{`, or `(`");
38 return; 38 return;
39 } 39 }
40 } 40 }
diff --git a/src/parser/grammar/items/use_item.rs b/src/parser/grammar/items/use_item.rs
index 38e7b3f8a..a3f7f0da8 100644
--- a/src/parser/grammar/items/use_item.rs
+++ b/src/parser/grammar/items/use_item.rs
@@ -37,7 +37,7 @@ fn use_tree(p: &mut Parser) {
37 L_CURLY => nested_trees(p), 37 L_CURLY => nested_trees(p),
38 _ => { 38 _ => {
39 // is this unreachable? 39 // is this unreachable?
40 p.error().message("expected `{` or `*`").emit(); 40 p.error("expected `{` or `*`");
41 } 41 }
42 } 42 }
43 } 43 }
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs
index afce308d0..b949583ff 100644
--- a/src/parser/grammar/mod.rs
+++ b/src/parser/grammar/mod.rs
@@ -53,7 +53,7 @@ fn alias(p: &mut Parser) -> bool {
53fn error_block(p: &mut Parser, message: &str) { 53fn error_block(p: &mut Parser, message: &str) {
54 assert!(p.at(L_CURLY)); 54 assert!(p.at(L_CURLY));
55 let err = p.start(); 55 let err = p.start();
56 p.error().message(message).emit(); 56 p.error(message);
57 p.bump(); 57 p.bump();
58 let mut level: u32 = 1; 58 let mut level: u32 = 1;
59 while level > 0 && !p.at(EOF) { 59 while level > 0 && !p.at(EOF) {
@@ -74,7 +74,7 @@ impl<'p> Parser<'p> {
74 74
75 fn err_and_bump(&mut self, message: &str) { 75 fn err_and_bump(&mut self, message: &str) {
76 let err = self.start(); 76 let err = self.start();
77 self.error().message(message).emit(); 77 self.error(message);
78 self.bump(); 78 self.bump();
79 err.complete(self, ERROR); 79 err.complete(self, ERROR);
80 } 80 }
@@ -84,7 +84,7 @@ impl<'p> Parser<'p> {
84 self.bump(); 84 self.bump();
85 true 85 true
86 } else { 86 } else {
87 self.error().message(format!("expected {:?}", kind)).emit(); 87 self.error(format!("expected {:?}", kind));
88 false 88 false
89 } 89 }
90 } 90 }
diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs
index 6efac2610..1aa30f28b 100644
--- a/src/parser/grammar/paths.rs
+++ b/src/parser/grammar/paths.rs
@@ -43,7 +43,9 @@ fn path_segment(p: &mut Parser, first: bool) {
43 } 43 }
44 match p.current() { 44 match p.current() {
45 IDENT | SELF_KW | SUPER_KW => p.bump(), 45 IDENT | SELF_KW | SUPER_KW => p.bump(),
46 _ => p.error().message("expected identifier").emit(), 46 _ => {
47 p.error("expected identifier");
48 },
47 }; 49 };
48 segment.complete(p, PATH_SEGMENT); 50 segment.complete(p, PATH_SEGMENT);
49} 51}