]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/lib.rs
11c4b0f12610a4f3a7984484863cbb91f438b0ff
[rust.git] / src / libsyntax / lib.rs
1 // Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! The Rust parser and macro expander.
12 //!
13 //! # Note
14 //!
15 //! This API is completely unstable and subject to change.
16
17 // Do not remove on snapshot creation. Needed for bootstrap. (Issue #22364)
18 #![cfg_attr(stage0, feature(custom_attribute))]
19 #![crate_name = "syntax"]
20 #![unstable(feature = "rustc_private")]
21 #![staged_api]
22 #![crate_type = "dylib"]
23 #![crate_type = "rlib"]
24 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
25        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
26        html_root_url = "http://doc.rust-lang.org/nightly/")]
27
28 #![feature(associated_consts)]
29 #![feature(collections)]
30 #![feature(collections_drain)]
31 #![feature(core)]
32 #![feature(libc)]
33 #![feature(rustc_private)]
34 #![feature(staged_api)]
35 #![feature(str_char)]
36 #![feature(unicode)]
37
38 extern crate fmt_macros;
39 extern crate serialize;
40 extern crate term;
41 extern crate libc;
42 #[macro_use] extern crate log;
43 #[macro_use] #[no_link] extern crate rustc_bitflags;
44
45 extern crate serialize as rustc_serialize; // used by deriving
46
47 // A variant of 'try!' that panics on Err(FatalError). This is used as a
48 // crutch on the way towards a non-panic!-prone parser. It should be used
49 // for fatal parsing errors; eventually we plan to convert all code using
50 // panictry to just use normal try
51 macro_rules! panictry {
52     ($e:expr) => ({
53         use std::result::Result::{Ok, Err};
54         use diagnostic::FatalError;
55         match $e {
56             Ok(e) => e,
57             Err(FatalError) => panic!(FatalError)
58         }
59     })
60 }
61
62 pub mod util {
63     pub mod interner;
64     #[cfg(test)]
65     pub mod parser_testing;
66     pub mod small_vector;
67 }
68
69 pub mod diagnostics {
70     pub mod macros;
71     pub mod plugin;
72     pub mod registry;
73     pub mod metadata;
74 }
75
76 pub mod syntax {
77     pub use ext;
78     pub use parse;
79     pub use ast;
80 }
81
82 pub mod abi;
83 pub mod ast;
84 pub mod ast_util;
85 pub mod attr;
86 pub mod codemap;
87 pub mod config;
88 pub mod diagnostic;
89 pub mod feature_gate;
90 pub mod fold;
91 pub mod owned_slice;
92 pub mod parse;
93 pub mod ptr;
94 pub mod show_span;
95 pub mod std_inject;
96 pub mod str;
97 pub mod test;
98 pub mod visit;
99
100 pub mod print {
101     pub mod pp;
102     pub mod pprust;
103 }
104
105 pub mod ext {
106     pub mod asm;
107     pub mod base;
108     pub mod build;
109     pub mod cfg;
110     pub mod concat;
111     pub mod concat_idents;
112     pub mod deriving;
113     pub mod env;
114     pub mod expand;
115     pub mod format;
116     pub mod log_syntax;
117     pub mod mtwt;
118     pub mod quote;
119     pub mod source_util;
120     pub mod trace_macros;
121
122     pub mod tt {
123         pub mod transcribe;
124         pub mod macro_parser;
125         pub mod macro_rules;
126     }
127 }