Top Prev Next Up Down TEST

ExPi

Create a mappool from Unicode Blocks.txt.
001| with Ada.Text_IO; use Ada.Text_IO;
002| with Ada.Command_Line;
003| with Ada.Containers.Ordered_Sets;
004| with Y2018.Text.Jets.RangeVectorPack;
005| with Y2018.Text.Core; use Y2018.Text.Core;
006| with Y2018.Text.Core.Str; use Y2018.Text.Core.Str;
007| with Y2018.Text.Core.CVarPack; use Y2018.Text.Core.CVarPack;
008| with Y2018.Text.Util.UrvPack;
009| with Y2018.Text.Jets; use Y2018.Text.Jets;
010| with Y2018.Text.Jets.MatchPack;
011| with Y2018.Text.Jets.PatternPack;
012| procedure ExPi is
013| __mp:Y2018.Text.Util.UrvPack.MapPool;
014| __uval:Y2018.Text.Jets.RangeVectorPack.Set_TY.Set;
015| __blocksFile:String:="UCDlink/Blocks.txt"; -- Change path to your UCD-directory
016| __p:PatternPack.Pattern_AC:=new PatternPack.Pattern;
017| __m:MatchPack.Match_TY;
018| __nextPos : Integer:=0;
019| __source_value:CFix:="_Å I have been found"c;
020| begin
021| __Y2018.Text.Util.UrvPack.insert(mp,null_CVar & "GC1"c);
022| __uval:=Y2018.Text.Util.UrvPack.Block(blocksFile,"^.*?Supplement"c);
023| __uval:=Y2018.Text.Util.UrvPack.Compress(uval);
024| __Y2018.Text.Util.UrvPack.put_Set(mp,null_CVar & "GC1"c,uval);
025| __Y2018.Text.Util.UrvPack.list_Map(mp,topTitle=>"-- Top of Map --",BottomTitle=>"-- Bottom of Map --");
026|
027| __PatternPack.compileM(p,"^.*?(\p{GC1}).*"c,Y2018.Text.Util.UrvPack.copy_Map(mp));
028| __if patternPack.matches(p,1,nextPos,source_value,m) then
029| _____declare
030| ________r:I_A_ARRAY:=MatchPack.getMatch(m);
031| _____begin
032| ________Ada.Text_IO.Put_Line ("zero " & subIA(source_value,r(0)));
033| ________Ada.Text_IO.Put_Line ("one. " & subIA(source_value,r(1)));
034| _____end;
035| __end if;
036| __Ada.Text_IO.Put_Line ("*** End of ExPi ***");
037| end ExPi;

Result

Running export LD_LIBRARY_PATH=lib;bin/expi in TEST directory.
List of the created map and a string with value "_Å I have been found"c is searched by pattern ^.*?(\p{GC1}).* and the result on lines 005 .. 006.
001| -- Top of Map --
002| __GC1 size= 24
003| __Number of urvSets 1
004| -- Bottom of Map --
005| zero _Å I have been found
006| one. Å
007| *** End of ExPi ***

and an output file q___.lst