Lex interpolations

This commit is contained in:
ConnorSkees 2020-01-12 10:52:51 -05:00
parent fd423ce300
commit 77d5c8ea2e

View File

@ -57,7 +57,7 @@ impl<'a> Iterator for Lexer<'a> {
self.buf.next(); self.buf.next();
TokenKind::Whitespace(Whitespace::CarriageReturn) TokenKind::Whitespace(Whitespace::CarriageReturn)
} }
'#' => symbol!(self, Hash), '#' => self.lex_hash(),
'{' => symbol!(self, OpenBrace), '{' => symbol!(self, OpenBrace),
'*' => symbol!(self, Mul), '*' => symbol!(self, Mul),
'}' => symbol!(self, CloseBrace), '}' => symbol!(self, CloseBrace),
@ -204,7 +204,14 @@ impl<'a> Lexer<'a> {
} }
fn lex_hash(&mut self) -> TokenKind { 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 { fn lex_attr(&mut self) -> TokenKind {