mirror of
https://github.com/uutils/awk.git
synced 2026-06-10 16:15:04 -07:00
parser: fix delete array indexing
This commit is contained in:
+4
-2
@@ -568,8 +568,10 @@ impl<'a> Parser<'a> {
|
||||
};
|
||||
let index = if lex.consume(&Token::OpenBracket) {
|
||||
let mut pratt = Pratt::new(self, false);
|
||||
let first = pratt.parse(lex)?;
|
||||
Some(pratt.parse_comma_expr(lex, first)?)
|
||||
let expr = pratt.parse(lex)?;
|
||||
let expr = pratt.parse_comma_expr(lex, expr)?;
|
||||
lex.expect(&Token::ClosedBracket, ParsingError::UnclosedArrayAccess)?;
|
||||
Some(expr)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
+5
-1
@@ -191,7 +191,11 @@ impl Debug for SimpleStatement<'_> {
|
||||
}
|
||||
|
||||
Self::Delete(array, Some(index)) => {
|
||||
write!(f, "(delete (index {array:?} {index:?}))")
|
||||
write!(f, "(delete (Index {array:?}")?;
|
||||
for i in index {
|
||||
write!(f, " {i}")?;
|
||||
}
|
||||
write!(f, "))")
|
||||
}
|
||||
Self::Delete(array, None) => write!(f, "(delete {array:?})"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user