Analyzer::Gleam::Helper
Shared helpers for the Gleam framework analyzers (Wisp, Mist).
Instance methods
Returns the balanced {…} span beginning at open_idx, braces
included, or nil if it never closes. String contents are skipped so
a brace inside a literal doesn't unbalance the count — Gleam
strings may span newlines and routinely embed JS/HTML.
Renders a Gleam list pattern from a case wisp.path_segments(req)
arm into a noir URL plus its path params.
Segment forms:
"users"— a string literal segment.id— a bound variable, i.e. a path parameter._/_name— a discarded segment; still a parameter position, but unnamed, so it renders as a generic binding.../..rest— matches all remaining segments (wildcard).
Splits a case pattern on its top-level | alternates, so
["a"] | ["b", _] becomes two independent path patterns.
Splits a case-arm list pattern body (the text between [ and ])
into its top-level comma-separated segments, ignoring commas nested
inside strings, brackets, parens or braces.
Blank out // line comments (this covers /// and //// doc
comments too) while PRESERVING newlines/offsets, so a comment never
collapses lines and shifts every later endpoint's reported line
number. Gleam has no block comments.
"..." strings are skipped so a URL literal like
"https://example.com" doesn't truncate the line. Gleam strings may
span multiple lines, so the scanner tracks them across newlines.