diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2017-05-13 21:40:06 +0200 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2017-05-15 23:56:09 +0200 |
| commit | 958c67d9c8ca74370e2052fd8a3d209b8184d1f4 (patch) | |
| tree | 8f89d2dddd401827953e94e8c3e8a0086a8fb068 /src/libsyntax/ext | |
| parent | a9c163ebe9deeaf74699fc8642d919cdb2b5e617 (diff) | |
| download | rust-958c67d9c8ca74370e2052fd8a3d209b8184d1f4.tar.gz rust-958c67d9c8ca74370e2052fd8a3d209b8184d1f4.zip | |
adressed comments by @kennytm and @petrochenkov
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 50 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 3 |
3 files changed, 31 insertions, 26 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index f78089aaa75..31a7e0d58d0 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -635,8 +635,8 @@ pub struct ExpansionData { } /// One of these is made during expansion and incrementally updated as we go; -/// when a macro expansion occurs, the resulting nodes have the backtrace() -/// -> `expn_info` of their expansion context stored into their span. +/// when a macro expansion occurs, the resulting nodes have the `backtrace() +/// -> expn_info` of their expansion context stored into their span. pub struct ExtCtxt<'a> { pub parse_sess: &'a parse::ParseSess, pub ecfg: expand::ExpansionConfig<'a>, diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 8e28135b11d..a0103a1e3fe 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -36,43 +36,47 @@ //! repetitions indicated by Kleene stars. It only advances or calls out to the //! real Rust parser when no `cur_eis` items remain //! -//! Example: Start parsing `a a a a b` against [· a $( a )* a b]. +//! Example: //! -//! Remaining input: `a a a a b` -//! `next_eis`: `[· a $( a )* a b]` +//! ```text, ignore +//! Start parsing a a a a b against [· a $( a )* a b]. //! -//! - - - Advance over an `a`. - - - +//! Remaining input: a a a a b +//! next_eis: [· a $( a )* a b] //! -//! Remaining input: `a a a b` -//! cur: `[a · $( a )* a b]` +//! - - - Advance over an a. - - - +//! +//! Remaining input: a a a b +//! cur: [a · $( a )* a b] //! Descend/Skip (first item). -//! next: `[a $( · a )* a b] [a $( a )* · a b]`. +//! next: [a $( · a )* a b] [a $( a )* · a b]. //! -//! - - - Advance over an `a`. - - - +//! - - - Advance over an a. - - - //! -//! Remaining input: `a a b` -//! cur: `[a $( a · )* a b]` next: `[a $( a )* a · b]` +//! Remaining input: a a b +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] //! Finish/Repeat (first item) -//! next: `[a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b]` +//! next: [a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b] //! -//! - - - Advance over an `a`. - - - (this looks exactly like the last step) +//! - - - Advance over an a. - - - (this looks exactly like the last step) //! -//! Remaining input: `a b` -//! cur: `[a $( a · )* a b]` next: `[a $( a )* a · b]` +//! Remaining input: a b +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] //! Finish/Repeat (first item) -//! next: `[a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b]` +//! next: [a $( a )* · a b] [a $( · a )* a b] [a $( a )* a · b] //! -//! - - - Advance over an `a`. - - - (this looks exactly like the last step) +//! - - - Advance over an a. - - - (this looks exactly like the last step) //! -//! Remaining input: `b` -//! cur: `[a $( a · )* a b]` next: `[a $( a )* a · b]` +//! Remaining input: b +//! cur: [a $( a · )* a b] next: [a $( a )* a · b] //! Finish/Repeat (first item) -//! next: `[a $( a )* · a b] [a $( · a )* a b]` +//! next: [a $( a )* · a b] [a $( · a )* a b] //! -//! - - - Advance over a `b`. - - - +//! - - - Advance over a b. - - - //! -//! Remaining input: `` -//! eof: `[a $( a )* a b ·]` +//! Remaining input: '' +//! eof: [a $( a )* a b ·] +//! ``` pub use self::NamedMatch::*; pub use self::ParseResult::*; @@ -485,7 +489,7 @@ pub fn parse(sess: &ParseSess, tts: TokenStream, ms: &[TokenTree], directory: Op } fn parse_nt<'a>(p: &mut Parser<'a>, sp: Span, name: &str) -> Nonterminal { - if let "tt" = name { + if name == "tt" { return token::NtTT(p.parse_token_tree()); } // check at the beginning and the parser checks after each bump diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 9e3fe30e7bf..4a307ab18a5 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -858,6 +858,7 @@ fn quoted_tt_to_string(tt: "ed::TokenTree) -> String { match *tt { quoted::TokenTree::Token(_, ref tok) => ::print::pprust::token_to_string(tok), quoted::TokenTree::MetaVarDecl(_, name, kind) => format!("${}:{}", name, kind), - _ => panic!("unexpected quoted::TokenTree::{{Sequence or Delimited}} in follow set checker"), + _ => panic!("unexpected quoted::TokenTree::{{Sequence or Delimited}} \ + in follow set checker"), } } |
