Skip to content

Commit

Permalink
Created <iaas> module, added <lexer> module.
Browse files Browse the repository at this point in the history
  • Loading branch information
irfanghat committed Jul 11, 2024
1 parent 898601d commit cb3c3d1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions rust/src/iaas/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,24 @@ impl<'l> Lexer<'l> {
}

Some(c) if c.is_alphabetic() => Token::Identifier(self.read_identifier()),
Some('"') => Token::StringLiteral(self.read_s)
}
Some('"') => Token::StringLiteral(self.read_string()),
Some('=') => {
self.advance();
Token::Equals
}
Some('{') => {
self.advance();
Token::LeftBrace
}
Some('}') => {
self.advance();
Token::RightBrace
}
Some(c) if c.is_digit(10) => Token::NumberLiteral(self.read_number()),
None => Token::EOF,
_ => panic!("Unexpected character: {:?}", self.current_char),
};

token
}
}

0 comments on commit cb3c3d1

Please sign in to comment.