forked from AbleOS/holey-bytes
adding array reformatting rule
This commit is contained in:
parent
b429534d23
commit
83d3fb4919
|
@ -3,7 +3,7 @@ use {
|
|||
lexer::{self, Lexer, TokenKind},
|
||||
parser::{self, CommentOr, CtorField, Expr, Poser, Radix, StructField},
|
||||
},
|
||||
core::fmt,
|
||||
core::fmt::{self},
|
||||
};
|
||||
|
||||
pub fn display_radix(radix: Radix, mut value: u64, buf: &mut [u8; 64]) -> &str {
|
||||
|
@ -263,6 +263,20 @@ impl<'a> Formatter<'a> {
|
|||
},
|
||||
)
|
||||
}
|
||||
Expr::Tupl {
|
||||
pos,
|
||||
ty: Some(&Expr::Slice { pos: spos, size: Some(&Expr::Number { value, .. }), item }),
|
||||
fields,
|
||||
trailing_comma,
|
||||
} if value as usize == fields.len() => self.fmt(
|
||||
&Expr::Tupl {
|
||||
pos,
|
||||
ty: Some(&Expr::Slice { pos: spos, size: None, item }),
|
||||
fields,
|
||||
trailing_comma,
|
||||
},
|
||||
f,
|
||||
),
|
||||
Expr::Tupl { ty, fields, trailing_comma, .. } => {
|
||||
if let Some(ty) = ty {
|
||||
self.fmt_paren(ty, f, unary)?;
|
||||
|
|
|
@ -155,9 +155,7 @@ impl<'a, 'b> Parser<'a, 'b> {
|
|||
|
||||
fn bin_expr(&mut self, mut fold: Expr<'a>, min_prec: u8, top_level: bool) -> Option<Expr<'a>> {
|
||||
loop {
|
||||
let Some(prec) = self.token.kind.precedence() else {
|
||||
break;
|
||||
};
|
||||
let Some(prec) = self.token.kind.precedence() else { break };
|
||||
|
||||
if prec <= min_prec {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue