module
Analyzer::Erlang::Helper
Overview
Shared helpers for the Erlang framework analyzers (Cowboy, Elli).
Extended Modules
Defined in:
analyzer/analyzers/erlang/erlang_helper.crInstance Method Summary
-
#parse_cowboy_path(path_match : String) : Tuple(String, Array(Param))
Erlang path matches appear both as plain strings (
"/users/:id") and as binaries (<<"/users/:id">>). -
#strip_erlang_comments(text : String) : String
Blank out
%line comments while PRESERVING newlines/offsets, so a comment never collapses lines and shifts every later endpoint's reported line number.
Instance Method Detail
Erlang path matches appear both as plain strings ("/users/:id")
and as binaries (<<"/users/:id">>). Both carry the same syntax.
Segment forms, per cowboy_router:
:name— a binding, i.e. a path parameter.[...]— matches all remaining segments (wildcard).[/optional]— an optional segment.:name[...]— a binding that also swallows the remainder.
Returns the noir-normalized URL plus the bindings as path params.
Blank out % line comments while PRESERVING newlines/offsets, so a
comment never collapses lines and shifts every later endpoint's
reported line number.
Erlang has three constructs a naive %-to-end-of-line scan gets
wrong, and all three appear in real dispatch tables:
"..."strings —"100%"is not a comment.'...'quoted atoms —'GET%', and more commonly'_'.$ccharacter literals —$%IS the percent character, and$'/$"are quote characters that must not open a string.