fmt: use `-1` for *really* no precedence, since `&` and `|` have precedence 0
parent
3bb6b6c8b2
commit
bdecbc1945
|
@ -145,7 +145,7 @@ fn (mut f Fmt) adjust_complete_line() {
|
||||||
for i, buf in f.expr_bufs {
|
for i, buf in f.expr_bufs {
|
||||||
// search for low penalties
|
// search for low penalties
|
||||||
if i == 0 || f.penalties[i-1] <= 1 {
|
if i == 0 || f.penalties[i-1] <= 1 {
|
||||||
precedence := if i == 0 { 0 } else { f.precedences[i-1] }
|
precedence := if i == 0 { -1 } else { f.precedences[i-1] }
|
||||||
mut len_sub_expr := if i == 0 { buf.len + f.line_len } else { buf.len }
|
mut len_sub_expr := if i == 0 { buf.len + f.line_len } else { buf.len }
|
||||||
mut sub_expr_end_idx := f.penalties.len
|
mut sub_expr_end_idx := f.penalties.len
|
||||||
// search for next position with low penalty and same precedence to form subexpression
|
// search for next position with low penalty and same precedence to form subexpression
|
||||||
|
|
|
@ -70,3 +70,7 @@ fn (mut p Parser) name_expr() {
|
||||||
println(p.peek_tok.lit)
|
println(p.peek_tok.lit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_nr_muls(t table.Type, nr_muls int) table.Type {
|
||||||
|
return int(t) & 0xff00ffff | (nr_muls << 16)
|
||||||
|
}
|
||||||
|
|
|
@ -82,3 +82,8 @@ fn (mut p Parser) name_expr() {
|
||||||
println(p.peek_tok.lit)
|
println(p.peek_tok.lit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_nr_muls(t table.Type, nr_muls int) table.Type {
|
||||||
|
return int(t) &
|
||||||
|
0xff00ffff | (nr_muls << 16)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue