ref: 64add66232ba4cf148aab299b3fa999444fe6e8e
parent: 3cb05279b1ab7d3b2a97d4aa427a44a1598ec839
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Apr 23 10:55:37 EDT 2014
Remove columnum variable columnum depend of the tab size, so it is not a good idea assume a tab size of 8, or a tab size of 4 or whanever you want, so the best option is remove it.
--- a/error.c
+++ b/error.c
@@ -15,8 +15,8 @@
{
if (!flag)
return;
- fprintf(stderr, "%s:%s:%u:%u: ",
- (!flag) ? "warning" : "error", filename, linenum, columnum);
+ fprintf(stderr, "%s:%s:%u: ",
+ (!flag) ? "warning" : "error", filename, linenum);
vfprintf(stderr, fmt, va);
putc('\n', stderr);
if (flag < 0)
--- a/lex.c
+++ b/lex.c
@@ -11,7 +11,6 @@
static FILE *yyin;
const char *filename;
unsigned linenum;
-unsigned columnum;
uint8_t yytoken, yyntoken;;
union yystype yylval;
@@ -125,7 +124,7 @@
case '0': /* TODO: */
case 'u': /* TODO: */
case '\n':
- ++linenum, columnum = 1;
+ ++linenum;
return s;
default:
warn(1, "unknown escape sequence");
@@ -371,11 +370,8 @@
}
while (isspace(c = getc(yyin))) {
- switch (c) {
- case '\n': ++linenum, columnum = 1; break;
- case '\t': columnum += 8; break;
- default: ++columnum; break;
- }
+ if (c == '\n')
+ ++linenum;
}
if (c == EOF) {
@@ -417,6 +413,6 @@
die("file '%s' not found", file);
filename = file;
}
- columnum = linenum = 1;
+ linenum = 1;
next(); /* prefetch first token */
}