def literal.go

bend-lint-rules@0.2.0.0 · layout/format.bend:528

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import Base

528# `literal`, with the text so far last character first: on the C lane, ++ copies its left side.
529def literal.go(
530  s: String,
531  keep: String,
532  +quote: Char,
533  at: Quote,
534  text: String,
535  n: U32,
536  last: Char,
537  tail: Maybe<&2, U32>
538) -> Scan:
539  match s at:
540    case SCon{+c, +rest} Inside{}:
541      literal.go(
542        rest,
543        rest,
544        quote,
545        quote_after(c, quote),
546        SCon{c, text},
547        (n + 1: U32),
548        c,
549        tail_after(c, tail)
550      )
551    case SCon{+c, +rest} Escaped{}:
552      literal.go(rest, rest, quote, Inside{}, SCon{c, text}, (n + 1: U32), c, tail_after(c, tail))
553    case _ _:
554      Tok{String.reverse(text), n, keep, last, Literal{}, Word{}, False{}, tail}

Uses (13)

Used by (1)