devalang_wasm/language/syntax/grammar/
mod.rs1use once_cell::sync::Lazy;
2use std::collections::HashSet;
3
4static BOOLEAN_LITERALS: Lazy<HashSet<&'static str>> =
5 Lazy::new(|| ["true", "false"].into_iter().collect());
6
7pub fn is_boolean_literal(value: &str) -> bool {
8 BOOLEAN_LITERALS.contains(&value.to_ascii_lowercase().as_str())
9}
10
11pub fn is_duration_literal(value: &str) -> bool {
12 let value = value.trim().to_ascii_lowercase();
13 value.ends_with("ms") || value.ends_with('b') || value == "auto"
14}