Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | s_expressions-conditionals-strings: add an equality test |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
87228b7a84f311cacda5df90d62c89fd |
| User & Date: | nat 2017-06-17 19:33:47.099 |
Context
|
2017-06-18
| ||
| 21:35 | s_expressions-conditionals-strings-tests: test the new equality test check-in: e21eaeef3f user: nat tags: trunk | |
|
2017-06-17
| ||
| 19:33 | s_expressions-conditionals-strings: add an equality test check-in: 87228b7a84 user: nat tags: trunk | |
|
2017-06-16
| ||
| 21:17 | tools/smaz: remove debug trace left over check-in: fe798b80fc user: nat tags: trunk | |
Changes
Changes to generated/natools-static_maps-s_expressions-conditionals-strings-p.adb.
1 2 3 4 5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | - + - + - + - - + + - - + + - + | with Interfaces; use Interfaces; package body Natools.Static_Maps.S_Expressions.Conditionals.Strings.P is P : constant array (0 .. 2) of Natural := |
Changes to generated/natools-static_maps-s_expressions-conditionals-strings.ads.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | - + + - - + + + + + - - + + + + + + + + |
|
Changes to src/natools-s_expressions-conditionals-strings-maps.sx.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + + |
(Natools.Static_Maps.S_Expressions.Conditionals.Strings
pure
(test-function T)
(extra-decl "\
type Parametric_Condition is
(Unknown_Parametric_Condition,
Case_Insensitive,
Case_Sensitive,
Contains_All,
Contains_Any,
Is_Equal_To,
Starts_With);
type Simple_Condition is
(Unknown_Simple_Condition,
Is_ASCII,
Is_Empty);")
(Parametric_Condition
(hash-package Natools.Static_Maps.S_Expressions.Conditionals.Strings.P)
(function To_Parametric)
(not-found Unknown_Parametric_Condition)
(nodes
(Case_Insensitive case-insensitive)
(Case_Sensitive case-sensitive)
(Contains_All contains contains-all contains-all-of)
(Contains_Any contains-any contains-any-of)
(Is_Equal_To is is-equal-to "=")
(Starts_With starts-with)))
(Simple_Condition
(hash-package Natools.Static_Maps.S_Expressions.Conditionals.Strings.S)
(function To_Simple)
(not-found Unknown_Simple_Condition)
(nodes
(Is_ASCII is-ascii)
(Is_Empty is-empty))))
|
Changes to src/natools-s_expressions-conditionals-strings.adb.
1 | 1 2 3 4 5 6 7 8 9 | - + | ------------------------------------------------------------------------------ |
| ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | + + + + |
Conjunction : in Boolean)
return Boolean;
-- Evaluate Element on all atoms of Arguments and combine them
function Contains (Context : in Strings.Context; Data : in Atom)
return Boolean;
-- Check whether Context contains Data
function Is_Equal_To (Context : in Strings.Context; Data : in Atom)
return Boolean;
-- Check whether Context is equal to Data
function Is_Prefix (Context : in Strings.Context; Data : in Atom)
return Boolean;
-- Check whether Context starts with Data
function To_Lower (Item : in Character) return Character
renames Ada.Characters.Handling.To_Lower;
|
| ︙ | |||
91 92 93 94 95 96 97 98 99 100 101 102 103 104 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | + + + + + + + + + + + + + + + + |
Str_Value,
Str_Value'First,
Ada.Strings.Forward,
Ada.Characters.Handling.To_Lower'Access) > 0;
end if;
end Contains;
function Is_Equal_To (Context : in Strings.Context; Data : in Atom)
return Boolean is
begin
if Context.Data.all'Length /= Data'Length then
return False;
end if;
if Context.Settings.Case_Sensitive then
return Context.Data.all = To_String (Data);
else
return Fixed.Translate (Context.Data.all, To_Lower'Access)
= Fixed.Translate (To_String (Data), To_Lower'Access);
end if;
end Is_Equal_To;
function Is_Prefix (Context : in Strings.Context; Data : in Atom)
return Boolean is
begin
if Context.Data.all'Length < Data'Length then
return False;
end if;
|
| ︙ | |||
161 162 163 164 165 166 167 168 169 170 171 172 173 174 | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | + + + + |
return Conditional_On_Atoms
(Context, Arguments, Contains'Access, True);
when Contains_Any =>
return Conditional_On_Atoms
(Context, Arguments, Contains'Access, False);
when Is_Equal_To =>
return Conditional_On_Atoms
(Context, Arguments, Is_Equal_To'Access, False);
when Starts_With =>
return Conditional_On_Atoms
(Context, Arguments, Is_Prefix'Access, False);
end case;
end Parametric_Evaluate;
|
| ︙ |