pub fn parse(source: &str, extglob: bool) -> Result<Vec<Node>>Expand description
Parses a bash source string into a list of top-level AST nodes.
Each top-level command separated by newlines becomes a separate node.
Commands separated by ; on the same line are grouped into a single
NodeKind::List.
Set extglob to true to enable extended glob patterns (@(), ?(),
*(), +(), !()).
§Examples
let nodes = rable::parse("echo hello", false).unwrap();
assert_eq!(nodes[0].to_string(), "(command (word \"echo\") (word \"hello\"))");// Multiple top-level commands
let nodes = rable::parse("echo a\necho b", false).unwrap();
assert_eq!(nodes.len(), 2);§Errors
Returns RableError::Parse for syntax errors and
RableError::MatchedPair for unclosed delimiters.