better error messages

This commit is contained in:
r4
2021-12-25 12:32:52 +01:00
parent f02dae603d
commit b58810e822
5 changed files with 24 additions and 5 deletions

6
lex.c
View File

@@ -2,6 +2,8 @@
#include "util.h"
#define TAB_WIDTH 4
typedef struct Pos {
size_t ln, col; /* current position */
size_t m_ln, m_col; /* marked position */
@@ -17,7 +19,9 @@ static void consume(Pos *p, char c) {
if (c == '\n') {
p->ln++;
p->col = 1;
} else
} else if (c == '\t')
p->col += TAB_WIDTH;
else
p->col++;
}