[lexer] Lexer emits Lexes instead of Tokens
This commit is contained in:
parent
5f3770914f
commit
cc43ffd135
3 changed files with 48 additions and 15 deletions
25
lexer/src/token.rs
Normal file
25
lexer/src/token.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* lexer/src/token.rs
|
||||
* Eryn Wells <eryn@erynwells.me>
|
||||
*/
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub struct Lex {
|
||||
token: Token,
|
||||
value: String,
|
||||
line: usize,
|
||||
offset: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub enum Token { LeftParen, RightParen, Id, }
|
||||
|
||||
impl Lex {
|
||||
pub fn new(token: Token, value: &str, line: usize, offset: usize) -> Lex {
|
||||
Lex {
|
||||
token: token,
|
||||
value: String::from(value),
|
||||
line: line,
|
||||
offset: offset,
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue