ast: Break compatibility

- Turned `static` and `const` into scoped modifiers (like `pub`
- Added anonymous record patterns
This commit is contained in:
2025-12-20 05:22:14 -05:00
parent 64ce18d576
commit f551e3aef3
8 changed files with 43 additions and 36 deletions

View File

@@ -30,8 +30,6 @@ impl ToLisp {
fn bind_op(&self, op: BindOp) -> &'static str {
match op {
BindOp::Let => "let",
BindOp::Const => "const",
BindOp::Static => "static",
BindOp::Type => "type",
BindOp::Fn => "fn",
BindOp::Mod => "mod",
@@ -51,6 +49,7 @@ impl ToLisp {
PatOp::Rest => "rest",
PatOp::RangeEx => "range-ex",
PatOp::RangeIn => "range-in",
PatOp::Record => "record",
PatOp::Tuple => "tuple",
PatOp::Slice => "slice",
PatOp::ArRep => "ar-rep",
@@ -75,6 +74,8 @@ impl ToLisp {
Op::Call => "call",
Op::Pub => "pub",
Op::Loop => "loop",
Op::Const => "const",
Op::Static => "static",
Op::Match => "match",
Op::If => "if",
Op::While => "while",
@@ -201,7 +202,7 @@ impl<'a> Visit<'a> for ToLisp {
Pat::MetId(id) => print!("(replace {id})"),
Pat::Name(name) => print!("{name}"),
Pat::Path(path) => path.visit_in(self)?,
Pat::NamedStruct(path, pat) => {
Pat::NamedRecord(path, pat) => {
print!("(struct-pat ");
path.visit_in(self)?;
print!(" ");