summaryrefslogtreecommitdiff
path: root/lexer.c
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2018-08-01 02:04:47 +1200
committerDavid Phillips <david@sighup.nz>2018-08-01 02:04:47 +1200
commit957d77141f56714e9f4551c8d49e6658ff778ce7 (patch)
treeb4d0207a06f12de12c1172312b6ee5de54c79a6f /lexer.c
parenta2e204aea97e7f844a5303f956c893579a89623e (diff)
downloadhence-957d77141f56714e9f4551c8d49e6658ff778ce7.tar.xz
Add line area/span indication to error messages
Diffstat (limited to 'lexer.c')
-rw-r--r--lexer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lexer.c b/lexer.c
index 40dfd67..a8b7716 100644
--- a/lexer.c
+++ b/lexer.c
@@ -138,6 +138,7 @@ lex_alphanum(void) {
t.value[i] = '\0';
column_number += i;
+ t.span = i;
if (i == 0) {
emit_error("Expected alphanumeric, got '%c'\n", buf[i]);
@@ -163,6 +164,7 @@ lex_eol(void) {
t.type = TOK_EOL;
t.loc = get_current_loc();
+ t.span = 1;
expect('\n');
@@ -175,6 +177,7 @@ lex_colon(void) {
t.type = TOK_COLON;
t.loc = get_current_loc();
+ t.span = 1;
expect(':');