Skip to content

Commit b070590

Browse files
committed
libsyntax: De-export libsyntax. rs=deexporting
1 parent a80a65b commit b070590

22 files changed

+579
-610
lines changed

src/libsyntax/ext/auto_encode.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,16 +101,13 @@ use core::vec;
101101
use std::map;
102102
use std::map::HashMap;
103103

104-
export expand_auto_encode;
105-
export expand_auto_decode;
106-
107104
// Transitional reexports so qquote can find the paths it is looking for
108105
mod syntax {
109106
pub use ext;
110107
pub use parse;
111108
}
112109

113-
fn expand_auto_encode(
110+
pub fn expand_auto_encode(
114111
cx: ext_ctxt,
115112
span: span,
116113
_mitem: ast::meta_item,
@@ -165,7 +162,7 @@ fn expand_auto_encode(
165162
}
166163
}
167164

168-
fn expand_auto_decode(
165+
pub fn expand_auto_decode(
169166
cx: ext_ctxt,
170167
span: span,
171168
_mitem: ast::meta_item,

src/libsyntax/ext/base.rs

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,38 +32,38 @@ use std::map::HashMap;
3232
// is now probably a redundant AST node, can be merged with
3333
// ast::mac_invoc_tt.
3434

35-
struct MacroDef {
35+
pub struct MacroDef {
3636
name: ~str,
3737
ext: SyntaxExtension
3838
}
3939

40-
type ItemDecorator =
40+
pub type ItemDecorator =
4141
fn@(ext_ctxt, span, ast::meta_item, ~[@ast::item]) -> ~[@ast::item];
4242

43-
struct SyntaxExpanderTT {
43+
pub struct SyntaxExpanderTT {
4444
expander: SyntaxExpanderTTFun,
4545
span: Option<span>
4646
}
4747

48-
type SyntaxExpanderTTFun = fn@(ext_ctxt, span, ~[ast::token_tree])
49-
-> MacResult;
48+
pub type SyntaxExpanderTTFun = fn@(ext_ctxt, span, ~[ast::token_tree])
49+
-> MacResult;
5050

51-
struct SyntaxExpanderTTItem {
51+
pub struct SyntaxExpanderTTItem {
5252
expander: SyntaxExpanderTTItemFun,
5353
span: Option<span>
5454
}
5555

56-
type SyntaxExpanderTTItemFun
56+
pub type SyntaxExpanderTTItemFun
5757
= fn@(ext_ctxt, span, ast::ident, ~[ast::token_tree]) -> MacResult;
5858

59-
enum MacResult {
59+
pub enum MacResult {
6060
MRExpr(@ast::expr),
6161
MRItem(@ast::item),
6262
MRAny(fn@()-> @ast::expr, fn@()-> Option<@ast::item>, fn@()->@ast::stmt),
6363
MRDef(MacroDef)
6464
}
6565

66-
enum SyntaxExtension {
66+
pub enum SyntaxExtension {
6767

6868
// #[auto_encode] and such
6969
ItemDecorator(ItemDecorator),
@@ -78,7 +78,7 @@ enum SyntaxExtension {
7878

7979
// A temporary hard-coded map of methods for expanding syntax extension
8080
// AST nodes into full ASTs
81-
fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
81+
pub fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
8282
fn builtin_normal_tt(f: SyntaxExpanderTTFun) -> SyntaxExtension {
8383
NormalTT(SyntaxExpanderTT{expander: f, span: None})
8484
}
@@ -161,7 +161,7 @@ fn syntax_expander_table() -> HashMap<~str, SyntaxExtension> {
161161
// One of these is made during expansion and incrementally updated as we go;
162162
// when a macro expansion occurs, the resulting nodes have the backtrace()
163163
// -> expn_info of their expansion context stored into their span.
164-
trait ext_ctxt {
164+
pub trait ext_ctxt {
165165
fn codemap() -> @CodeMap;
166166
fn parse_sess() -> parse::parse_sess;
167167
fn cfg() -> ast::crate_cfg;
@@ -187,8 +187,8 @@ trait ext_ctxt {
187187
fn ident_of(st: ~str) -> ast::ident;
188188
}
189189

190-
fn mk_ctxt(parse_sess: parse::parse_sess,
191-
cfg: ast::crate_cfg) -> ext_ctxt {
190+
pub fn mk_ctxt(parse_sess: parse::parse_sess,
191+
cfg: ast::crate_cfg) -> ext_ctxt {
192192
type ctxt_repr = {parse_sess: parse::parse_sess,
193193
cfg: ast::crate_cfg,
194194
mut backtrace: Option<@ExpnInfo>,
@@ -281,7 +281,7 @@ fn mk_ctxt(parse_sess: parse::parse_sess,
281281
move ((move imp) as ext_ctxt)
282282
}
283283

284-
fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
284+
pub fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
285285
match expr.node {
286286
ast::expr_lit(l) => match l.node {
287287
ast::lit_str(s) => return *s,
@@ -291,9 +291,9 @@ fn expr_to_str(cx: ext_ctxt, expr: @ast::expr, err_msg: ~str) -> ~str {
291291
}
292292
}
293293

294-
fn expr_to_ident(cx: ext_ctxt,
295-
expr: @ast::expr,
296-
err_msg: ~str) -> ast::ident {
294+
pub fn expr_to_ident(cx: ext_ctxt,
295+
expr: @ast::expr,
296+
err_msg: ~str) -> ast::ident {
297297
match expr.node {
298298
ast::expr_path(p) => {
299299
if vec::len(p.types) > 0u || vec::len(p.idents) != 1u {
@@ -305,15 +305,17 @@ fn expr_to_ident(cx: ext_ctxt,
305305
}
306306
}
307307

308-
fn check_zero_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
309-
name: &str) {
308+
pub fn check_zero_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
309+
name: &str) {
310310
if tts.len() != 0 {
311311
cx.span_fatal(sp, fmt!("%s takes no arguments", name));
312312
}
313313
}
314314

315-
fn get_single_str_from_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
316-
name: &str) -> ~str {
315+
pub fn get_single_str_from_tts(cx: ext_ctxt,
316+
sp: span,
317+
tts: &[ast::token_tree],
318+
name: &str) -> ~str {
317319
if tts.len() != 1 {
318320
cx.span_fatal(sp, fmt!("%s takes 1 argument.", name));
319321
}
@@ -325,8 +327,8 @@ fn get_single_str_from_tts(cx: ext_ctxt, sp: span, tts: &[ast::token_tree],
325327
}
326328
}
327329

328-
fn get_exprs_from_tts(cx: ext_ctxt, tts: ~[ast::token_tree])
329-
-> ~[@ast::expr] {
330+
pub fn get_exprs_from_tts(cx: ext_ctxt, tts: ~[ast::token_tree])
331+
-> ~[@ast::expr] {
330332
let p = parse::new_parser_from_tts(cx.parse_sess(),
331333
cx.cfg(),
332334
tts);

0 commit comments

Comments
 (0)