aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-formatters.ads
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2021-01-09 08:38:26 +0100
committerTristan Gingold <tgingold@free.fr>2021-01-09 09:17:50 +0100
commitd2990978f76425b736e01c936e878048e4801f65 (patch)
tree7cfeab2180fd45b026e08e4fa896dbc0077cece9 /src/vhdl/vhdl-formatters.ads
parentadcfcc7f7703e9c26018f3fb7353a19797d263c8 (diff)
downloadghdl-d2990978f76425b736e01c936e878048e4801f65.tar.gz
ghdl-d2990978f76425b736e01c936e878048e4801f65.tar.bz2
ghdl-d2990978f76425b736e01c936e878048e4801f65.zip
vhdl: rework formatter engine, add 'ghdl fmt' command
Diffstat (limited to 'src/vhdl/vhdl-formatters.ads')
-rw-r--r--src/vhdl/vhdl-formatters.ads23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/vhdl/vhdl-formatters.ads b/src/vhdl/vhdl-formatters.ads
index 029290107..86c7c60e3 100644
--- a/src/vhdl/vhdl-formatters.ads
+++ b/src/vhdl/vhdl-formatters.ads
@@ -21,11 +21,26 @@ with Grt.Types;
with Vhdl.Nodes; use Vhdl.Nodes;
package Vhdl.Formatters is
- -- Format/pretty print the file F.
- procedure Format (F : Iir_Design_File);
+ type Format_Level is
+ (
+ -- No re-formatting.
+ -- Trailing spaces are removed, keywords are converted to lower case.
+ Format_None,
+
+ -- Format_None + start of each line is adjusted
+ Format_Indent,
- -- Reindent the file.
- procedure Indent (F : Iir_Design_File;
+ -- Format_Indent + spaces between tokens is adjusted
+ Format_Space
+ );
+
+ -- Format/pretty print the file F.
+ -- If FLAG_REINDENT is true, lines are reindented. Otherwise the output is
+ -- the same as the input except keywords are converted to lower case.
+ -- If FLAG_RESPACE is true (which implies FLAG_REINDENT), spaces between
+ -- tokens are adjusted.
+ procedure Format (F : Iir_Design_File;
+ Level : Format_Level;
First_Line : Positive := 1;
Last_Line : Positive := Positive'Last);