| 1 | # Header section | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | %{ | ||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use OPTIMADE::Filter::AndOr; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 5 | ▶ | use OPTIMADE::Filter::Boolean; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | use OPTIMADE::Filter::Comparison; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 12 | 5 | ▶ | use OPTIMADE::Filter::Known; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 13 | 5 | ▶ | use OPTIMADE::Filter::ListComparison; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use OPTIMADE::Filter::Negation; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use OPTIMADE::Filter::Property; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use OPTIMADE::Filter::Zip; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | our $allow_LIKE_operator = 0; | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | %} | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 97 | ▶ | %% | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 23 | 97 | ||||||||||||||||||||||||||||||||
| 24 | 97 | ▶ | # Rules section | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | # The top-level 'filter' rule | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | filter: expression ; | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | # Values | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | ordered_constant: string | number ; | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | unordered_constant: TRUE | ||||||||||||||||||||||||||||||||
| 35 | 18 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 36 | 18 | return OPTIMADE::Filter::Boolean->new( 1 ); | |||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||
| 38 | | FALSE | ||||||||||||||||||||||||||||||||
| 39 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 40 | 6 | return OPTIMADE::Filter::Boolean->new( '' ); | |||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | ; | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | value: unordered_constant | ordered_value ; | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | ordered_value: ordered_constant | property ; | ||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | value_list_entry: value | ||||||||||||||||||||||||||||||||
| 49 | 44 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 50 | 44 | return [ '=', $_[1] ]; | |||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||
| 52 | | value_eq_rhs | ||||||||||||||||||||||||||||||||
| 53 | 46 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 54 | 46 | return [ $_[1]->operator, $_[1]->left ]; | |||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||
| 56 | | value_rel_comp_rhs | ||||||||||||||||||||||||||||||||
| 57 | 14 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 58 | 14 | return [ $_[1]->operator, $_[1]->left ]; | |||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | | fuzzy_string_op_rhs | ||||||||||||||||||||||||||||||||
| 61 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 62 | 6 | return [ $_[1]->operator, $_[1]->left ]; | |||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | ; | ||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | value_list: value_list_entry | ||||||||||||||||||||||||||||||||
| 67 | 16 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 68 | 16 | return [ $_[1] ]; | |||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||
| 70 | | value_list comma value_list_entry | ||||||||||||||||||||||||||||||||
| 71 | 36 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 72 | 36 | push @{$_[1]}, $_[3]; | |||||||||||||||||||||||||||||||
| 73 | 36 | return $_[1]; | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | ; | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | value_zip: value_list_entry colon value_list_entry | ||||||||||||||||||||||||||||||||
| 78 | 26 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 79 | 26 | return [ $_[1], $_[3] ]; | |||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | | value_zip colon value_list_entry | ||||||||||||||||||||||||||||||||
| 82 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 83 | 6 | push @{$_[1]}, $_[3]; | |||||||||||||||||||||||||||||||
| 84 | 6 | return $_[1]; | |||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||
| 86 | ; | ||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||
| 88 | value_zip_list: value_zip | ||||||||||||||||||||||||||||||||
| 89 | 12 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 90 | 12 | return [ $_[1] ]; | |||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||
| 92 | | value_zip_list comma value_zip | ||||||||||||||||||||||||||||||||
| 93 | 10 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 94 | 10 | push @{$_[1]}, $_[3]; | |||||||||||||||||||||||||||||||
| 95 | 10 | return $_[1]; | |||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||
| 97 | ; | ||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | # Expressions | ||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | expression: expression_clause | ||||||||||||||||||||||||||||||||
| 102 | | expression_clause OR expression | ||||||||||||||||||||||||||||||||
| 103 | 19 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 104 | 19 | return OPTIMADE::Filter::AndOr->new( @_[1..$#_] ); | |||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||
| 106 | ; | ||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | expression_clause: expression_phrase | ||||||||||||||||||||||||||||||||
| 109 | | expression_phrase AND expression_clause | ||||||||||||||||||||||||||||||||
| 110 | 123 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 111 | 123 | return OPTIMADE::Filter::AndOr->new( @_[1..$#_] ); | |||||||||||||||||||||||||||||||
| 112 | } | ||||||||||||||||||||||||||||||||
| 113 | ; | ||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||
| 115 | expression_phrase: comparison | ||||||||||||||||||||||||||||||||
| 116 | | openingbrace expression closingbrace | ||||||||||||||||||||||||||||||||
| 117 | 201 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 118 | 201 | return $_[2]; | |||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||
| 120 | | NOT comparison | ||||||||||||||||||||||||||||||||
| 121 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 122 | 6 | return OPTIMADE::Filter::Negation->new( $_[2] ); | |||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||
| 124 | | NOT openingbrace expression closingbrace | ||||||||||||||||||||||||||||||||
| 125 | 17 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 126 | 17 | return OPTIMADE::Filter::Negation->new( $_[3] ); | |||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||
| 128 | ; | ||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | comparison: constant_first_comparison | property_first_comparison ; | ||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||
| 132 | constant_first_comparison: ordered_constant value_op_rhs | ||||||||||||||||||||||||||||||||
| 133 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 134 | 4 | $_[2]->unshift_operand( $_[1] ); | |||||||||||||||||||||||||||||||
| 135 | 4 | return $_[2]; | |||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||
| 137 | | unordered_constant value_eq_rhs | ||||||||||||||||||||||||||||||||
| 138 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 139 | 4 | $_[2]->unshift_operand( $_[1] ); | |||||||||||||||||||||||||||||||
| 140 | 4 | return $_[2]; | |||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||
| 142 | ; | ||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||
| 144 | property_first_comparison: property | ||||||||||||||||||||||||||||||||
| 145 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 146 | 4 | my $cmp = OPTIMADE::Filter::Comparison->new( '=' ); | |||||||||||||||||||||||||||||||
| 147 | 4 | $cmp->left( $_[1] ); | |||||||||||||||||||||||||||||||
| 148 | 4 | $cmp->right( OPTIMADE::Filter::Boolean->new( 1 ) ); | |||||||||||||||||||||||||||||||
| 149 | 4 | return $cmp; | |||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||
| 151 | | property value_op_rhs | ||||||||||||||||||||||||||||||||
| 152 | 159 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 153 | 159 | $_[2]->unshift_operand( $_[1] ); | |||||||||||||||||||||||||||||||
| 154 | 159 | return $_[2]; | |||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | | property known_op_rhs | ||||||||||||||||||||||||||||||||
| 157 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 158 | 4 | $_[2]->property( $_[1] ); | |||||||||||||||||||||||||||||||
| 159 | 4 | return $_[2]; | |||||||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||||||
| 161 | | property fuzzy_string_op_rhs | ||||||||||||||||||||||||||||||||
| 162 | 18 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 163 | 18 | $_[2]->unshift_operand( $_[1] ); | |||||||||||||||||||||||||||||||
| 164 | 18 | return $_[2]; | |||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||
| 166 | | property set_op_rhs | ||||||||||||||||||||||||||||||||
| 167 | 22 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 168 | 22 | $_[2]->property( $_[1] ); | |||||||||||||||||||||||||||||||
| 169 | 22 | return $_[2]; | |||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||
| 171 | | property set_zip_op_rhs | ||||||||||||||||||||||||||||||||
| 172 | 16 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 173 | 16 | $_[2]->unshift_property( $_[1] ); | |||||||||||||||||||||||||||||||
| 174 | 16 | return $_[2]; | |||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||
| 176 | | property length_op_rhs | ||||||||||||||||||||||||||||||||
| 177 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 178 | 6 | $_[2]->property( $_[1] ); | |||||||||||||||||||||||||||||||
| 179 | 6 | return $_[2]; | |||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||
| 181 | ; | ||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||
| 183 | value_op_rhs: value_eq_rhs | value_rel_comp_rhs ; | ||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | value_eq_rhs: equality_operator value | ||||||||||||||||||||||||||||||||
| 186 | 179 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 187 | 179 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 188 | 179 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 189 | 179 | return $cmp; | |||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||
| 191 | ; | ||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||
| 193 | value_rel_comp_rhs: relative_comparison_operator ordered_value | ||||||||||||||||||||||||||||||||
| 194 | 48 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 195 | 48 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 196 | 48 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 197 | 48 | return $cmp; | |||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||
| 199 | ; | ||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||
| 201 | known_op_rhs: IS KNOWN | ||||||||||||||||||||||||||||||||
| 202 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 203 | 2 | return OPTIMADE::Filter::Known->new( 1 ); | |||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||
| 205 | | IS UNKNOWN | ||||||||||||||||||||||||||||||||
| 206 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 207 | 2 | return OPTIMADE::Filter::Known->new( 0 ); | |||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||
| 209 | ; | ||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||
| 211 | fuzzy_string_op_rhs: CONTAINS value | ||||||||||||||||||||||||||||||||
| 212 | 8 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 213 | 8 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 214 | 8 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 215 | 8 | return $cmp; | |||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||
| 217 | | STARTS value | ||||||||||||||||||||||||||||||||
| 218 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 219 | 2 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 220 | 2 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 221 | 2 | return $cmp; | |||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||
| 223 | | STARTS WITH value | ||||||||||||||||||||||||||||||||
| 224 | 10 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 225 | 10 | my $cmp = OPTIMADE::Filter::Comparison->new( "$_[1] $_[2]" ); | |||||||||||||||||||||||||||||||
| 226 | 10 | $cmp->push_operand( $_[3] ); | |||||||||||||||||||||||||||||||
| 227 | 10 | return $cmp; | |||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||
| 229 | | ENDS value | ||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 231 | 0 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 232 | 0 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 233 | 0 | return $cmp; | |||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||
| 235 | | ENDS WITH value | ||||||||||||||||||||||||||||||||
| 236 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 237 | 4 | my $cmp = OPTIMADE::Filter::Comparison->new( "$_[1] $_[2]" ); | |||||||||||||||||||||||||||||||
| 238 | 4 | $cmp->push_operand( $_[3] ); | |||||||||||||||||||||||||||||||
| 239 | 4 | return $cmp; | |||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||
| 241 | | LIKE value | ||||||||||||||||||||||||||||||||
| 242 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 243 | 2 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 244 | 2 | $cmp->push_operand( $_[2] ); | |||||||||||||||||||||||||||||||
| 245 | 2 | return $cmp; | |||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||
| 247 | ; | ||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||
| 249 | set_op_rhs: HAS value | ||||||||||||||||||||||||||||||||
| 250 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 251 | 1 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 252 | 1 | $lc->values( [ [ '=', $_[2] ] ] ); | |||||||||||||||||||||||||||||||
| 253 | 1 | return $lc; | |||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||
| 255 | | HAS equality_operator value | ||||||||||||||||||||||||||||||||
| 256 | 1 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 257 | 1 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 258 | 1 | $lc->values( [ [ $_[2], $_[3] ] ] ); | |||||||||||||||||||||||||||||||
| 259 | 1 | return $lc; | |||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||
| 261 | | HAS relative_comparison_operator ordered_value | ||||||||||||||||||||||||||||||||
| 262 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 263 | 2 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 264 | 2 | $lc->values( [ [ $_[2], $_[3] ] ] ); | |||||||||||||||||||||||||||||||
| 265 | 2 | return $lc; | |||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||
| 267 | | HAS fuzzy_string_op_rhs | ||||||||||||||||||||||||||||||||
| 268 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 269 | 2 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 270 | 2 | $lc->values( [ [ $_[2]->operator, $_[2]->left ] ] ); | |||||||||||||||||||||||||||||||
| 271 | 2 | return $lc; | |||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||
| 273 | | HAS ALL value_list | ||||||||||||||||||||||||||||||||
| 274 | 8 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 275 | 8 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | |||||||||||||||||||||||||||||||
| 276 | 8 | $lc->values( $_[3] ); | |||||||||||||||||||||||||||||||
| 277 | 8 | return $lc; | |||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||
| 279 | | HAS ANY value_list | ||||||||||||||||||||||||||||||||
| 280 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 281 | 4 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | |||||||||||||||||||||||||||||||
| 282 | 4 | $lc->values( $_[3] ); | |||||||||||||||||||||||||||||||
| 283 | 4 | return $lc; | |||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||
| 285 | | HAS ONLY value_list | ||||||||||||||||||||||||||||||||
| 286 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 287 | 4 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | |||||||||||||||||||||||||||||||
| 288 | 4 | $lc->values( $_[3] ); | |||||||||||||||||||||||||||||||
| 289 | 4 | return $lc; | |||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||
| 291 | ; | ||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||
| 293 | set_zip_op_rhs: property_zip_addon HAS value_zip | ||||||||||||||||||||||||||||||||
| 294 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 295 | 4 | $_[1]->operator( $_[2] ); | |||||||||||||||||||||||||||||||
| 296 | 4 | $_[1]->values( [ $_[3] ] ); | |||||||||||||||||||||||||||||||
| 297 | 4 | return $_[1]; | |||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||
| 299 | | property_zip_addon HAS ONLY value_zip_list | ||||||||||||||||||||||||||||||||
| 300 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 301 | 4 | $_[1]->operator( "$_[2] $_[3]" ); | |||||||||||||||||||||||||||||||
| 302 | 4 | $_[1]->values( $_[4] ); | |||||||||||||||||||||||||||||||
| 303 | 4 | return $_[1]; | |||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||
| 305 | | property_zip_addon HAS ALL value_zip_list | ||||||||||||||||||||||||||||||||
| 306 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 307 | 4 | $_[1]->operator( "$_[2] $_[3]" ); | |||||||||||||||||||||||||||||||
| 308 | 4 | $_[1]->values( $_[4] ); | |||||||||||||||||||||||||||||||
| 309 | 4 | return $_[1]; | |||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||
| 311 | | property_zip_addon HAS ANY value_zip_list | ||||||||||||||||||||||||||||||||
| 312 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 313 | 4 | $_[1]->operator( "$_[2] $_[3]" ); | |||||||||||||||||||||||||||||||
| 314 | 4 | $_[1]->values( $_[4] ); | |||||||||||||||||||||||||||||||
| 315 | 4 | return $_[1]; | |||||||||||||||||||||||||||||||
| 316 | } | ||||||||||||||||||||||||||||||||
| 317 | ; | ||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||
| 319 | property_zip_addon: colon property | ||||||||||||||||||||||||||||||||
| 320 | 16 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 321 | 16 | my $zip = OPTIMADE::Filter::Zip->new; | |||||||||||||||||||||||||||||||
| 322 | 16 | $zip->push_property( $_[2] ); | |||||||||||||||||||||||||||||||
| 323 | 16 | return $zip; | |||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||
| 325 | | property_zip_addon colon property | ||||||||||||||||||||||||||||||||
| 326 | 2 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 327 | 2 | $_[1]->push_property( $_[3] ); | |||||||||||||||||||||||||||||||
| 328 | 2 | return $_[1]; | |||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||
| 330 | ; | ||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||
| 332 | length_op_rhs: LENGTH value | ||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 334 | 0 | my $cmp = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 335 | 0 | $cmp->values( [ [ '=', $_[2] ] ] ); | |||||||||||||||||||||||||||||||
| 336 | 0 | return $cmp; | |||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||
| 338 | | LENGTH operator value | ||||||||||||||||||||||||||||||||
| 339 | 6 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 340 | 6 | my $cmp = OPTIMADE::Filter::ListComparison->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 341 | 6 | $cmp->values( [ [ $_[2], $_[3] ] ] ); | |||||||||||||||||||||||||||||||
| 342 | 6 | return $cmp; | |||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||
| 344 | ; | ||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||
| 346 | # Property | ||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||
| 348 | property: identifier | ||||||||||||||||||||||||||||||||
| 349 | 270 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 350 | 270 | return OPTIMADE::Filter::Property->new( $_[1] ); | |||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||
| 352 | | property dot identifier | ||||||||||||||||||||||||||||||||
| 353 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 354 | 4 | push @{$_[1]}, $_[3]; | |||||||||||||||||||||||||||||||
| 355 | 4 | return $_[1]; | |||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||
| 357 | ; | ||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||
| 359 | # Separators | ||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||
| 361 | openingbrace: '(' ; | ||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | closingbrace: ')' ; | ||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | dot: '.' ; | ||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||
| 367 | comma: ',' ; | ||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||
| 369 | colon: ':' ; | ||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||
| 371 | # Comparison operator tokens | ||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||
| 373 | operator: equality_operator | relative_comparison_operator ; | ||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||
| 375 | equality_operator: '=' | ||||||||||||||||||||||||||||||||
| 376 | | '!' '=' | ||||||||||||||||||||||||||||||||
| 377 | 8 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 378 | 8 | return join( '', @_[1..$#_] ); | |||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||
| 380 | ; | ||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||
| 382 | relative_comparison_operator: '<' | ||||||||||||||||||||||||||||||||
| 383 | | '<' '=' | ||||||||||||||||||||||||||||||||
| 384 | 3 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 385 | 3 | return join( '', @_[1..$#_] ); | |||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||
| 387 | | '>' | ||||||||||||||||||||||||||||||||
| 388 | | '>' '=' | ||||||||||||||||||||||||||||||||
| 389 | 5 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 390 | 5 | return join( '', @_[1..$#_] ); | |||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||
| 392 | 97 | ; | |||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||
| 394 | %% | ||||||||||||||||||||||||||||||||
| 395 | 97 | ||||||||||||||||||||||||||||||||
| 396 | # Footer section | ||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||
| 398 | sub _Error | ||||||||||||||||||||||||||||||||
| 399 | 4 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
_Error: called CC=3 SCAR=11.6
| |||||||||||||||||||||||||||||||||
| 400 | 4 | my( $self ) = @_; | |||||||||||||||||||||||||||||||
| 401 | 4 | ▶ | close $self->{USER}{FILEIN} if $self->{USER}{FILEIN}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 402 | 4 | my $msg = "$0: syntax error at line $self->{USER}{LINENO}, " . | |||||||||||||||||||||||||||||||
| 403 | "position $self->{USER}{CHARNO}"; | ||||||||||||||||||||||||||||||||
| 404 | 4 | ▶ | if( $self->YYData->{INPUT} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 405 | 4 | $self->YYData->{INPUT} =~ s/\n$//; | |||||||||||||||||||||||||||||||
| 406 | 4 | die "$msg: '" . $self->YYData->{INPUT} . "'.\n"; | |||||||||||||||||||||||||||||||
| 407 | } else { | ||||||||||||||||||||||||||||||||
| 408 | 0 | die "$msg.\n"; | |||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||
| 412 | sub _Lexer | ||||||||||||||||||||||||||||||||
| 413 | 1741 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
_Lexer: called CC=16 SCAR=27.8
| |||||||||||||||||||||||||||||||||
| 414 | 1741 | my( $self ) = @_; | |||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||
| 416 | # If the line is empty and the input is originating from the file, | ||||||||||||||||||||||||||||||||
| 417 | # another line is read. | ||||||||||||||||||||||||||||||||
| 418 | 1741 | ▶ | if( !$self->YYData->{INPUT} && $self->{USER}{FILEIN} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $self->YYData->{"INPUT"} and $self->{"USER"}{"FILEIN"}
MC/DC100%2/2
not $self->YYData->{"INPUT"} and $self->{"USER"}{"FILEIN"}
not $self->YYData->{"INPUT"}
$self->{"USER"}{"FILEIN"}
Truth table100%3/3
not(A) and B
A= not $self->YYData->{"INPUT"}B= $self->{"USER"}{"FILEIN"}
| |||||||||||||||||||||||||||||||||
| 419 | 49 | my $filein = $self->{USER}{FILEIN}; | |||||||||||||||||||||||||||||||
| 420 | 49 | $self->YYData->{INPUT} = <$filein>; | |||||||||||||||||||||||||||||||
| 421 | 49 | ▶ | $self->{USER}{LINENO} = -1 unless exists $self->{USER}{LINENO}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 422 | 49 | $self->{USER}{LINENO}++; | |||||||||||||||||||||||||||||||
| 423 | 49 | $self->{USER}{CHARNO} = 0; | |||||||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||
| 426 | 1741 | $self->YYData->{INPUT} =~ s/^(\s+)//; | |||||||||||||||||||||||||||||||
| 427 | 1741 | ▶ | $self->{USER}{CHARNO} += length( $1 ) if defined $1; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||
| 429 | # Escaped double quote or backslash are detected here and returned | ||||||||||||||||||||||||||||||||
| 430 | # as is to the caller in order to be detected as syntax errors. | ||||||||||||||||||||||||||||||||
| 431 | 1741 | ▶ | if( $self->YYData->{INPUT} =~ s/^(\\"|\\\\)// ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 432 | 0 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 433 | 0 | return( $1, $1 ); | |||||||||||||||||||||||||||||||
| 434 | } | ||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||
| 436 | # Handling strings | ||||||||||||||||||||||||||||||||
| 437 | 1741 | ▶ | if( $self->YYData->{INPUT} =~ s/^"// ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 438 | 189 | $self->{USER}{CHARNO} ++; | |||||||||||||||||||||||||||||||
| 439 | 189 | my $string = ''; | |||||||||||||||||||||||||||||||
| 440 | 189 | while( 1 ) { | |||||||||||||||||||||||||||||||
| 441 | 386 | ▶ | if( $self->YYData->{INPUT} =~ | ||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||
| 442 | s/^([A-Za-z_0-9 \t!#\$\%&\'\(\)\*\+,\-\.\/\:;<=>\?@\[\]\^`\{\|\}\~\P{ASCII}]+)// ) { | ||||||||||||||||||||||||||||||||
| 443 | 193 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 444 | 193 | $string .= $1; | |||||||||||||||||||||||||||||||
| 445 | } elsif( $self->YYData->{INPUT} =~ s/^\\([\\"])// ) { | ||||||||||||||||||||||||||||||||
| 446 | 4 | $self->{USER}{CHARNO} ++; | |||||||||||||||||||||||||||||||
| 447 | 4 | $string .= $1; | |||||||||||||||||||||||||||||||
| 448 | 4 | next; | |||||||||||||||||||||||||||||||
| 449 | } elsif( $self->YYData->{INPUT} =~ s/^"// ) { | ||||||||||||||||||||||||||||||||
| 450 | 188 | $self->{USER}{CHARNO} ++; | |||||||||||||||||||||||||||||||
| 451 | 188 | return( 'string', $string ); | |||||||||||||||||||||||||||||||
| 452 | } else { | ||||||||||||||||||||||||||||||||
| 453 | 1 | return( undef, undef ); | |||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||
| 458 | # Handling identifiers | ||||||||||||||||||||||||||||||||
| 459 | 1552 | ▶ | if( $self->YYData->{INPUT} =~ s/^([a-z_][a-z0-9_]*)// ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 460 | 274 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 461 | 274 | return( 'identifier', $1 ); | |||||||||||||||||||||||||||||||
| 462 | } | ||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||
| 464 | # Handling textual operators and other literals | ||||||||||||||||||||||||||||||||
| 465 | 1278 | ▶ | if( $self->YYData->{INPUT} =~ s/^(AND|NOT|OR| | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 466 | IS|UNKNOWN|KNOWN| | ||||||||||||||||||||||||||||||||
| 467 | CONTAINS|STARTS|ENDS|WITH| | ||||||||||||||||||||||||||||||||
| 468 | LENGTH|HAS|ALL|ONLY|ANY| | ||||||||||||||||||||||||||||||||
| 469 | TRUE|FALSE)//x ) { | ||||||||||||||||||||||||||||||||
| 470 | 309 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 471 | 309 | return( $1, $1 ); | |||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||
| 474 | # Handling LIKE operator if allowed | ||||||||||||||||||||||||||||||||
| 475 | 969 | ▶ | if( $allow_LIKE_operator && $self->YYData->{INPUT} =~ s/^(LIKE)// ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$OPTIMADE::Filter::Parser::allow_LIKE_operator and $self->YYData->{"INPUT"} =~ s/^(LIKE)//
MC/DC100%2/2
$OPTIMADE::Filter::Parser::allow_LIKE_operator and $self->YYData->{"INPUT"} =~ s/^(LIKE)//
$OPTIMADE::Filter::Parser::allow_LIKE_operator
$self->YYData->{"INPUT"} =~ s/^(LIKE)//
Truth table100%3/3
A and B
A= $OPTIMADE::Filter::Parser::allow_LIKE_operatorB= $self->YYData->{"INPUT"} =~ s/^(LIKE)//
| |||||||||||||||||||||||||||||||||
| 476 | 2 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 477 | 2 | return( $1, $1 ); | |||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||
| 480 | # Handling numbers | ||||||||||||||||||||||||||||||||
| 481 | 967 | ▶ | if( $self->YYData->{INPUT} =~ s/^([+-]? | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 482 | (\d+\.?\d*|\.\d+) | ||||||||||||||||||||||||||||||||
| 483 | ([eE][+-]?\d+)?)//x ) { | ||||||||||||||||||||||||||||||||
| 484 | 83 | $self->{USER}{CHARNO} += length( $1 ); | |||||||||||||||||||||||||||||||
| 485 | 83 | return( 'number', $1 ); | |||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||
| 488 | 884 | my $char = substr( $self->YYData->{INPUT}, 0, 1 ); | |||||||||||||||||||||||||||||||
| 489 | 884 | ▶ | if( $char ne '' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 490 | 791 | $self->YYData->{INPUT} = substr( $self->YYData->{INPUT}, 1 ); | |||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||
| 492 | 884 | $self->{USER}{CHARNO}++; | |||||||||||||||||||||||||||||||
| 493 | 884 | return( $char, $char ); | |||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||
| 496 | sub Run | ||||||||||||||||||||||||||||||||
| 497 | 49 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
Run: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 498 | 49 | my( $self, $filename ) = @_; | |||||||||||||||||||||||||||||||
| 499 | 49 | open $self->{USER}{FILEIN}, $filename; | |||||||||||||||||||||||||||||||
| 500 | 49 | my $result = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); | |||||||||||||||||||||||||||||||
| 501 | 45 | close $self->{USER}{FILEIN}; | |||||||||||||||||||||||||||||||
| 502 | 45 | return $result; | |||||||||||||||||||||||||||||||
| 503 | } | ||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||
| 505 | sub parse_string | ||||||||||||||||||||||||||||||||
| 506 | 48 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
parse_string: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 507 | 48 | my( $self, $string ) = @_; | |||||||||||||||||||||||||||||||
| 508 | 48 | $self->YYData->{INPUT} = $string; | |||||||||||||||||||||||||||||||
| 509 | 48 | $self->{USER}{LINENO} = 0; | |||||||||||||||||||||||||||||||
| 510 | 48 | $self->{USER}{CHARNO} = 0; | |||||||||||||||||||||||||||||||
| 511 | 48 | return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); | |||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||
| 514 | sub modify | ||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | { | ||||||||||||||||||||||||||||||
|
Subroutine
modify: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 516 | 0 | my $node = shift; | |||||||||||||||||||||||||||||||
| 517 | 0 | my $code = shift; | |||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | if( blessed $node && $node->can( 'modify' ) ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
builtin::blessed($node) and $node->can("modify")
MC/DC0%0/2
builtin::blessed($node) and $node->can("modify")
builtin::blessed($node)
$node->can("modify")
Truth table0%0/3
A and B
A= builtin::blessed($node)B= $node->can("modify")
| |||||||||||||||||||||||||||||||||
| 520 | 0 | return $node->modify( $code, @_ ); | |||||||||||||||||||||||||||||||
| 521 | } elsif( ref $node eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||
| 522 | 0 | return [ map { modify( $_, $code, @_ ) } @$node ]; | |||||||||||||||||||||||||||||||
| 523 | } else { | ||||||||||||||||||||||||||||||||
| 524 | 0 | return $code->( $node, @_ ); | |||||||||||||||||||||||||||||||
| 525 | } | ||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||
| 528 | 1; | ||||||||||||||||||||||||||||||||