Enum conch_parser::token::Token
[−]
[src]
pub enum Token { Newline, ParenOpen, ParenClose, CurlyOpen, CurlyClose, SquareOpen, SquareClose, Bang, Tilde, Pound, Star, Question, Backslash, Percent, Dash, Equals, Plus, Colon, At, Caret, Slash, Comma, SingleQuote, DoubleQuote, Backtick, Semi, Amp, Pipe, AndIf, OrIf, DSemi, Less, Great, DLess, DGreat, GreatAnd, LessAnd, DLessDash, Clobber, LessGreat, Dollar, ParamPositional(Positional), Whitespace(String), Literal(String), Name(String), }
The representation of (context free) shell tokens.
Variants
Newline
\n
ParenOpen
(
ParenClose
)
CurlyOpen
{
CurlyClose
}
SquareOpen
[
SquareClose
]
Bang
!
Tilde
~
Pound
#
Star
*
Question
?
Backslash
\
Percent
%
Dash
-
Equals
=
Plus
+
Colon
:
At
@
Caret
^
Slash
/
Comma
,
SingleQuote
'
DoubleQuote
"
Backtick
`
Semi
;
Amp
&
Pipe
|
AndIf
&&
OrIf
||
DSemi
;;
Less
<
Great
>
DLess
<<
DGreat
>>
GreatAnd
>&
LessAnd
<&
DLessDash
<<-
Clobber
>|
LessGreat
<>
Dollar
$
ParamPositional(Positional)
$0, $1, ..., $9
Must be its own token to avoid lumping the positional parameter
as a Literal
if the parameter is concatenated to something.
Whitespace(String)
Any string of whitespace characters NOT including a newline.
Literal(String)
Any literal delimited by whitespace.
Name(String)
A Literal
capable of being used as a variable or function name. According to the POSIX
standard it should only contain alphanumerics or underscores, and does not start with a digit.
Methods
impl Token
[src]
fn is_empty(&self) -> bool
Returns if the token's length is zero.
fn len(&self) -> usize
Returns the number of characters it took to recognize a token.
fn is_word_delimiter(&self) -> bool
Indicates whether a word can be delimited by this token when the token is not quoted or escaped.
fn as_str(&self) -> &str
Gets a representation of the token as a string slice.
Trait Implementations
impl PartialEq for Token
[src]
fn eq(&self, __arg_0: &Token) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Token) -> bool
This method tests for !=
.
impl Eq for Token
[src]
impl Debug for Token
[src]
impl Clone for Token
[src]
fn clone(&self) -> Token
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more