Add lexer support for angles, which we'll use for casting.
This commit is contained in:
@@ -40,6 +40,12 @@ pub enum Token {
|
|||||||
#[token(")")]
|
#[token(")")]
|
||||||
RightParen,
|
RightParen,
|
||||||
|
|
||||||
|
#[token("<")]
|
||||||
|
LessThan,
|
||||||
|
|
||||||
|
#[token(">")]
|
||||||
|
GreaterThan,
|
||||||
|
|
||||||
// Next we take of any reserved words; I always like to put
|
// Next we take of any reserved words; I always like to put
|
||||||
// these before we start recognizing more complicated regular
|
// these before we start recognizing more complicated regular
|
||||||
// expressions. I don't think it matters, but it works for me.
|
// expressions. I don't think it matters, but it works for me.
|
||||||
@@ -89,6 +95,8 @@ impl fmt::Display for Token {
|
|||||||
Token::Semi => write!(f, "';'"),
|
Token::Semi => write!(f, "';'"),
|
||||||
Token::LeftParen => write!(f, "'('"),
|
Token::LeftParen => write!(f, "'('"),
|
||||||
Token::RightParen => write!(f, "')'"),
|
Token::RightParen => write!(f, "')'"),
|
||||||
|
Token::LessThan => write!(f, "<"),
|
||||||
|
Token::GreaterThan => write!(f, ">"),
|
||||||
Token::Print => write!(f, "'print'"),
|
Token::Print => write!(f, "'print'"),
|
||||||
Token::Operator(c) => write!(f, "'{}'", c),
|
Token::Operator(c) => write!(f, "'{}'", c),
|
||||||
Token::Number((None, otype, v)) => write!(f, "'{}{}'", v, display_optional_type(otype)),
|
Token::Number((None, otype, v)) => write!(f, "'{}{}'", v, display_optional_type(otype)),
|
||||||
|
|||||||
Reference in New Issue
Block a user