mod dot;
mod json;
mod sexpr;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
pub enum JsonShape {
#[default]
Tree,
Arena,
}
pub(super) fn kind_name(kind: &crate::AstKind) -> &'static str {
match kind {
crate::AstKind::Empty => "empty",
crate::AstKind::Anchor { .. } => "anchor",
crate::AstKind::Literal { .. } => "literal",
crate::AstKind::Dot => "dot",
crate::AstKind::Class { .. } => "class",
crate::AstKind::Group { .. } => "group",
crate::AstKind::Alt { .. } => "alt",
crate::AstKind::Concat { .. } => "concat",
crate::AstKind::Repeat { .. } => "repeat",
}
}
pub(super) fn rep_name(kind: crate::RepKind) -> String {
match kind {
crate::RepKind::ZeroOrOne => "zero_or_one".into(),
crate::RepKind::ZeroOrMore => "zero_or_more".into(),
crate::RepKind::OneOrMore => "one_or_more".into(),
crate::RepKind::Range { min, max } => max.map_or_else(
|| format!("range_{min}_unbounded"),
|max| format!("range_{min}_{max}"),
),
}
}