Enum xswag_syntax_java::lex::Token
[−]
[src]
pub enum Token {
Whitespace,
Comment,
Ident(String),
KeyW(Keyword),
Literal(Lit),
ParenOp,
ParenCl,
BraceOp,
BraceCl,
BracketOp,
BracketCl,
Semi,
Comma,
Dot,
DotDotDot,
At,
ColonSep,
Eq,
Gt,
Lt,
Bang,
Tilde,
Question,
Colon,
Arrow,
EqEq,
Ge,
Le,
Ne,
AndAnd,
OrOr,
PlusPlus,
MinusMinus,
Plus,
Minus,
Star,
Slash,
And,
Or,
Caret,
Percent,
Shl,
Shr,
ShrUn,
PlusEq,
MinusEq,
StarEq,
SlashEq,
AndEq,
OrEq,
CaretEq,
PercentEq,
ShlEq,
ShrEq,
ShrUnEq,
}A Java token
This enum differs a bit from the original definition in the Java spec, in
which this Token is called InputElement and is defined as:
WhiteSpace | Comment | Token
The Java-*Token* is defined as:
Identifier | Keyword | Literal | Seperator | Operator
This Token type differs from the formal and correct definition to make
the parser and lexer module less verbose. The differences are:
- all 5 variants of the Java-*Token* are direct variants of this Token
- therefore the name Java-*Token* is not necessary and Java's
InputElement is called Token instead
- *Seperator*s and *Operator*s are also direct variants of this Token
Variants
WhitespaceCommentIdent(String)KeyW(Keyword)Literal(Lit)ParenOpParenClBraceOpBraceClBracketOpBracketClSemiCommaDotDotDotDotAtColonSepEqGtLtBangTildeQuestionColonArrowEqEqGeLeNeAndAndOrOrPlusPlusMinusMinusPlusMinusStarSlashAndOrCaretPercentShlShrShrUnPlusEqMinusEqStarEqSlashEqAndEqOrEqCaretEqPercentEqShlEqShrEqShrUnEqMethods
impl Token[src]
fn is_real(&self) -> bool
Returns true if the token is a "real" token (aka. a Java-*Token*)
fn as_java_string(&self) -> &str
String for error reporting. Example:
Excpected one of `,` `;` `)`
Trait Implementations
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
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 !=.