Enum yash_syntax::syntax::TextUnit
source · [−]pub enum TextUnit {
Literal(char),
Backslashed(char),
RawParam {
name: String,
location: Location,
},
BracedParam(Param),
CommandSubst {
content: String,
location: Location,
},
Backquote {
content: Vec<BackquoteUnit>,
location: Location,
},
Arith {
content: Text,
location: Location,
},
}
Expand description
Element of a Text, i.e., something that can be expanded.
Variants
Literal(char)
Literal single character.
Backslashed(char)
Backslash-escaped single character.
RawParam
Fields
name: String
Parameter name.
location: Location
Location of the initial $
character of this parameter expansion.
Parameter expansion that is not enclosed in braces.
BracedParam(Param)
Parameter expansion that is enclosed in braces.
CommandSubst
Fields
content: String
Command string that will be parsed and executed when the command substitution is expanded.
location: Location
Location of the initial $
character of this command substitution.
Command substitution of the form $(...)
.
Backquote
Fields
content: Vec<BackquoteUnit>
Command string that will be parsed and executed when the command substitution is expanded.
location: Location
Location of the initial backquote character of this command substitution.
Command substitution of the form `...`
.
Arith
Fields
content: Text
Expression that is to be evaluated.
location: Location
Location of the initial $
character of this command substitution.
Arithmetic expansion.
Trait Implementations
If self
is Literal
, appends the character to result
and returns
Ok(result)
. Otherwise, returns Err(result)
.
Checks if self
is literal and, if so, converts to a string.
Auto Trait Implementations
impl !RefUnwindSafe for TextUnit
impl !UnwindSafe for TextUnit
Blanket Implementations
Mutably borrows from an owned value. Read more