mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 12:24:45 +00:00
Parser: impl Record
This commit is contained in:
parent
3ae3fd997b
commit
a6f9e89ffc
8 changed files with 415 additions and 172 deletions
|
@ -481,12 +481,26 @@ macro_rules! impl_display_from_nested {
|
|||
};
|
||||
}
|
||||
|
||||
/// For Decl, Def, Call, etc., which can occupy a line by itself
|
||||
#[macro_export]
|
||||
macro_rules! impl_nested_display_for_chunk_enum {
|
||||
($Enum: ident; $($Variant: ident $(,)?)*) => {
|
||||
impl NestedDisplay for $Enum {
|
||||
fn fmt_nest(&self, f: &mut fmt::Formatter<'_>, level: usize) -> fmt::Result {
|
||||
write!(f, "{}", " ".repeat(level))?;
|
||||
match self {
|
||||
$($Enum::$Variant(v) => v.fmt_nest(f, level),)*
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! impl_nested_display_for_enum {
|
||||
($Enum: ident; $($Variant: ident $(,)?)*) => {
|
||||
impl NestedDisplay for $Enum {
|
||||
fn fmt_nest(&self, f: &mut fmt::Formatter<'_>, level: usize) -> fmt::Result {
|
||||
write!(f, "{}", " ".repeat(level))?;
|
||||
match self {
|
||||
$($Enum::$Variant(v) => v.fmt_nest(f, level),)*
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue