aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-07-13 13:52:22 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-07-13 13:52:22 +0300
commita2d8ce64b682996aebfc1182f3af1a66454bd449 (patch)
tree8430f549ac7a09e39c7ebdbd1b28b21a3ed85c36
parent142252826b38a0d87dd24b65c337770fc01b2daf (diff)
downloadmailfromd-a2d8ce64b682996aebfc1182f3af1a66454bd449.tar.gz
mailfromd-a2d8ce64b682996aebfc1182f3af1a66454bd449.tar.bz2
Minor fix
* src/lex.l (lex_new_source_0): Initialize yylloc early. This makes sure that eventual syntax errors occurring at the first token are printed with detailed location (filename:line.start-end)
-rw-r--r--src/lex.l10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lex.l b/src/lex.l
index eb9a7f80..472a0108 100644
--- a/src/lex.l
+++ b/src/lex.l
@@ -172,6 +172,8 @@ inctx_pop()
static int
lex_new_source_0(const char *name)
{
+ if (!yyin)
+ mu_locus_range_init (&yylloc);
if (ext_pp) {
yyin = pp_extrn_start(name, &pp_pid);
if (!yyin) {
@@ -190,7 +192,13 @@ lex_new_source_0(const char *name)
}
}
yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
- MU_ASSERT (mu_linetrack_create (&trk, name, 2));
+ MU_ASSERT(mu_linetrack_create(&trk, name, 2));
+ mu_locus_point_set_file(&yylloc.beg, name);
+ yylloc.beg.mu_line = 1;
+ yylloc.beg.mu_col = 1;
+ mu_locus_point_copy(&yylloc.end, &yylloc.beg);
+ mu_stream_ioctl(mu_strerr, MU_IOCTL_LOGSTREAM,
+ MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE, &yylloc);
return EX_OK;
}

Return to:

Send suggestions and report system problems to the System administrator.