buffer original source data into the Token struct for use in-game

This commit is contained in:
2025-11-28 18:01:57 -07:00
parent 804bf11d02
commit f172ac5899
3 changed files with 100 additions and 27 deletions

View File

@@ -8,14 +8,21 @@ pub struct Token {
pub line: usize,
/// The column where the token was found
pub column: usize,
pub original_string: Option<String>,
}
impl Token {
pub fn new(token_type: TokenType, line: usize, column: usize) -> Self {
pub fn new(
token_type: TokenType,
line: usize,
column: usize,
original: Option<String>,
) -> Self {
Self {
token_type,
line,
column,
original_string: original,
}
}
}