//! Precomputed regular-expression patterns and text assets that match every
//! RGI emoji symbol and sequence in the Unicode `emoji-test.txt` file, for a
//! range of Emoji versions.
//!
//! The patterns follow Unicode Technical Standard #51. Each pattern is built to
//! match every emoji string for its version in full on its target engine. The
//! crate's tests verify this for the `javascript` and `javascript-u` forms with
//! the Rust `regex` crate. The crate ships eight assets per version.
//!
//! # What this crate gives you
//!
//! - Embedded assets for Emoji versions 13.0 through 17.0, plus a `latest`
//!   alias. Read them with [`output`].
//! - Pure generators that rebuild the index, index-strings, and CSS assets from
//!   a list of emoji strings. See the [`generate`] module.
//!
//! The five regex patterns (`javascript`, `javascript-u`, `javascript-v`,
//! `java`, `cpp-re2`) are produced by a trie minimizer and ship as data. This
//! crate does not regenerate them.
//!
//! # Assets per version
//!
//! | Kind | Content |
//! | --- | --- |
//! | [`OutputKind::Index`] | `<U+XXXX ...> \u{2192} <emoji>` per line. |
//! | [`OutputKind::IndexStrings`] | one emoji per line. |
//! | [`OutputKind::Css`] | a CSS `unicode-range` value. |
//! | [`OutputKind::JavaScript`] | JS regex for use without the `u` flag. |
//! | [`OutputKind::JavaScriptU`] | JS regex for use with the `u` flag. |
//! | [`OutputKind::JavaScriptV`] | JS regex for use with the `v` flag. |
//! | [`OutputKind::Java`] | Java `Pattern` compatible regex. |
//! | [`OutputKind::CppRe2`] | Google RE2 compatible regex. |
//!
//! # Example
//!
//! ```
//! use emoji_test_regex_pattern::{output, EmojiVersion, OutputKind};
//!
//! let pattern = output(EmojiVersion::Latest, OutputKind::JavaScriptU);
//! assert!(!pattern.is_empty());
//!
//! // The index text ends with a newline. The regex patterns do not.
//! let index = output(EmojiVersion::V13_0, OutputKind::Index);
//! assert!(index.ends_with('\n'));
//! ```
//!
//! # Trailing newlines
//!
//! The index, index-strings, and CSS assets end with a newline. The five regex
//! patterns do not. [`OutputKind::has_trailing_newline`] reports which is which.

#![forbid(unsafe_code)]
#![warn(missing_docs)]

mod data;
pub mod generate;
mod kind;
mod version;

pub use kind::OutputKind;
pub use version::{EmojiVersion, ParseVersionError};

/// Return the embedded asset for a version and kind.
///
/// [`EmojiVersion::Latest`] resolves to the highest version and returns the same
/// bytes as that version.
///
/// # Example
///
/// ```
/// use emoji_test_regex_pattern::{output, EmojiVersion, OutputKind};
///
/// let css = output(EmojiVersion::V13_0, OutputKind::Css);
/// assert!(css.starts_with("U+23,"));
/// ```
pub const fn output(version: EmojiVersion, kind: OutputKind) -> &'static str {
    data::output(version, kind)
}
