add unknown flag to set_prolog_flag and current_prolog_flag

This commit is contained in:
Mark
2023-07-14 19:10:10 -06:00
parent 101d0548db
commit ff5e9a793b
7 changed files with 119 additions and 8 deletions

View File

@@ -303,12 +303,14 @@ pub type OpDir = IndexMap<(Atom, Fixity), OpDesc, FxBuildHasher>;
#[derive(Debug, Clone, Copy)]
pub struct MachineFlags {
pub double_quotes: DoubleQuotes,
pub unknown: Unknown,
}
impl Default for MachineFlags {
fn default() -> Self {
MachineFlags {
double_quotes: DoubleQuotes::default(),
unknown: Unknown::default(),
}
}
}
@@ -340,6 +342,34 @@ impl Default for DoubleQuotes {
}
}
#[derive(Debug, Clone, Copy)]
pub enum Unknown {
Error,
Fail,
Warn,
}
impl Unknown {
pub fn is_error(self) -> bool {
matches!(self, Unknown::Error)
}
pub fn is_fail(self) -> bool {
matches!(self, Unknown::Fail)
}
pub fn is_warn(self) -> bool {
matches!(self, Unknown::Warn)
}
}
impl Default for Unknown {
#[inline]
fn default() -> Self {
Unknown::Error
}
}
pub fn default_op_dir() -> OpDir {
let mut op_dir = OpDir::with_hasher(FxBuildHasher::default());