dementia 100 meow mrrp :3
All checks were successful
/ build (push) Successful in 1m42s

This commit is contained in:
xqtc161 2024-07-11 18:58:13 +02:00
parent a74b520231
commit eb4b8963fc

View file

@ -95,12 +95,17 @@ impl Lexer {
tokens.push(self.consume_comment());
} else {
match c {
// TODO Implement operands like +=
'+' | '-' | '*' | '/' | '%' | '&' | '|' | '^' | '!' | '=' | '<' | '>' | '?' => {
tokens.push(self.consume_operator());
}
_ => {
'{' | '}' | '(' | ')' | '#' | ',' | ';' => {
tokens.push(self.consume_symbol());
}
_ => {
tokens.push(self.consume_unknown());
}
}
}
}
@ -125,6 +130,12 @@ impl Lexer {
}
}
fn consume_unknown(&mut self) -> Token {
let unknown = self.current_char.unwrap();
self.advance();
Token::Unknown(unknown)
}
fn consume_identifier_or_keyword(&mut self) -> Token {
let mut identifier = String::new();
while let Some(c) = self.current_char {