unic_ucd_ident/lib.rs
1// Copyright 2017-2019 The UNIC Project Developers.
2//
3// See the COPYRIGHT file at the top-level directory of this distribution.
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#![no_std]
12#![warn(
13 bad_style,
14 missing_debug_implementations,
15 missing_docs,
16 unconditional_recursion
17)]
18#![forbid(unsafe_code)]
19
20//! # UNIC — UCD — Identifier Properties
21//!
22//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
23//!
24//! Accessor to the UCD properties used widely by [UAX31 Unicode Identifier and Pattern Syntax].
25//!
26//! # Features
27//!
28//! - `xid` (default): the `XID_Start` and `XID_Continue` properties.
29//!
30//! - `id` (optional): the `ID_Start` and `ID_Continue` properties.
31//! NOTE: in most cases, you should prefer using the `XID` properties
32//! because they are consistent under NFKC normalization.
33//!
34//! - `pattern` (optional): the `Pattern_Syntax` and `Pattern_White_Space` properties.
35//!
36//! [UAX31 Unicode Identifier and Pattern Syntax]: <https://www.unicode.org/reports/tr31/>
37
38#[macro_use]
39extern crate unic_char_property;
40#[macro_use]
41extern crate unic_char_range;
42
43mod pkg_info;
44pub use crate::pkg_info::{PKG_DESCRIPTION, PKG_NAME, PKG_VERSION};
45
46#[cfg(feature = "xid")]
47mod xid;
48#[cfg(feature = "xid")]
49pub use crate::xid::{is_xid_continue, is_xid_start, XidContinue, XidStart};
50
51#[cfg(feature = "id")]
52mod id;
53#[cfg(feature = "id")]
54pub use crate::id::{is_id_continue, is_id_start, IdContinue, IdStart};
55
56#[cfg(feature = "pattern")]
57mod pattern;
58#[cfg(feature = "pattern")]
59pub use crate::pattern::{
60 is_pattern_syntax,
61 is_pattern_whitespace,
62 PatternSyntax,
63 PatternWhitespace,
64};
65
66use unic_ucd_version::UnicodeVersion;
67
68/// The [Unicode version](https://www.unicode.org/versions/) of data
69pub const UNICODE_VERSION: UnicodeVersion = include!("../tables/unicode_version.rsv");