diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-17 22:16:43 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2015-10-17 22:16:43 -0400 |
commit | a655b8b3ebe77c236048b330ad35ef54a938217e (patch) | |
tree | 82b96993408d30e4588b86d6080dd93a5832c82a /minic | |
parent | 96fab802403fb70aaeaf270f34135d928a2bbc96 (diff) | |
download | roux-a655b8b3ebe77c236048b330ad35ef54a938217e.tar.gz |
add cheap line reporting in die
Diffstat (limited to 'minic')
-rw-r--r-- | minic/minic.y | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/minic/minic.y b/minic/minic.y index b73e043..ab95604 100644 --- 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)); |