diff options
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/errorout.adb | 16 | ||||
-rw-r--r-- | src/vhdl/evaluation.adb | 8 | ||||
-rw-r--r-- | src/vhdl/iirs_utils.adb | 2 | ||||
-rw-r--r-- | src/vhdl/parse.adb | 22 | ||||
-rw-r--r-- | src/vhdl/parse_psl.adb | 2 | ||||
-rw-r--r-- | src/vhdl/sem_lib.adb | 10 | ||||
-rw-r--r-- | src/vhdl/simulate/simul-debugger.adb | 10 | ||||
-rw-r--r-- | src/vhdl/vhdl-scanner-directive_protect.adb (renamed from src/vhdl/scanner-directive_protect.adb) | 20 | ||||
-rw-r--r-- | src/vhdl/vhdl-scanner-scan_literal.adb (renamed from src/vhdl/scanner-scan_literal.adb) | 2 | ||||
-rw-r--r-- | src/vhdl/vhdl-scanner.adb (renamed from src/vhdl/scanner.adb) | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl-scanner.ads (renamed from src/vhdl/scanner.ads) | 4 | ||||
-rw-r--r-- | src/vhdl/vhdl.ads | 21 |
12 files changed, 80 insertions, 41 deletions
diff --git a/src/vhdl/errorout.adb b/src/vhdl/errorout.adb index 90d30e138..fb6211ce4 100644 --- a/src/vhdl/errorout.adb +++ b/src/vhdl/errorout.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Logging; use Logging; -with Scanner; +with Vhdl.Scanner; with Name_Table; with Iirs_Utils; use Iirs_Utils; with Files_Map; use Files_Map; @@ -257,15 +257,15 @@ package body Errorout is when Elaboration => null; when Scan => - File := Scanner.Get_Current_Source_File; - Line := Scanner.Get_Current_Line; - Offset := Scanner.Get_Current_Offset; + File := Vhdl.Scanner.Get_Current_Source_File; + Line := Vhdl.Scanner.Get_Current_Line; + Offset := Vhdl.Scanner.Get_Current_Offset; Loc_Length := 1; when Parse => - File := Scanner.Get_Current_Source_File; - Line := Scanner.Get_Current_Line; - Offset := Scanner.Get_Token_Offset; - Loc_Length := Scanner.Get_Current_Offset - Offset; + File := Vhdl.Scanner.Get_Current_Source_File; + Line := Vhdl.Scanner.Get_Current_Line; + Offset := Vhdl.Scanner.Get_Token_Offset; + Loc_Length := Vhdl.Scanner.Get_Current_Offset - Offset; when Semantic => null; end case; diff --git a/src/vhdl/evaluation.adb b/src/vhdl/evaluation.adb index 72c5a9152..ec366aeef 100644 --- a/src/vhdl/evaluation.adb +++ b/src/vhdl/evaluation.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Ada.Unchecked_Deallocation; with Interfaces; -with Scanner; +with Vhdl.Scanner; with Errorout; use Errorout; with Name_Table; use Name_Table; with Str_Table; @@ -1906,7 +1906,7 @@ package body Evaluation is -- Separate string into numeric value and make lowercase unit. for I in reverse Val'range loop UnitName (I) := Ada.Characters.Handling.To_Lower (Val (I)); - if Scanner.Is_Whitespace (Val (I)) and Found_Unit then + if Vhdl.Scanner.Is_Whitespace (Val (I)) and Found_Unit then Sep := I; exit; else @@ -2193,11 +2193,11 @@ package body Evaluation is First := Value'First; Last := Value'Last; while First <= Last loop - exit when not Scanner.Is_Whitespace (Value (First)); + exit when not Vhdl.Scanner.Is_Whitespace (Value (First)); First := First + 1; end loop; while Last >= First loop - exit when not Scanner.Is_Whitespace (Value (Last)); + exit when not Vhdl.Scanner.Is_Whitespace (Value (Last)); Last := Last - 1; end loop; diff --git a/src/vhdl/iirs_utils.adb b/src/vhdl/iirs_utils.adb index 6a888911d..3ea7aed3c 100644 --- a/src/vhdl/iirs_utils.adb +++ b/src/vhdl/iirs_utils.adb @@ -15,7 +15,7 @@ -- along with GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. -with Scanner; use Scanner; +with Vhdl.Scanner; use Vhdl.Scanner; with Tokens; use Tokens; with Errorout; use Errorout; with Name_Table; diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index 874a5ae2d..d4e8b6121 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -17,7 +17,7 @@ -- 02111-1307, USA. with Iir_Chains; use Iir_Chains; with Tokens; use Tokens; -with Scanner; use Scanner; +with Vhdl.Scanner; use Vhdl.Scanner; with Iirs_Utils; use Iirs_Utils; with Errorout; use Errorout; with Std_Names; use Std_Names; @@ -4371,7 +4371,7 @@ package body Parse is Xrefs.Xref_Keyword (Get_Token_Location); -- Recognize PSL keywords. - Scanner.Flag_Psl := True; + Vhdl.Scanner.Flag_Psl := True; -- Skip 'clock'. Expect_Scan (Tok_Psl_Clock); @@ -4381,8 +4381,8 @@ package body Parse is Set_Psl_Boolean (Res, Parse_Psl.Parse_Psl_Boolean); - Scanner.Flag_Scan_In_Comment := False; - Scanner.Flag_Psl := False; + Vhdl.Scanner.Flag_Scan_In_Comment := False; + Vhdl.Scanner.Flag_Psl := False; Expect_Scan (Tok_Semi_Colon); @@ -4398,7 +4398,7 @@ package body Parse is Loc := Get_Token_Location; -- Recognize PSL keywords. - Scanner.Flag_Psl := True; + Vhdl.Scanner.Flag_Psl := True; -- Skip 'default'. Scan; @@ -4425,10 +4425,10 @@ package body Parse is end if; -- Parse PSL declaration. - Scanner.Flag_Psl := True; + Vhdl.Scanner.Flag_Psl := True; Decl := Parse_Psl.Parse_Psl_Declaration (Tok); - Scanner.Flag_Scan_In_Comment := False; - Scanner.Flag_Psl := False; + Vhdl.Scanner.Flag_Scan_In_Comment := False; + Vhdl.Scanner.Flag_Psl := False; Expect_Scan (Tok_Semi_Colon); @@ -8469,7 +8469,7 @@ package body Parse is procedure Parse_Psl_Assert_Report_Severity (Stmt : Iir) is begin -- No more PSL tokens after the property. - Scanner.Flag_Psl := False; + Vhdl.Scanner.Flag_Psl := False; if Current_Token = Tok_Report then -- Skip 'report' @@ -8485,7 +8485,7 @@ package body Parse is Set_Severity_Expression (Stmt, Parse_Expression); end if; - Scanner.Flag_Scan_In_Comment := False; + Vhdl.Scanner.Flag_Scan_In_Comment := False; Expect_Scan (Tok_Semi_Colon); end Parse_Psl_Assert_Report_Severity; @@ -8498,7 +8498,7 @@ package body Parse is -- Accept PSL tokens if Flags.Vhdl_Std >= Vhdl_08 then - Scanner.Flag_Psl := True; + Vhdl.Scanner.Flag_Psl := True; end if; -- Skip 'assert' diff --git a/src/vhdl/parse_psl.adb b/src/vhdl/parse_psl.adb index 32d24d478..5d78efba6 100644 --- a/src/vhdl/parse_psl.adb +++ b/src/vhdl/parse_psl.adb @@ -19,7 +19,7 @@ with Errorout; use Errorout; with PSL.Nodes; use PSL.Nodes; with Iirs; -with Scanner; use Scanner; +with Vhdl.Scanner; use Vhdl.Scanner; with PSL.Errors; use PSL.Errors; with PSL.Priorities; use PSL.Priorities; with Parse; diff --git a/src/vhdl/sem_lib.adb b/src/vhdl/sem_lib.adb index 19ca27230..6cf642f2f 100644 --- a/src/vhdl/sem_lib.adb +++ b/src/vhdl/sem_lib.adb @@ -21,7 +21,7 @@ with Files_Map; with Iirs_Utils; use Iirs_Utils; with Errorout; use Errorout; with Libraries; use Libraries; -with Scanner; +with Vhdl.Scanner; with Parse; with Disp_Tree; with Disp_Vhdl; @@ -40,15 +40,15 @@ package body Sem_Lib is is Res : Iir_Design_File; begin - Scanner.Set_File (File); - if Scanner.Detect_Encoding_Errors then + Vhdl.Scanner.Set_File (File); + if Vhdl.Scanner.Detect_Encoding_Errors then -- Don't even try to parse such a file. The BOM will be interpreted -- as an identifier, which is not valid at the beginning of a file. Res := Null_Iir; else Res := Parse.Parse_Design_File; end if; - Scanner.Close_File; + Vhdl.Scanner.Close_File; if Res /= Null_Iir then Set_Parent (Res, Work_Library); @@ -159,7 +159,7 @@ package body Sem_Lib is procedure Load_Parse_Design_Unit (Design_Unit: Iir_Design_Unit; Loc : Iir) is - use Scanner; + use Vhdl.Scanner; Design_File : constant Iir_Design_File := Get_Design_File (Design_Unit); Fe : Source_File_Entry; Line, Off: Natural; diff --git a/src/vhdl/simulate/simul-debugger.adb b/src/vhdl/simulate/simul-debugger.adb index ba15bb329..3e868a44a 100644 --- a/src/vhdl/simulate/simul-debugger.adb +++ b/src/vhdl/simulate/simul-debugger.adb @@ -24,7 +24,7 @@ with Name_Table; with Str_Table; with Files_Map; with Parse; -with Scanner; +with Vhdl.Scanner; with Tokens; with Sem_Expr; with Sem_Scopes; @@ -1899,13 +1899,13 @@ package body Simul.Debugger is File := Files_Map.Create_Source_File_From_String (Name_Table.Get_Identifier ("*debug" & Index_Str & '*'), Line (P .. Line'Last)); - Scanner.Set_File (File); - Scanner.Scan; + Vhdl.Scanner.Set_File (File); + Vhdl.Scanner.Scan; Expr := Parse.Parse_Expression; - if Scanner.Current_Token /= Tok_Eof then + if Vhdl.Scanner.Current_Token /= Tok_Eof then Put_Line ("garbage at end of expression ignored"); end if; - Scanner.Close_File; + Vhdl.Scanner.Close_File; if Nbr_Errors /= 0 then Put_Line ("error while parsing expression, evaluation aborted"); Nbr_Errors := 0; diff --git a/src/vhdl/scanner-directive_protect.adb b/src/vhdl/vhdl-scanner-directive_protect.adb index 1a70144d8..bad3bd6ce 100644 --- a/src/vhdl/scanner-directive_protect.adb +++ b/src/vhdl/vhdl-scanner-directive_protect.adb @@ -1,4 +1,22 @@ -separate (Scanner) +-- Lexical analysis for protect directive. +-- Copyright (C) 2019 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +separate (Vhdl.Scanner) package body Directive_Protect is function Scan_Expression_List return Boolean; diff --git a/src/vhdl/scanner-scan_literal.adb b/src/vhdl/vhdl-scanner-scan_literal.adb index ef6718925..9006587fc 100644 --- a/src/vhdl/scanner-scan_literal.adb +++ b/src/vhdl/vhdl-scanner-scan_literal.adb @@ -19,7 +19,7 @@ with Interfaces; use Interfaces; with Grt.Fcvt; use Grt.Fcvt; -separate (Scanner) +separate (Vhdl.Scanner) -- scan a decimal literal or a based literal. -- diff --git a/src/vhdl/scanner.adb b/src/vhdl/vhdl-scanner.adb index 913883ab1..734b0c7ce 100644 --- a/src/vhdl/scanner.adb +++ b/src/vhdl/vhdl-scanner.adb @@ -23,7 +23,7 @@ with Std_Names; with Str_Table; with Flags; use Flags; -package body Scanner is +package body Vhdl.Scanner is -- This classification is a simplification of the categories of LRM93 13.1 -- LRM93 13.1 @@ -2329,4 +2329,4 @@ package body Scanner is return False; end if; end Is_Whitespace; -end Scanner; +end Vhdl.Scanner; diff --git a/src/vhdl/scanner.ads b/src/vhdl/vhdl-scanner.ads index 2fc3db7be..221defd91 100644 --- a/src/vhdl/scanner.ads +++ b/src/vhdl/vhdl-scanner.ads @@ -18,7 +18,7 @@ with Types; use Types; with Tokens; use Tokens; -package Scanner is +package Vhdl.Scanner is -- Global variables -- The token that was just scanned. -- When the token was eaten, you can call invalidate_current_token to @@ -141,4 +141,4 @@ package Scanner is -- LRM93 13.2 Lexical elements, separators, and delimiters -- A space character (SPACE or NBSP) ... function Is_Whitespace (C : Character) return Boolean; -end Scanner; +end Vhdl.Scanner; diff --git a/src/vhdl/vhdl.ads b/src/vhdl/vhdl.ads new file mode 100644 index 000000000..db536d277 --- /dev/null +++ b/src/vhdl/vhdl.ads @@ -0,0 +1,21 @@ +-- VHDL package hierarchy. +-- Copyright (C) 2019 Tristan Gingold +-- +-- GHDL is free software; you can redistribute it and/or modify it under +-- the terms of the GNU General Public License as published by the Free +-- Software Foundation; either version 2, or (at your option) any later +-- version. +-- +-- GHDL is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or +-- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +-- for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with GHDL; see the file COPYING. If not, write to the Free +-- Software Foundation, 59 Temple Place - Suite 330, Boston, MA +-- 02111-1307, USA. + +package Vhdl is + pragma Pure (Vhdl); +end Vhdl; |