diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-15 21:42:10 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-15 21:42:10 +0100 |
commit | 67ee4c2d36be976bb5e86d988a0339b5f9c5825d (patch) | |
tree | faae6b854064e2387bf4f92d6fe0436e76a86482 | |
parent | LinkedList O(1) length. (diff) | |
download | calp-67ee4c2d36be976bb5e86d988a0339b5f9c5825d.tar.gz calp-67ee4c2d36be976bb5e86d988a0339b5f9c5825d.tar.xz |
Add ERR_P macro.
Diffstat (limited to '')
-rw-r--r-- | err.h | 4 | ||||
-rw-r--r-- | parse.c | 5 |
2 files changed, 6 insertions, 3 deletions
@@ -19,6 +19,10 @@ #define ERR_F(fmt, ...) fprintf(stderr, _RED "ERR" _RESET " (%s:%i) " fmt "\n", \ __FILE__, __LINE__, ##__VA_ARGS__) +/* Parse error */ +#define ERR_P(ctx, fmt, ...) fprintf(stderr, _RED "PARSE" _RESET " (%s:%i) %i:%i " fmt "\n", \ + __FILE__, __LINE__, (ctx)->pline, (ctx)->pcolumn, ##__VA_ARGS__) + #define INFO(msg) fprintf(stderr, _BLUE "INFO" _RESET " (%s:%i) %s\n", __FILE__, __LINE__, #msg) #define INFO_F(fmt, ...) fprintf(stderr, _BLUE "INFO" _RESET " (%s:%i) " fmt "\n", \ __FILE__, __LINE__, ##__VA_ARGS__) @@ -196,11 +196,10 @@ int handle_kv ( } else if (strbuf_c(&cline->key, "END")) { strbuf* s = POP(LLIST(strbuf))(&ctx->key_stack); if (strbuf_cmp(s, CLINE_CUR_VAL(cline)) != 0) { - ERR_F("Expected END:%s, got END:%s.\n%s line %i", + ERR_P(ctx, "Expected END:%s, got END:%s.\n%s line", s->mem, CLINE_CUR_VAL(cline)->mem, - PEEK(LLIST(vcomponent))(&ctx->comp_stack)->filename, - ctx->line); + PEEK(LLIST(vcomponent))(&ctx->comp_stack)->filename); PUSH(LLIST(strbuf))(&ctx->key_stack, s); return -1; |