Skip to main content

Module scanner

Module scanner 

Source
Expand description

Byte-level scanner for Erlang source.

Tracks position (line, column, byte offset), skips comments and strings, and exposes helpers the reader uses to find function clauses and call sites. Not a full Erlang tokenizer: just what the v1 xref reader needs.

A separate block-oriented tokenizer exists in backhopper_erlang::tokenizer. Consolidation is deferred until a third consumer needs it.

Structs§

ParenWalk
Outcome of a walk_paren_group pass over a (...) group.
Scanner

Functions§

arity_from_commas
Returns the arity inferred from the argument-list source (a, b, c). Empty parens yields 0; one or more top-level commas yields commas+1.
walk_paren_group
Scans the balanced (...) group at the current (, which must be the next byte. Tracks nested (), [], {}, and <<>>; skips strings, quoted atoms, char literals, and % comments. At each byte that can begin an identifier or ?macro use, on_ident runs with the cursor on that byte so callers can surface nested call sites; if it returns false the byte is consumed and the walk continues. Reports the top-level comma count, whether any non-whitespace content appeared, and whether the matching ) was reached.