pub struct Parser<'a> { /* private fields */ }Expand description
Parser for bash scripts.
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn parse(self) -> ParseResult
pub fn parse(self) -> ParseResult
Parse the input and return the AST, recovery diagnostics, and syntax facts.
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
Sourcepub fn with_dialect(input: &'a str, dialect: ShellDialect) -> Self
pub fn with_dialect(input: &'a str, dialect: ShellDialect) -> Self
Create a new parser for the given input and shell dialect.
Sourcepub fn with_profile(input: &'a str, shell_profile: ShellProfile) -> Self
pub fn with_profile(input: &'a str, shell_profile: ShellProfile) -> Self
Create a new parser for the given input and full shell profile.
Sourcepub fn with_max_depth(input: &'a str, max_depth: usize) -> Self
pub fn with_max_depth(input: &'a str, max_depth: usize) -> Self
Create a new parser with a custom maximum AST depth.
Sourcepub fn with_fuel(input: &'a str, max_fuel: usize) -> Self
pub fn with_fuel(input: &'a str, max_fuel: usize) -> Self
Create a new parser with a custom fuel limit.
Sourcepub fn with_limits(input: &'a str, max_depth: usize, max_fuel: usize) -> Self
pub fn with_limits(input: &'a str, max_depth: usize, max_fuel: usize) -> Self
Create a new parser with custom depth and fuel limits.
max_depth is clamped to HARD_MAX_AST_DEPTH (500)
to prevent stack overflow from misconfiguration. Even if the caller passes
max_depth = 1_000_000, the parser will cap it at 500.
Sourcepub fn with_limits_and_dialect(
input: &'a str,
max_depth: usize,
max_fuel: usize,
dialect: ShellDialect,
) -> Self
pub fn with_limits_and_dialect( input: &'a str, max_depth: usize, max_fuel: usize, dialect: ShellDialect, ) -> Self
Create a new parser with custom depth, fuel, and dialect settings.
Sourcepub fn with_limits_and_profile(
input: &'a str,
max_depth: usize,
max_fuel: usize,
shell_profile: ShellProfile,
) -> Self
pub fn with_limits_and_profile( input: &'a str, max_depth: usize, max_fuel: usize, shell_profile: ShellProfile, ) -> Self
Create a new parser with custom depth, fuel, and shell-profile settings.
Sourcepub fn parse_word_string(input: &str) -> Word
pub fn parse_word_string(input: &str) -> Word
Parse a string as a word (handling $var, $((expr)), ${…}, etc.). Used by the interpreter to expand operands in parameter expansions lazily.
Sourcepub fn parse_assignment_word_group(
source: &str,
words: &[&Word],
explicit_array_kind: Option<ArrayKind>,
subscript_interpretation: SubscriptInterpretation,
) -> Option<Assignment>
pub fn parse_assignment_word_group( source: &str, words: &[&Word], explicit_array_kind: Option<ArrayKind>, subscript_interpretation: SubscriptInterpretation, ) -> Option<Assignment>
Classify a contiguous group of already-parsed words as a shell assignment.
Some shell syntax, such as process substitution inside an array subscript, can produce multiple AST words while still occupying one contiguous assignment operand in the source.