diff options
Diffstat (limited to 'vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs')
-rw-r--r-- | vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs b/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs index 97dd658e4..0f22eeefb 100644 --- a/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs +++ b/vendor/bstr/src/unicode/fsm/sentence_break_fwd.rs @@ -1,41 +1,19 @@ // DO NOT EDIT THIS FILE. IT WAS AUTOMATICALLY GENERATED BY: // -// ucd-generate dfa --name SENTENCE_BREAK_FWD --minimize --sparse --anchored --state-size 4 src/unicode/fsm/ [snip (arg too long)] +// regex-cli generate serialize sparse dfa --minimize --start-kind anchored --shrink --rustfmt --safe SENTENCE_BREAK_FWD src/unicode/fsm/ <snip: arg too long> // -// ucd-generate 0.2.12 is available on crates.io. +// regex-cli 0.0.1 is available on crates.io. -#[cfg(target_endian = "big")] -pub static SENTENCE_BREAK_FWD: ::once_cell::sync::Lazy< - ::regex_automata::SparseDFA<&'static [u8], u32>, -> = ::once_cell::sync::Lazy::new(|| { - #[repr(C)] - struct Aligned<B: ?Sized> { - _align: [u8; 0], - bytes: B, - } +use regex_automata::{dfa::sparse::DFA, util::lazy::Lazy}; - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("sentence_break_fwd.bigendian.dfa"), - }; - - unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } -}); - -#[cfg(target_endian = "little")] -pub static SENTENCE_BREAK_FWD: ::once_cell::sync::Lazy< - ::regex_automata::SparseDFA<&'static [u8], u32>, -> = ::once_cell::sync::Lazy::new(|| { - #[repr(C)] - struct Aligned<B: ?Sized> { - _align: [u8; 0], - bytes: B, - } - - static ALIGNED: &'static Aligned<[u8]> = &Aligned { - _align: [], - bytes: *include_bytes!("sentence_break_fwd.littleendian.dfa"), - }; - - unsafe { ::regex_automata::SparseDFA::from_bytes(&ALIGNED.bytes) } +pub static SENTENCE_BREAK_FWD: Lazy<DFA<&'static [u8]>> = Lazy::new(|| { + #[cfg(target_endian = "big")] + static BYTES: &'static [u8] = + include_bytes!("sentence_break_fwd.bigendian.dfa"); + #[cfg(target_endian = "little")] + static BYTES: &'static [u8] = + include_bytes!("sentence_break_fwd.littleendian.dfa"); + let (dfa, _) = + DFA::from_bytes(BYTES).expect("serialized DFA should be valid"); + dfa }); |