lexer, parser: pass around lua version

This commit is contained in:
2026-04-19 17:07:05 +02:00
parent 92b85584c1
commit 1807520170
6 changed files with 23 additions and 11 deletions

View File

@@ -33,14 +33,14 @@ void print_node(noomP_Node* node, noom_uint_t depth) {
int main(int argc, char** argv) {
// uhh uhhh uhhhhh
const char* code = "local a, b";
const char* code = "local a, b = true, false\nif a == b then elseif a or b then end";
noom_uint_t pos = 0;
printf("LEX OUTPUT:\n");
noomL_Token token;
while (1) {
noomL_lex(code, pos, &token);
noomL_lex(code, pos, &token, NOOM_VERSION_51);
printf("%s ", noomL_formatTokenType(token.type));
for (noom_uint_t i = 0; i < token.length; i++) putchar((code + token.offset)[i]);
@@ -57,7 +57,7 @@ int main(int argc, char** argv) {
noomP_Node *program;
noomP_Node *last_node;
int success = noomP_parse(code, "shitass", &program, &last_node);
int success = noomP_parse(code, "shitass", NOOM_VERSION_54, &program, &last_node);
if (success != 0) return success;
print_node(program, 0);