#[derive(Clone, Eq, PartialEq, Hash, Debug)]
pub struct Features {
pub pragmas: bool,
pub unicode_identifiers: bool,
pub scoped_nodes: bool,
pub scoped_variables: bool,
pub subroutine: bool,
pub string_interpolation: bool,
pub extended_escape: bool,
}
impl Features {
pub fn new() -> Self {
Features {
pragmas: true,
unicode_identifiers: false,
scoped_nodes: true,
scoped_variables: true,
subroutine: true,
string_interpolation: true,
extended_escape: true,
}
}
pub fn basic() -> Self {
Features {
pragmas: true,
unicode_identifiers: false,
scoped_nodes: false,
scoped_variables: false,
subroutine: false,
string_interpolation: false,
extended_escape: false,
}
}
pub fn compatible() -> Self {
Features {
pragmas: false,
unicode_identifiers: false,
scoped_nodes: false,
scoped_variables: false,
subroutine: false,
string_interpolation: false,
extended_escape: false,
}
}
pub fn all() -> Self {
Features {
pragmas: true,
unicode_identifiers: true,
scoped_nodes: true,
scoped_variables: true,
subroutine: true,
string_interpolation: true,
extended_escape: true,
}
}
}
impl Default for Features {
fn default() -> Self {
Features::new()
}
}