From 9b64030a7a6e2f45c19c6938754492104276add1 Mon Sep 17 00:00:00 2001 From: ahmedsamyh Date: Mon, 3 Mar 2025 18:06:55 +0500 Subject: [PATCH] Parse [] and remove debug "OK" logging. --- main.c | 8 +++++-- main.momo | 33 ++++----------------------- tests/.identifiers.build.out.expected | 1 - tests/.operators.build.out.expected | 1 - tests/.strings.build.out.expected | 1 - 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/main.c b/main.c index 274b76d..14e3e57 100644 --- a/main.c +++ b/main.c @@ -582,6 +582,12 @@ bool next_token(Lexer *l, Token *t_out) { case '}': { LEX_N_CHAR_TOKEN(TK_RIGHT_BRACE, 1); } break; + case '[': { + LEX_N_CHAR_TOKEN(TK_LEFT_SQUARE_BRACE, 1); + } break; + case ']': { + LEX_N_CHAR_TOKEN(TK_RIGHT_SQUARE_BRACE, 1); + } break; case '-': { // - could be --, -= or -> char next = next_char(l); @@ -821,8 +827,6 @@ int main(int argc, char **argv) { Tokens tokens = lex(&l); - info("OK"); - free_lexer(&l); da_free(tokens); diff --git a/main.momo b/main.momo index 1d999f9..0fd558c 100644 --- a/main.momo +++ b/main.momo @@ -1,29 +1,6 @@ - - --- --> -+ -++ -+= -/ -/= -* -** -*= -% -%= +#include -& -&= -^ -^= -~ -| -|= - -! -!= -&& -|| - -= -== +fun main(args: [string]) -> int { + printf("Hello, World\n"); + return 0; +} diff --git a/tests/.identifiers.build.out.expected b/tests/.identifiers.build.out.expected index d8a895b..54292ac 100644 --- a/tests/.identifiers.build.out.expected +++ b/tests/.identifiers.build.out.expected @@ -8,4 +8,3 @@ identifiers.momo:10:0 [IDENT] '_D' identifiers.momo:10:3 [IDENT] 'eE' identifiers.momo:10:6 [IDENT] '_F' identifiers.momo:10:9 [IDENT] '_G' -[INFO] OK diff --git a/tests/.operators.build.out.expected b/tests/.operators.build.out.expected index 7a0e159..aae9bcf 100644 --- a/tests/.operators.build.out.expected +++ b/tests/.operators.build.out.expected @@ -30,4 +30,3 @@ operators.momo:33:0 [LT] '<' operators.momo:34:0 [GT] '>' operators.momo:35:0 [LTE] '<=' operators.momo:36:0 [GTE] '>=' -[INFO] OK diff --git a/tests/.strings.build.out.expected b/tests/.strings.build.out.expected index 214376d..ed0589b 100644 --- a/tests/.strings.build.out.expected +++ b/tests/.strings.build.out.expected @@ -1,3 +1,2 @@ strings.momo:1:1 [STRING] 'This is a string!' strings.momo:4:9 [STRING] 'This too is a string!' -[INFO] OK -- 2.39.5