lexer: strings

This commit is contained in:
2026-04-22 17:29:48 +02:00
parent 754fd13dfd
commit 5b99c73a1a
3 changed files with 200 additions and 3 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 = "--[=[i\nam\na\nlong\ncomment]]lololnotoveryet]==]nah lol]=] --local a = 2\nlocal b = 3";
const char* code = "local a = [=[Hello, world!]]lol]==]]]=]";
noom_uint_t pos = 0;
printf("LEX OUTPUT:\n");
noomL_Token token;
while (1) {
noomL_lex(code, pos, &token, NOOM_VERSION_54);
noomL_lex(code, pos, &token, NOOM_VERSION_53);
printf("%s ", noomL_formatTokenType(token.type));
for (noom_uint_t i = 0; i < token.length; i++) putchar((code + token.offset)[i]);