removed unneccessary SyntaxExpander structs
This commit is contained in:
@@ -22,8 +22,7 @@ use std::hashmap::HashMap;
|
||||
|
||||
// new-style macro! tt code:
|
||||
//
|
||||
// SyntaxExpanderTT, SyntaxExpanderTTItem, MacResult,
|
||||
// NormalTT, IdentTT
|
||||
// MacResult, NormalTT, IdentTT
|
||||
//
|
||||
// also note that ast::mac used to have a bunch of extraneous cases and
|
||||
// is now probably a redundant AST node, can be merged with
|
||||
@@ -40,21 +39,11 @@ pub type ItemDecorator = @fn(@ExtCtxt,
|
||||
~[@ast::item])
|
||||
-> ~[@ast::item];
|
||||
|
||||
pub struct SyntaxExpanderTT {
|
||||
expander: SyntaxExpanderTTFun,
|
||||
span: Option<Span>
|
||||
}
|
||||
|
||||
pub type SyntaxExpanderTTFun = @fn(@ExtCtxt,
|
||||
Span,
|
||||
&[ast::token_tree])
|
||||
-> MacResult;
|
||||
|
||||
pub struct SyntaxExpanderTTItem {
|
||||
expander: SyntaxExpanderTTItemFun,
|
||||
span: Option<Span>
|
||||
}
|
||||
|
||||
pub type SyntaxExpanderTTItemFun = @fn(@ExtCtxt,
|
||||
Span,
|
||||
ast::Ident,
|
||||
@@ -76,7 +65,7 @@ pub enum SyntaxExtension {
|
||||
ItemDecorator(ItemDecorator),
|
||||
|
||||
// Token-tree expanders
|
||||
NormalTT(SyntaxExpanderTT),
|
||||
NormalTT(SyntaxExpanderTTFun, Option<Span>),
|
||||
|
||||
// An IdentTT is a macro that has an
|
||||
// identifier in between the name of the
|
||||
@@ -86,7 +75,7 @@ pub enum SyntaxExtension {
|
||||
|
||||
// perhaps macro_rules! will lose its odd special identifier argument,
|
||||
// and this can go away also
|
||||
IdentTT(SyntaxExpanderTTItem),
|
||||
IdentTT(SyntaxExpanderTTItemFun, Option<Span>),
|
||||
}
|
||||
|
||||
// The SyntaxEnv is the environment that's threaded through the expansion
|
||||
@@ -121,11 +110,11 @@ type RenameList = ~[(ast::Ident,Name)];
|
||||
pub fn syntax_expander_table() -> SyntaxEnv {
|
||||
// utility function to simplify creating NormalTT syntax extensions
|
||||
fn builtin_normal_tt(f: SyntaxExpanderTTFun) -> @Transformer {
|
||||
@SE(NormalTT(SyntaxExpanderTT{expander: f, span: None}))
|
||||
@SE(NormalTT(f, None))
|
||||
}
|
||||
// utility function to simplify creating IdentTT syntax extensions
|
||||
fn builtin_item_tt(f: SyntaxExpanderTTItemFun) -> @Transformer {
|
||||
@SE(IdentTT(SyntaxExpanderTTItem{expander: f, span: None}))
|
||||
@SE(IdentTT(f, None))
|
||||
}
|
||||
let mut syntax_expanders = HashMap::new();
|
||||
// NB identifier starts with space, and can't conflict with legal idents
|
||||
|
||||
Reference in New Issue
Block a user