Skip to content

Commit 645536c

Browse files
committed
Merge branch 'po/filters-update' into 'master'
Ensure that the regexp/regpat is cloned. See merge request eng/toolchain/templates-parser!9
2 parents bef385e + 7bc8a2b commit 645536c

File tree

12 files changed

+201
-14
lines changed

12 files changed

+201
-14
lines changed

docs/tags.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ parser.
345345
character if needed. Returns the input string as-is if the parameter
346346
is not found.
347347

348+
**END_WITH(VALUE)**
349+
.. index:: Filter, END_WITH
350+
351+
Returns **True** if variable ends with VALUE given as parameter
352+
and **False** otherwise.
353+
348354
**EXIST**
349355
.. index:: Filter, EXIST
350356

@@ -585,6 +591,12 @@ parser.
585591
that 0 matches the last character of the string, -1 matches the character
586592
just before,...
587593

594+
**START_WITH(VALUE)**
595+
.. index:: Filter, START_WITH
596+
597+
Returns **True** if variable starts with VALUE given as parameter
598+
and **False** otherwise.
599+
588600
**STRIP**
589601
.. index:: Filter, STRIP
590602

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Test START_WITH() routine.
3+
4+
TRUE = TRUE
5+
TRUE = TRUE
6+
TRUE = TRUE
7+
TRUE = TRUE
8+
FALSE = FALSE
9+
FALSE = FALSE
10+
FALSE = FALSE
11+
FALSE = FALSE
12+
FALSE = FALSE
13+
14+
Test END_WITH() routine.
15+
16+
TRUE = TRUE
17+
TRUE = TRUE
18+
TRUE = TRUE
19+
TRUE = TRUE
20+
FALSE = FALSE
21+
FALSE = FALSE
22+
FALSE = FALSE
23+
FALSE = FALSE
24+
FALSE = FALSE
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from test_support import *
2+
3+
run('testme', ["testme144.tmplt"])

regtests/tests/0144_start_end_with/test.yaml

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
Test START_WITH() routine.
3+
4+
TRUE = @_START_WITH(a):VAR1_@
5+
TRUE = @_START_WITH(a ):VAR1_@
6+
TRUE = @_START_WITH(a valu):VAR1_@
7+
TRUE = @_START_WITH(a value):VAR1_@
8+
FALSE = @_START_WITH(w):VAR1_@
9+
FALSE = @_START_WITH(x value):VAR1_@
10+
FALSE = @_START_WITH(a valux):VAR1_@
11+
FALSE = @_START_WITH( value):VAR1_@
12+
FALSE = @_START_WITH(xxxxxxxxxxxxxxxxxxxxxxxxxxx):VAR1_@
13+
14+
Test END_WITH() routine.
15+
16+
TRUE = @_END_WITH(e):VAR1_@
17+
TRUE = @_END_WITH(lue):VAR1_@
18+
TRUE = @_END_WITH( value):VAR1_@
19+
TRUE = @_END_WITH(a value):VAR1_@
20+
FALSE = @_END_WITH(w):VAR1_@
21+
FALSE = @_END_WITH(x value):VAR1_@
22+
FALSE = @_END_WITH(a valux):VAR1_@
23+
FALSE = @_END_WITH(a valu):VAR1_@
24+
FALSE = @_END_WITH(xxxxxxxxxxxxxxxxxxxxxxxxxxxx):VAR1_@
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
Test MATCH into a MACRO
3+
4+
5+
ONE
6+
TWO
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from test_support import *
2+
3+
run('testme', ["testme145.tmplt"])

regtests/tests/0145_regex_macro/test.yaml

Whitespace-only changes.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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)_@

src/templates_parser-data.adb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)