| 1 | #################################################################### | ||
| 2 | # | ||
| 3 | # This file was generated using Parse::Yapp version 1.21. | ||
| 4 | # | ||
| 5 | # Don't edit this file, use source file instead. | ||
| 6 | # | ||
| 7 | # ANY CHANGE MADE HERE WILL BE LOST ! | ||
| 8 | # | ||
| 9 | #################################################################### | ||
| 10 | package OPTIMADE::Filter::Parser; | ||
| 11 | 5 | ▶ | use vars qw ( @ISA ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | |||
| 14 | 5 | @ISA= qw ( Parse::Yapp::Driver ); | |
| 15 | 5 | ▶ | use Parse::Yapp::Driver; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | #line 3 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 18 | |||
| 19 | |||
| 20 | use warnings; | ||
| 21 | |||
| 22 | use Scalar::Util qw(blessed); | ||
| 23 | |||
| 24 | use OPTIMADE::Filter::AndOr; | ||
| 25 | use OPTIMADE::Filter::Comparison; | ||
| 26 | use OPTIMADE::Filter::Known; | ||
| 27 | use OPTIMADE::Filter::ListComparison; | ||
| 28 | use OPTIMADE::Filter::Negation; | ||
| 29 | use OPTIMADE::Filter::Property; | ||
| 30 | use OPTIMADE::Filter::Zip; | ||
| 31 | |||
| 32 | our $allow_LIKE_operator = 0; | ||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | sub new { | ||
| 37 | my($class)=shift; | ||
| 38 | ref($class) | ||
| 39 | and $class=ref($class); | ||
| 40 | |||
| 41 | my($self)=$class->SUPER::new( yyversion => '1.21', | ||
| 42 | yystates => | ||
| 43 | [ | ||
| 44 | {#State 0 | ||
| 45 | ACTIONS => { | ||
| 46 | 'NOT' => 15, | ||
| 47 | 'identifier' => 7, | ||
| 48 | 'string' => 11, | ||
| 49 | "(" => 5, | ||
| 50 | 'number' => 3 | ||
| 51 | }, | ||
| 52 | GOTOS => { | ||
| 53 | 'comparison' => 1, | ||
| 54 | 'expression' => 8, | ||
| 55 | 'expression_phrase' => 6, | ||
| 56 | 'constant_first_comparison' => 10, | ||
| 57 | 'property_first_comparison' => 9, | ||
| 58 | 'openingbrace' => 14, | ||
| 59 | 'property' => 13, | ||
| 60 | 'filter' => 4, | ||
| 61 | 'constant' => 12, | ||
| 62 | 'expression_clause' => 2 | ||
| 63 | } | ||
| 64 | }, | ||
| 65 | {#State 1 | ||
| 66 | DEFAULT => -22 | ||
| 67 | }, | ||
| 68 | {#State 2 | ||
| 69 | ACTIONS => { | ||
| 70 | 'OR' => 16 | ||
| 71 | }, | ||
| 72 | DEFAULT => -18 | ||
| 73 | }, | ||
| 74 | {#State 3 | ||
| 75 | DEFAULT => -3 | ||
| 76 | }, | ||
| 77 | {#State 4 | ||
| 78 | ACTIONS => { | ||
| 79 | '' => 17 | ||
| 80 | } | ||
| 81 | }, | ||
| 82 | {#State 5 | ||
| 83 | DEFAULT => -59 | ||
| 84 | }, | ||
| 85 | {#State 6 | ||
| 86 | ACTIONS => { | ||
| 87 | 'AND' => 18 | ||
| 88 | }, | ||
| 89 | DEFAULT => -20 | ||
| 90 | }, | ||
| 91 | {#State 7 | ||
| 92 | DEFAULT => -57 | ||
| 93 | }, | ||
| 94 | {#State 8 | ||
| 95 | DEFAULT => -1 | ||
| 96 | }, | ||
| 97 | {#State 9 | ||
| 98 | DEFAULT => -27 | ||
| 99 | }, | ||
| 100 | {#State 10 | ||
| 101 | DEFAULT => -26 | ||
| 102 | }, | ||
| 103 | {#State 11 | ||
| 104 | DEFAULT => -2 | ||
| 105 | }, | ||
| 106 | {#State 12 | ||
| 107 | ACTIONS => { | ||
| 108 | "=" => 21, | ||
| 109 | "<" => 22, | ||
| 110 | "!" => 24, | ||
| 111 | ">" => 20 | ||
| 112 | }, | ||
| 113 | GOTOS => { | ||
| 114 | 'value_op_rhs' => 23, | ||
| 115 | 'operator' => 19 | ||
| 116 | } | ||
| 117 | }, | ||
| 118 | {#State 13 | ||
| 119 | ACTIONS => { | ||
| 120 | 'ENDS' => 42, | ||
| 121 | ">" => 20, | ||
| 122 | 'LENGTH' => 40, | ||
| 123 | 'STARTS' => 37, | ||
| 124 | 'HAS' => 39, | ||
| 125 | "=" => 21, | ||
| 126 | 'IS' => 35, | ||
| 127 | "<" => 22, | ||
| 128 | 'CONTAINS' => 27, | ||
| 129 | "!" => 24, | ||
| 130 | ":" => 26, | ||
| 131 | "." => 25, | ||
| 132 | 'LIKE' => 33 | ||
| 133 | }, | ||
| 134 | GOTOS => { | ||
| 135 | 'length_op_rhs' => 31, | ||
| 136 | 'property_zip_addon' => 28, | ||
| 137 | 'operator' => 19, | ||
| 138 | 'dot' => 41, | ||
| 139 | 'set_zip_op_rhs' => 32, | ||
| 140 | 'colon' => 38, | ||
| 141 | 'fuzzy_string_op_rhs' => 29, | ||
| 142 | 'set_op_rhs' => 36, | ||
| 143 | 'known_op_rhs' => 30, | ||
| 144 | 'value_op_rhs' => 34 | ||
| 145 | } | ||
| 146 | }, | ||
| 147 | {#State 14 | ||
| 148 | ACTIONS => { | ||
| 149 | 'number' => 3, | ||
| 150 | 'NOT' => 15, | ||
| 151 | 'identifier' => 7, | ||
| 152 | "(" => 5, | ||
| 153 | 'string' => 11 | ||
| 154 | }, | ||
| 155 | GOTOS => { | ||
| 156 | 'comparison' => 1, | ||
| 157 | 'constant' => 12, | ||
| 158 | 'expression_clause' => 2, | ||
| 159 | 'openingbrace' => 14, | ||
| 160 | 'property' => 13, | ||
| 161 | 'expression' => 43, | ||
| 162 | 'expression_phrase' => 6, | ||
| 163 | 'property_first_comparison' => 9, | ||
| 164 | 'constant_first_comparison' => 10 | ||
| 165 | } | ||
| 166 | }, | ||
| 167 | {#State 15 | ||
| 168 | ACTIONS => { | ||
| 169 | 'number' => 3, | ||
| 170 | "(" => 5, | ||
| 171 | 'string' => 11, | ||
| 172 | 'identifier' => 7 | ||
| 173 | }, | ||
| 174 | GOTOS => { | ||
| 175 | 'openingbrace' => 45, | ||
| 176 | 'property' => 13, | ||
| 177 | 'constant' => 12, | ||
| 178 | 'constant_first_comparison' => 10, | ||
| 179 | 'property_first_comparison' => 9, | ||
| 180 | 'comparison' => 44 | ||
| 181 | } | ||
| 182 | }, | ||
| 183 | {#State 16 | ||
| 184 | ACTIONS => { | ||
| 185 | 'identifier' => 7, | ||
| 186 | 'string' => 11, | ||
| 187 | "(" => 5, | ||
| 188 | 'NOT' => 15, | ||
| 189 | 'number' => 3 | ||
| 190 | }, | ||
| 191 | GOTOS => { | ||
| 192 | 'expression_phrase' => 6, | ||
| 193 | 'expression' => 46, | ||
| 194 | 'property_first_comparison' => 9, | ||
| 195 | 'constant_first_comparison' => 10, | ||
| 196 | 'expression_clause' => 2, | ||
| 197 | 'constant' => 12, | ||
| 198 | 'openingbrace' => 14, | ||
| 199 | 'property' => 13, | ||
| 200 | 'comparison' => 1 | ||
| 201 | } | ||
| 202 | }, | ||
| 203 | {#State 17 | ||
| 204 | DEFAULT => 0 | ||
| 205 | }, | ||
| 206 | {#State 18 | ||
| 207 | ACTIONS => { | ||
| 208 | 'number' => 3, | ||
| 209 | 'identifier' => 7, | ||
| 210 | 'string' => 11, | ||
| 211 | "(" => 5, | ||
| 212 | 'NOT' => 15 | ||
| 213 | }, | ||
| 214 | GOTOS => { | ||
| 215 | 'expression_phrase' => 6, | ||
| 216 | 'property_first_comparison' => 9, | ||
| 217 | 'constant_first_comparison' => 10, | ||
| 218 | 'constant' => 12, | ||
| 219 | 'expression_clause' => 47, | ||
| 220 | 'openingbrace' => 14, | ||
| 221 | 'property' => 13, | ||
| 222 | 'comparison' => 1 | ||
| 223 | } | ||
| 224 | }, | ||
| 225 | {#State 19 | ||
| 226 | ACTIONS => { | ||
| 227 | 'number' => 49, | ||
| 228 | 'identifier' => 7, | ||
| 229 | 'string' => 51 | ||
| 230 | }, | ||
| 231 | GOTOS => { | ||
| 232 | 'property' => 48, | ||
| 233 | 'value' => 50 | ||
| 234 | } | ||
| 235 | }, | ||
| 236 | {#State 20 | ||
| 237 | ACTIONS => { | ||
| 238 | "=" => 52 | ||
| 239 | }, | ||
| 240 | DEFAULT => -66 | ||
| 241 | }, | ||
| 242 | {#State 21 | ||
| 243 | DEFAULT => -68 | ||
| 244 | }, | ||
| 245 | {#State 22 | ||
| 246 | ACTIONS => { | ||
| 247 | "=" => 53 | ||
| 248 | }, | ||
| 249 | DEFAULT => -64 | ||
| 250 | }, | ||
| 251 | {#State 23 | ||
| 252 | DEFAULT => -28 | ||
| 253 | }, | ||
| 254 | {#State 24 | ||
| 255 | ACTIONS => { | ||
| 256 | "=" => 54 | ||
| 257 | } | ||
| 258 | }, | ||
| 259 | {#State 25 | ||
| 260 | DEFAULT => -61 | ||
| 261 | }, | ||
| 262 | {#State 26 | ||
| 263 | DEFAULT => -63 | ||
| 264 | }, | ||
| 265 | {#State 27 | ||
| 266 | ACTIONS => { | ||
| 267 | 'number' => 49, | ||
| 268 | 'identifier' => 7, | ||
| 269 | 'string' => 51 | ||
| 270 | }, | ||
| 271 | GOTOS => { | ||
| 272 | 'value' => 55, | ||
| 273 | 'property' => 48 | ||
| 274 | } | ||
| 275 | }, | ||
| 276 | {#State 28 | ||
| 277 | ACTIONS => { | ||
| 278 | 'HAS' => 56, | ||
| 279 | ":" => 26 | ||
| 280 | }, | ||
| 281 | GOTOS => { | ||
| 282 | 'colon' => 57 | ||
| 283 | } | ||
| 284 | }, | ||
| 285 | {#State 29 | ||
| 286 | DEFAULT => -31 | ||
| 287 | }, | ||
| 288 | {#State 30 | ||
| 289 | DEFAULT => -30 | ||
| 290 | }, | ||
| 291 | {#State 31 | ||
| 292 | DEFAULT => -34 | ||
| 293 | }, | ||
| 294 | {#State 32 | ||
| 295 | DEFAULT => -33 | ||
| 296 | }, | ||
| 297 | {#State 33 | ||
| 298 | ACTIONS => { | ||
| 299 | 'number' => 49, | ||
| 300 | 'string' => 51, | ||
| 301 | 'identifier' => 7 | ||
| 302 | }, | ||
| 303 | GOTOS => { | ||
| 304 | 'value' => 58, | ||
| 305 | 'property' => 48 | ||
| 306 | } | ||
| 307 | }, | ||
| 308 | {#State 34 | ||
| 309 | DEFAULT => -29 | ||
| 310 | }, | ||
| 311 | {#State 35 | ||
| 312 | ACTIONS => { | ||
| 313 | 'KNOWN' => 59, | ||
| 314 | 'UNKNOWN' => 60 | ||
| 315 | } | ||
| 316 | }, | ||
| 317 | {#State 36 | ||
| 318 | DEFAULT => -32 | ||
| 319 | }, | ||
| 320 | {#State 37 | ||
| 321 | ACTIONS => { | ||
| 322 | 'WITH' => 61, | ||
| 323 | 'string' => 51, | ||
| 324 | 'identifier' => 7, | ||
| 325 | 'number' => 49 | ||
| 326 | }, | ||
| 327 | GOTOS => { | ||
| 328 | 'value' => 62, | ||
| 329 | 'property' => 48 | ||
| 330 | } | ||
| 331 | }, | ||
| 332 | {#State 38 | ||
| 333 | ACTIONS => { | ||
| 334 | 'identifier' => 7 | ||
| 335 | }, | ||
| 336 | GOTOS => { | ||
| 337 | 'property' => 63 | ||
| 338 | } | ||
| 339 | }, | ||
| 340 | {#State 39 | ||
| 341 | ACTIONS => { | ||
| 342 | 'string' => 51, | ||
| 343 | 'ANY' => 65, | ||
| 344 | "<" => 22, | ||
| 345 | "!" => 24, | ||
| 346 | "=" => 21, | ||
| 347 | 'identifier' => 7, | ||
| 348 | 'ALL' => 67, | ||
| 349 | 'number' => 49, | ||
| 350 | 'ONLY' => 68, | ||
| 351 | ">" => 20 | ||
| 352 | }, | ||
| 353 | GOTOS => { | ||
| 354 | 'value' => 64, | ||
| 355 | 'property' => 48, | ||
| 356 | 'operator' => 66 | ||
| 357 | } | ||
| 358 | }, | ||
| 359 | {#State 40 | ||
| 360 | ACTIONS => { | ||
| 361 | "<" => 22, | ||
| 362 | 'number' => 49, | ||
| 363 | "!" => 24, | ||
| 364 | ">" => 20, | ||
| 365 | 'string' => 51, | ||
| 366 | "=" => 21, | ||
| 367 | 'identifier' => 7 | ||
| 368 | }, | ||
| 369 | GOTOS => { | ||
| 370 | 'value' => 70, | ||
| 371 | 'property' => 48, | ||
| 372 | 'operator' => 69 | ||
| 373 | } | ||
| 374 | }, | ||
| 375 | {#State 41 | ||
| 376 | ACTIONS => { | ||
| 377 | 'identifier' => 71 | ||
| 378 | } | ||
| 379 | }, | ||
| 380 | {#State 42 | ||
| 381 | ACTIONS => { | ||
| 382 | 'WITH' => 72, | ||
| 383 | 'identifier' => 7, | ||
| 384 | 'string' => 51, | ||
| 385 | 'number' => 49 | ||
| 386 | }, | ||
| 387 | GOTOS => { | ||
| 388 | 'value' => 73, | ||
| 389 | 'property' => 48 | ||
| 390 | } | ||
| 391 | }, | ||
| 392 | {#State 43 | ||
| 393 | ACTIONS => { | ||
| 394 | ")" => 74 | ||
| 395 | }, | ||
| 396 | GOTOS => { | ||
| 397 | 'closingbrace' => 75 | ||
| 398 | } | ||
| 399 | }, | ||
| 400 | {#State 44 | ||
| 401 | DEFAULT => -24 | ||
| 402 | }, | ||
| 403 | {#State 45 | ||
| 404 | ACTIONS => { | ||
| 405 | "(" => 5, | ||
| 406 | 'string' => 11, | ||
| 407 | 'identifier' => 7, | ||
| 408 | 'NOT' => 15, | ||
| 409 | 'number' => 3 | ||
| 410 | }, | ||
| 411 | GOTOS => { | ||
| 412 | 'openingbrace' => 14, | ||
| 413 | 'property' => 13, | ||
| 414 | 'expression_clause' => 2, | ||
| 415 | 'constant' => 12, | ||
| 416 | 'expression_phrase' => 6, | ||
| 417 | 'expression' => 76, | ||
| 418 | 'constant_first_comparison' => 10, | ||
| 419 | 'property_first_comparison' => 9, | ||
| 420 | 'comparison' => 1 | ||
| 421 | } | ||
| 422 | }, | ||
| 423 | {#State 46 | ||
| 424 | DEFAULT => -19 | ||
| 425 | }, | ||
| 426 | {#State 47 | ||
| 427 | DEFAULT => -21 | ||
| 428 | }, | ||
| 429 | {#State 48 | ||
| 430 | ACTIONS => { | ||
| 431 | "." => 25 | ||
| 432 | }, | ||
| 433 | DEFAULT => -6, | ||
| 434 | GOTOS => { | ||
| 435 | 'dot' => 41 | ||
| 436 | } | ||
| 437 | }, | ||
| 438 | {#State 49 | ||
| 439 | DEFAULT => -5 | ||
| 440 | }, | ||
| 441 | {#State 50 | ||
| 442 | DEFAULT => -35 | ||
| 443 | }, | ||
| 444 | {#State 51 | ||
| 445 | DEFAULT => -4 | ||
| 446 | }, | ||
| 447 | {#State 52 | ||
| 448 | DEFAULT => -67 | ||
| 449 | }, | ||
| 450 | {#State 53 | ||
| 451 | DEFAULT => -65 | ||
| 452 | }, | ||
| 453 | {#State 54 | ||
| 454 | DEFAULT => -69 | ||
| 455 | }, | ||
| 456 | {#State 55 | ||
| 457 | DEFAULT => -38 | ||
| 458 | }, | ||
| 459 | {#State 56 | ||
| 460 | ACTIONS => { | ||
| 461 | 'number' => 49, | ||
| 462 | 'ONLY' => 78, | ||
| 463 | ">" => 20, | ||
| 464 | "=" => 21, | ||
| 465 | 'identifier' => 7, | ||
| 466 | 'ALL' => 79, | ||
| 467 | "<" => 22, | ||
| 468 | "!" => 24, | ||
| 469 | 'string' => 51, | ||
| 470 | 'ANY' => 81 | ||
| 471 | }, | ||
| 472 | GOTOS => { | ||
| 473 | 'operator' => 80, | ||
| 474 | 'value' => 82, | ||
| 475 | 'property' => 48, | ||
| 476 | 'value_zip' => 77 | ||
| 477 | } | ||
| 478 | }, | ||
| 479 | {#State 57 | ||
| 480 | ACTIONS => { | ||
| 481 | 'identifier' => 7 | ||
| 482 | }, | ||
| 483 | GOTOS => { | ||
| 484 | 'property' => 83 | ||
| 485 | } | ||
| 486 | }, | ||
| 487 | {#State 58 | ||
| 488 | DEFAULT => -43 | ||
| 489 | }, | ||
| 490 | {#State 59 | ||
| 491 | DEFAULT => -36 | ||
| 492 | }, | ||
| 493 | {#State 60 | ||
| 494 | DEFAULT => -37 | ||
| 495 | }, | ||
| 496 | {#State 61 | ||
| 497 | ACTIONS => { | ||
| 498 | 'number' => 49, | ||
| 499 | 'identifier' => 7, | ||
| 500 | 'string' => 51 | ||
| 501 | }, | ||
| 502 | GOTOS => { | ||
| 503 | 'property' => 48, | ||
| 504 | 'value' => 84 | ||
| 505 | } | ||
| 506 | }, | ||
| 507 | {#State 62 | ||
| 508 | DEFAULT => -39 | ||
| 509 | }, | ||
| 510 | {#State 63 | ||
| 511 | ACTIONS => { | ||
| 512 | "." => 25 | ||
| 513 | }, | ||
| 514 | DEFAULT => -53, | ||
| 515 | GOTOS => { | ||
| 516 | 'dot' => 41 | ||
| 517 | } | ||
| 518 | }, | ||
| 519 | {#State 64 | ||
| 520 | DEFAULT => -44 | ||
| 521 | }, | ||
| 522 | {#State 65 | ||
| 523 | ACTIONS => { | ||
| 524 | "<" => 22, | ||
| 525 | 'number' => 49, | ||
| 526 | "!" => 24, | ||
| 527 | ">" => 20, | ||
| 528 | "=" => 21, | ||
| 529 | 'string' => 51, | ||
| 530 | 'identifier' => 7 | ||
| 531 | }, | ||
| 532 | GOTOS => { | ||
| 533 | 'operator' => 87, | ||
| 534 | 'value_list' => 86, | ||
| 535 | 'value' => 85, | ||
| 536 | 'property' => 48 | ||
| 537 | } | ||
| 538 | }, | ||
| 539 | {#State 66 | ||
| 540 | ACTIONS => { | ||
| 541 | 'string' => 51, | ||
| 542 | 'identifier' => 7, | ||
| 543 | 'number' => 49 | ||
| 544 | }, | ||
| 545 | GOTOS => { | ||
| 546 | 'value' => 88, | ||
| 547 | 'property' => 48 | ||
| 548 | } | ||
| 549 | }, | ||
| 550 | {#State 67 | ||
| 551 | ACTIONS => { | ||
| 552 | 'identifier' => 7, | ||
| 553 | "=" => 21, | ||
| 554 | 'string' => 51, | ||
| 555 | ">" => 20, | ||
| 556 | "!" => 24, | ||
| 557 | 'number' => 49, | ||
| 558 | "<" => 22 | ||
| 559 | }, | ||
| 560 | GOTOS => { | ||
| 561 | 'value_list' => 89, | ||
| 562 | 'operator' => 87, | ||
| 563 | 'property' => 48, | ||
| 564 | 'value' => 85 | ||
| 565 | } | ||
| 566 | }, | ||
| 567 | {#State 68 | ||
| 568 | ACTIONS => { | ||
| 569 | 'string' => 51, | ||
| 570 | "=" => 21, | ||
| 571 | 'identifier' => 7, | ||
| 572 | "<" => 22, | ||
| 573 | 'number' => 49, | ||
| 574 | "!" => 24, | ||
| 575 | ">" => 20 | ||
| 576 | }, | ||
| 577 | GOTOS => { | ||
| 578 | 'operator' => 87, | ||
| 579 | 'value_list' => 90, | ||
| 580 | 'value' => 85, | ||
| 581 | 'property' => 48 | ||
| 582 | } | ||
| 583 | }, | ||
| 584 | {#State 69 | ||
| 585 | ACTIONS => { | ||
| 586 | 'string' => 51, | ||
| 587 | 'identifier' => 7, | ||
| 588 | 'number' => 49 | ||
| 589 | }, | ||
| 590 | GOTOS => { | ||
| 591 | 'property' => 48, | ||
| 592 | 'value' => 91 | ||
| 593 | } | ||
| 594 | }, | ||
| 595 | {#State 70 | ||
| 596 | DEFAULT => -55 | ||
| 597 | }, | ||
| 598 | {#State 71 | ||
| 599 | DEFAULT => -58 | ||
| 600 | }, | ||
| 601 | {#State 72 | ||
| 602 | ACTIONS => { | ||
| 603 | 'number' => 49, | ||
| 604 | 'identifier' => 7, | ||
| 605 | 'string' => 51 | ||
| 606 | }, | ||
| 607 | GOTOS => { | ||
| 608 | 'property' => 48, | ||
| 609 | 'value' => 92 | ||
| 610 | } | ||
| 611 | }, | ||
| 612 | {#State 73 | ||
| 613 | DEFAULT => -41 | ||
| 614 | }, | ||
| 615 | {#State 74 | ||
| 616 | DEFAULT => -60 | ||
| 617 | }, | ||
| 618 | {#State 75 | ||
| 619 | DEFAULT => -23 | ||
| 620 | }, | ||
| 621 | {#State 76 | ||
| 622 | ACTIONS => { | ||
| 623 | ")" => 74 | ||
| 624 | }, | ||
| 625 | GOTOS => { | ||
| 626 | 'closingbrace' => 93 | ||
| 627 | } | ||
| 628 | }, | ||
| 629 | {#State 77 | ||
| 630 | ACTIONS => { | ||
| 631 | ":" => 26 | ||
| 632 | }, | ||
| 633 | DEFAULT => -49, | ||
| 634 | GOTOS => { | ||
| 635 | 'colon' => 95, | ||
| 636 | 'value_zip_part' => 94 | ||
| 637 | } | ||
| 638 | }, | ||
| 639 | {#State 78 | ||
| 640 | ACTIONS => { | ||
| 641 | 'identifier' => 7, | ||
| 642 | "=" => 21, | ||
| 643 | 'number' => 49, | ||
| 644 | ">" => 20, | ||
| 645 | 'string' => 51, | ||
| 646 | "<" => 22, | ||
| 647 | "!" => 24 | ||
| 648 | }, | ||
| 649 | GOTOS => { | ||
| 650 | 'value_zip_list' => 97, | ||
| 651 | 'operator' => 80, | ||
| 652 | 'property' => 48, | ||
| 653 | 'value' => 82, | ||
| 654 | 'value_zip' => 96 | ||
| 655 | } | ||
| 656 | }, | ||
| 657 | {#State 79 | ||
| 658 | ACTIONS => { | ||
| 659 | 'identifier' => 7, | ||
| 660 | "=" => 21, | ||
| 661 | 'string' => 51, | ||
| 662 | 'number' => 49, | ||
| 663 | "<" => 22, | ||
| 664 | ">" => 20, | ||
| 665 | "!" => 24 | ||
| 666 | }, | ||
| 667 | GOTOS => { | ||
| 668 | 'operator' => 80, | ||
| 669 | 'value' => 82, | ||
| 670 | 'property' => 48, | ||
| 671 | 'value_zip' => 96, | ||
| 672 | 'value_zip_list' => 98 | ||
| 673 | } | ||
| 674 | }, | ||
| 675 | {#State 80 | ||
| 676 | ACTIONS => { | ||
| 677 | 'number' => 49, | ||
| 678 | 'string' => 51, | ||
| 679 | 'identifier' => 7 | ||
| 680 | }, | ||
| 681 | GOTOS => { | ||
| 682 | 'property' => 48, | ||
| 683 | 'value' => 99 | ||
| 684 | } | ||
| 685 | }, | ||
| 686 | {#State 81 | ||
| 687 | ACTIONS => { | ||
| 688 | "=" => 21, | ||
| 689 | 'string' => 51, | ||
| 690 | 'identifier' => 7, | ||
| 691 | "!" => 24, | ||
| 692 | ">" => 20, | ||
| 693 | "<" => 22, | ||
| 694 | 'number' => 49 | ||
| 695 | }, | ||
| 696 | GOTOS => { | ||
| 697 | 'value_zip_list' => 100, | ||
| 698 | 'operator' => 80, | ||
| 699 | 'value_zip' => 96, | ||
| 700 | 'property' => 48, | ||
| 701 | 'value' => 82 | ||
| 702 | } | ||
| 703 | }, | ||
| 704 | {#State 82 | ||
| 705 | ACTIONS => { | ||
| 706 | ":" => 26 | ||
| 707 | }, | ||
| 708 | GOTOS => { | ||
| 709 | 'value_zip_part' => 101, | ||
| 710 | 'colon' => 95 | ||
| 711 | } | ||
| 712 | }, | ||
| 713 | {#State 83 | ||
| 714 | ACTIONS => { | ||
| 715 | "." => 25 | ||
| 716 | }, | ||
| 717 | DEFAULT => -54, | ||
| 718 | GOTOS => { | ||
| 719 | 'dot' => 41 | ||
| 720 | } | ||
| 721 | }, | ||
| 722 | {#State 84 | ||
| 723 | DEFAULT => -40 | ||
| 724 | }, | ||
| 725 | {#State 85 | ||
| 726 | DEFAULT => -7 | ||
| 727 | }, | ||
| 728 | {#State 86 | ||
| 729 | ACTIONS => { | ||
| 730 | "," => 102 | ||
| 731 | }, | ||
| 732 | DEFAULT => -47, | ||
| 733 | GOTOS => { | ||
| 734 | 'comma' => 103 | ||
| 735 | } | ||
| 736 | }, | ||
| 737 | {#State 87 | ||
| 738 | ACTIONS => { | ||
| 739 | 'identifier' => 7, | ||
| 740 | 'string' => 51, | ||
| 741 | 'number' => 49 | ||
| 742 | }, | ||
| 743 | GOTOS => { | ||
| 744 | 'property' => 48, | ||
| 745 | 'value' => 104 | ||
| 746 | } | ||
| 747 | }, | ||
| 748 | {#State 88 | ||
| 749 | DEFAULT => -45 | ||
| 750 | }, | ||
| 751 | {#State 89 | ||
| 752 | ACTIONS => { | ||
| 753 | "," => 102 | ||
| 754 | }, | ||
| 755 | DEFAULT => -46, | ||
| 756 | GOTOS => { | ||
| 757 | 'comma' => 103 | ||
| 758 | } | ||
| 759 | }, | ||
| 760 | {#State 90 | ||
| 761 | ACTIONS => { | ||
| 762 | "," => 102 | ||
| 763 | }, | ||
| 764 | DEFAULT => -48, | ||
| 765 | GOTOS => { | ||
| 766 | 'comma' => 103 | ||
| 767 | } | ||
| 768 | }, | ||
| 769 | {#State 91 | ||
| 770 | DEFAULT => -56 | ||
| 771 | }, | ||
| 772 | {#State 92 | ||
| 773 | DEFAULT => -42 | ||
| 774 | }, | ||
| 775 | {#State 93 | ||
| 776 | DEFAULT => -25 | ||
| 777 | }, | ||
| 778 | {#State 94 | ||
| 779 | DEFAULT => -13 | ||
| 780 | }, | ||
| 781 | {#State 95 | ||
| 782 | ACTIONS => { | ||
| 783 | 'identifier' => 7, | ||
| 784 | "=" => 21, | ||
| 785 | 'string' => 51, | ||
| 786 | 'number' => 49, | ||
| 787 | "<" => 22, | ||
| 788 | ">" => 20, | ||
| 789 | "!" => 24 | ||
| 790 | }, | ||
| 791 | GOTOS => { | ||
| 792 | 'value' => 106, | ||
| 793 | 'property' => 48, | ||
| 794 | 'operator' => 105 | ||
| 795 | } | ||
| 796 | }, | ||
| 797 | {#State 96 | ||
| 798 | ACTIONS => { | ||
| 799 | ":" => 26 | ||
| 800 | }, | ||
| 801 | DEFAULT => -16, | ||
| 802 | GOTOS => { | ||
| 803 | 'value_zip_part' => 94, | ||
| 804 | 'colon' => 95 | ||
| 805 | } | ||
| 806 | }, | ||
| 807 | {#State 97 | ||
| 808 | ACTIONS => { | ||
| 809 | "," => 102 | ||
| 810 | }, | ||
| 811 | DEFAULT => -50, | ||
| 812 | GOTOS => { | ||
| 813 | 'comma' => 107 | ||
| 814 | } | ||
| 815 | }, | ||
| 816 | {#State 98 | ||
| 817 | ACTIONS => { | ||
| 818 | "," => 102 | ||
| 819 | }, | ||
| 820 | DEFAULT => -51, | ||
| 821 | GOTOS => { | ||
| 822 | 'comma' => 107 | ||
| 823 | } | ||
| 824 | }, | ||
| 825 | {#State 99 | ||
| 826 | ACTIONS => { | ||
| 827 | ":" => 26 | ||
| 828 | }, | ||
| 829 | GOTOS => { | ||
| 830 | 'colon' => 95, | ||
| 831 | 'value_zip_part' => 108 | ||
| 832 | } | ||
| 833 | }, | ||
| 834 | {#State 100 | ||
| 835 | ACTIONS => { | ||
| 836 | "," => 102 | ||
| 837 | }, | ||
| 838 | DEFAULT => -52, | ||
| 839 | GOTOS => { | ||
| 840 | 'comma' => 107 | ||
| 841 | } | ||
| 842 | }, | ||
| 843 | {#State 101 | ||
| 844 | DEFAULT => -11 | ||
| 845 | }, | ||
| 846 | {#State 102 | ||
| 847 | DEFAULT => -62 | ||
| 848 | }, | ||
| 849 | {#State 103 | ||
| 850 | ACTIONS => { | ||
| 851 | 'identifier' => 7, | ||
| 852 | 'string' => 51, | ||
| 853 | "=" => 21, | ||
| 854 | ">" => 20, | ||
| 855 | "!" => 24, | ||
| 856 | 'number' => 49, | ||
| 857 | "<" => 22 | ||
| 858 | }, | ||
| 859 | GOTOS => { | ||
| 860 | 'value' => 109, | ||
| 861 | 'property' => 48, | ||
| 862 | 'operator' => 110 | ||
| 863 | } | ||
| 864 | }, | ||
| 865 | {#State 104 | ||
| 866 | DEFAULT => -8 | ||
| 867 | }, | ||
| 868 | {#State 105 | ||
| 869 | ACTIONS => { | ||
| 870 | 'number' => 49, | ||
| 871 | 'identifier' => 7, | ||
| 872 | 'string' => 51 | ||
| 873 | }, | ||
| 874 | GOTOS => { | ||
| 875 | 'property' => 48, | ||
| 876 | 'value' => 111 | ||
| 877 | } | ||
| 878 | }, | ||
| 879 | {#State 106 | ||
| 880 | DEFAULT => -14 | ||
| 881 | }, | ||
| 882 | {#State 107 | ||
| 883 | ACTIONS => { | ||
| 884 | ">" => 20, | ||
| 885 | "!" => 24, | ||
| 886 | 'number' => 49, | ||
| 887 | "<" => 22, | ||
| 888 | 'identifier' => 7, | ||
| 889 | "=" => 21, | ||
| 890 | 'string' => 51 | ||
| 891 | }, | ||
| 892 | GOTOS => { | ||
| 893 | 'value' => 82, | ||
| 894 | 'property' => 48, | ||
| 895 | 'value_zip' => 112, | ||
| 896 | 'operator' => 80 | ||
| 897 | } | ||
| 898 | }, | ||
| 899 | {#State 108 | ||
| 900 | DEFAULT => -12 | ||
| 901 | }, | ||
| 902 | {#State 109 | ||
| 903 | DEFAULT => -9 | ||
| 904 | }, | ||
| 905 | {#State 110 | ||
| 906 | ACTIONS => { | ||
| 907 | 'number' => 49, | ||
| 908 | 'identifier' => 7, | ||
| 909 | 'string' => 51 | ||
| 910 | }, | ||
| 911 | GOTOS => { | ||
| 912 | 'value' => 113, | ||
| 913 | 'property' => 48 | ||
| 914 | } | ||
| 915 | }, | ||
| 916 | {#State 111 | ||
| 917 | DEFAULT => -15 | ||
| 918 | }, | ||
| 919 | {#State 112 | ||
| 920 | ACTIONS => { | ||
| 921 | ":" => 26 | ||
| 922 | }, | ||
| 923 | DEFAULT => -17, | ||
| 924 | GOTOS => { | ||
| 925 | 'value_zip_part' => 94, | ||
| 926 | 'colon' => 95 | ||
| 927 | } | ||
| 928 | }, | ||
| 929 | {#State 113 | ||
| 930 | DEFAULT => -10 | ||
| 931 | } | ||
| 932 | ], | ||
| 933 | yyrules => | ||
| 934 | [ | ||
| 935 | [#Rule 0 | ||
| 936 | '$start', 2, undef | ||
| 937 | ], | ||
| 938 | [#Rule 1 | ||
| 939 | 'filter', 1, undef | ||
| 940 | ], | ||
| 941 | [#Rule 2 | ||
| 942 | 'constant', 1, undef | ||
| 943 | ], | ||
| 944 | [#Rule 3 | ||
| 945 | 'constant', 1, undef | ||
| 946 | ], | ||
| 947 | [#Rule 4 | ||
| 948 | 'value', 1, undef | ||
| 949 | ], | ||
| 950 | [#Rule 5 | ||
| 951 | 'value', 1, undef | ||
| 952 | ], | ||
| 953 | [#Rule 6 | ||
| 954 | 'value', 1, undef | ||
| 955 | ], | ||
| 956 | [#Rule 7 | ||
| 957 | 'value_list', 1, | ||
| 958 | sub | ||
| 959 | #line 36 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 960 | { | ||
| 961 | return [ [ '=', $_[1] ] ]; | ||
| 962 | } | ||
| 963 | ], | ||
| 964 | [#Rule 8 | ||
| 965 | 'value_list', 2, | ||
| 966 | sub | ||
| 967 | #line 40 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 968 | { | ||
| 969 | return [ [ @_[1..$#_] ] ]; | ||
| 970 | } | ||
| 971 | ], | ||
| 972 | [#Rule 9 | ||
| 973 | 'value_list', 3, | ||
| 974 | sub | ||
| 975 | #line 44 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 976 | { | ||
| 977 | push @{$_[1]}, [ '=', $_[3] ]; | ||
| 978 | return $_[1]; | ||
| 979 | } | ||
| 980 | ], | ||
| 981 | [#Rule 10 | ||
| 982 | 'value_list', 4, | ||
| 983 | sub | ||
| 984 | #line 49 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 985 | { | ||
| 986 | push @{$_[1]}, [ $_[3], $_[4] ]; | ||
| 987 | return $_[1]; | ||
| 988 | } | ||
| 989 | ], | ||
| 990 | [#Rule 11 | ||
| 991 | 'value_zip', 2, | ||
| 992 | sub | ||
| 993 | #line 56 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 994 | { | ||
| 995 | return [ [ '=', $_[1] ], $_[2] ]; | ||
| 996 | } | ||
| 997 | ], | ||
| 998 | [#Rule 12 | ||
| 999 | 'value_zip', 3, | ||
| 1000 | sub | ||
| 1001 | #line 60 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1002 | { | ||
| 1003 | return [ [ $_[1], $_[2] ], $_[3] ]; | ||
| 1004 | } | ||
| 1005 | ], | ||
| 1006 | [#Rule 13 | ||
| 1007 | 'value_zip', 2, | ||
| 1008 | sub | ||
| 1009 | #line 64 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1010 | { | ||
| 1011 | push @{$_[1]}, $_[2]; | ||
| 1012 | return $_[1]; | ||
| 1013 | } | ||
| 1014 | ], | ||
| 1015 | [#Rule 14 | ||
| 1016 | 'value_zip_part', 2, | ||
| 1017 | sub | ||
| 1018 | #line 71 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1019 | { | ||
| 1020 | return [ '=', $_[2] ]; | ||
| 1021 | } | ||
| 1022 | ], | ||
| 1023 | [#Rule 15 | ||
| 1024 | 'value_zip_part', 3, | ||
| 1025 | sub | ||
| 1026 | #line 75 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1027 | { | ||
| 1028 | return [ $_[2], $_[3] ]; | ||
| 1029 | } | ||
| 1030 | ], | ||
| 1031 | [#Rule 16 | ||
| 1032 | 'value_zip_list', 1, | ||
| 1033 | sub | ||
| 1034 | #line 81 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1035 | { | ||
| 1036 | return [ $_[1] ]; | ||
| 1037 | } | ||
| 1038 | ], | ||
| 1039 | [#Rule 17 | ||
| 1040 | 'value_zip_list', 3, | ||
| 1041 | sub | ||
| 1042 | #line 85 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1043 | { | ||
| 1044 | push @{$_[1]}, $_[3]; | ||
| 1045 | return $_[1]; | ||
| 1046 | } | ||
| 1047 | ], | ||
| 1048 | [#Rule 18 | ||
| 1049 | 'expression', 1, undef | ||
| 1050 | ], | ||
| 1051 | [#Rule 19 | ||
| 1052 | 'expression', 3, | ||
| 1053 | sub | ||
| 1054 | #line 95 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1055 | { | ||
| 1056 | return OPTIMADE::Filter::AndOr->new( @_[1..$#_] ); | ||
| 1057 | } | ||
| 1058 | ], | ||
| 1059 | [#Rule 20 | ||
| 1060 | 'expression_clause', 1, undef | ||
| 1061 | ], | ||
| 1062 | [#Rule 21 | ||
| 1063 | 'expression_clause', 3, | ||
| 1064 | sub | ||
| 1065 | #line 102 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1066 | { | ||
| 1067 | return OPTIMADE::Filter::AndOr->new( @_[1..$#_] ); | ||
| 1068 | } | ||
| 1069 | ], | ||
| 1070 | [#Rule 22 | ||
| 1071 | 'expression_phrase', 1, undef | ||
| 1072 | ], | ||
| 1073 | [#Rule 23 | ||
| 1074 | 'expression_phrase', 3, | ||
| 1075 | sub | ||
| 1076 | #line 109 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1077 | { | ||
| 1078 | return $_[2]; | ||
| 1079 | } | ||
| 1080 | ], | ||
| 1081 | [#Rule 24 | ||
| 1082 | 'expression_phrase', 2, | ||
| 1083 | sub | ||
| 1084 | #line 113 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1085 | { | ||
| 1086 | return OPTIMADE::Filter::Negation->new( $_[2] ); | ||
| 1087 | } | ||
| 1088 | ], | ||
| 1089 | [#Rule 25 | ||
| 1090 | 'expression_phrase', 4, | ||
| 1091 | sub | ||
| 1092 | #line 117 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1093 | { | ||
| 1094 | return OPTIMADE::Filter::Negation->new( $_[3] ); | ||
| 1095 | } | ||
| 1096 | ], | ||
| 1097 | [#Rule 26 | ||
| 1098 | 'comparison', 1, undef | ||
| 1099 | ], | ||
| 1100 | [#Rule 27 | ||
| 1101 | 'comparison', 1, undef | ||
| 1102 | ], | ||
| 1103 | [#Rule 28 | ||
| 1104 | 'constant_first_comparison', 2, | ||
| 1105 | sub | ||
| 1106 | #line 125 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1107 | { | ||
| 1108 | $_[2]->unshift_operand( $_[1] ); | ||
| 1109 | return $_[2]; | ||
| 1110 | } | ||
| 1111 | ], | ||
| 1112 | [#Rule 29 | ||
| 1113 | 'property_first_comparison', 2, | ||
| 1114 | sub | ||
| 1115 | #line 132 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1116 | { | ||
| 1117 | $_[2]->unshift_operand( $_[1] ); | ||
| 1118 | return $_[2]; | ||
| 1119 | } | ||
| 1120 | ], | ||
| 1121 | [#Rule 30 | ||
| 1122 | 'property_first_comparison', 2, | ||
| 1123 | sub | ||
| 1124 | #line 137 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1125 | { | ||
| 1126 | $_[2]->property( $_[1] ); | ||
| 1127 | return $_[2]; | ||
| 1128 | } | ||
| 1129 | ], | ||
| 1130 | [#Rule 31 | ||
| 1131 | 'property_first_comparison', 2, | ||
| 1132 | sub | ||
| 1133 | #line 142 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1134 | { | ||
| 1135 | $_[2]->unshift_operand( $_[1] ); | ||
| 1136 | return $_[2]; | ||
| 1137 | } | ||
| 1138 | ], | ||
| 1139 | [#Rule 32 | ||
| 1140 | 'property_first_comparison', 2, | ||
| 1141 | sub | ||
| 1142 | #line 147 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1143 | { | ||
| 1144 | $_[2]->property( $_[1] ); | ||
| 1145 | return $_[2]; | ||
| 1146 | } | ||
| 1147 | ], | ||
| 1148 | [#Rule 33 | ||
| 1149 | 'property_first_comparison', 2, | ||
| 1150 | sub | ||
| 1151 | #line 152 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1152 | { | ||
| 1153 | $_[2]->unshift_property( $_[1] ); | ||
| 1154 | return $_[2]; | ||
| 1155 | } | ||
| 1156 | ], | ||
| 1157 | [#Rule 34 | ||
| 1158 | 'property_first_comparison', 2, | ||
| 1159 | sub | ||
| 1160 | #line 157 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1161 | { | ||
| 1162 | $_[2]->property( $_[1] ); | ||
| 1163 | return $_[2]; | ||
| 1164 | } | ||
| 1165 | ], | ||
| 1166 | [#Rule 35 | ||
| 1167 | 'value_op_rhs', 2, | ||
| 1168 | sub | ||
| 1169 | #line 164 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1170 | { | ||
| 1171 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | ||
| 1172 | $cmp->push_operand( $_[2] ); | ||
| 1173 | return $cmp; | ||
| 1174 | } | ||
| 1175 | ], | ||
| 1176 | [#Rule 36 | ||
| 1177 | 'known_op_rhs', 2, | ||
| 1178 | sub | ||
| 1179 | #line 172 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1180 | { | ||
| 1181 | return OPTIMADE::Filter::Known->new( 1 ); | ||
| 1182 | } | ||
| 1183 | ], | ||
| 1184 | [#Rule 37 | ||
| 1185 | 'known_op_rhs', 2, | ||
| 1186 | sub | ||
| 1187 | #line 176 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1188 | { | ||
| 1189 | return OPTIMADE::Filter::Known->new( 0 ); | ||
| 1190 | } | ||
| 1191 | ], | ||
| 1192 | [#Rule 38 | ||
| 1193 | 'fuzzy_string_op_rhs', 2, | ||
| 1194 | sub | ||
| 1195 | #line 182 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1196 | { | ||
| 1197 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | ||
| 1198 | $cmp->push_operand( $_[2] ); | ||
| 1199 | return $cmp; | ||
| 1200 | } | ||
| 1201 | ], | ||
| 1202 | [#Rule 39 | ||
| 1203 | 'fuzzy_string_op_rhs', 2, | ||
| 1204 | sub | ||
| 1205 | #line 188 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1206 | { | ||
| 1207 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | ||
| 1208 | $cmp->push_operand( $_[2] ); | ||
| 1209 | return $cmp; | ||
| 1210 | } | ||
| 1211 | ], | ||
| 1212 | [#Rule 40 | ||
| 1213 | 'fuzzy_string_op_rhs', 3, | ||
| 1214 | sub | ||
| 1215 | #line 194 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1216 | { | ||
| 1217 | my $cmp = OPTIMADE::Filter::Comparison->new( "$_[1] $_[2]" ); | ||
| 1218 | $cmp->push_operand( $_[3] ); | ||
| 1219 | return $cmp; | ||
| 1220 | } | ||
| 1221 | ], | ||
| 1222 | [#Rule 41 | ||
| 1223 | 'fuzzy_string_op_rhs', 2, | ||
| 1224 | sub | ||
| 1225 | #line 200 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1226 | { | ||
| 1227 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | ||
| 1228 | $cmp->push_operand( $_[2] ); | ||
| 1229 | return $cmp; | ||
| 1230 | } | ||
| 1231 | ], | ||
| 1232 | [#Rule 42 | ||
| 1233 | 'fuzzy_string_op_rhs', 3, | ||
| 1234 | sub | ||
| 1235 | #line 206 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1236 | { | ||
| 1237 | my $cmp = OPTIMADE::Filter::Comparison->new( "$_[1] $_[2]" ); | ||
| 1238 | $cmp->push_operand( $_[3] ); | ||
| 1239 | return $cmp; | ||
| 1240 | } | ||
| 1241 | ], | ||
| 1242 | [#Rule 43 | ||
| 1243 | 'fuzzy_string_op_rhs', 2, | ||
| 1244 | sub | ||
| 1245 | #line 212 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1246 | { | ||
| 1247 | my $cmp = OPTIMADE::Filter::Comparison->new( $_[1] ); | ||
| 1248 | $cmp->push_operand( $_[2] ); | ||
| 1249 | return $cmp; | ||
| 1250 | } | ||
| 1251 | ], | ||
| 1252 | [#Rule 44 | ||
| 1253 | 'set_op_rhs', 2, | ||
| 1254 | sub | ||
| 1255 | #line 220 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1256 | { | ||
| 1257 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | ||
| 1258 | $lc->values( [ [ '=', $_[2] ] ] ); | ||
| 1259 | return $lc; | ||
| 1260 | } | ||
| 1261 | ], | ||
| 1262 | [#Rule 45 | ||
| 1263 | 'set_op_rhs', 3, | ||
| 1264 | sub | ||
| 1265 | #line 226 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1266 | { | ||
| 1267 | my $lc = OPTIMADE::Filter::ListComparison->new( $_[1] ); | ||
| 1268 | $lc->values( [ [ $_[2], $_[3] ] ] ); | ||
| 1269 | return $lc; | ||
| 1270 | } | ||
| 1271 | ], | ||
| 1272 | [#Rule 46 | ||
| 1273 | 'set_op_rhs', 3, | ||
| 1274 | sub | ||
| 1275 | #line 232 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1276 | { | ||
| 1277 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | ||
| 1278 | $lc->values( $_[3] ); | ||
| 1279 | return $lc; | ||
| 1280 | } | ||
| 1281 | ], | ||
| 1282 | [#Rule 47 | ||
| 1283 | 'set_op_rhs', 3, | ||
| 1284 | sub | ||
| 1285 | #line 238 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1286 | { | ||
| 1287 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | ||
| 1288 | $lc->values( $_[3] ); | ||
| 1289 | return $lc; | ||
| 1290 | } | ||
| 1291 | ], | ||
| 1292 | [#Rule 48 | ||
| 1293 | 'set_op_rhs', 3, | ||
| 1294 | sub | ||
| 1295 | #line 244 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1296 | { | ||
| 1297 | my $lc = OPTIMADE::Filter::ListComparison->new( "$_[1] $_[2]" ); | ||
| 1298 | $lc->values( $_[3] ); | ||
| 1299 | return $lc; | ||
| 1300 | } | ||
| 1301 | ], | ||
| 1302 | [#Rule 49 | ||
| 1303 | 'set_zip_op_rhs', 3, | ||
| 1304 | sub | ||
| 1305 | #line 252 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1306 | { | ||
| 1307 | $_[1]->operator( $_[2] ); | ||
| 1308 | $_[1]->values( [ $_[3] ] ); | ||
| 1309 | return $_[1]; | ||
| 1310 | } | ||
| 1311 | ], | ||
| 1312 | [#Rule 50 | ||
| 1313 | 'set_zip_op_rhs', 4, | ||
| 1314 | sub | ||
| 1315 | #line 258 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1316 | { | ||
| 1317 | $_[1]->operator( "$_[2] $_[3]" ); | ||
| 1318 | $_[1]->values( $_[4] ); | ||
| 1319 | return $_[1]; | ||
| 1320 | } | ||
| 1321 | ], | ||
| 1322 | [#Rule 51 | ||
| 1323 | 'set_zip_op_rhs', 4, | ||
| 1324 | sub | ||
| 1325 | #line 264 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1326 | { | ||
| 1327 | $_[1]->operator( "$_[2] $_[3]" ); | ||
| 1328 | $_[1]->values( $_[4] ); | ||
| 1329 | return $_[1]; | ||
| 1330 | } | ||
| 1331 | ], | ||
| 1332 | [#Rule 52 | ||
| 1333 | 'set_zip_op_rhs', 4, | ||
| 1334 | sub | ||
| 1335 | #line 270 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1336 | { | ||
| 1337 | $_[1]->operator( "$_[2] $_[3]" ); | ||
| 1338 | $_[1]->values( $_[4] ); | ||
| 1339 | return $_[1]; | ||
| 1340 | } | ||
| 1341 | ], | ||
| 1342 | [#Rule 53 | ||
| 1343 | 'property_zip_addon', 2, | ||
| 1344 | sub | ||
| 1345 | #line 278 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1346 | { | ||
| 1347 | my $zip = OPTIMADE::Filter::Zip->new; | ||
| 1348 | $zip->push_property( $_[2] ); | ||
| 1349 | return $zip; | ||
| 1350 | } | ||
| 1351 | ], | ||
| 1352 | [#Rule 54 | ||
| 1353 | 'property_zip_addon', 3, | ||
| 1354 | sub | ||
| 1355 | #line 284 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1356 | { | ||
| 1357 | $_[1]->push_property( $_[3] ); | ||
| 1358 | return $_[1]; | ||
| 1359 | } | ||
| 1360 | ], | ||
| 1361 | [#Rule 55 | ||
| 1362 | 'length_op_rhs', 2, | ||
| 1363 | sub | ||
| 1364 | #line 291 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1365 | { | ||
| 1366 | my $cmp = OPTIMADE::Filter::ListComparison->new( $_[1] ); | ||
| 1367 | $cmp->values( [ [ '=', $_[2] ] ] ); | ||
| 1368 | return $cmp; | ||
| 1369 | } | ||
| 1370 | ], | ||
| 1371 | [#Rule 56 | ||
| 1372 | 'length_op_rhs', 3, | ||
| 1373 | sub | ||
| 1374 | #line 297 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1375 | { | ||
| 1376 | my $cmp = OPTIMADE::Filter::ListComparison->new( $_[1] ); | ||
| 1377 | $cmp->values( [ [ $_[2], $_[3] ] ] ); | ||
| 1378 | return $cmp; | ||
| 1379 | } | ||
| 1380 | ], | ||
| 1381 | [#Rule 57 | ||
| 1382 | 'property', 1, | ||
| 1383 | sub | ||
| 1384 | #line 307 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1385 | { | ||
| 1386 | return OPTIMADE::Filter::Property->new( $_[1] ); | ||
| 1387 | } | ||
| 1388 | ], | ||
| 1389 | [#Rule 58 | ||
| 1390 | 'property', 3, | ||
| 1391 | sub | ||
| 1392 | #line 311 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1393 | { | ||
| 1394 | push @{$_[1]}, $_[3]; | ||
| 1395 | return $_[1]; | ||
| 1396 | } | ||
| 1397 | ], | ||
| 1398 | [#Rule 59 | ||
| 1399 | 'openingbrace', 1, undef | ||
| 1400 | ], | ||
| 1401 | [#Rule 60 | ||
| 1402 | 'closingbrace', 1, undef | ||
| 1403 | ], | ||
| 1404 | [#Rule 61 | ||
| 1405 | 'dot', 1, undef | ||
| 1406 | ], | ||
| 1407 | [#Rule 62 | ||
| 1408 | 'comma', 1, undef | ||
| 1409 | ], | ||
| 1410 | [#Rule 63 | ||
| 1411 | 'colon', 1, undef | ||
| 1412 | ], | ||
| 1413 | [#Rule 64 | ||
| 1414 | 'operator', 1, undef | ||
| 1415 | ], | ||
| 1416 | [#Rule 65 | ||
| 1417 | 'operator', 2, | ||
| 1418 | sub | ||
| 1419 | #line 333 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1420 | { | ||
| 1421 | return join( '', @_[1..$#_] ); | ||
| 1422 | } | ||
| 1423 | ], | ||
| 1424 | [#Rule 66 | ||
| 1425 | 'operator', 1, undef | ||
| 1426 | ], | ||
| 1427 | [#Rule 67 | ||
| 1428 | 'operator', 2, | ||
| 1429 | sub | ||
| 1430 | #line 338 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1431 | { | ||
| 1432 | return join( '', @_[1..$#_] ); | ||
| 1433 | } | ||
| 1434 | ], | ||
| 1435 | [#Rule 68 | ||
| 1436 | 'operator', 1, undef | ||
| 1437 | ], | ||
| 1438 | [#Rule 69 | ||
| 1439 | 'operator', 2, | ||
| 1440 | sub | ||
| 1441 | #line 343 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1442 | { | ||
| 1443 | return join( '', @_[1..$#_] ); | ||
| 1444 | } | ||
| 1445 | ] | ||
| 1446 | ], | ||
| 1447 | @_); | ||
| 1448 | bless($self,$class); | ||
| 1449 | } | ||
| 1450 | |||
| 1451 | #line 348 "lib/OPTIMADE/Filter/Parser.yp" | ||
| 1452 | |||
| 1453 | |||
| 1454 | # Footer section | ||
| 1455 | |||
| 1456 | sub _Error | ||
| 1457 | { | ||
| 1458 | my( $self ) = @_; | ||
| 1459 | close $self->{USER}{FILEIN} if $self->{USER}{FILEIN}; | ||
| 1460 | my $msg = "$0: syntax error at line $self->{USER}{LINENO}, " . | ||
| 1461 | "position $self->{USER}{CHARNO}"; | ||
| 1462 | if( $self->YYData->{INPUT} ) { | ||
| 1463 | $self->YYData->{INPUT} =~ s/\n$//; | ||
| 1464 | die "$msg: '" . $self->YYData->{INPUT} . "'.\n"; | ||
| 1465 | } else { | ||
| 1466 | die "$msg.\n"; | ||
| 1467 | } | ||
| 1468 | } | ||
| 1469 | |||
| 1470 | sub _Lexer | ||
| 1471 | { | ||
| 1472 | my( $self ) = @_; | ||
| 1473 | |||
| 1474 | # If the line is empty and the input is originating from the file, | ||
| 1475 | # another line is read. | ||
| 1476 | if( !$self->YYData->{INPUT} && $self->{USER}{FILEIN} ) { | ||
| 1477 | my $filein = $self->{USER}{FILEIN}; | ||
| 1478 | $self->YYData->{INPUT} = <$filein>; | ||
| 1479 | $self->{USER}{LINENO} = -1 unless exists $self->{USER}{LINENO}; | ||
| 1480 | $self->{USER}{LINENO}++; | ||
| 1481 | $self->{USER}{CHARNO} = 0; | ||
| 1482 | } | ||
| 1483 | |||
| 1484 | $self->YYData->{INPUT} =~ s/^(\s+)//; | ||
| 1485 | $self->{USER}{CHARNO} += length( $1 ) if defined $1; | ||
| 1486 | |||
| 1487 | # Escaped double quote or backslash are detected here and returned | ||
| 1488 | # as is to the caller in order to be detected as syntax errors. | ||
| 1489 | if( $self->YYData->{INPUT} =~ s/^(\\"|\\\\)// ) { | ||
| 1490 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1491 | return( $1, $1 ); | ||
| 1492 | } | ||
| 1493 | |||
| 1494 | # Handling strings | ||
| 1495 | if( $self->YYData->{INPUT} =~ s/^"// ) { | ||
| 1496 | $self->{USER}{CHARNO} ++; | ||
| 1497 | my $string = ''; | ||
| 1498 | while( 1 ) { | ||
| 1499 | if( $self->YYData->{INPUT} =~ | ||
| 1500 | s/^([A-Za-z_0-9 \t!#\$\%&\'\(\)\*\+,\-\.\/\:;<=>\?@\[\]\^`\{\|\}\~\P{ASCII}]+)// ) { | ||
| 1501 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1502 | $string .= $1; | ||
| 1503 | } elsif( $self->YYData->{INPUT} =~ s/^\\([\\"])// ) { | ||
| 1504 | $self->{USER}{CHARNO} ++; | ||
| 1505 | $string .= $1; | ||
| 1506 | next; | ||
| 1507 | } elsif( $self->YYData->{INPUT} =~ s/^"// ) { | ||
| 1508 | $self->{USER}{CHARNO} ++; | ||
| 1509 | return( 'string', $string ); | ||
| 1510 | } else { | ||
| 1511 | return( undef, undef ); | ||
| 1512 | } | ||
| 1513 | } | ||
| 1514 | } | ||
| 1515 | |||
| 1516 | # Handling identifiers | ||
| 1517 | if( $self->YYData->{INPUT} =~ s/^([a-z_][a-z0-9_]*)// ) { | ||
| 1518 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1519 | return( 'identifier', $1 ); | ||
| 1520 | } | ||
| 1521 | |||
| 1522 | # Handling boolean relations | ||
| 1523 | if( $self->YYData->{INPUT} =~ s/^(AND|NOT|OR| | ||
| 1524 | IS|UNKNOWN|KNOWN| | ||
| 1525 | CONTAINS|STARTS|ENDS|WITH| | ||
| 1526 | LENGTH|HAS|ALL|ONLY|ANY)//x ) { | ||
| 1527 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1528 | return( $1, $1 ); | ||
| 1529 | } | ||
| 1530 | |||
| 1531 | # Handling LIKE operator if allowed | ||
| 1532 | if( $allow_LIKE_operator && $self->YYData->{INPUT} =~ s/^(LIKE)// ) { | ||
| 1533 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1534 | return( $1, $1 ); | ||
| 1535 | } | ||
| 1536 | |||
| 1537 | # Handling numbers | ||
| 1538 | if( $self->YYData->{INPUT} =~ s/^([+-]? | ||
| 1539 | (\d+\.?\d*|\.\d+) | ||
| 1540 | ([eE][+-]?\d+)?)//x ) { | ||
| 1541 | $self->{USER}{CHARNO} += length( $1 ); | ||
| 1542 | return( 'number', $1 ); | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | my $char = substr( $self->YYData->{INPUT}, 0, 1 ); | ||
| 1546 | if( $char ne '' ) { | ||
| 1547 | $self->YYData->{INPUT} = substr( $self->YYData->{INPUT}, 1 ); | ||
| 1548 | } | ||
| 1549 | $self->{USER}{CHARNO}++; | ||
| 1550 | return( $char, $char ); | ||
| 1551 | } | ||
| 1552 | |||
| 1553 | sub Run | ||
| 1554 | { | ||
| 1555 | my( $self, $filename ) = @_; | ||
| 1556 | open $self->{USER}{FILEIN}, $filename; | ||
| 1557 | my $result = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); | ||
| 1558 | close $self->{USER}{FILEIN}; | ||
| 1559 | return $result; | ||
| 1560 | } | ||
| 1561 | |||
| 1562 | sub parse_string | ||
| 1563 | { | ||
| 1564 | my( $self, $string ) = @_; | ||
| 1565 | $self->YYData->{INPUT} = $string; | ||
| 1566 | $self->{USER}{LINENO} = 0; | ||
| 1567 | $self->{USER}{CHARNO} = 0; | ||
| 1568 | return $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error ); | ||
| 1569 | } | ||
| 1570 | |||
| 1571 | sub modify | ||
| 1572 | { | ||
| 1573 | my $node = shift; | ||
| 1574 | my $code = shift; | ||
| 1575 | |||
| 1576 | if( blessed $node && $node->can( 'modify' ) ) { | ||
| 1577 | return $node->modify( $code, @_ ); | ||
| 1578 | } elsif( ref $node eq 'ARRAY' ) { | ||
| 1579 | return [ map { modify( $_, $code, @_ ) } @$node ]; | ||
| 1580 | } else { | ||
| 1581 | return $code->( $node, @_ ); | ||
| 1582 | } | ||
| 1583 | } | ||
| 1584 | |||
| 1585 | 1; | ||
| 1586 | |||
| 1587 | 1; | ||