From e2dbc82213a6e5da74de2220eeeab78da41fb519 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Wed, 2 Feb 2022 19:22:15 -0500 Subject: Add initial support for arrays (also no testing) Usual disclaimer at this point: Quick&Dirty implementation, hasn't been tested other than basic sanity checks. Arrays are automatically decayed into pointers when the identifier is accessed. --- src/lexer.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/lexer.c') diff --git a/src/lexer.c b/src/lexer.c index af5a14c..3e71343 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -109,6 +109,8 @@ Token Lexer_next(Lexer *lexer) case ')': return Lexer_make_token(lexer, TOKEN_CLOSE_PAREN, 1); case '{': return Lexer_make_token(lexer, TOKEN_OPEN_BRACE, 1); case '}': return Lexer_make_token(lexer, TOKEN_CLOSE_BRACE, 1); + case '[': return Lexer_make_token(lexer, TOKEN_OPEN_BRACKET, 1); + case ']': return Lexer_make_token(lexer, TOKEN_CLOSE_BRACKET, 1); case ';': return Lexer_make_token(lexer, TOKEN_SEMICOLON, 1); case ':': return Lexer_make_token(lexer, TOKEN_COLON, 1); case '~': return Lexer_make_token(lexer, TOKEN_TILDE, 1); -- cgit v1.2.3