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.
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.
11 //! The Rust parser and macro expander.
15 //! This API is completely unstable and subject to change.
17 #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
18 html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
19 html_root_url = "https://doc.rust-lang.org/nightly/",
20 test(attr(deny(warnings))))]
24 #![feature(rustc_diagnostic_macros)]
25 #![feature(match_default_bindings)]
26 #![feature(i128_type)]
27 #![feature(const_atomic_usize_new)]
29 // See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
30 #[allow(unused_extern_crates)]
31 extern crate rustc_cratesio_shim;
33 #[macro_use] extern crate bitflags;
34 extern crate serialize;
35 #[macro_use] extern crate log;
36 extern crate std_unicode;
37 pub extern crate rustc_errors as errors;
38 extern crate syntax_pos;
39 extern crate rustc_data_structures;
41 extern crate serialize as rustc_serialize; // used by deriving
43 // A variant of 'try!' that panics on an Err. This is used as a crutch on the
44 // way towards a non-panic!-prone parser. It should be used for fatal parsing
45 // errors; eventually we plan to convert all code using panictry to just use
47 // Exported for syntax_ext, not meant for general use.
49 macro_rules! panictry {
51 use std::result::Result::{Ok, Err};
52 use errors::FatalError;
64 macro_rules! unwrap_or {
65 ($opt:expr, $default:expr) => {
81 // NB: This module needs to be declared first so diagnostics are
82 // registered before they are used.
83 pub mod diagnostic_list;
90 pub mod parser_testing;
95 pub use self::thin_vec::ThinVec;
98 pub use self::rc_slice::RcSlice;
116 pub mod feature_gate;
123 pub use syntax_pos::symbol;
134 pub use syntax_pos::hygiene;
139 pub mod placeholders;
145 pub mod macro_parser;
154 #[cfg(not(stage0))] // remove after the next snapshot
155 __build_diagnostic_array! { libsyntax, DIAGNOSTICS }