lexer: add comma and fix newline
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
@@ -64,6 +64,7 @@ pub enum TokenSymbol {
|
|||||||
//misc
|
//misc
|
||||||
Colon,
|
Colon,
|
||||||
Dot,
|
Dot,
|
||||||
|
Comma,
|
||||||
Hash,
|
Hash,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,6 +373,7 @@ impl<'a> Lexer<'a> {
|
|||||||
'~' => Symbol(Tilde),
|
'~' => Symbol(Tilde),
|
||||||
':' => Symbol(Colon),
|
':' => Symbol(Colon),
|
||||||
'.' => Symbol(Dot),
|
'.' => Symbol(Dot),
|
||||||
|
',' => Symbol(Comma),
|
||||||
'#' => Symbol(Hash),
|
'#' => Symbol(Hash),
|
||||||
_ => {
|
_ => {
|
||||||
self.error("Unknown character encountered");
|
self.error("Unknown character encountered");
|
||||||
@@ -388,6 +390,7 @@ impl<'a> Lexer<'a> {
|
|||||||
let token = if let Some(c) = self.peek() {
|
let token = if let Some(c) = self.peek() {
|
||||||
match c {
|
match c {
|
||||||
'\n' => {
|
'\n' => {
|
||||||
|
self.next();
|
||||||
self.line += 1;
|
self.line += 1;
|
||||||
self.new_token(TokenKind::Newline)
|
self.new_token(TokenKind::Newline)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user