Merge from mainline
[official-gcc.git] / gcc / ada / styleg.adb
blob381b39d1933c74443937dd4a974a683cdd017752
1 ------------------------------------------------------------------------------
2 -- --
3 -- GNAT COMPILER COMPONENTS --
4 -- --
5 -- S T Y L E G --
6 -- --
7 -- B o d y --
8 -- --
9 -- Copyright (C) 1992-2006, Free Software Foundation, Inc. --
10 -- --
11 -- GNAT is free software; you can redistribute it and/or modify it under --
12 -- terms of the GNU General Public License as published by the Free Soft- --
13 -- ware Foundation; either version 2, or (at your option) any later ver- --
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
16 -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17 -- for more details. You should have received a copy of the GNU General --
18 -- Public License distributed with GNAT; see file COPYING. If not, write --
19 -- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
20 -- Boston, MA 02110-1301, USA. --
21 -- --
22 -- GNAT was originally developed by the GNAT team at New York University. --
23 -- Extensive contributions were provided by Ada Core Technologies Inc. --
24 -- --
25 ------------------------------------------------------------------------------
27 -- This version of the Style package implements the standard GNAT style
28 -- checking rules. For documentation of these rules, see comments on the
29 -- individual procedures.
31 with Casing; use Casing;
32 with Csets; use Csets;
33 with Err_Vars; use Err_Vars;
34 with Opt; use Opt;
35 with Scans; use Scans;
36 with Sinput; use Sinput;
37 with Stylesw; use Stylesw;
39 package body Styleg is
41 use ASCII;
43 Blank_Lines : Nat := 0;
44 -- Counts number of empty lines seen. Reset to zero if a non-empty line
45 -- is encountered. Used to check for trailing blank lines in Check_EOF,
46 -- and for multiple blank lines.
48 Blank_Line_Location : Source_Ptr;
49 -- Remembers location of first blank line in a series. Used to issue an
50 -- appropriate diagnostic if subsequent blank lines or the end of file
51 -- is encountered.
53 -----------------------
54 -- Local Subprograms --
55 -----------------------
57 procedure Check_No_Space_After;
58 -- Checks that there is a non-white space character after the current
59 -- token, or white space followed by a comment, or the end of line.
60 -- Issue error message if not.
62 procedure Check_No_Space_Before;
63 -- Check that token is first token on line, or else is not preceded
64 -- by white space. Signal error of space not allowed if not.
66 function Determine_Token_Casing return Casing_Type;
68 procedure Error_Space_Not_Allowed (S : Source_Ptr);
69 -- Posts an error message indicating that a space is not allowed
70 -- at the given source location.
72 procedure Error_Space_Required (S : Source_Ptr);
73 -- Posts an error message indicating that a space is required at
74 -- the given source location.
76 function Is_White_Space (C : Character) return Boolean;
77 pragma Inline (Is_White_Space);
78 -- Returns True for space, HT, VT or FF, False otherwise
80 procedure Require_Following_Space;
81 pragma Inline (Require_Following_Space);
82 -- Require token to be followed by white space. Used only if in GNAT
83 -- style checking mode.
85 procedure Require_Preceding_Space;
86 pragma Inline (Require_Preceding_Space);
87 -- Require token to be preceded by white space. Used only if in GNAT
88 -- style checking mode.
90 ----------------------
91 -- Check_Abs_Or_Not --
92 ----------------------
94 -- In check tokens mode (-gnatyt), ABS/NOT must be followed by a space
96 procedure Check_Abs_Not is
97 begin
98 if Style_Check_Tokens then
99 if Source (Scan_Ptr) > ' ' then
100 Error_Space_Required (Scan_Ptr);
101 end if;
102 end if;
103 end Check_Abs_Not;
105 ----------------------
106 -- Check_Apostrophe --
107 ----------------------
109 -- Do not allow space before or after apostrophe
111 procedure Check_Apostrophe is
112 begin
113 if Style_Check_Tokens then
114 Check_No_Space_After;
115 end if;
116 end Check_Apostrophe;
118 -----------------
119 -- Check_Arrow --
120 -----------------
122 -- In check tokens mode (-gnatys), arrow must be surrounded by spaces
124 procedure Check_Arrow is
125 begin
126 if Style_Check_Tokens then
127 Require_Preceding_Space;
128 Require_Following_Space;
129 end if;
130 end Check_Arrow;
132 --------------------------
133 -- Check_Attribute_Name --
134 --------------------------
136 -- In check attribute casing mode (-gnatya), attribute names must be
137 -- mixed case, i.e. start with an upper case letter, and otherwise
138 -- lower case, except after an underline character.
140 procedure Check_Attribute_Name (Reserved : Boolean) is
141 pragma Warnings (Off, Reserved);
142 begin
143 if Style_Check_Attribute_Casing then
144 if Determine_Token_Casing /= Mixed_Case then
145 Error_Msg_SC ("(style) bad capitalization, mixed case required");
146 end if;
147 end if;
148 end Check_Attribute_Name;
150 ---------------------------
151 -- Check_Binary_Operator --
152 ---------------------------
154 -- In check token mode (-gnatyt), binary operators other than the special
155 -- case of exponentiation require surrounding space characters.
157 procedure Check_Binary_Operator is
158 begin
159 if Style_Check_Tokens then
160 Require_Preceding_Space;
161 Require_Following_Space;
162 end if;
163 end Check_Binary_Operator;
165 ---------------
166 -- Check_Box --
167 ---------------
169 -- In check token mode (-gnatyt), box must be preceded by a space or by
170 -- a left parenthesis. Spacing checking on the surrounding tokens takes
171 -- care of the remaining checks.
173 procedure Check_Box is
174 begin
175 if Style_Check_Tokens then
176 if Prev_Token /= Tok_Left_Paren then
177 Require_Preceding_Space;
178 end if;
179 end if;
180 end Check_Box;
182 -----------------
183 -- Check_Colon --
184 -----------------
186 -- In check token mode (-gnatyt), colon must be surrounded by spaces
188 procedure Check_Colon is
189 begin
190 if Style_Check_Tokens then
191 Require_Preceding_Space;
192 Require_Following_Space;
193 end if;
194 end Check_Colon;
196 -----------------------
197 -- Check_Colon_Equal --
198 -----------------------
200 -- In check token mode (-gnatyt), := must be surrounded by spaces
202 procedure Check_Colon_Equal is
203 begin
204 if Style_Check_Tokens then
205 Require_Preceding_Space;
206 Require_Following_Space;
207 end if;
208 end Check_Colon_Equal;
210 -----------------
211 -- Check_Comma --
212 -----------------
214 -- In check token mode (-gnatyt), comma must be either the first
215 -- token on a line, or be preceded by a non-blank character.
216 -- It must also always be followed by a blank.
218 procedure Check_Comma is
219 begin
220 if Style_Check_Tokens then
221 Check_No_Space_Before;
223 if Source (Scan_Ptr) > ' ' then
224 Error_Space_Required (Scan_Ptr);
225 end if;
226 end if;
227 end Check_Comma;
229 -------------------
230 -- Check_Comment --
231 -------------------
233 -- In check comment mode (-gnatyc) there are several requirements on the
234 -- format of comments. The following are permissible comment formats:
236 -- 1. Any comment that is not at the start of a line, i.e. where the
237 -- initial minuses are not the first non-blank characters on the
238 -- line must have at least one blank after the second minus.
240 -- 2. A row of all minuses of any length is permitted (see procedure
241 -- box above in the source of this routine).
243 -- 3. A comment line starting with two minuses and a space, and ending
244 -- with a space and two minuses. Again see the procedure title box
245 -- immediately above in the source.
247 -- 4. A full line comment where two spaces follow the two minus signs.
248 -- This is the normal comment format in GNAT style, as typified by
249 -- the comments you are reading now.
251 -- 5. A full line comment where the first character after the second
252 -- minus is a special character, i.e. a character in the ASCII
253 -- range 16#21#..16#2F# or 16#3A#..16#3F#. This allows special
254 -- comments, such as those generated by gnatprep, or those that
255 -- appear in the SPARK annotation language to be accepted.
257 -- Note: for GNAT internal files (-gnatg switch set on for the
258 -- compilation), the only special sequence recognized and allowed
259 -- is --! as generated by gnatprep.
261 procedure Check_Comment is
262 S : Source_Ptr;
263 C : Character;
265 function Is_Box_Comment return Boolean;
266 -- Returns True if the last two characters on the line are -- which
267 -- characterizes a box comment (as for example follows this spec).
269 --------------------
270 -- Is_Box_Comment --
271 --------------------
273 function Is_Box_Comment return Boolean is
274 S : Source_Ptr;
276 begin
277 -- Do we need to worry about UTF_32 line terminators here ???
279 S := Scan_Ptr + 3;
280 while Source (S) not in Line_Terminator loop
281 S := S + 1;
282 end loop;
284 return Source (S - 1) = '-' and then Source (S - 2) = '-';
285 end Is_Box_Comment;
287 -- Start of processing for Check_Comment
289 begin
290 -- Can never have a non-blank character preceding the first minus
292 if Style_Check_Comments then
293 if Scan_Ptr > Source_First (Current_Source_File)
294 and then Source (Scan_Ptr - 1) > ' '
295 then
296 Error_Msg_S ("(style) space required");
297 end if;
298 end if;
300 -- For a comment that is not at the start of the line, the only
301 -- requirement is that we cannot have a non-blank character after
302 -- the second minus sign.
304 if Scan_Ptr /= First_Non_Blank_Location then
305 if Style_Check_Comments then
306 if Source (Scan_Ptr + 2) > ' ' then
307 Error_Msg ("(style) space required", Scan_Ptr + 2);
308 end if;
309 end if;
311 return;
313 -- Case of a comment that is at the start of a line
315 else
316 -- First check, must be in appropriately indented column
318 if Style_Check_Indentation /= 0 then
319 if Start_Column rem Style_Check_Indentation /= 0 then
320 Error_Msg_S ("(style) bad column");
321 return;
322 end if;
323 end if;
325 -- If we are not checking comments, nothing to do
327 if not Style_Check_Comments then
328 return;
329 end if;
331 -- Case of not followed by a blank. Usually wrong, but there are
332 -- some exceptions that we permit.
334 if Source (Scan_Ptr + 2) /= ' ' then
335 C := Source (Scan_Ptr + 2);
337 -- Case of -- all on its own on a line is OK
339 if C < ' ' then
340 return;
341 end if;
343 -- Case of --x, x special character is OK (gnatprep/SPARK/etc.)
344 -- This is not permitted in internal GNAT implementation units
345 -- except for the case of --! as used by gnatprep output.
347 if GNAT_Mode then
348 if C = '!' then
349 return;
350 end if;
352 else
353 if Character'Pos (C) in 16#21# .. 16#2F#
354 or else
355 Character'Pos (C) in 16#3A# .. 16#3F#
356 then
357 return;
358 end if;
359 end if;
361 -- The only other case in which we allow a character after
362 -- the -- other than a space is when we have a row of minus
363 -- signs (case of header lines for a box comment for example).
365 S := Scan_Ptr + 2;
366 while Source (S) >= ' ' loop
367 if Source (S) /= '-' then
368 if Is_Box_Comment then
369 Error_Space_Required (Scan_Ptr + 2);
370 else
371 Error_Msg ("(style) two spaces required", Scan_Ptr + 2);
372 end if;
374 return;
375 end if;
377 S := S + 1;
378 end loop;
380 -- If we are followed by a blank, then the comment is OK if the
381 -- character following this blank is another blank or a format
382 -- effector.
384 elsif Source (Scan_Ptr + 3) <= ' ' then
385 return;
387 -- Here is the case where we only have one blank after the two
388 -- minus signs, which is an error unless the line ends with two
389 -- minus signs, the case of a box comment.
391 elsif not Is_Box_Comment then
392 Error_Space_Required (Scan_Ptr + 3);
393 end if;
394 end if;
395 end Check_Comment;
397 -------------------
398 -- Check_Dot_Dot --
399 -------------------
401 -- In check token mode (-gnatyt), colon must be surrounded by spaces
403 procedure Check_Dot_Dot is
404 begin
405 if Style_Check_Tokens then
406 Require_Preceding_Space;
407 Require_Following_Space;
408 end if;
409 end Check_Dot_Dot;
411 ---------------
412 -- Check_EOF --
413 ---------------
415 -- In check blanks at end mode, check no blank lines precede the EOF
417 procedure Check_EOF is
418 begin
419 if Style_Check_Blank_Lines then
421 -- We expect one blank line, from the EOF, but no more than one
423 if Blank_Lines = 2 then
424 Error_Msg
425 ("(style) blank line not allowed at end of file",
426 Blank_Line_Location);
428 elsif Blank_Lines >= 3 then
429 Error_Msg
430 ("(style) blank lines not allowed at end of file",
431 Blank_Line_Location);
432 end if;
433 end if;
434 end Check_EOF;
436 -----------------------------------
437 -- Check_Exponentiation_Operator --
438 -----------------------------------
440 -- No spaces are required for the ** operator in GNAT style check mode
442 procedure Check_Exponentiation_Operator is
443 begin
444 null;
445 end Check_Exponentiation_Operator;
447 --------------
448 -- Check_HT --
449 --------------
451 -- In check horizontal tab mode (-gnatyh), tab characters are not allowed
453 procedure Check_HT is
454 begin
455 if Style_Check_Horizontal_Tabs then
456 Error_Msg_S ("(style) horizontal tab not allowed");
457 end if;
458 end Check_HT;
460 -----------------------
461 -- Check_Indentation --
462 -----------------------
464 -- In check indentation mode (-gnatyn for n a digit), a new statement or
465 -- declaration is required to start in a column that is a multiple of the
466 -- indentiation amount.
468 procedure Check_Indentation is
469 begin
470 if Style_Check_Indentation /= 0 then
471 if Token_Ptr = First_Non_Blank_Location
472 and then Start_Column rem Style_Check_Indentation /= 0
473 then
474 Error_Msg_SC ("(style) bad indentation");
475 end if;
476 end if;
477 end Check_Indentation;
479 ----------------------
480 -- Check_Left_Paren --
481 ----------------------
483 -- In tone check mode (-gnatyt), left paren must not be preceded by an
484 -- identifier character or digit (a separating space is required) and
485 -- may never be followed by a space.
487 procedure Check_Left_Paren is
488 begin
489 if Style_Check_Tokens then
490 if Token_Ptr > Source_First (Current_Source_File)
491 and then Identifier_Char (Source (Token_Ptr - 1))
492 then
493 Error_Space_Required (Token_Ptr);
494 end if;
496 Check_No_Space_After;
497 end if;
498 end Check_Left_Paren;
500 ---------------------------
501 -- Check_Line_Max_Length --
502 ---------------------------
504 -- In check max line length mode (-gnatym), the line length must
505 -- not exceed the permitted maximum value.
507 procedure Check_Line_Max_Length (Len : Int) is
508 begin
509 if Style_Check_Max_Line_Length then
510 if Len > Style_Max_Line_Length then
511 Error_Msg
512 ("(style) this line is too long",
513 Current_Line_Start + Source_Ptr (Style_Max_Line_Length));
514 end if;
515 end if;
516 end Check_Line_Max_Length;
518 ---------------------------
519 -- Check_Line_Terminator --
520 ---------------------------
522 -- In check blanks at end mode (-gnatyb), lines may not end with a
523 -- trailing space.
525 -- In check form feeds mode (-gnatyf), the line terminator may not
526 -- be either of the characters FF or VT.
528 -- In check DOS line terminators node (-gnatyd), the line terminator
529 -- must be a single LF, without a following CR.
531 procedure Check_Line_Terminator (Len : Int) is
532 S : Source_Ptr;
534 L : Int := Len;
535 -- Length of line (adjusted down for blanks at end of line)
537 begin
538 -- Reset count of blank lines if first line
540 if Get_Logical_Line_Number (Scan_Ptr) = 1 then
541 Blank_Lines := 0;
542 end if;
544 -- Check FF/VT terminators
546 if Style_Check_Form_Feeds then
547 if Source (Scan_Ptr) = ASCII.FF then
548 Error_Msg_S ("(style) form feed not allowed");
549 elsif Source (Scan_Ptr) = ASCII.VT then
550 Error_Msg_S ("(style) vertical tab not allowed");
551 end if;
552 end if;
554 -- Check DOS line terminator (ignore EOF, since we only get called
555 -- with an EOF if it is the last character in the buffer, and was
556 -- therefore not present in the sources
558 if Style_Check_DOS_Line_Terminator then
559 if Source (Scan_Ptr) = EOF then
560 null;
561 elsif Source (Scan_Ptr) /= LF
562 or else Source (Scan_Ptr + 1) = CR
563 then
564 Error_Msg_S ("(style) incorrect line terminator");
565 end if;
566 end if;
568 -- Remove trailing spaces
570 S := Scan_Ptr;
571 while L > 0 and then Is_White_Space (Source (S - 1)) loop
572 S := S - 1;
573 L := L - 1;
574 end loop;
576 -- Issue message for blanks at end of line if option enabled
578 if Style_Check_Blanks_At_End and then L < Len then
579 Error_Msg
580 ("(style) trailing spaces not permitted", S);
581 end if;
583 -- Deal with empty (blank) line
585 if L = 0 then
587 -- Increment blank line count
589 Blank_Lines := Blank_Lines + 1;
591 -- If first blank line, record location for later error message
593 if Blank_Lines = 1 then
594 Blank_Line_Location := Scan_Ptr;
595 end if;
597 -- Non-blank line, check for previous multiple blank lines
599 else
600 if Style_Check_Blank_Lines and then Blank_Lines > 1 then
601 Error_Msg
602 ("(style) multiple blank lines", Blank_Line_Location);
603 end if;
605 -- And reset blank line count
607 Blank_Lines := 0;
608 end if;
609 end Check_Line_Terminator;
611 --------------------------
612 -- Check_No_Space_After --
613 --------------------------
615 procedure Check_No_Space_After is
616 S : Source_Ptr;
618 begin
619 if Is_White_Space (Source (Scan_Ptr)) then
621 -- Allow one or more spaces if followed by comment
623 S := Scan_Ptr + 1;
624 loop
625 if Source (S) = '-' and then Source (S + 1) = '-' then
626 return;
628 elsif Is_White_Space (Source (S)) then
629 S := S + 1;
631 else
632 exit;
633 end if;
634 end loop;
636 Error_Space_Not_Allowed (Scan_Ptr);
637 end if;
638 end Check_No_Space_After;
640 ---------------------------
641 -- Check_No_Space_Before --
642 ---------------------------
644 procedure Check_No_Space_Before is
645 begin
646 if Token_Ptr > First_Non_Blank_Location
647 and then Source (Token_Ptr - 1) <= ' '
648 then
649 Error_Space_Not_Allowed (Token_Ptr - 1);
650 end if;
651 end Check_No_Space_Before;
653 -----------------------
654 -- Check_Pragma_Name --
655 -----------------------
657 -- In check pragma casing mode (-gnatyp), pragma names must be mixed
658 -- case, i.e. start with an upper case letter, and otherwise lower case,
659 -- except after an underline character.
661 procedure Check_Pragma_Name is
662 begin
663 if Style_Check_Pragma_Casing then
664 if Determine_Token_Casing /= Mixed_Case then
665 Error_Msg_SC ("(style) bad capitalization, mixed case required");
666 end if;
667 end if;
668 end Check_Pragma_Name;
670 -----------------------
671 -- Check_Right_Paren --
672 -----------------------
674 -- In check tokens mode (-gnatyt), right paren must never be preceded by
675 -- a space unless it is the initial non-blank character on the line.
677 procedure Check_Right_Paren is
678 begin
679 if Style_Check_Tokens then
680 Check_No_Space_Before;
681 end if;
682 end Check_Right_Paren;
684 ---------------------
685 -- Check_Semicolon --
686 ---------------------
688 -- In check tokens mode (-gnatyt), semicolon does not permit a preceding
689 -- space and a following space is required.
691 procedure Check_Semicolon is
692 begin
693 if Style_Check_Tokens then
694 Check_No_Space_Before;
696 if Source (Scan_Ptr) > ' ' then
697 Error_Space_Required (Scan_Ptr);
698 end if;
699 end if;
700 end Check_Semicolon;
702 ----------------
703 -- Check_Then --
704 ----------------
706 -- In check if then layout mode (-gnatyi), we expect a THEN keyword
707 -- to appear either on the same line as the IF, or on a separate line
708 -- after multiple conditions. In any case, it may not appear on the
709 -- line immediately following the line with the IF.
711 procedure Check_Then (If_Loc : Source_Ptr) is
712 begin
713 if Style_Check_If_Then_Layout then
714 if Get_Physical_Line_Number (Token_Ptr) =
715 Get_Physical_Line_Number (If_Loc) + 1
716 then
717 Error_Msg_SC ("(style) misplaced THEN");
718 end if;
719 end if;
720 end Check_Then;
722 -------------------------------
723 -- Check_Unary_Plus_Or_Minus --
724 -------------------------------
726 -- In check tokem mode (-gnatyt), unary plus or minus must not be
727 -- followed by a space.
729 procedure Check_Unary_Plus_Or_Minus is
730 begin
731 if Style_Check_Tokens then
732 Check_No_Space_After;
733 end if;
734 end Check_Unary_Plus_Or_Minus;
736 ------------------------
737 -- Check_Vertical_Bar --
738 ------------------------
740 -- In check token mode (-gnatyt), vertical bar must be surrounded by spaces
742 procedure Check_Vertical_Bar is
743 begin
744 if Style_Check_Tokens then
745 Require_Preceding_Space;
746 Require_Following_Space;
747 end if;
748 end Check_Vertical_Bar;
750 -----------------------
751 -- Check_Xtra_Parens --
752 -----------------------
754 procedure Check_Xtra_Parens (Loc : Source_Ptr) is
755 begin
756 if Style_Check_Xtra_Parens then
757 Error_Msg ("redundant parentheses?", Loc);
758 end if;
759 end Check_Xtra_Parens;
761 ----------------------------
762 -- Determine_Token_Casing --
763 ----------------------------
765 function Determine_Token_Casing return Casing_Type is
766 begin
767 return Determine_Casing (Source (Token_Ptr .. Scan_Ptr - 1));
768 end Determine_Token_Casing;
770 -----------------------------
771 -- Error_Space_Not_Allowed --
772 -----------------------------
774 procedure Error_Space_Not_Allowed (S : Source_Ptr) is
775 begin
776 Error_Msg ("(style) space not allowed", S);
777 end Error_Space_Not_Allowed;
779 --------------------------
780 -- Error_Space_Required --
781 --------------------------
783 procedure Error_Space_Required (S : Source_Ptr) is
784 begin
785 Error_Msg ("(style) space required", S);
786 end Error_Space_Required;
788 --------------------
789 -- Is_White_Space --
790 --------------------
792 function Is_White_Space (C : Character) return Boolean is
793 begin
794 return C = ' ' or else C = HT;
795 end Is_White_Space;
797 -------------------
798 -- Mode_In_Check --
799 -------------------
801 function Mode_In_Check return Boolean is
802 begin
803 return Style_Check and Style_Check_Mode_In;
804 end Mode_In_Check;
806 -----------------
807 -- No_End_Name --
808 -----------------
810 -- In check end/exit labels mode (-gnatye), always require the name of
811 -- a subprogram or package to be present on the END, so this is an error.
813 procedure No_End_Name (Name : Node_Id) is
814 begin
815 if Style_Check_End_Labels then
816 Error_Msg_Node_1 := Name;
817 Error_Msg_SP ("(style) `END &` required");
818 end if;
819 end No_End_Name;
821 ------------------
822 -- No_Exit_Name --
823 ------------------
825 -- In check end/exit labels mode (-gnatye), always require the name of
826 -- the loop to be present on the EXIT when exiting a named loop.
828 procedure No_Exit_Name (Name : Node_Id) is
829 begin
830 if Style_Check_End_Labels then
831 Error_Msg_Node_1 := Name;
832 Error_Msg_SP ("(style) `EXIT &` required");
833 end if;
834 end No_Exit_Name;
836 ----------------------------
837 -- Non_Lower_Case_Keyword --
838 ----------------------------
840 -- In check casing mode (-gnatyk), reserved keywords must be be spelled
841 -- in all lower case (excluding keywords range, access, delta and digits
842 -- used as attribute designators).
844 procedure Non_Lower_Case_Keyword is
845 begin
846 if Style_Check_Keyword_Casing then
847 Error_Msg_SC ("(style) reserved words must be all lower case");
848 end if;
849 end Non_Lower_Case_Keyword;
851 -----------------------------
852 -- Require_Following_Space --
853 -----------------------------
855 procedure Require_Following_Space is
856 begin
857 if Source (Scan_Ptr) > ' ' then
858 Error_Space_Required (Scan_Ptr);
859 end if;
860 end Require_Following_Space;
862 -----------------------------
863 -- Require_Preceding_Space --
864 -----------------------------
866 procedure Require_Preceding_Space is
867 begin
868 if Token_Ptr > Source_First (Current_Source_File)
869 and then Source (Token_Ptr - 1) > ' '
870 then
871 Error_Space_Required (Token_Ptr);
872 end if;
873 end Require_Preceding_Space;
875 ---------------------
876 -- RM_Column_Check --
877 ---------------------
879 function RM_Column_Check return Boolean is
880 begin
881 return Style_Check and Style_Check_Layout;
882 end RM_Column_Check;
884 end Styleg;