def content source · line 1719 · raw
@parts:List<&2, Part> -> List<&2, Doc>
The parts' docs with their separators, last first.
raw source on the hub · import bend-lint-rules@0.3.3.0/layout/format.bend as Format
layout/format: a file that differs from its formatted text, where it first differs. One formatter owns indentation, spacing, declaration gaps and wrapping. Fix: writes the formatted text. Options: tabWidth (2); wrapAtWidth (100, or "never": no optional wrapping); endOfLine ("lf", "crlf", or "preserve": the file's first, or LF if it has none). Heuristics: it reads tokens, not Bend's syntax, and changes only blanks, line breaks and the space after a comment's #, so a fix keeps the program. A form its token rules do not know can come out laid out oddly.
A String is a JS string at run time: ++ is native, and a match on SCon reads one character and slices off the rest. So the lexer reads the text once, tokens carry what the layout asks of them, and docs carry widths.
Each loop is go(input, state): a step that does not recurse makes the next state, so every loop recurses on a smaller part of its input. The lexer and the printer recurse on fuel instead: more steps than they can need.
import Base import bend-lint-api@0.3.3.0/linter/api/impl.bend as LintImpl import bend-lint-api@0.3.3.0/linter/api/spec.bend as Lint import bend-lint-api@0.3.3.0/shared.bend as Shared
Data
Types =====
Code Lex
Literal Lex
Comment Lex
Newline Lex
Data
The spellings the layout tells apart; Word{} is any other, Inc{} ends in n+.
Word Sym
Comma Sym
Semi Sym
Colon Sym
Ques Sym
Bang Sym
Dot Sym
Tilde Sym
At Sym
Bslash Sym
Plus Sym
Minus Sym
Star Sym
Slash Sym
Pct Sym
Caret Sym
Amp Sym
Bar Sym
Lpar Sym
Rpar Sym
Lbrk Sym
Rbrk Sym
Lbrc Sym
Rbrc Sym
Lt Sym
Gt Sym
Assign Sym
Arrow Sym
Concat Sym
AndAnd Sym
OrOr Sym
Meet Sym
BitAnd Sym
BitOr Sym
BitXor Sym
Shl Sym
Shr Sym
Cons Sym
Le Sym
Ge Sym
EqEq Sym
Ne Sym
Inc Sym
KwReturn Sym
KwCase Sym
KwMatch Sym
KwFor Sym
KwExs Sym
KwIs Sym
KwDo Sym
KwDef Sym
KwType Sym
KwLaw Sym
KwImport Sym
Data
Offsets and columns count code points. name: whether the text matches /^[\w.]+$/. tail: for a literal across lines, how many characters follow its last newline. from: the text from the token on.
Token @text:String -> @beg:U32 -> @end:U32 -> @col:U32 -> @lex:Lex -> @sym:Sym -> @name:Bool -> @tail:Maybe<&2, U32> -> @from:String -> Token
Data
What the lexer read: the end of the text, one whitespace character, or a token; with the text after it and its last character.
Eof Scan
Blank @rest:String -> @last:Char -> @len:U32 -> Scan
Tok @text:String -> @len:U32 -> @rest:String -> @last:Char -> @lex:Lex -> @sym:Sym -> @name:Bool -> @tail:Maybe<&2, U32> -> Scan
Data
Characters read by run: their text and count, the text after them, and the last one.
Run @text:String -> @len:U32 -> @rest:String -> @last:Char -> Run
Data
What the next character of a literal is: inside it, escaped, or past it.
Inside Quote
Escaped Quote
Shut Quote
Data
IsBlank Class
IsHead Class
IsDigit Class
IsOther Class
Data
Leaf @token:Token -> Tree
Group @open:Token -> @close:Token -> @children:List<&2, Tree> -> @block:Bool -> Tree
Data
A group the tree has opened: the sym that closes it, children last first, and whether a child is a token that makes it a block.
Open @token:Token -> @close:Sym -> @children:List<&2, Tree> -> @block:Bool -> Open
Data
Built @stack:List<&2, Open> -> @root:List<&2, Tree> -> Built
Data
A doc printed flat: its width up to the first break it cannot lose (a hard line, or a newline in text), and whether it has one.
Flat @width:U32 -> @brk:Bool -> Flat
Data
Str: text without its trailing whitespace, that whitespace, the width, and how many characters follow the last newline, if any. Line: the text and width when flat. Grp, Nest and Cat keep their Flat; Cat its docs last first.
Str @body:String -> @blank:String -> @width:U32 -> @tail:Maybe<&2, U32> -> Doc
Line @flat:String -> @width:U32 -> @hard:Bool -> @offset:U32 -> Doc
Grp @doc:Doc -> @flat:Flat -> Doc
Nest @doc:Doc -> @amount:U32 -> @flat:Flat -> Doc
Cat @docs:List<&2, Doc> -> @flat:Flat -> Doc
Data
Measure @width:U32 -> @tail:Maybe<&2, U32> -> @keep:U32 -> Measure
Data
How build reads a list of trees: a record, a group's children as a raw block, as comma-separated parts, or a group with no children. A block is an embedded statement body: its line and column boundaries mean something, so it keeps them, while ordinary calls inside it still wrap.
Plain Mode
Block @open:Token -> @close:Token -> Mode
Parts @open:Token -> @close:Token -> Mode
Bare @open:Token -> @close:Token -> Mode
Data
A sequence being built: its docs last first, the docs of an operator chain, the previous tree, the indentation levels deepest first, and whether the rest of a run of newlines is skipped.
Seq @out:List<&2, Doc> -> @chain:Maybe<&2, List<&2, Doc>> -> @prev:Maybe<&2, Tree> -> @levels:List<&2, U32> -> @skip:Bool -> Seq
Data
A comma-separated part: whether it holds only newlines, and whether its last other tree ends in a comment.
Part @doc:Doc -> @newlines:Bool -> @comment:Bool -> Part
Data
A group's parts so far, last first; the current part's flags; whether the next tree ends the current part; whether a child starts with a comment.
Split @parts:List<&2, Part> -> @newlines:Bool -> @comment:Bool -> @attach:Bool -> @comments:Bool -> Split
Data
State @seq:Seq -> @split:Split -> State
Data
What a child of a group does to its parts.
Add Act
AddAttach Act
AddEnd Act
End Act
Data
Job @doc:Doc -> @indent:U32 -> @flat:Bool -> Job
Data
The printer: jobs left, the text so far as chunks last first, the whitespace not written yet (dropped at a break or at the end), and the column.
Print @jobs:List<&2, Job> -> @out:List<&2, String> -> @pending:String -> @col:U32 -> Print
Data
Go @jobs:List<&2, Job> -> @left:U32 -> Fit
Stop @fits:Bool -> Fit
Data
Records so far, last first, and the current record, last first.
Recs @done:List<&2, List<&2, Tree>> -> @current:List<&2, Tree> -> Recs
Data
A declaration record cut after its first colon, if it has one.
Cut @before:List<&2, Tree> -> @after:List<&2, Tree> -> @found:Bool -> Cut
Data
Hash @before:String -> @comment:Maybe<&2, String> -> Hash
Data
The rows so far, last first, and what the next record needs from them.
Rows @levels:List<&2, U32> -> @blank:Bool -> @unsafe:Bool -> @comment:Bool -> @rows:List<&2, String> -> Rows
Data
width: None{} for "never".
Settings @tab:U32 -> @width:Maybe<&2, U32> -> @newline:String -> Settings
U32
Fuel per code point of a record: more printer steps than any doc needs.
@+c:Char -> Bool
Whitespace, as Bend's parser reads it.
@+c:Char -> Bool
@+c:Char -> Bool
@c:Char -> String
@s:String -> @blank:Bool -> String
@+s:String -> String
@s:String -> String
@n:Nat -> @out:String -> String
@a:String -> @b:String -> @ok:Bool -> Bool
Base's String.eq is not tail-recursive, so long text would overflow the stack; is_same is. ok: whether the characters so far were the same.
@a:String -> @b:String -> Bool
@s:String -> Bool
Lexer -----
A branch that uses a string or a character its match took apart gets it rebuilt: a string as character + rest, a rope that the next read copies whole, and a character bit by bit. So a def that needs the whole value in a branch takes it twice, as keep, and matches the other copy.
@s:String -> Bool
@dot:Bool -> @c:Char -> @rest:String -> Bool
@s:String -> Bool
A word character, or a dot before the start of a word.
@r:Run -> @sym:Sym -> @name:Bool -> Scan
@text:String -> @len:U32 -> @rest:String -> @last:Char -> @sym:Sym -> Scan
@text:String -> @word:String -> @sym:Sym -> Sym
@text:String -> @+keep:String -> Sym
@r:Run -> Scan
@r:Run -> @inc:Bool -> @name:Bool -> Scan
@go:Bool -> @+rest:String -> @mark:String -> @k:U32 -> @keep:String -> @text:String -> @n:U32 -> @last:Char -> @signed:Bool -> Scan
@rest:String -> @+again:String -> @mark:String -> @keep:String -> @text:String -> @n:U32 -> @last:Char -> Scan
@s:String -> @keep:String -> @text:String -> @n:U32 -> @last:Char -> Scan
@r:Run -> Scan
After a fraction: [eE][+-]?\d+, if it is there.
@go:Bool -> @+rest:String -> @keep:String -> @text:String -> @n:U32 -> @last:Char -> Scan
@s:String -> @keep:String -> @text:String -> @n:U32 -> Scan
After "n": n+, or n alone.
@s:String -> @keep:String -> @text:String -> @n:U32 -> @last:Char -> Scan
@r:Run -> Scan
After a number's digits: n, n+, or a fraction and its exponent.
@c:Char -> @tail:Maybe<&2, U32> -> Maybe<&2, U32>
@+c:Char -> @quote:Char -> Quote
@s:String -> @keep:String -> @+quote:Char -> @at:Quote -> @text:String -> @n:U32 -> @last:Char -> @tail:Maybe<&2, U32> -> Scan
literal, with the text so far last character first: on the C lane, ++ copies its left side.
@s:String -> @keep:String -> @quote:Char -> @at:Quote -> @text:String -> @n:U32 -> @last:Char -> @tail:Maybe<&2, U32> -> Scan
@+c:Char -> Class
@c:Char -> Sym
@class:Class -> @+c:Char -> @+rest:String -> Scan
@s:String -> Scan
@word:Bool -> @keep:String -> @r:String -> Scan
@rest:String -> @keep:String -> @+prev:Char -> Scan
@blank:Bool -> @keep:String -> @r:String -> Scan
@rest:String -> @keep:String -> @prev:Char -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@rest:String -> @keep:String -> Scan
@r:Run -> Scan
@s:String -> @keep:String -> @n:U32 -> @last:Char -> Scan
A run of whitespace on one line.
@s:String -> @keep:String -> @prev:Char -> Scan
The token at the start of s; prev is the character before it. Literals and comment text are kept verbatim: a quote or # inside a string is not syntax. Successor notation (1n+) and quantities (&2) are single tokens.
@lex:Lex -> @tail:Maybe<&2, U32> -> @col:U32 -> @len:U32 -> U32
@fuel:Nat -> @sc:Scan -> @from:String -> @+at:U32 -> @+col:U32 -> @acc:List<&2, Token> -> List<&2, Token>
Each step reads at least one character, so the text's length is fuel.
@+s:String -> List<&2, Token>
@t:Token -> String
Tokens ------
@t:Token -> U32
@t:Token -> U32
@t:Token -> U32
@t:Token -> Sym
@t:Token -> Bool
@t:Token -> String
@t:Token -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
A sign or quantity glued to what follows it.
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> Bool
A record that ends in one of these goes on at the next line.
@s:Sym -> Bool
@s:Sym -> Bool
@s:Sym -> @t:Sym -> Bool
@n:Tree -> Token
Trees -----
@n:Tree -> Token
@n:Tree -> Bool
@n:Tree -> Bool
@n:Tree -> @s:Sym -> Bool
@xs:List<&2, Tree> -> Maybe<&2, Tree>
@xs:List<&2, Tree> -> @at:Maybe<&2, Tree> -> Maybe<&2, Tree>
@xs:List<&2, Tree> -> Maybe<&2, Tree>
The first tree after a run of newlines.
@s:Sym -> Sym
What closes the group s opens, or Word{}.
@prev:Maybe<&2, Token> -> @t:Token -> Bool
@s:Sym -> @t:Token -> @prev:Maybe<&2, Token> -> Bool
Whether t opens a group: a glued < opens type arguments.
@+t:Token -> @prev:Maybe<&2, Token> -> Bool
@n:Tree -> Bool
@+n:Tree -> @stack:List<&2, Open> -> @root:List<&2, Tree> -> Built
@stack:List<&2, Open> -> @s:Sym -> Bool
@t:Token -> @stack:List<&2, Open> -> @root:List<&2, Tree> -> Built
@closes:Bool -> @t:Token -> @stack:List<&2, Open> -> @root:List<&2, Tree> -> Built
@opens:Bool -> @+t:Token -> @+stack:List<&2, Open> -> @root:List<&2, Tree> -> Built
@ts:List<&2, Token> -> @prev:Maybe<&2, Token> -> @b:Built -> Maybe<&2, List<&2, Tree>>
@s:String -> @+n:U32 -> @tail:Maybe<&2, U32> -> @keep:U32 -> Measure
Docs ----
@whole:Bool -> @+s:String -> @width:U32 -> @tail:Maybe<&2, U32> -> @+keep:U32 -> Doc
@s:String -> @m:Measure -> Doc
@+s:String -> Doc
@s:String -> @width:U32 -> Doc
A doc for text of this width, with no newline and no trailing whitespace.
@s:String -> @width:U32 -> Doc
Doc
@flat:String -> @width:U32 -> Doc
@offset:U32 -> Doc
@d:Doc -> Flat
@a:Flat -> @rest:Flat -> Flat
The Flat of a doc a, then of what follows it.
@docs:List<&2, Doc> -> @acc:Flat -> Flat
@+d:Doc -> Doc
@+d:Doc -> @amount:U32 -> Doc
@+docs:List<&2, Doc> -> Doc
A Cat of docs last first.
@docs:List<&2, Doc> -> Doc
A Cat of a few docs, in order.
@t:Token -> Doc
@+a:Token -> @b:Maybe<&2, Tree> -> Bool
@+x:Token -> Bool
Whether a group after x is its argument list or type arguments.
@s:Sym -> Bool
@+x:Token -> @+y:Token -> @+group:Bool -> @b:Tree -> Doc
What goes between x and the tree b that y starts. A constructor's brace is glued to its name; a brace after a space can instead be the next (annotated) argument of a call without commas, so the space stays. Other atoms need a space.
@a:Tree -> @+b:Tree -> Doc
@rest:String -> @+keep:String -> String
"#x" gets a space; empty comments, whitespace, test expectations (#|), directives (#!) and headings (##) stay as they are.
@text:String -> @keep:String -> String
@+t:Token -> Doc
@levels:List<&2, U32> -> @col:U32 -> Bool
Levels ------
@levels:List<&2, U32> -> @+col:U32 -> @go:Bool -> List<&2, U32>
@levels:List<&2, U32> -> @+col:U32 -> List<&2, U32>
@+levels:List<&2, U32> -> @+col:U32 -> List<&2, U32>
Closes the levels deeper than col, then opens col if it is deeper.
@levels:List<&2, U32> -> @n:U32 -> U32
@levels:List<&2, U32> -> U32
@base:U32 -> Seq
Sequences ---------
@s:Seq -> @d:Doc -> Seq
@s:Seq -> Seq
@s:Seq -> @tab:U32 -> Doc
@prev:Maybe<&2, Tree> -> Bool
@+levels:List<&2, U32> -> @tab:U32 -> @out:List<&2, Doc> -> @chain:Maybe<&2, List<&2, Doc>> -> Seq
A run of newlines breaks the line at the next tree's level.
@comment:Bool -> @s:Seq -> Seq
@up:Maybe<&2, Tree> -> @tab:U32 -> @s:Seq -> Seq
@trigger:Bool -> @rest:List<&2, Tree> -> @tab:U32 -> @s:Seq -> Seq
@rest:List<&2, Tree> -> @tab:U32 -> @raw:Bool -> @s:Seq -> Seq
@chain:Bool -> @p:Tree -> @n:Tree -> @s:Seq -> Seq
@+n:Tree -> @d:Doc -> @next:Maybe<&2, Tree> -> @raw:Bool -> @s:Seq -> Seq
@newline:Bool -> @n:Tree -> @d:Doc -> @rest:List<&2, Tree> -> @tab:U32 -> @raw:Bool -> @s:Seq -> Seq
@+n:Tree -> @d:Doc -> @rest:List<&2, Tree> -> @tab:U32 -> @raw:Bool -> @s:Seq -> Seq
Split
Parts -----
@+n:Tree -> @attach:Bool -> @sp:Split -> Split
@tab:U32 -> @base:U32 -> @st:State -> State
@n:Tree -> @sp:Split -> Split
@xs:List<&2, Tree> -> Bool
@n:Tree -> @rest:List<&2, Tree> -> @sp:Split -> Act
@act:Act -> @+n:Tree -> @d:Doc -> @rest:List<&2, Tree> -> @+tab:U32 -> @base:U32 -> @st:State -> State
@+n:Tree -> @d:Doc -> @+rest:List<&2, Tree> -> @tab:U32 -> @base:U32 -> @st:State -> State
@parts:List<&2, Part> -> Bool
@parts:List<&2, Part> -> @go:Bool -> List<&2, Part>
Drops the trailing parts that hold only newlines, keeping one part.
@comment:Bool -> @acc:List<&2, Doc> -> List<&2, Doc>
@parts:List<&2, Part> -> @comment:Bool -> @acc:List<&2, Doc> -> List<&2, Doc>
@parts:List<&2, Part> -> List<&2, Doc>
The parts' docs with their separators, last first.
@comments:Bool -> Doc
@close:Token -> @comments:Bool -> Doc
A generic's closing > stays glued to the term before it: Bend parses a spaced > as a comparison, even across a newline.
@open:Token -> @+close:Token -> @tab:U32 -> @st:State -> Doc
@open:Token -> @close:Token -> @children:List<&2, Tree> -> @block:Bool -> Mode
Build -----
@base:U32 -> State
@+mode:Mode -> @n:Tree -> @d:Doc -> @rest:List<&2, Tree> -> @tab:U32 -> @base:U32 -> @st:State -> State
@mode:Mode -> @st:State -> @+tab:U32 -> @base:U32 -> Doc
@nodes:List<&2, Tree> -> @+tab:U32 -> @+base:U32 -> @+mode:Mode -> @st:State -> Doc
The doc of a list of trees, read as mode says. A group's children are built first, by the same def, as a smaller part of the list.
@nodes:List<&2, Tree> -> @tab:U32 -> @+base:U32 -> Doc
@docs:List<&2, Doc> -> @+indent:U32 -> @+flat:Bool -> @jobs:List<&2, Job> -> List<&2, Job>
Printer ------- Jobs for a Cat's docs, last first, so its first doc ends on top.
@over:Bool -> @brk:Bool -> @jobs:List<&2, Job> -> @left:U32 -> Fit
@f:Flat -> @jobs:List<&2, Job> -> @+left:U32 -> Fit
A doc printed flat, whole: past the width, or up to a break within it.
@stop:Bool -> @+n:U32 -> @jobs:List<&2, Job> -> @+left:U32 -> Fit
@jobs:List<&2, Job> -> @left:U32 -> Fit
@fuel:Nat -> @f:Fit -> Bool
@over:Bool -> @fuel:Nat -> @left:U32 -> @jobs:List<&2, Job> -> Bool
@fuel:Nat -> @+width:U32 -> @+col:U32 -> @jobs:List<&2, Job> -> Bool
Whether the jobs fit before their first break, from col.
@tail:Maybe<&2, U32> -> @col:U32 -> @width:U32 -> U32
@body:String -> @keep:String -> @blank:String -> @jobs:List<&2, Job> -> @out:List<&2, String> -> @pending:String -> @col:U32 -> Print
Text goes out after the pending whitespace; its own trailing whitespace becomes pending.
@flat:Bool -> @text:String -> @+at:U32 -> @jobs:List<&2, Job> -> @out:List<&2, String> -> @pending:String -> @col:U32 -> @width:U32 -> @newline:String -> Print
@flat:Bool -> @fuel:Nat -> @+width:Maybe<&2, U32> -> @col:U32 -> @jobs:List<&2, Job> -> Bool
@width:Maybe<&2, U32> -> Bool
@jobs:List<&2, Job> -> @out:List<&2, String> -> @pending:String -> @+col:U32 -> @width:Maybe<&2, U32> -> @newline:String -> @fuel:Nat -> Print
@fuel:Nat -> @p:Print -> @+width:Maybe<&2, U32> -> @+newline:String -> @+budget:Nat -> String
The text so far; pending whitespace is never written at the end.
@doc:Doc -> @width:Maybe<&2, U32> -> @+indent:U32 -> @newline:String -> @+fuel:Nat -> String
The doc at indent; fuel bounds the steps of the printer and of each fit. A group is all flat if it fits; else its separators break together. Nesting is relative, never aligned under a function name. The width is a target, not a license to split atoms.
@+p:Tree -> @+next:Tree -> @following:Maybe<&2, Tree> -> Bool
Records -------
@previous:Maybe<&2, Tree> -> @rest:List<&2, Tree> -> Bool
Whether a newline between previous and rest continues the record.
@join:Bool -> @done:List<&2, List<&2, Tree>> -> @current:List<&2, Tree> -> Recs
@newline:Bool -> @n:Tree -> @rest:List<&2, Tree> -> @done:List<&2, List<&2, Tree>> -> @+current:List<&2, Tree> -> Recs
@nodes:List<&2, Tree> -> @r:Recs -> List<&2, List<&2, Tree>>
@+n:Tree -> @c:Cut -> Cut
@xs:List<&2, Tree> -> @c:Cut -> Cut
@c:Cut -> Bool
Whether the cut has a body after its colon that is not a comment.
@s:String -> Bool
@r:Run -> Hash
@+s:String -> Hash
@+rest:String -> @s:String -> String
@+s:String -> String
@s:String -> Bool
@+s:String -> Bool
@s:String -> @hit:Bool -> @acc:String -> String
@+s:String -> String
@h:Hash -> Doc
@head:Token -> @record:List<&2, Tree> -> U32
Where the record that head starts ends.
@+head:Token -> @record:List<&2, Tree> -> Doc
Paths and aliases have their own grammar: / and - are not operators there, so an import keeps its text and only its spacing changes.
@inline:Bool -> @c:Cut -> @record:List<&2, Tree> -> @+tab:U32 -> @+col:U32 -> Doc
@+c:Cut -> @record:List<&2, Tree> -> @declaration:Bool -> @tab:U32 -> @+col:U32 -> Doc
@+record:List<&2, Tree> -> @declaration:Bool -> @tab:U32 -> @col:U32 -> Doc
A declaration's body on the line of its colon moves to the next line, indented.
@is_import:Bool -> @head:Token -> @record:List<&2, Tree> -> @declaration:Bool -> @tab:U32 -> @col:U32 -> Doc
@xs:List<&2, Tree> -> @acc:List<&2, String> -> String
The text of the first tokens of xs, after acc, the texts so far, last first.
@at:Bool -> @record:List<&2, Tree> -> Bool
@gap:Bool -> @rows:List<&2, String> -> List<&2, String>
@+head:Token -> @+record:List<&2, Tree> -> @+set:Settings -> @r:Rows -> Rows
@record:List<&2, Tree> -> @set:Settings -> @r:Rows -> Rows
@records:List<&2, List<&2, Tree>> -> @+set:Settings -> @r:Rows -> Rows
@rows:List<&2, String> -> Bool
@rows:List<&2, String> -> @go:Bool -> List<&2, String>
@rows:List<&2, String> -> @+newline:String -> @acc:String -> String
@rows:List<&2, String> -> @+newline:String -> String
The rows, last first, joined, without the empty rows at the end, with a newline. Each row has no trailing whitespace already.
@+rows:List<&2, String> -> @newline:String -> String
@r:Rows -> @newline:String -> String
@nodes:Maybe<&2, List<&2, Tree>> -> @+set:Settings -> Maybe<&2, String>
@source:String -> @set:Settings -> Maybe<&2, String>
The formatted text, or None{} if its delimiters do not balance.
@a:String -> @b:String -> @at:U32 -> @same:Bool -> U32
Where a and b first differ: same is whether the characters before at were the same.
@s:String -> @i:U32 -> U32
Where the line that s starts, at i, ends: before its newline, or at the end of the text.
@same:Bool -> @+out:String -> @+text:String -> @+path:String -> List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Finding>
@formatted:Maybe<&2, String> -> @+text:String -> @path:String -> List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Finding>
@s:String -> String
@preserve:Bool -> @source:String -> String
@crlf:Bool -> @eol:String -> @source:String -> String
@+eol:String -> @source:String -> String
@value:Maybe<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Value> -> Maybe<&2, U32>
@+here:0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Here -> Settings
@+here:0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Here -> 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Ask(List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Finding>)
List<&2, 0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Declared>
0x94bdd21968f0b8ad8c1be0e7e2b606a0/linter/api/spec.Rule
@-test:(@+c:Char -> Bool) -> @s:String -> Bool
@-test:(@_:String -> Bool) -> @s:String -> @keep:String -> @ok:Bool -> @text:String -> @n:U32 -> @last:Char -> Run
scan, with the text so far last character first: on the C lane, ++ copies its left side.
@-test:(@_:String -> Bool) -> @s:String -> @keep:String -> @ok:Bool -> @text:String -> @n:U32 -> @last:Char -> Run
Reads characters while test holds, after text; test sees the text from each character on, so it can look ahead.