diff options
Diffstat (limited to 'core/parser.c')
| -rw-r--r-- | core/parser.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/parser.c b/core/parser.c index e568504..698691e 100644 --- a/core/parser.c +++ b/core/parser.c @@ -8,6 +8,7 @@ #include "defconf/token.h" #include "defconf/data.h" #include "defconf/emit.h" +#include "defconf/trace.h" /* Symbolic token */ #define SYMTOK(TOKSTR) \ @@ -74,12 +75,12 @@ parse_expect(struct defconf_state *state, struct token *tok, tt_t exp) /* Try to grab the next token */ if ((error = lexer_scan(state, tok)) < 0) { - printf("fatal: expected '%s', got eof\n", TOKSTR(exp)); + trace_fatal(state, "expected '%s', got eof\n", TOKSTR(exp)); return error; } if (tok->type != exp) { - printf("fatal: expected '%s', got %s instead\n", + trace_fatal(state, "expected '%s', got %s instead\n", TOKSTR(exp), TOKSTR(tok->type)); return -1; } @@ -116,13 +117,13 @@ parse_define(struct defconf_state *state, struct token *tok) /* Scan the value */ if ((error = lexer_scan(state, tok)) < 0) { - printf("fatal: expected value, got eof\n"); + trace_fatal(state, "expected value, got eof\n"); return error; } /* Convert token to data */ if ((error = token_to_data(tok, &value)) < 0) { - printf("fatal: got bad data [%s]\n", TOKSTR(tok->type)); + trace_fatal(state, "got bad data [%s]\n", TOKSTR(tok->type)); return error; } @@ -153,7 +154,7 @@ parse_begin(struct defconf_state *state) break; default: - printf("fatal: got unexpected token: %s\n", TOKSTR(tok.type)); + trace_fatal(state, "got unexpected token: %s\n", TOKSTR(tok.type)); return -1; } } |
