def print.step
bend-lint-rules@0.2.0.0 · layout/format.bend:1963
import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import Base
1963def print.step(
1964 jobs: List<&2, Job>,
1965 out: List<&2, String>,
1966 pending: String,
1967 +col: U32,
1968 width: Maybe<&2, U32>,
1969 newline: String,
1970 fuel: Nat
1971) -> Print:
1972 match jobs:
1973 case Nil{}:
1974 Print{Nil{}, out, pending, col}
1975 case Con{Job{Str{+body, blank, w, tail}, indent, flat}, rest}:
1976 print.str(body, body, blank, rest, out, pending, col_of(tail, col, w))
1977 case Con{Job{Line{text, w, hard, offset}, +indent, +flat}, rest}:
1978 print.line(
1979 Bool.not(hard) && (flat || is_unbounded(width)),
1980 text,
1981 (indent + offset: U32),
1982 rest,
1983 out,
1984 pending,
1985 col,
1986 w,
1987 newline
1988 )
1989 case Con{Job{Nest{doc, amount, f}, indent, flat}, rest}:
1990 Print{Con{Job{doc, (indent + amount: U32), flat}, rest}, out, pending, col}
1991 case Con{Job{Grp{+doc, f}, +indent, +flat}, +rest}:
1992 Print{
1993 Con{
1994 Job{
1995 doc,
1996 indent,
1997 print.is_flat(flat, fuel, width, col, Con{Job{doc, indent, True{}}, rest})
1998 },
1999 rest
2000 },
2001 out,
2002 pending,
2003 col
2004 }
2005 case Con{Job{Cat{docs, f}, indent, flat}, rest}:
2006 Print{push(docs, indent, flat, rest), out, pending, col}