aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2017-03-14 08:09:55 +0100
committerTristan Gingold <tgingold@free.fr>2017-03-14 08:09:55 +0100
commit536f469d83c4b972ba7cb0d014b349f1345ec9cf (patch)
tree7009141c241c63f4e118604dd3a9ca86841a7ad4
parentc2c6d63247da8973f8cfcdb04038793bc02eb53e (diff)
downloadghdl-536f469d83c4b972ba7cb0d014b349f1345ec9cf.tar.gz
ghdl-536f469d83c4b972ba7cb0d014b349f1345ec9cf.tar.bz2
ghdl-536f469d83c4b972ba7cb0d014b349f1345ec9cf.zip
Expand line for -fcaret-diagnostics according to -ftabstop
-rw-r--r--src/vhdl/errorout.adb24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb
index 6b2c36e3b..6d1a43d06 100644
--- a/src/vhdl/errorout.adb
+++ b/src/vhdl/errorout.adb
@@ -576,19 +576,31 @@ package body Errorout is
then
declare
Buf : constant File_Buffer_Acc := Get_File_Source (File);
- Pos : constant Source_Ptr := Line_To_Position (File, Line);
- Len : Source_Ptr;
+ Pos : Source_Ptr;
+ Len : Natural;
C : Character;
begin
-- Compute line length.
+ Pos := Line_To_Position (File, Line);
Len := 0;
loop
- C := Buf (Pos + Len);
+ C := Buf (Pos);
+ Pos := Pos + 1;
exit when C = ASCII.CR or C = ASCII.LF or C = ASCII.EOT;
- Len := Len + 1;
+ if C = ASCII.HT then
+ -- Expand tab.
+ loop
+ Put (' ');
+ Len := Len + 1;
+ exit when Len mod Tab_Stop = 0;
+ end loop;
+ else
+ Put (C);
+ Len := Len + 1;
+ end if;
end loop;
- Put_Line (String (Buf (Pos .. Pos + Len - 1)));
- Put_Line ((1 .. Col - 1 => ' ') & '^');
+ Put_Line;
+ Put_Line ((1 .. Col => ' ') & '^');
end;
end if;
end Report_Msg;