poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMMITED] pkl: diag: normalize tabs to space in location lines


From: Jose E. Marchesi
Subject: [COMMITED] pkl: diag: normalize tabs to space in location lines
Date: Thu, 13 Jan 2022 00:44:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2022-01-13  Jose E. Marchesi  <jemarch@gnu.org>

        * libpoke/pkl-diag.c (pkl_detailed_location): Normalize tabs to
        spaces in the source location line to avoid displacements.
---
 ChangeLog          | 5 +++++
 libpoke/pkl-diag.c | 8 ++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b34f1b41..48d36e77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-01-13  Jose E. Marchesi  <jemarch@gnu.org>
+
+       * libpoke/pkl-diag.c (pkl_detailed_location): Normalize tabs to
+       spaces in the source location line to avoid displacements.
+
 2022-01-11  Jose E. Marchesi  <jemarch@gnu.org>
 
        * libpoke/pvm-val.c (pvm_typeof): If given a type value, return
diff --git a/libpoke/pkl-diag.c b/libpoke/pkl-diag.c
index fb74e1b0..562567e5 100644
--- a/libpoke/pkl-diag.c
+++ b/libpoke/pkl-diag.c
@@ -86,10 +86,14 @@ pkl_detailed_location (pkl_ast ast, pkl_ast_loc loc,
           if (cur_line >= loc.first_line
               && cur_line <= loc.last_line)
             {
-              /* Print until newline or end of string.  */
+              /* Print until newline or end of string.  Note that we
+                 are normalizing tabs to spaces so the error location
+                 wont' appear displaed.  */
               do
                 {
-                  if (c != '\n')
+                  if (c == '\t')
+                    pk_puts (" ");
+                  else if (c != '\n')
                     pk_printf ("%c", c);
                   c = fgetc (fp);
                 }
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]