diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2020-07-13 13:52:22 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2020-07-13 13:52:22 +0300 |
commit | a2d8ce64b682996aebfc1182f3af1a66454bd449 (patch) | |
tree | 8430f549ac7a09e39c7ebdbd1b28b21a3ed85c36 | |
parent | 142252826b38a0d87dd24b65c337770fc01b2daf (diff) | |
download | mailfromd-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.l | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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; } |