#[derive(Debug, Default)]
pub(crate) struct ParserSurfaceBindings {
pub(crate) inline_actions: BTreeMap<usize, String>,
pub(crate) predicates: BTreeMap<(usize, usize), (String, Option<String>)>,
pub(crate) init_entry: BTreeMap<usize, String>,
pub(crate) after: BTreeMap<usize, String>,
pub(crate) rule_has_attrs: Vec<bool>,
pub(crate) call_args: BTreeMap<usize, String>,
pub(crate) rule_arg0: Vec<Option<String>>,
pub(crate) attrs_structs: String,
pub(crate) struct_fields: String,
pub(crate) field_inits: String,
pub(crate) impl_items: String,
pub(crate) module_items: String,
}
#[derive(Debug, Default)]
pub(crate) struct ParserSurfaceModel {
embedded: Option<ParserSurfaceBindings>,
structural: Option<ParserSurfaceBindings>,
}
impl ParserSurfaceModel {
pub(crate) const fn embedded(bindings: ParserSurfaceBindings) -> Self {
Self {
embedded: Some(bindings),
structural: None,
}
}
pub(crate) const fn structural(bindings: ParserSurfaceBindings) -> Self {
Self {
embedded: None,
structural: Some(bindings),
}
}
pub(crate) const fn embedded_bindings(&self) -> Option<&ParserSurfaceBindings> {
self.embedded.as_ref()
}
pub(crate) const fn structural_bindings(&self) -> Option<&ParserSurfaceBindings> {
self.structural.as_ref()
}
pub(crate) fn bindings(&self) -> Option<&ParserSurfaceBindings> {
self.embedded.as_ref().or(self.structural.as_ref())
}
}