From 77d5c8ea2ee49e3635cf2d3fd644282f50bc4551 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Sun, 12 Jan 2020 10:52:51 -0500 Subject: [PATCH] Lex interpolations --- src/lexer.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lexer.rs b/src/lexer.rs index 6afe276..261aa9c 100644 --- a/src/lexer.rs +++ b/src/lexer.rs @@ -57,7 +57,7 @@ impl<'a> Iterator for Lexer<'a> { self.buf.next(); TokenKind::Whitespace(Whitespace::CarriageReturn) } - '#' => symbol!(self, Hash), + '#' => self.lex_hash(), '{' => symbol!(self, OpenBrace), '*' => symbol!(self, Mul), '}' => symbol!(self, CloseBrace), @@ -204,7 +204,14 @@ impl<'a> Lexer<'a> { } fn lex_hash(&mut self) -> TokenKind { - todo!() + self.buf.next(); + self.pos.next_char(); + if self.buf.peek() == Some(&'{') { + self.buf.next(); + self.pos.next_char(); + return TokenKind::Interpolation; + } + TokenKind::Symbol(Symbol::Hash) } fn lex_attr(&mut self) -> TokenKind {