File tree Expand file tree Collapse file tree 7 files changed +48
-0
lines changed
regtests/tests/0145_regex_macro Expand file tree Collapse file tree 7 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+
2+ Test MATCH into a MACRO
3+
4+
5+ ONE
6+ TWO
Original file line number Diff line number Diff line change 1+ from test_support import *
2+
3+ run ('testme' , ["testme145.tmplt" ])
Original file line number Diff line number Diff line change 1+
2+ Test MATCH into a MACRO
3+
4+ @@MACRO(CHECK)@@
5+ @@IF@@ @_MATCH(.*value):VAR1_@
6+ @_$1_@
7+ @@ELSE@@
8+ FALSE
9+ @@END_IF@@
10+ @@END_MACRO@@
11+
12+ @_CHECK(ONE)_@
13+ @_CHECK(TWO)_@
Original file line number Diff line number Diff line change @@ -642,6 +642,10 @@ package body Data is
642642 begin
643643 if R.Filters /= null then
644644 R.Filters := new Filter.Set'(R.Filters.all );
645+
646+ for K in R.Filters'Range loop
647+ R.Filters (K) := Filter.Clone (@);
648+ end loop ;
645649 end if ;
646650
647651 if R.Is_Macro then
Original file line number Diff line number Diff line change @@ -544,6 +544,25 @@ package body Filter is
544544 return Result;
545545 end Clean_Text ;
546546
547+ -- ---------
548+ -- Clone --
549+ -- ---------
550+
551+ function Clone (P : Routine) return Routine is
552+ D : Parameter_Data := P.Parameters;
553+ begin
554+ case D.Mode is
555+ when Regpat =>
556+ D.Regpat := new GNAT.Regpat.Pattern_Matcher'(D.Regpat.all );
557+ when Regexp =>
558+ D.Regexp := new GNAT.Regpat.Pattern_Matcher'(D.Regexp.all );
559+ when others =>
560+ null ;
561+ end case ;
562+
563+ return (P with delta Parameters => D);
564+ end Clone ;
565+
547566 -- ----------------
548567 -- Coma_2_Point --
549568 -- ----------------
Original file line number Diff line number Diff line change @@ -365,6 +365,9 @@ package body Templates_Parser is
365365 procedure Release (S : in out Set);
366366 -- Release all memory allocated P
367367
368+ function Clone (P : Routine) return Routine;
369+ -- Clone parameter data
370+
368371 type String_Access is access constant String;
369372
370373 type Filter_Record is record
You can’t perform that action at this time.
0 commit comments