Lex and parse array expression

This commit is contained in:
Rafał Grodziński
2025-07-07 14:53:56 +09:00
parent 18926f3477
commit 18dd7d05d4
12 changed files with 117 additions and 6 deletions

View File

@@ -126,6 +126,14 @@ shared_ptr<Token> Lexer::nextToken() {
if (token != nullptr)
return token;
token = match(TokenKind::LEFT_SQUARE_BRACKET, "[", false);
if (token != nullptr)
return token;
token = match(TokenKind::RIGHT_SQUARE_BRACKET, "]", false);
if (token != nullptr)
return token;
token = match(TokenKind::COMMA, ",", false);
if (token != nullptr)
return token;
@@ -472,6 +480,8 @@ bool Lexer::isSeparator(int index) {
case '>':
case '(':
case ')':
case '[':
case ']':
case ',':
case ':':
case ';':

View File

@@ -21,6 +21,8 @@ enum class TokenKind {
LEFT_PAREN,
RIGHT_PAREN,
LEFT_SQUARE_BRACKET,
RIGHT_SQUARE_BRACKET,
COMMA,
COLON,
SEMICOLON,