added very verbose output option, '-VV'
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 30 Dec 2020 22:52:19 +0000 (16:52 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 30 Dec 2020 22:52:19 +0000 (16:52 -0600)
core/string/reader.onyx
src/onyx.c

index b7bc8a7e2dbbc0d1d3b0bfd481809e4bbb89c4b1..2b46d0333ce037a8204029563600f3cec0aedaac 100644 (file)
@@ -3,6 +3,7 @@ package core.string.reader
 use package core { printf }
 
 StringReader :: struct {
+    // Think of this as `use s : str`;
     data : ^u8;
     count : u32;
 
index b4df7f0a2d6eb4290585f9a60e5208dd894ee991..4df26fb82bc562da7241221c836ffcf6db96e26f 100644 (file)
@@ -47,7 +47,7 @@ typedef struct OnyxCompileOptions {
     bh_allocator allocator;
     CompileAction action;
 
-    u32 verbose_output : 1;
+    u32 verbose_output : 2;
     u32 fun_output     : 1;
 
     bh_arr(const char *) included_folders;
@@ -93,6 +93,9 @@ static OnyxCompileOptions compile_opts_parse(bh_allocator alloc, int argc, char
             else if (!strcmp(argv[i], "--verbose") || !strcmp(argv[i], "-V")) {
                 options.verbose_output = 1;
             }
+            else if (!strcmp(argv[i], "-VV")) {
+                options.verbose_output = 2;
+            }
             else if (!strcmp(argv[i], "--fun") || !strcmp(argv[i], "-F")) {
                 options.fun_output = 1;
             }
@@ -441,6 +444,15 @@ static b32 process_include_entity(CompilerState* compiler_state, Entity* ent) {
 static b32 process_entity(CompilerState* compiler_state, Entity* ent) {
     i32 changed = 1;
 
+    if (compiler_state->options->verbose_output == 2) {
+        if (ent->expr && ent->expr->token)
+            printf("%s | %s:%i:%i\n",
+                entity_state_strings[ent->state],
+                ent->expr->token->pos.filename,
+                ent->expr->token->pos.line,
+                ent->expr->token->pos.column);
+    }
+
     switch (ent->state) {
         case Entity_State_Parse_Builtin:
             process_include_entity(compiler_state, ent);