cl-ast: No more bare ExprKind: every Expr has a Span cl-interpret: Give errors a span cl-repl: Print eval errors in load_file, instead of returning them. These changes are relevant.
15 lines
386 B
Rust
15 lines
386 B
Rust
//! Squashes group expressions
|
|
use crate::{ast::*, ast_visitor::fold::*};
|
|
|
|
/// Squashes group expressions
|
|
pub struct SquashGroups;
|
|
|
|
impl Fold for SquashGroups {
|
|
fn fold_expr_kind(&mut self, kind: ExprKind) -> ExprKind {
|
|
match kind {
|
|
ExprKind::Group(Group { expr }) => self.fold_expr(*expr).kind,
|
|
_ => or_fold_expr_kind(self, kind),
|
|
}
|
|
}
|
|
}
|