Adds support for parenthesized expressions

This commit is contained in:
2019-05-21 17:16:53 +02:00
parent ae25598864
commit aec07bd29a
7 changed files with 186 additions and 127 deletions

View File

@@ -38,7 +38,7 @@ IToken* Lexer::LexNext(char c){
switch (c) {
case '\0':
return new SimpleToken(TokenKind::EndOfFile, this -> Position - 1, 1);
case ' ': case '\t': case '\n': case '\r': case '\v': case '\f':
case ' ': case '\t': case '\n': case '\r': case '\v': case '\f':
return new SimpleToken(TokenKind::WhiteSpace, this -> Position - 1, 1);
case '+':
return new SimpleToken(TokenKind::PlusToken, this -> Position - 1, 1);
@@ -48,6 +48,10 @@ IToken* Lexer::LexNext(char c){
return new SimpleToken(TokenKind::SlashToken, this -> Position - 1, 1);
case '*':
return new SimpleToken(TokenKind::StarToken, this -> Position - 1, 1);
case '(':
return new SimpleToken(TokenKind::OpenParenthesis, this -> Position - 1, 1);
case ')':
return new SimpleToken(TokenKind::CloseParenthesis, this -> Position - 1, 1);
case '=':
if (Lexer::Peek() == '='){
Lexer::Next();