From ad46e4bed268a9c4faefb503deec7dc5603a9be2 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Thu, 30 May 2019 14:28:12 +0200 Subject: vhdl: differenciate block and line comments. --- src/vhdl/python/libghdl/thin/vhdl/tokens.py | 357 ++++++++++++++-------------- src/vhdl/simulate/simul-debugger-ams.adb | 4 +- src/vhdl/simulate/simul-debugger.adb | 6 +- src/vhdl/vhdl-scanner.adb | 4 +- src/vhdl/vhdl-tokens.adb | 6 +- src/vhdl/vhdl-tokens.ads | 3 +- 6 files changed, 195 insertions(+), 185 deletions(-) (limited to 'src/vhdl') diff --git a/src/vhdl/python/libghdl/thin/vhdl/tokens.py b/src/vhdl/python/libghdl/thin/vhdl/tokens.py index 80f582da7..572c3906d 100644 --- a/src/vhdl/python/libghdl/thin/vhdl/tokens.py +++ b/src/vhdl/python/libghdl/thin/vhdl/tokens.py @@ -19,178 +19,185 @@ class Tok: Equal_Equal = 15 Eof = 16 Newline = 17 - Comment = 18 - Character = 19 - Identifier = 20 - Integer = 21 - Real = 22 - String = 23 - Bit_String = 24 - Integer_Letter = 25 - Equal = 26 - Not_Equal = 27 - Less = 28 - Less_Equal = 29 - Greater = 30 - Greater_Equal = 31 - Match_Equal = 32 - Match_Not_Equal = 33 - Match_Less = 34 - Match_Less_Equal = 35 - Match_Greater = 36 - Match_Greater_Equal = 37 - Plus = 38 - Minus = 39 - Ampersand = 40 - Condition = 41 - Double_Less = 42 - Double_Greater = 43 - Caret = 44 - And_And = 45 - Bar_Bar = 46 - Left_Curly = 47 - Right_Curly = 48 - Exclam_Mark = 49 - Brack_Star = 50 - Brack_Plus_Brack = 51 - Brack_Arrow = 52 - Brack_Equal = 53 - Bar_Arrow = 54 - Bar_Double_Arrow = 55 - Minus_Greater = 56 - Arobase = 57 - Star = 58 - Slash = 59 - Mod = 60 - Rem = 61 - Abs = 62 - Not = 63 - Access = 64 - After = 65 - Alias = 66 - All = 67 - Architecture = 68 - Array = 69 - Assert = 70 - Attribute = 71 - Begin = 72 - Block = 73 - Body = 74 - Buffer = 75 - Bus = 76 - Case = 77 - Component = 78 - Configuration = 79 - Constant = 80 - Disconnect = 81 - Downto = 82 - Else = 83 - Elsif = 84 - End = 85 - Entity = 86 - Exit = 87 - File = 88 - For = 89 - Function = 90 - Generate = 91 - Generic = 92 - Guarded = 93 - If = 94 - In = 95 - Inout = 96 - Is = 97 - Label = 98 - Library = 99 - Linkage = 100 - Loop = 101 - Map = 102 - New = 103 - Next = 104 - Null = 105 - Of = 106 - On = 107 - Open = 108 - Others = 109 - Out = 110 - Package = 111 - Port = 112 - Procedure = 113 - Process = 114 - Range = 115 - Record = 116 - Register = 117 - Report = 118 - Return = 119 - Select = 120 - Severity = 121 - Signal = 122 - Subtype = 123 - Then = 124 - To = 125 - Transport = 126 - Type = 127 - Units = 128 - Until = 129 - Use = 130 - Variable = 131 - Wait = 132 - When = 133 - While = 134 - With = 135 - And = 136 - Or = 137 - Xor = 138 - Nand = 139 - Nor = 140 - Xnor = 141 - Group = 142 - Impure = 143 - Inertial = 144 - Literal = 145 - Postponed = 146 - Pure = 147 - Reject = 148 - Shared = 149 - Unaffected = 150 - Sll = 151 - Sla = 152 - Sra = 153 - Srl = 154 - Rol = 155 - Ror = 156 - Protected = 157 - Context = 158 - Parameter = 159 - Across = 160 - Break = 161 - Limit = 162 - Nature = 163 - Noise = 164 - Procedural = 165 - Quantity = 166 - Reference = 167 - Spectrum = 168 - Subnature = 169 - Terminal = 170 - Through = 171 - Tolerance = 172 - Psl_Default = 173 - Psl_Clock = 174 - Psl_Property = 175 - Psl_Sequence = 176 - Psl_Endpoint = 177 - Psl_Cover = 178 - Psl_Const = 179 - Psl_Boolean = 180 - Inf = 181 - Within = 182 - Abort = 183 - Before = 184 - Always = 185 - Never = 186 - Eventually = 187 - Next_A = 188 - Next_E = 189 - Next_Event = 190 - Next_Event_A = 191 - Next_Event_E = 192 + Line_Comment = 18 + Block_Comment = 19 + Character = 20 + Identifier = 21 + Integer = 22 + Real = 23 + String = 24 + Bit_String = 25 + Integer_Letter = 26 + Equal = 27 + Not_Equal = 28 + Less = 29 + Less_Equal = 30 + Greater = 31 + Greater_Equal = 32 + Match_Equal = 33 + Match_Not_Equal = 34 + Match_Less = 35 + Match_Less_Equal = 36 + Match_Greater = 37 + Match_Greater_Equal = 38 + Plus = 39 + Minus = 40 + Ampersand = 41 + Condition = 42 + Double_Less = 43 + Double_Greater = 44 + Caret = 45 + And_And = 46 + Bar_Bar = 47 + Left_Curly = 48 + Right_Curly = 49 + Exclam_Mark = 50 + Brack_Star = 51 + Brack_Plus_Brack = 52 + Brack_Arrow = 53 + Brack_Equal = 54 + Bar_Arrow = 55 + Bar_Double_Arrow = 56 + Minus_Greater = 57 + Arobase = 58 + Star = 59 + Slash = 60 + Mod = 61 + Rem = 62 + Abs = 63 + Not = 64 + Access = 65 + After = 66 + Alias = 67 + All = 68 + Architecture = 69 + Array = 70 + Assert = 71 + Attribute = 72 + Begin = 73 + Block = 74 + Body = 75 + Buffer = 76 + Bus = 77 + Case = 78 + Component = 79 + Configuration = 80 + Constant = 81 + Disconnect = 82 + Downto = 83 + Else = 84 + Elsif = 85 + End = 86 + Entity = 87 + Exit = 88 + File = 89 + For = 90 + Function = 91 + Generate = 92 + Generic = 93 + Guarded = 94 + If = 95 + In = 96 + Inout = 97 + Is = 98 + Label = 99 + Library = 100 + Linkage = 101 + Loop = 102 + Map = 103 + New = 104 + Next = 105 + Null = 106 + Of = 107 + On = 108 + Open = 109 + Others = 110 + Out = 111 + Package = 112 + Port = 113 + Procedure = 114 + Process = 115 + Range = 116 + Record = 117 + Register = 118 + Report = 119 + Return = 120 + Select = 121 + Severity = 122 + Signal = 123 + Subtype = 124 + Then = 125 + To = 126 + Transport = 127 + Type = 128 + Units = 129 + Until = 130 + Use = 131 + Variable = 132 + Wait = 133 + When = 134 + While = 135 + With = 136 + And = 137 + Or = 138 + Xor = 139 + Nand = 140 + Nor = 141 + Xnor = 142 + Group = 143 + Impure = 144 + Inertial = 145 + Literal = 146 + Postponed = 147 + Pure = 148 + Reject = 149 + Shared = 150 + Unaffected = 151 + Sll = 152 + Sla = 153 + Sra = 154 + Srl = 155 + Rol = 156 + Ror = 157 + Protected = 158 + Context = 159 + Parameter = 160 + Across = 161 + Break = 162 + Limit = 163 + Nature = 164 + Noise = 165 + Procedural = 166 + Quantity = 167 + Reference = 168 + Spectrum = 169 + Subnature = 170 + Terminal = 171 + Through = 172 + Tolerance = 173 + Psl_Default = 174 + Psl_Clock = 175 + Psl_Property = 176 + Psl_Sequence = 177 + Psl_Endpoint = 178 + Psl_Cover = 179 + Psl_Const = 180 + Psl_Boolean = 181 + Inf = 182 + Within = 183 + Abort = 184 + Before = 185 + Before_Em = 186 + Before_Un = 187 + Before_Em_Un = 188 + Until_Em = 189 + Until_Un = 190 + Until_Em_Un = 191 + Always = 192 + Never = 193 + Eventually = 194 + Next_A = 195 + Next_E = 196 + Next_Event = 197 + Next_Event_A = 198 + Next_Event_E = 199 diff --git a/src/vhdl/simulate/simul-debugger-ams.adb b/src/vhdl/simulate/simul-debugger-ams.adb index 828e5bdbc..2c5098839 100644 --- a/src/vhdl/simulate/simul-debugger-ams.adb +++ b/src/vhdl/simulate/simul-debugger-ams.adb @@ -18,7 +18,7 @@ with Simple_IO; use Simple_IO; with Vhdl.Utils; use Vhdl.Utils; -with Vhdl.Disp_Vhdl; +with Vhdl.Prints; package body Simul.Debugger.AMS is procedure Disp_Quantity_Name (Quantity : Quantity_Index_Type) @@ -46,7 +46,7 @@ package body Simul.Debugger.AMS is when Op_Quantity => Disp_Quantity_Name (Term.Quantity); when Op_Vhdl_Expr => - Vhdl.Disp_Vhdl.Disp_Expression (Term.Vhdl_Expr); + Vhdl.Prints.Disp_Expression (Term.Vhdl_Expr); end case; end Disp_Term; diff --git a/src/vhdl/simulate/simul-debugger.adb b/src/vhdl/simulate/simul-debugger.adb index 652828b19..93f926048 100644 --- a/src/vhdl/simulate/simul-debugger.adb +++ b/src/vhdl/simulate/simul-debugger.adb @@ -37,7 +37,7 @@ with Simul.Execution; use Simul.Execution; with Vhdl.Utils; use Vhdl.Utils; with Errorout; use Errorout; with Vhdl.Errors; use Vhdl.Errors; -with Vhdl.Disp_Vhdl; +with Vhdl.Prints; with Vhdl.Nodes_Walk; use Vhdl.Nodes_Walk; with Areapools; use Areapools; with Grt.Types; use Grt.Types; @@ -1521,7 +1521,7 @@ package body Simul.Debugger is Put ('.'); Put (Name_Table.Image (Get_Identifier (E.Stmt))); New_Line; - Vhdl.Disp_Vhdl.Disp_PSL_NFA (Get_PSL_NFA (E.Stmt)); + Vhdl.Prints.Disp_PSL_NFA (Get_PSL_NFA (E.Stmt)); Put (" 01234567890123456789012345678901234567890123456789"); for I in E.States'Range loop if I mod 50 = 0 then @@ -1925,7 +1925,7 @@ package body Simul.Debugger is return; end if; - Vhdl.Disp_Vhdl.Disp_Expression (Expr); + Vhdl.Prints.Disp_Expression (Expr); New_Line; Annotate_Expand_Table; diff --git a/src/vhdl/vhdl-scanner.adb b/src/vhdl/vhdl-scanner.adb index 1b3243761..3aa6f0361 100644 --- a/src/vhdl/vhdl-scanner.adb +++ b/src/vhdl/vhdl-scanner.adb @@ -1845,7 +1845,7 @@ package body Vhdl.Scanner is Pos := Pos + 1; end loop; if Flag_Comment then - Current_Token := Tok_Comment; + Current_Token := Tok_Line_Comment; return; end if; goto Again; @@ -1928,7 +1928,7 @@ package body Vhdl.Scanner is end case; end loop; if Flag_Comment then - Current_Token := Tok_Comment; + Current_Token := Tok_Block_Comment; return; end if; goto Again; diff --git a/src/vhdl/vhdl-tokens.adb b/src/vhdl/vhdl-tokens.adb index 61c196721..fe20a07bd 100644 --- a/src/vhdl/vhdl-tokens.adb +++ b/src/vhdl/vhdl-tokens.adb @@ -56,8 +56,10 @@ package body Vhdl.Tokens is return ""; when Tok_Newline => return ""; - when Tok_Comment => - return ""; + when Tok_Line_Comment => + return ""; + when Tok_Block_Comment => + return ""; when Tok_Character => return ""; when Tok_Identifier => diff --git a/src/vhdl/vhdl-tokens.ads b/src/vhdl/vhdl-tokens.ads index e791ebb63..08834a575 100644 --- a/src/vhdl/vhdl-tokens.ads +++ b/src/vhdl/vhdl-tokens.ads @@ -42,7 +42,8 @@ package Vhdl.Tokens is Tok_Eof, -- End of file. Tok_Newline, - Tok_Comment, + Tok_Line_Comment, -- End of line comment (--) + Tok_Block_Comment, -- Block comment (/* .. */) Tok_Character, Tok_Identifier, Tok_Integer, -- cgit v1.2.3