]> git.lizzy.rs Git - rust.git/blob - src/libregex/lib.rs
Set allow(unstable) in crates that use unstable features
[rust.git] / src / libregex / lib.rs
1 // Copyright 2014 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 // ignore-lexer-test FIXME #15679
12
13 //! Regular expressions implemented in Rust
14 //!
15 //! For official documentation, see the rust-lang/regex crate
16 #![crate_name = "regex"]
17 #![crate_type = "rlib"]
18 #![crate_type = "dylib"]
19 #![unstable = "use the crates.io `regex` library instead"]
20 #![staged_api]
21 #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
22        html_favicon_url = "http://www.rust-lang.org/favicon.ico",
23        html_root_url = "http://doc.rust-lang.org/nightly/",
24        html_playground_url = "http://play.rust-lang.org/")]
25
26 #![allow(unknown_features)]
27 #![allow(unstable)]
28 #![feature(slicing_syntax)]
29 #![feature(box_syntax)]
30 #![allow(unknown_features)] #![feature(int_uint)]
31 #![deny(missing_docs)]
32
33 #[cfg(test)]
34 extern crate "test" as stdtest;
35 #[cfg(test)]
36 extern crate rand;
37
38 // During tests, this links with the `regex` crate so that the `regex!` macro
39 // can be tested.
40 #[cfg(test)]
41 extern crate regex;
42
43 // Unicode tables for character classes are defined in libunicode
44 extern crate unicode;
45
46 pub use parse::Error;
47 pub use re::{Regex, Captures, SubCaptures, SubCapturesPos};
48 pub use re::{FindCaptures, FindMatches};
49 pub use re::{Replacer, NoExpand, RegexSplits, RegexSplitsN};
50 pub use re::{quote, is_match};
51
52 mod compile;
53 mod parse;
54 mod re;
55 mod vm;
56
57 #[cfg(test)]
58 mod test;
59
60 /// The `native` module exists to support the `regex!` macro. Do not use.
61 #[doc(hidden)]
62 pub mod native {
63     // Exporting this stuff is bad form, but it's necessary for two reasons.
64     // Firstly, the `regex!` syntax extension is in a different crate and
65     // requires access to the representation of a regex (particularly the
66     // instruction set) in order to compile to native Rust. This could be
67     // mitigated if `regex!` was defined in the same crate, but this has
68     // undesirable consequences (such as requiring a dependency on
69     // `libsyntax`).
70     //
71     // Secondly, the code generated by `regex!` must *also* be able
72     // to access various functions in this crate to reduce code duplication
73     // and to provide a value with precisely the same `Regex` type in this
74     // crate. This, AFAIK, is impossible to mitigate.
75     //
76     // On the bright side, `rustdoc` lets us hide this from the public API
77     // documentation.
78     pub use compile::{
79         Program,
80         OneChar, CharClass, Any, Save, Jump, Split,
81         Match, EmptyBegin, EmptyEnd, EmptyWordBoundary,
82     };
83     pub use parse::{
84         FLAG_EMPTY, FLAG_NOCASE, FLAG_MULTI, FLAG_DOTNL,
85         FLAG_SWAP_GREED, FLAG_NEGATED,
86     };
87     pub use re::{Dynamic, ExDynamic, Native, ExNative};
88     pub use vm::{
89         MatchKind, Exists, Location, Submatches,
90         StepState, StepMatchEarlyReturn, StepMatch, StepContinue,
91         CharReader, find_prefix,
92     };
93 }