quasi_macros 0.1.1

A quasi-quoting macro system
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
b0VIM 7.4���T��TmYericktErick-Tryzelaar-MBP.local~erickt/projects/rust/rust-quasi/quote_macros/src/lib.rsutf-8
3210#"! Utph��������mi��������b���������g8��������_�(�ad�h��]Z��R.-�
�
�
�
�
�
�
�
h
H
1

�������L	���eW;�
�
�
�
�
c
B

�	�	p	n	m	9		��R/-,��rO����Y �����j/�����uE����h@
��][Z-��                           tts: &[ast::TokenTree])                           sp: Span,pub fn expand_quote_method(cx: &mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_parse_call(cx, sp, "parse_block", Vec::new(), tts);                              -> Box<base::MacResult+'cx> {                              tts: &[ast::TokenTree])                              sp: Span,pub fn expand_quote_block<'cx>(cx: &'cx mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_parse_call(cx, sp, "parse_arm", vec!(), tts);                        -> Box<base::MacResult+'static> {                        tts: &[ast::TokenTree])                        sp: Span,pub fn expand_quote_arm(cx: &mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_parse_call(cx, sp, "parse_pat", vec!(), tts);                             -> Box<base::MacResult+'cx> {                             tts: &[ast::TokenTree])                             sp: Span,pub fn expand_quote_pat<'cx>(cx: &'cx mut ExtCtxt,}    base::MacEager::expr(expanded)                                    vec!(e_attrs), tts);    let expanded = expand_parse_call(cx, sp, "parse_stmt",        .build();        .path().global().ids(&["std", "vec", "Vec", "new"]).build()    let e_attrs = builder.expr().call()    let builder = builder::AstBuilder::new(&ctx).span(sp);    let ctx = builder::Ctx::new();                         -> Box<base::MacResult+'static> {                         tts: &[ast::TokenTree])                         sp: Span,pub fn expand_quote_stmt(cx: &mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_parse_call(cx, sp, "parse_expr", Vec::new(), tts);                              -> Box<base::MacResult+'cx> {                              tts: &[ast::TokenTree])                              sp: Span,pub fn expand_quote_expr<'cx>(cx: &'cx mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_parse_call(cx, sp, "parse_ty", vec!(), tts);                       -> Box<base::MacResult+'static> {                       tts: &[ast::TokenTree])                       sp: Span,pub fn expand_quote_ty(cx: &mut ExtCtxt,}    base::MacEager::expr(expanded)    let expanded = expand_wrapper(sp, cx_expr, expr);    let (cx_expr, expr) = expand_tts(cx, sp, tts);) -> Box<base::MacResult+'cx> {    tts: &[ast::TokenTree],    sp: Span,    cx: &'cx mut ExtCtxt,pub fn expand_quote_tokens<'cx>(///  as antiquotes (splices).///  construction of the same token tree, with token::SubstNt interpreted///  that lifts its argument token-tree to an AST representing the///  This is registered as a set of expression syntax extension called quote!//////  Quasiquoting works via token trees.use rustc::plugin::Registry;use syntax::ptr::P;use syntax::parse::token;use syntax::parse::token::*;use syntax::ext::base;use syntax::ext::base::ExtCtxt;use syntax::codemap::Span;use syntax::ast;extern crate "syntax_ast_builder" as builder;extern crate rustc;extern crate syntax;#![feature(plugin_registrar, unboxed_closures, rustc_private)]// 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 The Rust Project Developers. See the COPYRIGHTad8
�
(����WA/.�����oL0�
�
�
t
s
M
K
J
6
'
���N��l/�
�
�
}    reg.register_macro("quote_item", expand_quote_item);    reg.register_macro("quote_method", expand_quote_method);    reg.register_macro("quote_block", expand_quote_block);    reg.register_macro("quote_arm", expand_quote_arm);    reg.register_macro("quote_pat", expand_quote_pat);    reg.register_macro("quote_stmt", expand_quote_stmt);    reg.register_macro("quote_expr", expand_quote_expr);    reg.register_macro("quote_ty", expand_quote_ty);    reg.register_macro("quote_tokens", expand_quote_tokens);pub fn plugin_registrar(reg: &mut Registry) {#[doc(hidden)]#[plugin_registrar]}    expand_wrapper(sp, cx_expr, expr)        .build();        .with_args(arg_exprs)        .build_expr(new_parser_call)    let expr = builder.expr().method_call(parse_method)        .build();        .with_arg(tts_expr)        .with_arg(cfg_call)        .with_arg(parse_sess_call)        .id("new_parser_from_tts")    let new_parser_call = builder.expr().call()        .build();        .id("ext_cx")    let parse_sess_call = builder.expr().method_call("parse_sess")        .build();        .id("ext_cx")    let cfg_call = builder.expr().method_call("cfg")    let (cx_expr, tts_expr) = expand_tts(cx, sp, tts);    let builder = builder::AstBuilder::new(&ctx).span(sp);