JustBash.Commands.Awk.Evaluator (JustBash v0.4.0)
View SourceEvaluator for AWK programs.
Executes parsed AWK programs against input content, managing state and producing output.
Summary
Functions
Evaluate an expression in the given state context.
Evaluate an expression and return both the value and potentially updated state. Most expressions don't modify state, but increment/decrement expressions do.
Execute an AWK program against the given content.
Parse a value as a number.
Types
@type state() :: %{ nr: non_neg_integer(), nf: non_neg_integer(), fs: String.t(), ofs: String.t(), ors: String.t(), fields: [String.t()], variables: %{required(String.t()) => String.t()}, arrays: %{required(String.t()) => map()}, output: String.t(), exit_code: non_neg_integer() | nil, deadline: JustBash.Limit.Deadline.t() | nil }
Functions
@spec evaluate_expression(JustBash.Commands.Awk.AST.expr(), state()) :: String.t() | number()
Evaluate an expression in the given state context.
Evaluate an expression and return both the value and potentially updated state. Most expressions don't modify state, but increment/decrement expressions do.
@spec execute(JustBash.Commands.Awk.AST.program(), map()) :: {String.t(), non_neg_integer(), map(), JustBash.t() | nil}
Execute an AWK program against the given content.
Accepts opts with :files as a list of {filename, content} tuples for proper FNR/FILENAME multi-file support.
Returns {output, exit_code, file_outputs, bash}.
@spec execute(String.t(), JustBash.Commands.Awk.AST.program(), map()) :: {String.t(), non_neg_integer(), map(), JustBash.t() | nil}
Parse a value as a number.