Alpha Chen 2 years ago
parent 3dc84e9f28
commit 3707f7be91
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -158,8 +158,8 @@ impl<'a> Iterator for Scanner<'a> {
Some(match self.advance() { Some(match self.advance() {
c if is_alpha(c) => self.identifier(), c if is_alpha(c) => self.identifier(),
c if c.is_ascii_digit() => self.number(), c if c.is_ascii_digit() => self.number(),
// '(' => Token::new(self, TokenKind::LeftParen), '(' => Token::new(self, TokenKind::LeftParen),
'(' => self.make_token(TokenKind::LeftParen), // '(' => self.make_token(TokenKind::LeftParen),
// ')' => self.make_token(TokenKind::RightParen), // ')' => self.make_token(TokenKind::RightParen),
// '{' => self.make_token(TokenKind::LeftBrace), // '{' => self.make_token(TokenKind::LeftBrace),
// '}' => self.make_token(TokenKind::RightBrace), // '}' => self.make_token(TokenKind::RightBrace),
@ -211,7 +211,7 @@ pub struct Token<'a> {
} }
impl<'a> Token<'a> { impl<'a> Token<'a> {
fn new(scanner: &'a Scanner, kind: TokenKind) -> Self { fn new(scanner: &Scanner<'a>, kind: TokenKind) -> Self {
Token { Token {
kind, kind,
value: std::str::from_utf8(&scanner.source[..scanner.current]).unwrap(), value: std::str::from_utf8(&scanner.source[..scanner.current]).unwrap(),

Loading…
Cancel
Save