qbe

Internal scc patchset buffer for QBE
Log | Files | Refs | README | LICENSE

commit a655b8b3ebe77c236048b330ad35ef54a938217e
parent 96fab802403fb70aaeaf270f34135d928a2bbc96
Author: Quentin Carbonneaux <quentin.carbonneaux@yale.edu>
Date:   Sat, 17 Oct 2015 22:16:43 -0400

add cheap line reporting in die

Diffstat:
Mminic/minic.y | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/minic/minic.y b/minic/minic.y @@ -72,6 +72,7 @@ int yylex(void), yyerror(char *); Symb expr(Node *), lval(Node *); FILE *of; +int line; int lbl, tmp, nglo; char *ini[NGlo]; struct { @@ -83,7 +84,7 @@ struct { void die(char *s) { - fprintf(stderr, "error: %s\n", s); + fprintf(stderr, "error:%d: %s\n", line, s); exit(1); } @@ -796,6 +797,8 @@ yylex() if (c == '#') while ((c = getchar()) != '\n') ; + if (c == '\n') + line++; } while (isspace(c));