sibil/src/lexer/token.rs

30 lines
544 B
Rust
Raw Normal View History

/* token.rs
* Eryn Wells <eryn@erynwells.me>
*/
#[derive(Debug)]
2016-12-25 14:20:25 -07:00
#[derive(PartialEq)]
pub enum Token {
LeftParen(String),
2016-12-25 20:59:21 -07:00
LeftVectorParen,
RightParen(String),
2016-12-25 20:54:47 -07:00
Dot,
Identifier(String),
Boolean(bool),
2016-12-25 15:03:18 -07:00
String(String),
2016-12-25 13:50:34 -07:00
Comment(String),
}
/// A Lex is a Token extracted from a specific position in an input. It contains useful information about the token's
/// place.
#[derive(Debug)]
pub struct Lex {
2016-12-25 14:20:25 -07:00
pub token: Token,
}
impl Lex {
pub fn new(token: Token) -> Lex {
Lex { token: token }
}
}