Skip to content

Commit b851160

Browse files
committed
---
yaml --- r: 23130 b: refs/heads/master c: b354fe2 h: refs/heads/master v: v3
1 parent bbe6346 commit b851160

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: d704fc9196c9c80e1c29a04ef02d1165ad2cd760
2+
refs/heads/master: b354fe2a918c4821bd66996a023a7bb108bd2862
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/libsyntax/ext/tt/earley_parser.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match])
134134
135135
enum parse_result {
136136
success(hashmap<ident, @named_match>),
137-
failure(codemap::span, ~str)
137+
failure(codemap::span, ~str),
138+
error(codemap::span, ~str)
138139
}
139140
140141
fn parse_or_else(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader,
141142
ms: ~[matcher]) -> hashmap<ident, @named_match> {
142143
match parse(sess, cfg, rdr, ms) {
143144
success(m) => m,
144-
failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str)
145+
failure(sp, str) => sess.span_diagnostic.span_fatal(sp, str),
146+
error(sp, str) => sess.span_diagnostic.span_fatal(sp, str)
145147
}
146148
}
147149
@@ -262,7 +264,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
262264
nameize(sess, ms,
263265
vec::map(eof_eis[0u].matches, |dv| dv.pop())));
264266
} else if eof_eis.len() > 1u {
265-
return failure(sp, ~"Ambiguity: multiple successful parses");
267+
return error(sp, ~"Ambiguity: multiple successful parses");
266268
} else {
267269
return failure(sp, ~"Unexpected end of macro invocation");
268270
}
@@ -276,7 +278,7 @@ fn parse(sess: parse_sess, cfg: ast::crate_cfg, rdr: reader, ms: ~[matcher])
276278
}
277279
_ => fail
278280
} }), ~" or ");
279-
return failure(sp, fmt!{
281+
return error(sp, fmt!{
280282
"Local ambiguity: multiple parsing options: \
281283
built-in NTs %s or %u other options.",
282284
nts, next_eis.len()});

trunk/src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import parse::lexer::{new_tt_reader, reader};
66
import parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt};
77
import parse::parser::{parser, SOURCE_FILE};
88
import earley_parser::{parse, parse_or_else, success, failure, named_match,
9-
matched_seq, matched_nonterminal};
9+
matched_seq, matched_nonterminal, error};
1010
import std::map::hashmap;
1111

1212
fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
@@ -80,7 +80,8 @@ fn add_new_extension(cx: ext_ctxt, sp: span, name: ident,
8080
failure(sp, msg) => if sp.lo >= best_fail_spot.lo {
8181
best_fail_spot = sp;
8282
best_fail_msg = msg;
83-
}
83+
},
84+
error(sp, msg) => cx.span_fatal(sp, msg)
8485
}
8586
}
8687
_ => cx.bug(~"non-matcher found in parsed lhses")

0 commit comments

Comments
 (0)