Refine data structures.

This commit is contained in:
Stephen Chung
2022-05-07 15:54:44 +08:00
parent fc64e93b93
commit 4194e2c048
8 changed files with 59 additions and 41 deletions

View File

@@ -112,7 +112,7 @@ pub struct Engine {
/// A map containing custom keywords and precedence to recognize.
pub(crate) custom_keywords: BTreeMap<Identifier, Option<Precedence>>,
/// Custom syntax.
pub(crate) custom_syntax: BTreeMap<Identifier, Box<CustomSyntax>>,
pub(crate) custom_syntax: BTreeMap<Identifier, CustomSyntax>,
/// Callback closure for filtering variable definition.
pub(crate) def_var_filter: Option<Box<OnDefVarCallback>>,
/// Callback closure for resolving variable access.
@@ -155,7 +155,14 @@ impl fmt::Debug for Engine {
f.field("disabled_symbols", &self.disabled_symbols)
.field("custom_keywords", &self.custom_keywords)
.field("custom_syntax", &(!self.custom_syntax.is_empty()))
.field(
"custom_syntax",
&self
.custom_syntax
.keys()
.map(|s| s.as_str())
.collect::<String>(),
)
.field("def_var_filter", &self.def_var_filter.is_some())
.field("resolve_var", &self.resolve_var.is_some())
.field("token_mapper", &self.token_mapper.is_some());