-- B o d y --
-- --
-- Copyright (C) 1986 by University of Toronto. --
--- Copyright (C) 1996-2004 Ada Core Technologies, Inc. --
+-- Copyright (C) 1999-2005, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- Complex loops
CURLYX, -- 2num node Match this complex thing {n,m} times
- -- The nums are coded on two characters each.
+ -- The nums are coded on two characters each
WHILEM, -- no Do curly processing and see if rest matches
procedure Set_In_Class
(Bitmap : in out Character_Class;
C : Character);
- -- Set the entry to True for C in the class Bitmap.
+ -- Set the entry to True for C in the class Bitmap
function Get_From_Class
(Bitmap : Character_Class;
C : Character) return Boolean;
- -- Return True if the entry is set for C in the class Bitmap.
+ -- Return True if the entry is set for C in the class Bitmap
procedure Reset_Class (Bitmap : out Character_Class);
- -- Clear all the entries in the class Bitmap.
+ -- Clear all the entries in the class Bitmap
pragma Inline (Set_In_Class);
pragma Inline (Get_From_Class);
function Get_Next_Offset
(Program : Program_Data;
IP : Pointer) return Pointer;
- -- Get the offset field of a node. Used by Get_Next.
+ -- Get the offset field of a node. Used by Get_Next
function Get_Next
(Program : Program_Data;
function Read_Natural
(Program : Program_Data;
IP : Pointer) return Natural;
- -- Return the 2-byte natural coded at position IP.
+ -- Return the 2-byte natural coded at position IP
-- All of the subprograms above are tiny and should be inlined
-- Return value is the location of new opcode, ie old Emit_Ptr.
procedure Emit_Natural (IP : Pointer; N : Natural);
- -- Split N on two characters at position IP.
+ -- Split N on two characters at position IP
procedure Emit_Class (Bitmap : Character_Class);
- -- Emits a character class.
+ -- Emits a character class
procedure Case_Emit (C : Character);
-- Emit C, after converting is to lower-case if the regular
function Next_Instruction (P : Pointer) return Pointer;
-- Dig the "next" pointer out of a node
- procedure Fail (M : in String);
+ procedure Fail (M : String);
pragma No_Return (Fail);
-- Fail with a diagnostic message, if possible
-- Fail --
----------
- procedure Fail (M : in String) is
+ procedure Fail (M : String) is
begin
- raise Expression_Error;
+ raise Expression_Error with M;
end Fail;
-------------------------
-- makes it hard to avoid.
procedure Parse
- (Parenthesized : in Boolean;
+ (Parenthesized : Boolean;
Flags : out Expression_Flags;
IP : out Pointer)
is
Parse_Pos := Parse_Pos + 1;
end if;
- -- First character can be ] or -, without closing the class.
+ -- First character can be ] or - without closing the class
if Parse_Pos <= Parse_End
and then (Expression (Parse_Pos) = ']'
type Natural_Array is array (Match_Count range <>) of Natural;
Matches_Tmp : Natural_Array (Matches_Full'Range);
- -- Save the opening position of parenthesis.
+ -- Save the opening position of parenthesis
Last_Paren : Natural := 0;
-- Last parenthesis seen
-- operators for complex expressions.
Current_Curly : Current_Curly_Access := null;
- -- The curly currently being processed.
+ -- The curly currently being processed
-----------------------
-- Local Subprograms --
-- It only matches on things of length 1.
-- Starting from Input_Pos, it matches at most Max CURLY.
- function Try (Pos : in Positive) return Boolean;
+ function Try (Pos : Positive) return Boolean;
-- Try to match at specific point
function Match (IP : Pointer) return Boolean;
pragma Inline (Index);
pragma Inline (Repeat);
- -- These are two complex functions, but used only once.
+ -- These are two complex functions, but used only once
pragma Inline (Match_Whilem);
pragma Inline (Match_Simple_Operator);
Ln : Natural := 0;
Lastloc : constant Natural := Cc.Lastloc;
- -- Detection of 0-len.
+ -- Detection of 0-len
begin
- -- If degenerate scan matches "", assume scan done.
+ -- If degenerate scan matches "", assume scan done
if Input_Pos = Cc.Lastloc
and then N >= Cc.Min
return False;
end if;
- -- First, just match a string of min scans.
+ -- First, just match a string of min scans
if N < Cc.Min then
Cc.Cur := N;
return False;
end if;
- -- Prefer next over scan for minimal matching.
+ -- Prefer next over scan for minimal matching
if not Cc.Greedy then
Current_Curly := Cc.Old_Cc;
-- Try --
---------
- function Try (Pos : in Positive) return Boolean is
+ function Try (Pos : Positive) return Boolean is
begin
Input_Pos := Pos;
Last_Paren := 0;