#![forbid(unsafe_code)]
#![deny(missing_docs)]
#![doc(
html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png"
)]
#![no_std]
#![cfg_attr(feature = "bench", feature(test, unicode_internals))]
#[cfg(test)]
#[macro_use]
extern crate std;
#[cfg(feature = "bench")]
extern crate test;
use tables::derived_property;
pub use tables::UNICODE_VERSION;
mod tables;
#[cfg(test)]
mod tests;
pub trait UnicodeXID {
fn is_xid_start(self) -> bool;
fn is_xid_continue(self) -> bool;
}
impl UnicodeXID for char {
#[inline]
fn is_xid_start(self) -> bool {
('a' <= self && self <= 'z')
|| ('A' <= self && self <= 'Z')
|| (self > '\x7f' && derived_property::XID_Start(self))
}
#[inline]
fn is_xid_continue(self) -> bool {
('a' <= self && self <= 'z')
|| ('A' <= self && self <= 'Z')
|| ('0' <= self && self <= '9')
|| self == '_'
|| (self > '\x7f' && derived_property::XID_Continue(self))
}
}