]> www.git.momoyon.org Git - lang.git/commitdiff
[main.c] WIP: error_pretty()
authormomoyon <ahmedsamyh10@gmail.com>
Sun, 13 Apr 2025 12:59:00 +0000 (17:59 +0500)
committermomoyon <ahmedsamyh10@gmail.com>
Sun, 13 Apr 2025 12:59:00 +0000 (17:59 +0500)
main.c

diff --git a/main.c b/main.c
index 7cdedd8c1de37122c17e07fff035bec183fb39fa..129ca751816327ef3b567efa9bfa963da07256c6 100644 (file)
--- a/main.c
+++ b/main.c
@@ -372,7 +372,13 @@ void print_loc(FILE *f, Location loc) {
         putc(' ', stderr);\
         error(fmt, ##__VA_ARGS__);\
     } while (0)
-
+/**/
+/*#define error_pretty(loc, lexer, fmt, ...) do {\*/
+/*        print_loc(stderr, loc);\*/
+/*        putc(' ', stderr);\*/
+/*        error(fmt, ##__VA_ARGS__);\*/
+/**/
+/*    } while (0)*/
 
 bool token_is_number(Token t) {
     return t.type == TK_INT || t.type == TK_FLOAT;
@@ -1498,6 +1504,17 @@ int main(int argc, char **argv) {
 
     Tokens tokens = lex(&l);
 
+    log_info("Lexer.col: %d, ", col(&l));
+    log_info("Lexer.bol: %d, ", l.bol);
+    log_info("Lexer.cur: %d, ", l.cur);
+    log_info("Lexer.line: %d, ", l.line);
+
+    sv_print_range(l.src, stdout, 0, 2);
+    printf("\n");
+
+    return 0;
+
+
     if (dump_tokens) {
         for (size_t i = 0; i < tokens.count; ++i) {
             print_token(stdout, tokens.items[i]);