-
-
Save yhara/a53475ba4d2c75d85caa16754e5254b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Parser<'a> { | |
pub str: String, | |
pub current_token: Option<&'a str>, | |
} | |
impl<'a> Parser<'a> { | |
pub fn lex(&'a mut self) { | |
let tmp: &'a str = &self.str[0..1]; | |
self.current_token = Some(tmp); | |
} | |
} | |
fn main() { | |
let mut parser = Parser{ | |
str: "hello".to_string(), | |
current_token: None, | |
}; | |
parser.lex(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment