syntex_syntax 0.7.0

Export of libsyntax for code generation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
b0VIM 7.4	�tU+�B�ericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-syntex/syntex_syntax/src/fold.rs	3210#"! Utpq��������}r��������m���������c\��������d���������a#��������D���������]���������m%��������\���������n���������X\��������U���������l	"uad�q�{XU��M)(�
�
]
T
P

��POC:,�������hQ�
�
x
r
p
o
H
�	�	�	�	�	�	h	)	���jBA����b\[����f`_�����{zD����d932����d?98�����ysr0���    }        s.and_then(|s| noop_fold_stmt(s, self))    fn fold_stmt(&mut self, s: P<Stmt>) -> SmallVector<P<Stmt>> {    }        noop_fold_block(b, self)    fn fold_block(&mut self, b: P<Block>) -> P<Block> {    }        noop_fold_fn_decl(d, self)    fn fold_fn_decl(&mut self, d: P<FnDecl>) -> P<FnDecl> {    }        noop_fold_impl_item(i, self)    fn fold_impl_item(&mut self, i: P<ImplItem>) -> SmallVector<P<ImplItem>> {    }        noop_fold_trait_item(i, self)    fn fold_trait_item(&mut self, i: P<TraitItem>) -> SmallVector<P<TraitItem>> {    }        noop_fold_item_underscore(i, self)    fn fold_item_underscore(&mut self, i: Item_) -> Item_ {    }        noop_fold_struct_field(sf, self)    fn fold_struct_field(&mut self, sf: StructField) -> StructField {    }        noop_fold_item_simple(i, self)    fn fold_item_simple(&mut self, i: Item) -> Item {    }        noop_fold_item(i, self)    fn fold_item(&mut self, i: P<Item>) -> SmallVector<P<Item>> {    }        noop_fold_foreign_item(ni, self)    fn fold_foreign_item(&mut self, ni: P<ForeignItem>) -> P<ForeignItem> {    }        noop_fold_view_path(view_path, self)    fn fold_view_path(&mut self, view_path: P<ViewPath>) -> P<ViewPath> {    }        noop_fold_meta_item(meta_item, self)    fn fold_meta_item(&mut self, meta_item: P<MetaItem>) -> P<MetaItem> {    }        noop_fold_meta_items(meta_items, self)    fn fold_meta_items(&mut self, meta_items: Vec<P<MetaItem>>) -> Vec<P<MetaItem>> {    }        noop_fold_crate(c, self)    fn fold_crate(&mut self, c: Crate) -> Crate {    // in an overridden default method.    // being able to call out to the super default method    // This is a necessary API workaround to the problem of not    //    // out to the folder again, not other `noop_*` functions.    // of a call to a public `noop_*` function that only calls    // Any additions to this trait should happen in formpub trait Folder : Sized {}    }        OwnedSlice::from_vec(self.into_vec().move_map(f))    fn move_map<F>(self, f: F) -> OwnedSlice<T> where F: FnMut(T) -> T {impl<T> MoveMap<T> for OwnedSlice<T> {}    }        self.into_iter().map(|p| f(p)).collect()    fn move_map<F>(self, mut f: F) -> Vec<T> where F: FnMut(T) -> T {impl<T> MoveMap<T> for Vec<T> {}    fn move_map<F>(self, f: F) -> Self where F: FnMut(T) -> T;pub trait MoveMap<T> {// This could have a better place to live.use std::rc::Rc;use util::small_vector::SmallVector;use ptr::P;use parse::token;use owned_slice::OwnedSlice;use codemap::{respan, Span, Spanned};use ast_util;use ast;use ast::*;//! that are created by the expansion of a macro.//! a folder renaming item names in a module will miss all of those//! an AST before macro expansion is probably a bad idea. For instance,//! Note: using a Folder (other than the MacroExpander Folder) on//!//! AST.//! expansion is a Folder that walks over an AST and produces another//! and returns a piece of the same type. So, for instance, macro//! A Folder represents an AST->AST fold; it accepts an AST piece,// except according to those terms.// option. This file may not be copied, modified, or distributed// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or//// http://rust-lang.org/COPYRIGHT.// file at the top-level directory of this distribution and at// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHTadQ
�
"��qcYSR���['�
�
�
6
0
/


���Q"����M�
�
�
�
}    }            "zz!zz((zz$zz:zz$(zz $zz:zz)zz+=>(zz$(zz$zz$zz)+)));".to_string());            pprust::to_string(|s| fake_print_crate(s, &folded_crate)),            "matches_codepattern",            matches_codepattern,        assert_pred!(        let folded_crate = zz_fold.fold_crate(ast);             (g $(d $d $e)+))} ".to_string());            "macro_rules! a {(b $c:expr $(d $e:token)f+ => \        let ast = string_to_crate(        let mut zz_fold = ToZzIdentFolder;    #[test] fn ident_transformation_in_defs () {    // even inside macro defs....    }            "#[a]mod zz{fn zz(zz:zz,zz:zz){zz!(zz,zz,zz);zz;zz}}".to_string());            pprust::to_string(|s| fake_print_crate(s, &folded_crate)),            "matches_codepattern",            matches_codepattern,        assert_pred!(        let folded_crate = zz_fold.fold_crate(ast);            "#[a] mod b {fn c (d : e, f : g) {h!(i,j,k);l;m}}".to_string());        let ast = string_to_crate(        let mut zz_fold = ToZzIdentFolder;    #[test] fn ident_transformation () {    // make sure idents get transformed everywhere    }        )            }                }                          $predname, a_val, b_val);                    panic!("expected args satisfying {}, got {} and {}",