Expand description
Bash AST parser wrapper around tree-sitter-bash.
Converts tree-sitter’s raw [tree_sitter::Node] graph into a friendlier
Node tree that the security analyzer consumes. All offsets are UTF-8
byte offsets and Node::text is sliced directly from the original source
so callers never have to manage tree-sitter lifetimes themselves.
Structs§
- Node
- A node in the bash AST.
- Simple
Command - A simple command with its argv, leading environment assignments, and redirects.
Enums§
- Redirect
Op - A redirect operator canonical enum.
Constants§
- ARGUMENT_
KINDS - Kinds that are considered literal words / arguments.
- DANGEROUS_
KINDS - Named node kinds that represent compound / dynamic shell constructs. If any of these appear in a command, we refuse to extract a static argv.
- STRUCTURAL_
KINDS - Kinds that wrap multiple commands.
Functions§
- is_
argument_ kind - Returns true if the node kind is an argument-like token.
- is_
command_ kind - Returns true if the node kind is a command name or declaration command.
- parse
- Parse a bash command string into an AST.
- parse_
variable_ assignment - Simple field-name to value map for a
variable_assignmentnode. - redirect_
op_ from_ kind - Maps a tree-sitter redirect operator kind to its canonical form.