Lex and parse array expression
This commit is contained in:
@@ -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 ';':
|
||||
|
||||
@@ -21,6 +21,8 @@ enum class TokenKind {
|
||||
|
||||
LEFT_PAREN,
|
||||
RIGHT_PAREN,
|
||||
LEFT_SQUARE_BRACKET,
|
||||
RIGHT_SQUARE_BRACKET,
|
||||
COMMA,
|
||||
COLON,
|
||||
SEMICOLON,
|
||||
|
||||
Reference in New Issue
Block a user