aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-strsea.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/a-strsea.adb')
-rw-r--r--gcc/ada/a-strsea.adb36
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/ada/a-strsea.adb b/gcc/ada/a-strsea.adb
index 848c063..6f458ff 100644
--- a/gcc/ada/a-strsea.adb
+++ b/gcc/ada/a-strsea.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2010, Free Software Foundation, 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- --
@@ -197,6 +197,40 @@ package body Ada.Strings.Search is
procedure Find_Token
(Source : String;
Set : Maps.Character_Set;
+ From : Positive;
+ Test : Membership;
+ First : out Positive;
+ Last : out Natural)
+ is
+ begin
+ for J in From .. Source'Last loop
+ if Belongs (Source (J), Set, Test) then
+ First := J;
+
+ for K in J + 1 .. Source'Last loop
+ if not Belongs (Source (K), Set, Test) then
+ Last := K - 1;
+ return;
+ end if;
+ end loop;
+
+ -- Here if J indexes first char of token, and all chars after J
+ -- are in the token.
+
+ Last := Source'Last;
+ return;
+ end if;
+ end loop;
+
+ -- Here if no token found
+
+ First := From;
+ Last := 0;
+ end Find_Token;
+
+ procedure Find_Token
+ (Source : String;
+ Set : Maps.Character_Set;
Test : Membership;
First : out Positive;
Last : out Natural)