JustBash.AST (JustBash v0.3.0)

View Source

Abstract Syntax Tree (AST) Types for Bash

This module defines the complete AST structure for bash scripts. The design follows the actual bash grammar while being Elixir-idiomatic.

Architecture: Input -> Lexer -> Parser -> AST -> Interpreter -> Output

Summary

Types

arith_expr()

brace_item()

@type brace_item() ::
  {:word, JustBash.AST.Word.t()}
  | {:range, start :: String.t() | integer(), end_val :: String.t() | integer(),
     step :: integer() | nil}

command()

compound_command()

conditional_expression()

parameter_operation()

word_part()

Functions

arithmetic_command(expression, redirections \\ [])

arithmetic_expansion(expression)

assignment(name, value, append \\ false, array \\ nil)

case_item(patterns, body, terminator \\ :dsemi)

case_node(word, items, redirections \\ [])

command_substitution(body, legacy \\ false)

conditional_command(expression, redirections \\ [])

double_quoted(parts)

escaped(value)

for_node(variable, words, body, redirections \\ [])

function_def(name, body, redirections \\ [])

group(body, redirections \\ [])

here_doc(delimiter, content, strip_tabs \\ false, quoted \\ false)

if_clause(condition, body)

if_node(clauses, else_body \\ nil, redirections \\ [])

literal(value)

parameter_expansion(parameter, operation \\ nil)

pipeline(commands, negated \\ false)

redirection(operator, target, fd \\ nil)

script(statements)

simple_command(name, args \\ [], assignments \\ [], redirections \\ [], line \\ nil)

single_quoted(value)

statement(pipelines, operators \\ [], background \\ false)

subshell(body, redirections \\ [])

until_node(condition, body, redirections \\ [])

while_node(condition, body, redirections \\ [])

word(parts)