1 ------------------------------------------------------------------------------
4 -- Copyright (C) 2006, Pascal Obry --
6 -- This library is free software; you can redistribute it and/or modify --
7 -- it under the terms of the GNU General Public License as published by --
8 -- the Free Software Foundation; either version 2 of the License, or (at --
9 -- your option) any later version. --
11 -- This library is distributed in the hope that it will be useful, but --
12 -- WITHOUT ANY WARRANTY; without even the implied warranty of --
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
14 -- General Public License for more details. --
16 -- You should have received a copy of the GNU General Public License --
17 -- along with this library; if not, write to the Free Software Foundation, --
18 -- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. --
20 ------------------------------------------------------------------------------
22 with Ada
.Strings
.Unbounded
;
30 use Ada
.Strings
.Unbounded
;
32 type Lang
is tagged private;
33 type Lang_Access
is access Lang
'Class;
35 function Name
(L
: in Lang
) return String;
37 function Is_Extension
(L
: in Lang
; Ext
: in String) return Boolean;
38 -- Returns True if Ext (an extension) belongs to the given language
40 function Comment
(L
: in Lang
) return String;
41 -- Returns the comment characters used for the given language
43 function Start_Multiline_Comment
(L
: in Lang
) return String;
44 -- Returns the characters use to start a multi-line comment
46 function End_Multiline_Comment
(L
: in Lang
) return String;
47 -- Returns the characters use to end a multi-line comment
49 function Run_Syntax_Check
50 (L
: in Lang
; Filename
: in String) return Boolean;
51 -- Run the syntax checker for the given languages, returns true if no
52 -- error has been found.
54 function Get
(Filename
: in String) return Lang
'Class;
55 -- Returns the language handler for the given filename
57 procedure Register
(L
: in Lang
'Class; Name
: in String);
58 -- Register a new language handler with the given name
60 function Get_From_Name
(Name
: in String) return Lang_Access
;
61 -- Returns the language handler for Name, null if not found
64 -- Output on the list of registered languages
68 procedure Set_Line_Ending
70 Ending
: in Checks
.Line_Ending_Style
);
72 function Get_Line_Ending
(L
: in Lang
) return Checks
.Line_Ending_Style
;
76 procedure Set_Line_Length_Max
78 Length
: in Positive);
80 function Get_Line_Length_Max
(L
: in Lang
) return Positive;
82 -- Duplicate blank line
84 procedure Set_Duplicate_Blank_Line
86 Mode
: in Checks
.Mode
);
88 function Get_Duplicate_Blank_Line
(L
: in Lang
) return Checks
.Mode
;
92 procedure Set_Trailing_Spaces
94 Mode
: in Checks
.Mode
);
96 function Get_Trailing_Spaces
(L
: in Lang
) return Checks
.Mode
;
100 procedure Set_Syntax_Check
104 function Get_Syntax_Check
(L
: in Lang
) return Boolean;
108 procedure Set_Header_Size
112 function Get_Header_Size
(L
: in Lang
) return Natural;
116 procedure Set_Copyright_Present
120 function Get_Copyright_Present
(L
: in Lang
) return Boolean;
124 procedure Set_Copyright_Year
128 function Get_Copyright_Year
(L
: in Lang
) return Boolean;
132 procedure Set_Copyright_Pattern
134 Pattern
: in String);
136 function Get_Copyright_Pattern
(L
: in Lang
) return String;
140 procedure Set_Space_Comment
142 Number
: in Natural);
144 function Get_Space_Comment
(L
: in Lang
) return Natural;
148 procedure Set_Comment_Dot_EOL
152 function Get_Comment_Dot_EOL
(L
: in Lang
) return Boolean;
154 -- Style checker parameter
156 procedure Add_Style_Checker_Parameter
158 Parameter
: in String);
159 -- Add a parameter for the style checker
161 function Get_Style_Checker_Parameters
162 (L
: in Lang
) return GNAT
.OS_Lib
.Argument_List
;
163 -- Returns the arguments for the style checker
167 type Lang
is tagged record
168 Name
: Unbounded_String
;