]> git.lizzy.rs Git - rust.git/blob - src/libsyntax/lib.rs
Auto merge of #38049 - frewsxcv:libunicode, r=alexcrichton
[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 #![crate_name = "syntax"]
18 #![unstable(feature = "rustc_private", issue = "27812")]
19 #![crate_type = "dylib"]
20 #![crate_type = "rlib"]
21 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22        html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
23        html_root_url = "https://doc.rust-lang.org/nightly/",
24        test(attr(deny(warnings))))]
25 #![cfg_attr(not(stage0), deny(warnings))]
26
27 #![feature(associated_consts)]
28 #![feature(const_fn)]
29 #![feature(libc)]
30 #![feature(optin_builtin_traits)]
31 #![feature(rustc_private)]
32 #![feature(staged_api)]
33 #![feature(str_escape)]
34 #![feature(unicode)]
35 #![feature(rustc_diagnostic_macros)]
36 #![feature(specialization)]
37
38 extern crate core;
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 extern crate std_unicode;
45 pub extern crate rustc_errors as errors;
46 extern crate syntax_pos;
47 extern crate rustc_data_structures;
48
49 extern crate serialize as rustc_serialize; // used by deriving
50
51
52 // A variant of 'try!' that panics on an Err. This is used as a crutch on the
53 // way towards a non-panic!-prone parser. It should be used for fatal parsing
54 // errors; eventually we plan to convert all code using panictry to just use
55 // normal try.
56 // Exported for syntax_ext, not meant for general use.
57 #[macro_export]
58 macro_rules! panictry {
59     ($e:expr) => ({
60         use std::result::Result::{Ok, Err};
61         use errors::FatalError;
62         match $e {
63             Ok(e) => e,
64             Err(mut e) => {
65                 e.emit();
66                 panic!(FatalError);
67             }
68         }
69     })
70 }
71
72 #[macro_use]
73 pub mod diagnostics {
74     #[macro_use]
75     pub mod macros;
76     pub mod plugin;
77     pub mod metadata;
78 }
79
80 // NB: This module needs to be declared first so diagnostics are
81 // registered before they are used.
82 pub mod diagnostic_list;
83
84 pub mod util {
85     pub mod lev_distance;
86     pub mod node_count;
87     pub mod parser;
88     #[cfg(test)]
89     pub mod parser_testing;
90     pub mod small_vector;
91     pub mod move_map;
92
93     mod thin_vec;
94     pub use self::thin_vec::ThinVec;
95 }
96
97 pub mod json;
98
99 pub mod syntax {
100     pub use ext;
101     pub use parse;
102     pub use ast;
103 }
104
105 pub mod abi;
106 pub mod ast;
107 pub mod attr;
108 pub mod codemap;
109 #[macro_use]
110 pub mod config;
111 pub mod entry;
112 pub mod feature_gate;
113 pub mod fold;
114 pub mod parse;
115 pub mod ptr;
116 pub mod show_span;
117 pub mod std_inject;
118 pub mod str;
119 pub mod symbol;
120 pub mod test;
121 pub mod tokenstream;
122 pub mod visit;
123
124 pub mod print {
125     pub mod pp;
126     pub mod pprust;
127 }
128
129 pub mod ext {
130     pub mod base;
131     pub mod build;
132     pub mod expand;
133     pub mod placeholders;
134     pub mod hygiene;
135     pub mod proc_macro_shim;
136     pub mod quote;
137     pub mod source_util;
138
139     pub mod tt {
140         pub mod transcribe;
141         pub mod macro_parser;
142         pub mod macro_rules;
143     }
144 }
145
146 #[cfg(test)]
147 mod test_snippet;
148
149 // __build_diagnostic_array! { libsyntax, DIAGNOSTICS }