parser: fix table literals with semicolons

This commit is contained in:
2026-05-08 21:55:51 +02:00
parent 9f6b6e1eec
commit 8e8642d7d6
2 changed files with 3 additions and 1 deletions

View File

@@ -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");

View File

@@ -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;
}