diff options
| author | Seo Sanghyeon <sanxiyn@gmail.com> | 2015-11-14 19:18:32 +0900 |
|---|---|---|
| committer | Seo Sanghyeon <sanxiyn@gmail.com> | 2015-11-14 19:18:32 +0900 |
| commit | 289b1b400a01f9cc8a6b75b3083341c1a2170831 (patch) | |
| tree | 16e39b433d3d6e197c3b55de3f459988ab1c2e0c /src | |
| parent | fdadba578655ed35f99395b66cd36d8f6d6fdaf3 (diff) | |
| download | rust-289b1b400a01f9cc8a6b75b3083341c1a2170831.tar.gz rust-289b1b400a01f9cc8a6b75b3083341c1a2170831.zip | |
Reindent code
Diffstat (limited to 'src')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 898d4d80b99..c5cbb95aeeb 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -169,17 +169,17 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, let mut best_fail_msg = "internal error: ran no matchers".to_string(); for (i, lhs) in lhses.iter().enumerate() { // try each arm's matchers - let lhs_tt = match *lhs { - TokenTree::Delimited(_, ref delim) => &delim.tts[..], - _ => panic!(cx.span_fatal(sp, "malformed macro lhs")) - }; + let lhs_tt = match *lhs { + TokenTree::Delimited(_, ref delim) => &delim.tts[..], + _ => panic!(cx.span_fatal(sp, "malformed macro lhs")) + }; - match TokenTree::parse(cx, lhs_tt, arg) { - Success(named_matches) => { + match TokenTree::parse(cx, lhs_tt, arg) { + Success(named_matches) => { let rhs = match rhses[i] { - // ignore delimiters - TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(), - _ => panic!(cx.span_fatal(sp, "macro rhs must be delimited")), + // ignore delimiters + TokenTree::Delimited(_, ref delimed) => delimed.tts.clone(), + _ => panic!(cx.span_fatal(sp, "macro rhs must be delimited")), }; // rhs has holes ( `$id` and `$(...)` that need filled) let trncbr = new_tt_reader(&cx.parse_sess().span_diagnostic, @@ -199,15 +199,15 @@ fn generic_extension<'cx>(cx: &'cx ExtCtxt, site_span: sp, macro_ident: name }) - } - Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { + } + Failure(sp, ref msg) => if sp.lo >= best_fail_spot.lo { best_fail_spot = sp; best_fail_msg = (*msg).clone(); - }, - Error(err_sp, ref msg) => { + }, + Error(err_sp, ref msg) => { panic!(cx.span_fatal(err_sp.substitute_dummy(sp), &msg[..])) - } } + } } panic!(cx.span_fatal(best_fail_spot.substitute_dummy(sp), &best_fail_msg[..])); @@ -310,14 +310,14 @@ fn check_lhs_nt_follows(cx: &mut ExtCtxt, lhs: &TokenTree, sp: Span) { // lhs is going to be like TokenTree::Delimited(...), where the // entire lhs is those tts. Or, it can be a "bare sequence", not wrapped in parens. match lhs { - &TokenTree::Delimited(_, ref tts) => { - check_matcher(cx, tts.tts.iter(), &Eof); - }, - tt @ &TokenTree::Sequence(..) => { - check_matcher(cx, Some(tt).into_iter(), &Eof); - }, - _ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained \ - in balanced delimiters or a repetition indicator") + &TokenTree::Delimited(_, ref tts) => { + check_matcher(cx, tts.tts.iter(), &Eof); + }, + tt @ &TokenTree::Sequence(..) => { + check_matcher(cx, Some(tt).into_iter(), &Eof); + }, + _ => cx.span_err(sp, "Invalid macro matcher; matchers must be contained \ + in balanced delimiters or a repetition indicator") }; // we don't abort on errors on rejection, the driver will do that for us // after parsing/expansion. we can report every error in every macro this way. |
