JustBash.Interpreter.Expansion.Brace (JustBash v0.4.0)
View SourceBrace expansion for bash.
Handles:
- List expansion: {a,b,c}
- Range expansion: {1..10}, {a..z}, {1..10..2}
Bounds
This is the one expansion whose output size is not bounded by anything the
input already holds: {1..1000000} is twelve characters, and nesting
multiplies. The word list is therefore produced under two bounds — the
cardinality cap of Limit.check_expansion_words!/2 and the wall clock — both
applied as each word is produced rather than after the list exists.
Summary
Types
Pending variable assignments from expansions
Functions
Expand brace expansion items (words and ranges).
Expand a range (numeric or character).
Expand word parts that may contain brace expansions. Returns {list_of_expanded_strings, pending_assignments}.
Check if word parts contain a brace expansion.
Types
@type pending_assignments() :: JustBash.Interpreter.Expansion.pending_assignments()
Pending variable assignments from expansions
Functions
@spec expand_brace_items(JustBash.t(), [JustBash.AST.brace_item()]) :: [String.t()]
Expand brace expansion items (words and ranges).
Expand a range (numeric or character).
@spec expand_with_brace(JustBash.t(), [JustBash.AST.word_part()]) :: {[String.t()], pending_assignments()}
Expand word parts that may contain brace expansions. Returns {list_of_expanded_strings, pending_assignments}.
@spec has_brace_expansion?([JustBash.AST.word_part()]) :: boolean()
Check if word parts contain a brace expansion.