Emit line and offset information with tokens in Lex objects
This commit is contained in:
parent
5b88ec73ec
commit
f2ff1acdd1
2 changed files with 11 additions and 9 deletions
|
@ -22,10 +22,12 @@ pub enum Token {
|
|||
#[derive(Debug)]
|
||||
pub struct Lex {
|
||||
pub token: Token,
|
||||
pub line: usize,
|
||||
pub offset: usize,
|
||||
}
|
||||
|
||||
impl Lex {
|
||||
pub fn new(token: Token) -> Lex {
|
||||
Lex { token: token }
|
||||
pub fn new(token: Token, line: usize, offset: usize) -> Lex {
|
||||
Lex { token: token, line: line, offset: offset }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue