Top Prev Next Up Down TEST

ExPsi.adb


001| with Ada.Text_IO;
002| with Y2018.Text.Core; use Y2018.Text.Core;
003| with Y2018.Text.Core.Str; use Y2018.Text.Core.Str;
004| with Y2018.Text.Core.UTF;
005| with Y2018.Text.Jets; use Y2018.Text.Jets;
006| with Y2018.Text.Jets.MatchPack;
007| with Y2018.Text.Jets.PatternPack;
008| with Y2018.Text.TestQ; use Y2018.Text.TestQ;
009| with GNAT.Source_Info;
010|
011| procedure ExPsi is
012| __patternvalue : CFix:="^.*?(P[\w]*).*"c;
013| __sourcevalue : CFix:="ExPsi procedure"c;
014| __m : Y2018.Text.Jets.MatchPack.Match_TY;
015| __jAC: PatternPack.Pattern_AC;
016| __nextPos : Integer;
017| begin
018| __jAC:=new PatternPack.Pattern;
019| __PatternPack.compileM(jAC,patternvalue);
020| __if PatternPack.matches(jAC,1,nextPos,sourcevalue,m) then
021| _____declare
022| ________r:Y2018.Text.Jets.I_A_ARRAY(0 .. MatchPack.size(m) - 1);
023| _____begin
024| ________MatchPack.getMatch(m,r);
025| ________for i in r'First(1) .. r'Last(1) loop
026| ___________Ada.Text_IO.Put_Line (Integer'image(i) & "|" & subIA(sourcevalue,r(i)));
027| ________end loop;
028| _____end;
029| __else
030| _____Ada.Text_IO.Put_Line ("FAIL");
031| __end if;
032| end ExPsi;

Result

Running export LD_LIBRARY_PATH=lib;bin/expsi in TEST directory.


  0|ExPsi procedure
 1|Psi

code after precompilation