rename one of the two confusing MacroExpanders

There were two things named MacroExpander, which was confusing. I renamed
one of them TTMacroExpander.

[breaking change]
This commit is contained in:
John Clements
2014-07-10 12:09:56 -07:00
parent 3f3291e0c7
commit 50d9965c25
2 changed files with 6 additions and 5 deletions

View File

@@ -48,7 +48,8 @@ pub struct BasicMacroExpander {
pub span: Option<Span> pub span: Option<Span>
} }
pub trait MacroExpander { /// Represents a thing that maps token trees to Macro Results
pub trait TTMacroExpander {
fn expand(&self, fn expand(&self,
ecx: &mut ExtCtxt, ecx: &mut ExtCtxt,
span: Span, span: Span,
@@ -60,7 +61,7 @@ pub type MacroExpanderFn =
fn(ecx: &mut ExtCtxt, span: codemap::Span, token_tree: &[ast::TokenTree]) fn(ecx: &mut ExtCtxt, span: codemap::Span, token_tree: &[ast::TokenTree])
-> Box<MacResult>; -> Box<MacResult>;
impl MacroExpander for BasicMacroExpander { impl TTMacroExpander for BasicMacroExpander {
fn expand(&self, fn expand(&self,
ecx: &mut ExtCtxt, ecx: &mut ExtCtxt,
span: Span, span: Span,
@@ -259,7 +260,7 @@ pub enum SyntaxExtension {
/// A normal, function-like syntax extension. /// A normal, function-like syntax extension.
/// ///
/// `bytes!` is a `NormalTT`. /// `bytes!` is a `NormalTT`.
NormalTT(Box<MacroExpander + 'static>, Option<Span>), NormalTT(Box<TTMacroExpander + 'static>, Option<Span>),
/// A function-like syntax extension that has an extra ident before /// A function-like syntax extension that has an extra ident before
/// the block. /// the block.

View File

@@ -13,7 +13,7 @@ use ast::{TTDelim};
use ast; use ast;
use codemap::{Span, Spanned, DUMMY_SP}; use codemap::{Span, Spanned, DUMMY_SP};
use ext::base::{ExtCtxt, MacResult, MacroDef}; use ext::base::{ExtCtxt, MacResult, MacroDef};
use ext::base::{NormalTT, MacroExpander}; use ext::base::{NormalTT, TTMacroExpander};
use ext::base; use ext::base;
use ext::tt::macro_parser::{Success, Error, Failure}; use ext::tt::macro_parser::{Success, Error, Failure};
use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal}; use ext::tt::macro_parser::{NamedMatch, MatchedSeq, MatchedNonterminal};
@@ -95,7 +95,7 @@ struct MacroRulesMacroExpander {
rhses: Vec<Rc<NamedMatch>>, rhses: Vec<Rc<NamedMatch>>,
} }
impl MacroExpander for MacroRulesMacroExpander { impl TTMacroExpander for MacroRulesMacroExpander {
fn expand(&self, fn expand(&self,
cx: &mut ExtCtxt, cx: &mut ExtCtxt,
sp: Span, sp: Span,