/src/libsyntax/lib.rs

https://gitlab.com/alx741/rust · Rust · 127 lines · 94 code · 14 blank · 19 comment · 1 complexity · 529b9f90604476b50748aa8a0504fc8a MD5 · raw file

  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. //! The Rust parser and macro expander.
  11. //!
  12. //! # Note
  13. //!
  14. //! This API is completely unstable and subject to change.
  15. #![crate_name = "syntax"]
  16. #![unstable(feature = "rustc_private", issue = "27812")]
  17. #![crate_type = "dylib"]
  18. #![crate_type = "rlib"]
  19. #![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
  20. html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
  21. html_root_url = "https://doc.rust-lang.org/nightly/",
  22. test(attr(deny(warnings))))]
  23. #![cfg_attr(not(stage0), deny(warnings))]
  24. #![feature(associated_consts)]
  25. #![feature(const_fn)]
  26. #![feature(filling_drop)]
  27. #![feature(libc)]
  28. #![feature(rustc_private)]
  29. #![feature(staged_api)]
  30. #![feature(str_escape)]
  31. #![feature(unicode)]
  32. #![feature(question_mark)]
  33. #![feature(range_contains)]
  34. extern crate serialize;
  35. extern crate term;
  36. extern crate libc;
  37. #[macro_use] extern crate log;
  38. #[macro_use] #[no_link] extern crate rustc_bitflags;
  39. extern crate rustc_unicode;
  40. extern crate serialize as rustc_serialize; // used by deriving
  41. // A variant of 'try!' that panics on an Err. This is used as a crutch on the
  42. // way towards a non-panic!-prone parser. It should be used for fatal parsing
  43. // errors; eventually we plan to convert all code using panictry to just use
  44. // normal try.
  45. // Exported for syntax_ext, not meant for general use.
  46. #[macro_export]
  47. macro_rules! panictry {
  48. ($e:expr) => ({
  49. use std::result::Result::{Ok, Err};
  50. use $crate::errors::FatalError;
  51. match $e {
  52. Ok(e) => e,
  53. Err(mut e) => {
  54. e.emit();
  55. panic!(FatalError);
  56. }
  57. }
  58. })
  59. }
  60. pub mod util {
  61. pub mod interner;
  62. pub mod lev_distance;
  63. pub mod node_count;
  64. pub mod parser;
  65. #[cfg(test)]
  66. pub mod parser_testing;
  67. pub mod small_vector;
  68. pub mod move_map;
  69. }
  70. pub mod diagnostics {
  71. pub mod macros;
  72. pub mod plugin;
  73. pub mod registry;
  74. pub mod metadata;
  75. }
  76. pub mod errors;
  77. pub mod syntax {
  78. pub use ext;
  79. pub use parse;
  80. pub use ast;
  81. }
  82. pub mod abi;
  83. pub mod ast;
  84. pub mod attr;
  85. pub mod codemap;
  86. pub mod config;
  87. pub mod entry;
  88. pub mod feature_gate;
  89. pub mod fold;
  90. pub mod parse;
  91. pub mod ptr;
  92. pub mod show_span;
  93. pub mod std_inject;
  94. pub mod str;
  95. pub mod test;
  96. pub mod visit;
  97. pub mod print {
  98. pub mod pp;
  99. pub mod pprust;
  100. }
  101. pub mod ext {
  102. pub mod base;
  103. pub mod build;
  104. pub mod expand;
  105. pub mod mtwt;
  106. pub mod quote;
  107. pub mod source_util;
  108. pub mod tt {
  109. pub mod transcribe;
  110. pub mod macro_parser;
  111. pub mod macro_rules;
  112. }
  113. }