Add support for multi-line comments on C language.
[style_checker.git] / src / languages.ads
blobbe9a290ab5e7ca1e1ea34853e7c6e1302e74f34e
1 ------------------------------------------------------------------------------
2 -- Style Checker --
3 -- --
4 -- Copyright (C) 2006, Pascal Obry --
5 -- --
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. --
10 -- --
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. --
15 -- --
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. --
19 -- --
20 ------------------------------------------------------------------------------
22 with Ada.Strings.Unbounded;
24 with GNAT.OS_Lib;
26 with Checks;
28 package Languages is
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
63 procedure List;
64 -- Output on the list of registered languages
66 -- Line ending
68 procedure Set_Line_Ending
69 (L : in Lang_Access;
70 Ending : in Checks.Line_Ending_Style);
72 function Get_Line_Ending (L : in Lang) return Checks.Line_Ending_Style;
74 -- Line length
76 procedure Set_Line_Length_Max
77 (L : in Lang_Access;
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
85 (L : in Lang_Access;
86 Mode : in Checks.Mode);
88 function Get_Duplicate_Blank_Line (L : in Lang) return Checks.Mode;
90 -- Trailing spaces
92 procedure Set_Trailing_Spaces
93 (L : in Lang_Access;
94 Mode : in Checks.Mode);
96 function Get_Trailing_Spaces (L : in Lang) return Checks.Mode;
98 -- Syntax check
100 procedure Set_Syntax_Check
101 (L : in Lang_Access;
102 Mode : in Boolean);
104 function Get_Syntax_Check (L : in Lang) return Boolean;
106 -- Header size
108 procedure Set_Header_Size
109 (L : in Lang_Access;
110 Size : in Natural);
112 function Get_Header_Size (L : in Lang) return Natural;
114 -- Copyright present
116 procedure Set_Copyright_Present
117 (L : in Lang_Access;
118 Mode : in Boolean);
120 function Get_Copyright_Present (L : in Lang) return Boolean;
122 -- Copyright year
124 procedure Set_Copyright_Year
125 (L : in Lang_Access;
126 Mode : in Boolean);
128 function Get_Copyright_Year (L : in Lang) return Boolean;
130 -- Copyright pattern
132 procedure Set_Copyright_Pattern
133 (L : in Lang_Access;
134 Pattern : in String);
136 function Get_Copyright_Pattern (L : in Lang) return String;
138 -- Comments
140 procedure Set_Space_Comment
141 (L : in Lang_Access;
142 Number : in Natural);
144 function Get_Space_Comment (L : in Lang) return Natural;
146 -- Comments ending
148 procedure Set_Comment_Dot_EOL
149 (L : in Lang_Access;
150 Mode : in Boolean);
152 function Get_Comment_Dot_EOL (L : in Lang) return Boolean;
154 -- Style checker parameter
156 procedure Add_Style_Checker_Parameter
157 (L : in Lang_Access;
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
165 private
167 type Lang is tagged record
168 Name : Unbounded_String;
169 C : Checks.Data;
170 end record;
172 end Languages;