2024-01-24 00:02:20 +00:00
|
|
|
//! Holds functions to determine if a character belongs to a specific character set.
|
|
|
|
|
2024-03-17 07:47:11 +00:00
|
|
|
/// Check if the string can be expressed a valid literal block scalar.
|
2024-03-19 17:18:59 +00:00
|
|
|
/// The YAML spec supports all of the following in block literals except `#xFEFF`:
|
2024-03-20 14:54:09 +00:00
|
|
|
/// ```no_compile
|
2024-03-19 17:18:59 +00:00
|
|
|
/// #x9 | #xA | [#x20-#x7E] /* 8 bit */
|
2024-03-17 07:47:11 +00:00
|
|
|
/// | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] /* 16 bit */
|
|
|
|
/// | [#x10000-#x10FFFF] /* 32 bit */
|
|
|
|
/// ```
|
|
|
|
#[inline]
|
|
|
|
pub(crate) fn is_valid_literal_block_scalar(string: &str) -> bool {
|
|
|
|
string.chars().all(|character: char|
|
|
|
|
matches!(character, '\t' | '\n' | '\x20'..='\x7e' | '\u{0085}' | '\u{00a0}'..='\u{d7fff}'))
|
|
|
|
}
|