From 11a93a21a684ba5b70b006b4162d5448e707307e Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sat, 21 Mar 2020 14:20:33 -0400 Subject: [PATCH] properly lex $ --- src/lexer.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index a8da83d..2d9f5c1 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -281,14 +281,17 @@ impl<'a> Lexer<'a> { self.buf.next(); self.pos.next_char(); let mut name = String::with_capacity(99); - if let Some(c) = self.buf.next() { - if !c.is_alphabetic() && c != '-' && c != '_' { + if let Some(c) = self.buf.peek() { + if c == &'=' { + return TokenKind::Symbol(Symbol::Dollar); + } else if !c.is_alphabetic() && c != &'-' && c != &'_' { eprintln!("Error: Expected identifier."); std::process::exit(1) } else { self.pos.next_char(); - name.push(c); + name.push(*c); } + self.buf.next(); } while let Some(c) = self.buf.peek() { if !c.is_alphanumeric() && c != &'-' && c != &'_' {