Adds support for parenthesized expressions
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user