-- --
-- B o d y --
-- --
--- Copyright (C) 1998-2004, Ada Core Technologies, Inc. --
+-- Copyright (C) 1998-2005, Ada Core Technologies, Inc. --
-- --
-- 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- --
function Match
(Subject : VString;
- Pat : Pattern)
- return Boolean
+ Pat : Pattern) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
return Start /= 0;
function Match
(Subject : String;
- Pat : Pattern)
- return Boolean
+ Pat : Pattern) return Boolean
is
Start, Stop : Natural;
subtype String1 is String (1 .. Subject'Length);
function Match
(Subject : VString_Var;
Pat : Pattern;
- Replace : VString)
- return Boolean
+ Replace : VString) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start = 0 then
return False;
else
+ Get_String (Replace, S, L);
Replace_Slice
- (Subject'Unrestricted_Access.all,
- Start, Stop, Get_String (Replace).all);
+ (Subject'Unrestricted_Access.all, Start, Stop, S (1 .. L));
return True;
end if;
end Match;
function Match
(Subject : VString_Var;
Pat : Pattern;
- Replace : String)
- return Boolean
+ Replace : String) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start = 0 then
(Subject : VString;
Pat : Pattern)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
-
end Match;
procedure Match
Pat : Pattern;
Replace : VString)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start /= 0 then
- Replace_Slice (Subject, Start, Stop, Get_String (Replace).all);
+ Get_String (Replace, S, L);
+ Replace_Slice (Subject, Start, Stop, S (1 .. L));
end if;
end Match;
Pat : Pattern;
Replace : String)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start /= 0 then
function Match
(Subject : VString;
- Pat : PString)
- return Boolean
+ Pat : PString) return Boolean
is
- Pat_Len : constant Natural := Pat'Length;
- Sub_Len : constant Natural := Length (Subject);
- Sub_Str : constant String_Access := Get_String (Subject);
+ Pat_Len : constant Natural := Pat'Length;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Anchored_Mode then
- if Pat_Len > Sub_Len then
+ if Pat_Len > L then
return False;
else
- return Pat = Sub_Str.all (1 .. Pat_Len);
+ return Pat = S (1 .. Pat_Len);
end if;
else
- for J in 1 .. Sub_Len - Pat_Len + 1 loop
- if Pat = Sub_Str.all (J .. J + (Pat_Len - 1)) then
+ for J in 1 .. L - Pat_Len + 1 loop
+ if Pat = S (J .. J + (Pat_Len - 1)) then
return True;
end if;
end loop;
function Match
(Subject : String;
- Pat : PString)
- return Boolean
+ Pat : PString) return Boolean
is
Pat_Len : constant Natural := Pat'Length;
Sub_Len : constant Natural := Subject'Length;
function Match
(Subject : VString_Var;
Pat : PString;
- Replace : VString)
- return Boolean
+ Replace : VString) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatchD (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
else
- XMatch (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatch (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
end if;
if Start = 0 then
return False;
else
+ Get_String (Replace, S, L);
Replace_Slice
- (Subject'Unrestricted_Access.all,
- Start, Stop, Get_String (Replace).all);
+ (Subject'Unrestricted_Access.all, Start, Stop, S (1 .. L));
return True;
end if;
end Match;
function Match
(Subject : VString_Var;
Pat : PString;
- Replace : String)
- return Boolean
+ Replace : String) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatchD (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
else
- XMatch (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatch (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
end if;
if Start = 0 then
(Subject : VString;
Pat : PString)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatchD (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
else
- XMatch (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatch (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
end if;
end Match;
Pat : PString;
Replace : VString)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatchD (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
else
- XMatch (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatch (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
end if;
if Start /= 0 then
- Replace_Slice (Subject, Start, Stop, Get_String (Replace).all);
+ Get_String (Replace, S, L);
+ Replace_Slice (Subject, Start, Stop, S (1 .. L));
end if;
end Match;
Pat : PString;
Replace : String)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatchD (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
else
- XMatch (Get_String (Subject).all, S_To_PE (Pat), 0, Start, Stop);
+ XMatch (S (1 .. L), S_To_PE (Pat), 0, Start, Stop);
end if;
if Start /= 0 then
function Match
(Subject : VString_Var;
Pat : Pattern;
- Result : Match_Result_Var)
- return Boolean
+ Result : Match_Result_Var) return Boolean
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start = 0 then
Pat : Pattern;
Result : out Match_Result)
is
- Start, Stop : Natural;
+ Start : Natural;
+ Stop : Natural;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (Subject, S, L);
+
if Debug_Mode then
- XMatchD (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatchD (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
else
- XMatch (Get_String (Subject).all, Pat.P, Pat.Stk, Start, Stop);
+ XMatch (S (1 .. L), Pat.P, Pat.Stk, Start, Stop);
end if;
if Start = 0 then
Result.Var := null;
-
else
Result.Var := Subject'Unrestricted_Access;
Result.Start := Start;
(Result : in out Match_Result;
Replace : VString)
is
+ S : String_Access;
+ L : Natural;
+
begin
+ Get_String (Replace, S, L);
+
if Result.Var /= null then
- Replace_Slice
- (Result.Var.all,
- Result.Start,
- Result.Stop,
- Get_String (Replace).all);
+ Replace_Slice (Result.Var.all, Result.Start, Result.Stop, S (1 .. L));
Result.Var := null;
end if;
end Replace;
function Str_BF (A : Boolean_Func) return String is
function To_A is new Unchecked_Conversion (Boolean_Func, Address);
-
begin
return "BF(" & Image (To_A (A)) & ')';
end Str_BF;
function Str_NF (A : Natural_Func) return String is
function To_A is new Unchecked_Conversion (Natural_Func, Address);
-
begin
return "NF(" & Image (To_A (A)) & ')';
end Str_NF;
function Str_VF (A : VString_Func) return String is
function To_A is new Unchecked_Conversion (VString_Func, Address);
-
begin
return "VF(" & Image (To_A (A)) & ')';
end Str_VF;
-- Any (string function case)
when PC_Any_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
if Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- Any (string pointer case)
when PC_Any_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
if Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- Break (string function case)
when PC_Break_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- Break (string pointer case)
when PC_Break_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- BreakX (string function case)
when PC_BreakX_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- BreakX (string pointer case)
when PC_BreakX_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- NotAny (string function case)
when PC_NotAny_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
if Cursor < Length
and then
- not Is_In (Subject (Cursor + 1), Str.all)
+ not Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- NotAny (string pointer case)
when PC_NotAny_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
if Cursor < Length
and then
- not Is_In (Subject (Cursor + 1), Str.all)
+ not Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- NSpan (string function case)
when PC_NSpan_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
loop
Cursor := Cursor + 1;
end loop;
-- NSpan (string pointer case)
when PC_NSpan_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
+ Get_String (U, S, L);
+
while Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
loop
Cursor := Cursor + 1;
end loop;
-- Span (string function case)
when PC_Span_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
- P : Natural := Cursor;
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
+ P : Natural;
begin
+ Get_String (U, S, L);
+
+ P := Cursor;
while P < Length
- and then Is_In (Subject (P + 1), Str.all)
+ and then Is_In (Subject (P + 1), S (1 .. L))
loop
P := P + 1;
end loop;
-- Span (string pointer case)
when PC_Span_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
- P : Natural := Cursor;
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
+ P : Natural;
begin
+ Get_String (U, S, L);
+
+ P := Cursor;
while P < Length
- and then Is_In (Subject (P + 1), Str.all)
+ and then Is_In (Subject (P + 1), S (1 .. L))
loop
P := P + 1;
end loop;
-- String (function case)
when PC_String_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
- Len : constant Natural := Str'Length;
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- if (Length - Cursor) >= Len
- and then Str.all = Subject (Cursor + 1 .. Cursor + Len)
+ Get_String (U, S, L);
+
+ if (Length - Cursor) >= L
+ and then S (1 .. L) = Subject (Cursor + 1 .. Cursor + L)
then
- Cursor := Cursor + Len;
+ Cursor := Cursor + L;
goto Succeed;
else
goto Fail;
-- String (pointer case)
when PC_String_VP => declare
- S : constant String_Access := Get_String (Node.VP.all);
- Len : constant Natural := S'Length;
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- if (Length - Cursor) >= Len
- and then S.all = Subject (Cursor + 1 .. Cursor + Len)
+ Get_String (U, S, L);
+
+ if (Length - Cursor) >= L
+ and then S (1 .. L) = Subject (Cursor + 1 .. Cursor + L)
then
- Cursor := Cursor + Len;
+ Cursor := Cursor + L;
goto Succeed;
else
goto Fail;
-- Any (string function case)
when PC_Any_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching Any", Str.all);
+ Get_String (U, S, L);
+
+ Dout (Img (Node) & "matching Any", S (1 .. L));
if Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- Any (string pointer case)
when PC_Any_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching Any", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching Any", S (1 .. L));
if Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- Break (string function case)
when PC_Break_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching Break", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching Break", S (1 .. L));
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- Break (string pointer case)
when PC_Break_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching Break", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching Break", S (1 .. L));
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- BreakX (string function case)
when PC_BreakX_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching BreakX", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching BreakX", S (1 .. L));
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
-- BreakX (string pointer case)
when PC_BreakX_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching BreakX", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching BreakX", S (1 .. L));
while Cursor < Length loop
- if Is_In (Subject (Cursor + 1), Str.all) then
+ if Is_In (Subject (Cursor + 1), S (1 .. L)) then
goto Succeed;
else
Cursor := Cursor + 1;
when PC_BreakX_X =>
Dout (Img (Node) & "extending BreakX");
-
Cursor := Cursor + 1;
goto Succeed;
-- NotAny (string function case)
when PC_NotAny_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching NotAny", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching NotAny", S (1 .. L));
if Cursor < Length
and then
- not Is_In (Subject (Cursor + 1), Str.all)
+ not Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- NotAny (string pointer case)
when PC_NotAny_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching NotAny", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching NotAny", S (1 .. L));
if Cursor < Length
and then
- not Is_In (Subject (Cursor + 1), Str.all)
+ not Is_In (Subject (Cursor + 1), S (1 .. L))
then
Cursor := Cursor + 1;
goto Succeed;
-- NSpan (string function case)
when PC_NSpan_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching NSpan", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching NSpan", S (1 .. L));
while Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
loop
Cursor := Cursor + 1;
end loop;
-- NSpan (string pointer case)
when PC_NSpan_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching NSpan", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching NSpan", S (1 .. L));
while Cursor < Length
- and then Is_In (Subject (Cursor + 1), Str.all)
+ and then Is_In (Subject (Cursor + 1), S (1 .. L))
loop
Cursor := Cursor + 1;
end loop;
-- Span (string function case)
when PC_Span_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
- P : Natural := Cursor;
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
+ P : Natural;
begin
- Dout (Img (Node) & "matching Span", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching Span", S (1 .. L));
+ P := Cursor;
while P < Length
- and then Is_In (Subject (P + 1), Str.all)
+ and then Is_In (Subject (P + 1), S (1 .. L))
loop
P := P + 1;
end loop;
-- Span (string pointer case)
when PC_Span_VP => declare
- Str : constant String_Access := Get_String (Node.VP.all);
- P : Natural := Cursor;
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
+ P : Natural;
begin
- Dout (Img (Node) & "matching Span", Str.all);
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching Span", S (1 .. L));
+ P := Cursor;
while P < Length
- and then Is_In (Subject (P + 1), Str.all)
+ and then Is_In (Subject (P + 1), S (1 .. L))
loop
P := P + 1;
end loop;
-- String (function case)
when PC_String_VF => declare
- U : constant VString := Node.VF.all;
- Str : constant String_Access := Get_String (U);
- Len : constant Natural := Str'Length;
+ U : constant VString := Node.VF.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout (Img (Node) & "matching " & Image (Str.all));
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching " & Image (S (1 .. L)));
- if (Length - Cursor) >= Len
- and then Str.all = Subject (Cursor + 1 .. Cursor + Len)
+ if (Length - Cursor) >= L
+ and then S (1 .. L) = Subject (Cursor + 1 .. Cursor + L)
then
- Cursor := Cursor + Len;
+ Cursor := Cursor + L;
goto Succeed;
else
goto Fail;
-- String (vstring pointer case)
when PC_String_VP => declare
- S : constant String_Access := Get_String (Node.VP.all);
- Len : constant Natural :=
- Ada.Strings.Unbounded.Length (Node.VP.all);
+ U : constant VString := Node.VP.all;
+ S : String_Access;
+ L : Natural;
begin
- Dout
- (Img (Node) & "matching " & Image (S.all));
+ Get_String (U, S, L);
+ Dout (Img (Node) & "matching " & Image (S (1 .. L)));
- if (Length - Cursor) >= Len
- and then S.all = Subject (Cursor + 1 .. Cursor + Len)
+ if (Length - Cursor) >= L
+ and then S (1 .. L) = Subject (Cursor + 1 .. Cursor + L)
then
- Cursor := Cursor + Len;
+ Cursor := Cursor + L;
goto Succeed;
else
goto Fail;