From e65ba595793794873e7c42ddeb999d81574585b1 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 30 Dec 2020 16:52:19 -0600 Subject: [PATCH] added very verbose output option, '-VV' --- core/string/reader.onyx | 1 + src/onyx.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/core/string/reader.onyx b/core/string/reader.onyx index b7bc8a7e..2b46d033 100644 --- a/core/string/reader.onyx +++ b/core/string/reader.onyx @@ -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; diff --git a/src/onyx.c b/src/onyx.c index b4df7f0a..4df26fb8 100644 --- a/src/onyx.c +++ b/src/onyx.c @@ -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); -- 2.25.1