diff --git a/src/ast.rs b/src/ast.rs index 75d9f48..484725a 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -282,7 +282,7 @@ pub enum PatOp { /// Matches the elements of a slice or array Slice, /// Matches a constant-size slice with repeating elements - Arrep, + ArRep, /// Matches a type annotation or struct member Typed, /// Matches a function signature diff --git a/src/ast/display.rs b/src/ast/display.rs index dde1556..f87c868 100644 --- a/src/ast/display.rs +++ b/src/ast/display.rs @@ -259,7 +259,7 @@ impl Display for Pat { Self::NamedTuple(name, bind) => write!(f, "{name} {bind}"), Self::Op(PatOp::Tuple, pats) => f.delimit("(", ")").list(pats, ", "), Self::Op(PatOp::Slice, pats) => f.delimit("[", "]").list(pats, ", "), - Self::Op(op @ PatOp::Arrep, pats) => f.delimit("[", "]").list(pats, op), + Self::Op(op @ PatOp::ArRep, pats) => f.delimit("[", "]").list(pats, op), Self::Op(op @ (PatOp::Typed | PatOp::Fn), pats) => f.list(pats, op), Self::Op(op @ PatOp::Alt, pats) => f.delimit("<", ">").list(pats, op), Self::Op(op, pats) => match pats.as_slice() { @@ -283,7 +283,7 @@ impl Display for PatOp { Self::RangeIn => "..=", Self::Tuple => ", ", Self::Slice => ", ", - Self::Arrep => "; ", + Self::ArRep => "[;]", Self::Typed => ": ", Self::Fn => " -> ", Self::Alt => " | ", diff --git a/src/parser/pat.rs b/src/parser/pat.rs index 49a611e..ea26a3d 100644 --- a/src/parser/pat.rs +++ b/src/parser/pat.rs @@ -174,7 +174,7 @@ fn parse_array_pat(p: &mut Parser<'_>) -> PResult { p.expect(TKind::RBrack)?; Ok(match (repeat, item) { - (Some(repeat), item) => Pat::Op(PatOp::Arrep, vec![item, repeat]), + (Some(repeat), item) => Pat::Op(PatOp::ArRep, vec![item, repeat]), (None, Pat::Op(PatOp::Tuple, items)) => Pat::Op(PatOp::Slice, items), (None, item) => Pat::Op(PatOp::Slice, vec![item]), })