JustBash.Interpreter.Executor.Loop (JustBash v0.4.0)

View Source

Executes loop constructs: for, while, until.

Handles:

  • For loops with word expansion
  • While/until loops with condition evaluation
  • Break and continue signals with nesting levels
  • Loop iteration limits (prevents infinite loops)

Summary

Types

result()

@type result() :: %{
  stdout: String.t(),
  stderr: String.t(),
  exit_code: non_neg_integer()
}

Functions

execute_for(bash, variable, words, body, execute_body_fn)

@spec execute_for(JustBash.t(), String.t(), [any()], [any()], function()) ::
  {result(), JustBash.t()}

execute_until(bash, condition, body, stdin, execute_body_fn)

@spec execute_until(JustBash.t(), [any()], [any()], String.t(), function()) ::
  {result(), JustBash.t()}

execute_while(bash, condition, body, stdin, execute_body_fn)

@spec execute_while(JustBash.t(), [any()], [any()], String.t(), function()) ::
  {result(), JustBash.t()}