From 8e8642d7d6fdb18544e2a0f2982817a4b8d4a02a Mon Sep 17 00:00:00 2001 From: Blendi Date: Fri, 8 May 2026 21:55:51 +0200 Subject: [PATCH] parser: fix table literals with semicolons --- src/main.c | 2 +- src/parser.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index b3b814a..852d51f 100644 --- a/src/main.c +++ b/src/main.c @@ -33,7 +33,7 @@ void print_node(noomP_Node* node, noom_uint_t depth) { int main(int argc, char** argv) { // uhh uhhh uhhhhh - const char* code = "function a(...) print(...) end"; + const char* code = "local t = {'a'; 2; 6}"; noom_uint_t pos = 0; printf("LEX OUTPUT:\n"); diff --git a/src/parser.c b/src/parser.c index c855b73..cb2958d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -270,6 +270,8 @@ noomP_Node* noomP_parseTableLiteral(noomP_Parser* parser) { if (noomP_peek(parser, &token)) return 0; if (token.type == NOOML_TOKEN_SYMBOL && noom_streql(parser->code + token.offset, token.length, ",", 1)) { noomP_skip(parser, &token); + } else if (token.type == NOOML_TOKEN_SYMBOL && noom_streql(parser->code + token.offset, token.length, ";", 1)) { + noomP_skip(parser, &token); } else { break; }