Static walks over parsed statements, for compile-time checks and tooling. bodies/1 is the one
place that knows how statements nest; flatten/1 and the walks built on it follow from that.
Summary
Functions
The statement lists nested directly inside statement: <<if>> branches, else, option bodies.
The expressions statement evaluates itself, without nested statements, with their lines.
Every statement, depth first, including those nested in branches and options.
Every <<jump>> target, with its line, including inside options and <<if>> branches.
Every $name read, with the line of the statement reading it.
The statements with their source lines removed. A script's fingerprint is taken over this, so editing comments or blank lines does not invalidate stored cursors while changing a statement does.
Every $name assigned by <<set>> or <<declare>>, anywhere in the statements.
Functions
@spec bodies(Yarnspinnex.Parser.Body.statement()) :: [ [Yarnspinnex.Parser.Body.statement()] ]
The statement lists nested directly inside statement: <<if>> branches, else, option bodies.
@spec expressions(Yarnspinnex.Parser.Body.statement()) :: [ {Yarnspinnex.Parser.Expression.ast(), Yarnspinnex.Parser.Body.line()} ]
The expressions statement evaluates itself, without nested statements, with their lines.
@spec flatten([Yarnspinnex.Parser.Body.statement()]) :: [ Yarnspinnex.Parser.Body.statement() ]
Every statement, depth first, including those nested in branches and options.
@spec jump_targets([Yarnspinnex.Parser.Body.statement()]) :: [ {String.t(), Yarnspinnex.Parser.Body.line()} ]
Every <<jump>> target, with its line, including inside options and <<if>> branches.
@spec reads([Yarnspinnex.Parser.Body.statement()]) :: [ {String.t(), Yarnspinnex.Parser.Body.line()} ]
Every $name read, with the line of the statement reading it.
@spec strip_lines([Yarnspinnex.Parser.Body.statement()]) :: [tuple() | :stop]
The statements with their source lines removed. A script's fingerprint is taken over this, so editing comments or blank lines does not invalidate stored cursors while changing a statement does.
@spec writes([Yarnspinnex.Parser.Body.statement()]) :: [String.t()]
Every $name assigned by <<set>> or <<declare>>, anywhere in the statements.