Enum brush_parser::word::ParameterExpr
source · pub enum ParameterExpr {
Show 19 variants
Parameter {
parameter: Parameter,
indirect: bool,
},
UseDefaultValues {
parameter: Parameter,
indirect: bool,
test_type: ParameterTestType,
default_value: Option<String>,
},
AssignDefaultValues {
parameter: Parameter,
indirect: bool,
test_type: ParameterTestType,
default_value: Option<String>,
},
IndicateErrorIfNullOrUnset {
parameter: Parameter,
indirect: bool,
test_type: ParameterTestType,
error_message: Option<String>,
},
UseAlternativeValue {
parameter: Parameter,
indirect: bool,
test_type: ParameterTestType,
alternative_value: Option<String>,
},
ParameterLength {
parameter: Parameter,
indirect: bool,
},
RemoveSmallestSuffixPattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
RemoveLargestSuffixPattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
RemoveSmallestPrefixPattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
RemoveLargestPrefixPattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
Substring {
parameter: Parameter,
indirect: bool,
offset: UnexpandedArithmeticExpr,
length: Option<UnexpandedArithmeticExpr>,
},
Transform {
parameter: Parameter,
indirect: bool,
op: ParameterTransformOp,
},
UppercaseFirstChar {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
UppercasePattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
LowercaseFirstChar {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
LowercasePattern {
parameter: Parameter,
indirect: bool,
pattern: Option<String>,
},
ReplaceSubstring {
parameter: Parameter,
indirect: bool,
pattern: String,
replacement: String,
match_kind: SubstringMatchKind,
},
VariableNames {
prefix: String,
concatenate: bool,
},
MemberKeys {
variable_name: String,
concatenate: bool,
},
}Expand description
A parameter expression, used in a parameter expansion.
Variants§
Parameter
A parameter, with optional indirection.
Fields
UseDefaultValues
Conditionally use default values.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
test_type: ParameterTestTypeThe type of test to perform.
AssignDefaultValues
Conditionally assign default values.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
test_type: ParameterTestTypeThe type of test to perform.
IndicateErrorIfNullOrUnset
Indicate error if null or unset.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
test_type: ParameterTestTypeThe type of test to perform.
UseAlternativeValue
Conditionally use an alternative value.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
test_type: ParameterTestTypeThe type of test to perform.
ParameterLength
Compute the length of the given parameter.
Fields
RemoveSmallestSuffixPattern
Remove the smallest suffix from the given string matching the given pattern.
Fields
RemoveLargestSuffixPattern
Remove the largest suffix from the given string matching the given pattern.
Fields
RemoveSmallestPrefixPattern
Remove the smallest prefix from the given string matching the given pattern.
Fields
RemoveLargestPrefixPattern
Remove the largest prefix from the given string matching the given pattern.
Fields
Substring
Extract a substring from the given parameter.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
offset: UnexpandedArithmeticExprArithmetic expression that will be expanded to compute the offset at which the substring should be extracted.
length: Option<UnexpandedArithmeticExpr>Optionally provides an arithmetic expression that will be expanded to compute the length of substring to be extracted; if left unspecified, the remainder of the string will be extracted.
Transform
Transform the given parameter.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
op: ParameterTransformOpType of transformation to apply.
UppercaseFirstChar
Uppercase the first character of the given parameter.
Fields
UppercasePattern
Uppercase the portion of the given parameter matching the given pattern.
Fields
LowercaseFirstChar
Lowercase the first character of the given parameter.
Fields
LowercasePattern
Lowercase the portion of the given parameter matching the given pattern.
Fields
ReplaceSubstring
Replace occurrences of the given pattern in the given parameter.
Fields
indirect: boolWhether to treat the expanded parameter as an indirect reference, which should be subsequently dereferenced for the expansion.
match_kind: SubstringMatchKindKind of match to perform.
VariableNames
Select variable names from the environment with a given prefix.
MemberKeys
Select member keys from the named array.