1--  Error message handling for PSL.
2--  Copyright (C) 2002-2019 Tristan Gingold
3--
4--  This program is free software: you can redistribute it and/or modify
5--  it under the terms of the GNU General Public License as published by
6--  the Free Software Foundation, either version 2 of the License, or
7--  (at your option) any later version.
8--
9--  This program is distributed in the hope that it will be useful,
10--  but WITHOUT ANY WARRANTY; without even the implied warranty of
11--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12--  GNU General Public License for more details.
13--
14--  You should have received a copy of the GNU General Public License
15--  along with this program.  If not, see <gnu.org/licenses>.
16with Logging; use Logging;
17with Errorout; use Errorout;
18with PSL.Nodes;
19
20package body PSL.Errors is
21   function "+" (L : PSL_Node) return Location_Type
22   is
23      use PSL.Nodes;
24   begin
25      if L = Null_Node then
26         return No_Location;
27      else
28         return PSL.Nodes.Get_Location (L);
29      end if;
30   end "+";
31
32   procedure Error_Kind (Msg : String; N : PSL_Node) is
33   begin
34      Log (Msg);
35      Log (": cannot handle ");
36      Log_Line (PSL.Nodes.Nkind'Image (PSL.Nodes.Get_Kind (N)));
37      raise Internal_Error;
38   end Error_Kind;
39
40   procedure Error_Msg_Sem (Msg: String; Loc : PSL_Node) is
41   begin
42      Report_Msg (Msgid_Error, Semantic, +(+Loc), Msg, No_Eargs);
43   end Error_Msg_Sem;
44end PSL.Errors;
45