def Scan.in_quote

bend-lint-rules@0.2.0.0 · lib/linter/directives.bend:165

import bend-lint-rules@0.2.0.0/lib/linter/directives.bend as Directives
import Base

165# A step in a string or a char literal (`string`): a \ escapes the next character, its closing quote ends it, and a
166# line it spans holds code.
167def Scan.in_quote(
168  string: Bool,
169  escaped: Bool,
170  glyph: Glyph,
171  at: U32,
172  line: U32,
173  code: Bool,
174  open: Comment,
175  comments: List<&2, Comment>,
176  lines: List<&2, Bool>
177) -> Scan:
178  match escaped glyph:
179    case _ LineEnd{}:
180      Scan{
181        InQuote{string, False{}},
182        (at + 1: U32),
183        (line + 1: U32),
184        True{},
185        open,
186        comments,
187        True{} <> lines
188      }
189    case True{} _:
190      Scan{InQuote{string, False{}}, (at + 1: U32), line, code, open, comments, lines}
191    case False{} Backslash{}:
192      Scan{InQuote{string, True{}}, (at + 1: U32), line, code, open, comments, lines}
193    case False{} DoubleQuote{}:
194      Scan{Scan.quote(string, True{}), (at + 1: U32), line, code, open, comments, lines}
195    case False{} SingleQuote{}:
196      Scan{Scan.quote(string, False{}), (at + 1: U32), line, code, open, comments, lines}
197    case False{} _:
198      Scan{InQuote{string, False{}}, (at + 1: U32), line, code, open, comments, lines}

Uses (9)

Used by (1)