aboutsummaryrefslogtreecommitdiff
path: root/src/lexer.c
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 19:22:15 -0500
committerMustafa Quraish <[email protected]>2022-02-02 19:22:15 -0500
commite2dbc82213a6e5da74de2220eeeab78da41fb519 (patch)
tree7f6d9a40fde00ec761e100a92bd93f555725d56c /src/lexer.c
parentMove type-related stuff to a separate file (diff)
downloadcup-e2dbc82213a6e5da74de2220eeeab78da41fb519.tar.xz
cup-e2dbc82213a6e5da74de2220eeeab78da41fb519.zip
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.
Diffstat (limited to 'src/lexer.c')
-rw-r--r--src/lexer.c2
1 files changed, 2 insertions, 0 deletions
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);