diff --git a/src/rustc/front/attr.rs b/src/librustsyntax/attr.rs similarity index 97% rename from src/rustc/front/attr.rs rename to src/librustsyntax/attr.rs index cc41957a021..3736c2f374e 100644 --- a/src/rustc/front/attr.rs +++ b/src/librustsyntax/attr.rs @@ -3,8 +3,7 @@ import std::map; import std::map::hashmap; import either::either; -import syntax::{ast, ast_util}; -import driver::diagnostic::span_handler; +import diagnostic::span_handler; export attr_meta; export attr_metas; @@ -169,10 +168,10 @@ fn eq(a: @ast::meta_item, b: @ast::meta_item) -> bool { fn contains(haystack: [@ast::meta_item], needle: @ast::meta_item) -> bool { #debug("looking for %s", - syntax::print::pprust::meta_item_to_str(*needle)); + print::pprust::meta_item_to_str(*needle)); for item: @ast::meta_item in haystack { #debug("looking in %s", - syntax::print::pprust::meta_item_to_str(*item)); + print::pprust::meta_item_to_str(*item)); if eq(item, needle) { #debug("found it!"); ret true; } } #debug("found it not :("); diff --git a/src/rustc/syntax/parse/eval.rs b/src/librustsyntax/parse/eval.rs similarity index 92% rename from src/rustc/syntax/parse/eval.rs rename to src/librustsyntax/parse/eval.rs index b56f26230b9..42187ad9c7c 100644 --- a/src/rustc/syntax/parse/eval.rs +++ b/src/librustsyntax/parse/eval.rs @@ -1,9 +1,7 @@ -import front::attr; -import syntax::ast; -import syntax::parse::token; -import syntax::parse::parser::{parser, new_parser_from_file, - parse_inner_attrs_and_next, - parse_mod_items, SOURCE_FILE}; +import attr; +import parser::{parser, new_parser_from_file, + parse_inner_attrs_and_next, + parse_mod_items, SOURCE_FILE}; export eval_crate_directives_to_mod; @@ -109,8 +107,8 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, let m0 = parse_mod_items(p0, token::EOF, first_item_outer_attrs); let i = - syntax::parse::parser::mk_item(p0, cdir.span.lo, cdir.span.hi, id, - ast::item_mod(m0), mod_attrs); + parser::mk_item(p0, cdir.span.lo, cdir.span.hi, id, + ast::item_mod(m0), mod_attrs); // Thread defids, chpos and byte_pos through the parsers cx.sess.chpos = p0.reader.chpos; cx.sess.byte_pos = cx.sess.byte_pos + p0.reader.pos; diff --git a/src/rustc/syntax/parse/parser.rs b/src/librustsyntax/parse/parser.rs similarity index 99% rename from src/rustc/syntax/parse/parser.rs rename to src/librustsyntax/parse/parser.rs index 0ef54e09993..7d3d30d1a2f 100644 --- a/src/rustc/syntax/parse/parser.rs +++ b/src/librustsyntax/parse/parser.rs @@ -6,9 +6,7 @@ import codemap::{span,fss_none}; import util::interner; import ast::{node_id, spanned}; import ast_util::{mk_sp, ident_to_path}; -import front::attr; import lexer::reader; -import driver::diagnostic; enum restriction { UNRESTRICTED, diff --git a/src/rustc/syntax/print/pp.rs b/src/librustsyntax/print/pp.rs similarity index 100% rename from src/rustc/syntax/print/pp.rs rename to src/librustsyntax/print/pp.rs diff --git a/src/rustc/syntax/print/pprust.rs b/src/librustsyntax/print/pprust.rs similarity index 99% rename from src/rustc/syntax/print/pprust.rs rename to src/librustsyntax/print/pprust.rs index a1c118c3144..1a4780f78ae 100644 --- a/src/rustc/syntax/print/pprust.rs +++ b/src/librustsyntax/print/pprust.rs @@ -1,9 +1,9 @@ import parse::lexer; -import syntax::codemap::codemap; +import codemap::codemap; import pp::{break_offset, word, printer, space, zerobreak, hardbreak, breaks, consistent, inconsistent, eof}; -import driver::diagnostic; +import diagnostic; // The ps is stored here to prevent recursive type. enum ann_node { diff --git a/src/librustsyntax/rustsyntax.rc b/src/librustsyntax/rustsyntax.rc index 081f31f7b00..1a321f91554 100644 --- a/src/librustsyntax/rustsyntax.rc +++ b/src/librustsyntax/rustsyntax.rc @@ -6,6 +6,7 @@ use std; +mod attr; mod diagnostic; mod codemap; mod ast; @@ -16,6 +17,13 @@ mod util { mod interner; } mod parse { - mod token; + mod eval; mod lexer; + mod parser; + mod token; +} + +mod print { + mod pp; + mod pprust; } \ No newline at end of file diff --git a/src/rustc/front.rs b/src/rustc/front.rs new file mode 100644 index 00000000000..f94decc900b --- /dev/null +++ b/src/rustc/front.rs @@ -0,0 +1,6 @@ +import rustsyntax::attr; +export attr; + +export config; +export test; +export core_inject; diff --git a/src/rustc/rustc.rc b/src/rustc/rustc.rc index d161eeb78db..837a28e5d00 100644 --- a/src/rustc/rustc.rc +++ b/src/rustc/rustc.rc @@ -70,10 +70,6 @@ mod middle { mod syntax { - mod parse { - mod parser; - mod eval; - } mod ext { mod base; mod expand; @@ -88,14 +84,9 @@ mod syntax { mod log_syntax; mod auto_serialize; } - mod print { - mod pprust; - mod pp; - } } mod front { - mod attr; mod config; mod test; mod core_inject; diff --git a/src/rustc/syntax.rs b/src/rustc/syntax.rs index 4eb6021127f..a11734a2858 100644 --- a/src/rustc/syntax.rs +++ b/src/rustc/syntax.rs @@ -14,13 +14,17 @@ export visit; import rustsyntax::fold; export fold; +import rustsyntax::print; +export print; + +import rustsyntax::parse; +export parse; + export ast; export ast_util; export visit; export fold; -export parse; export ext; -export print; export util; mod util { diff --git a/src/rustc/syntax/parse.rs b/src/rustc/syntax/parse.rs deleted file mode 100644 index 5fffd171dd7..00000000000 --- a/src/rustc/syntax/parse.rs +++ /dev/null @@ -1,7 +0,0 @@ -import rustsyntax::parse::token; -export token; - -import rustsyntax::parse::lexer; -export lexer; - -export parser; \ No newline at end of file