| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
package net.sf.saxon.expr.parser; |
| 9 |
|
| 10 |
import java.util.HashMap; |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
public abstract class Token { |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
public static final int EOF = 0; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public static final int UNION = 1; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public static final int SLASH = 2; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
public static final int AT = 3; |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
public static final int LSQB = 4; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public static final int LPAR = 5; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
public static final int EQUALS = 6; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public static final int COMMA = 7; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public static final int SLASH_SLASH = 8; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
public static final int OR = 9; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
public static final int AND = 10; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
public static final int GT = 11; |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
public static final int LT = 12; |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public static final int GE = 13; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public static final int LE = 14; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
public static final int PLUS = 15; |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
public static final int MINUS = 16; |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
public static final int MULT = 17; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
public static final int DIV = 18; |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
public static final int MOD = 19; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
public static final int IS = 20; |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
public static final int DOLLAR = 21; |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
public static final int NE = 22; |
| 117 |
|
| 118 |
|
| 119 |
|
| 120 |
public static final int INTERSECT = 23; |
| 121 |
|
| 122 |
|
| 123 |
|
| 124 |
public static final int EXCEPT = 24; |
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
public static final int RETURN = 25; |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
public static final int THEN = 26; |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
public static final int ELSE = 27; |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
public static final int WHERE = 28; |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
public static final int TO = 29; |
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
public static final int CONCAT = 30; |
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
public static final int IN = 31; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
public static final int SOME = 32; |
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
public static final int EVERY = 33; |
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
public static final int SATISFIES = 34; |
| 165 |
|
| 166 |
|
| 167 |
|
| 168 |
public static final int FUNCTION = 35; |
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
|
| 173 |
public static final int AXIS = 36; |
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
public static final int IF = 37; |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
public static final int PRECEDES = 38; |
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
public static final int FOLLOWS = 39; |
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
public static final int BANG = 40; |
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
public static final int COLONCOLON = 41; |
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
public static final int COLONSTAR = 42; |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
public static final int NAMED_FUNCTION_REF = 43; |
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
public static final int HASH = 44; |
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
public static final int INSTANCE_OF = 45; |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
public static final int CAST_AS = 46; |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
public static final int TREAT_AS = 47; |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
public static final int TILDE = 48; |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
public static final int PILCROW = 49; |
| 226 |
|
| 227 |
|
| 228 |
|
| 229 |
public static final int FEQ = 50; |
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
public static final int FNE = 51; |
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
public static final int FGT = 52; |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
public static final int FLT = 53; |
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
public static final int FGE = 54; |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
public static final int FLE = 55; |
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
public static final int IDIV = 56; |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
public static final int CASTABLE_AS = 57; |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
public static final int ASSIGN = 58; |
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
public static final int LCURLY = 59; |
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
public static final int KEYWORD_CURLY = 60; |
| 270 |
|
| 271 |
|
| 272 |
|
| 273 |
public static final int ELEMENT_QNAME = 61; |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
public static final int ATTRIBUTE_QNAME = 62; |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
public static final int PI_QNAME = 63; |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
public static final int NAMESPACE_QNAME = 64; |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
public static final int TYPESWITCH = 65; |
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
public static final int SWITCH = 66; |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
public static final int CASE = 67; |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
public static final int MODIFY = 68; |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
public static final int NODEKIND = 69; |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
public static final int SUFFIX = 70; |
| 311 |
|
| 312 |
|
| 313 |
|
| 314 |
public static final int AS = 71; |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
public static final int GROUP_BY = 72; |
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
public static final int FOR_TUMBLING = 73; |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
public static final int FOR_SLIDING = 74; |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
public static final int COLON = 75; |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
public static final int ARROW = 76; |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
public static final int STRING_TEMPLATE_INITIAL = 77; |
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
public static final int STRING_TEMPLATE_INTERMEDIATE = 78; |
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
public static final int AND_ALSO = 79; |
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
public static final int OR_ELSE = 80; |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
public static final int XQUERY_VERSION = 88; |
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
public static final int XQUERY_ENCODING = 89; |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
public static final int DECLARE_NAMESPACE = 90; |
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
public static final int DECLARE_DEFAULT = 91; |
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
public static final int DECLARE_CONSTRUCTION = 92; |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
public static final int DECLARE_BASEURI = 93; |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
public static final int DECLARE_BOUNDARY_SPACE = 94; |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
public static final int DECLARE_DECIMAL_FORMAT = 95; |
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
public static final int IMPORT_SCHEMA = 96; |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
public static final int IMPORT_MODULE = 97; |
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
public static final int DECLARE_VARIABLE = 98; |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
public static final int DECLARE_CONTEXT = 99; |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
public static final int DECLARE_FUNCTION = 100; |
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
public static final int MODULE_NAMESPACE = 101; |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
public static final int VALIDATE = 102; |
| 420 |
public static final int VALIDATE_STRICT = 103; |
| 421 |
public static final int VALIDATE_LAX = 104; |
| 422 |
public static final int VALIDATE_TYPE = 105; |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
public static final int PERCENT = 106; |
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
public static final int DECLARE_ORDERING = 107; |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
public static final int DECLARE_COPY_NAMESPACES = 108; |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
public static final int DECLARE_OPTION = 109; |
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
public static final int DECLARE_REVALIDATION = 110; |
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
public static final int INSERT_NODE = 111; |
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
public static final int DELETE_NODE = 112; |
| 453 |
|
| 454 |
|
| 455 |
|
| 456 |
public static final int REPLACE_NODE = 113; |
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
public static final int REPLACE_VALUE = 114; |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
public static final int RENAME_NODE = 115; |
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
public static final int FIRST_INTO = 116; |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
public static final int LAST_INTO = 117; |
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
public static final int AFTER = 118; |
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
public static final int BEFORE = 119; |
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
public static final int INTO = 120; |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
public static final int WITH = 121; |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
public static final int DECLARE_UPDATING = 122; |
| 493 |
|
| 494 |
|
| 495 |
|
| 496 |
public static final int DECLARE_ANNOTATED = 123; |
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
public static final int DECLARE_TYPE = 124; |
| 501 |
|
| 502 |
|
| 503 |
|
| 504 |
public static final int SEMICOLON = 149; |
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
static int LAST_OPERATOR = 150; |
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
public static final int NAME = 201; |
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
public static final int STRING_LITERAL = 202; |
| 523 |
|
| 524 |
|
| 525 |
|
| 526 |
public static final int RSQB = 203; |
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
public static final int RPAR = 204; |
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
public static final int DOT = 205; |
| 535 |
|
| 536 |
|
| 537 |
|
| 538 |
public static final int DOTDOT = 206; |
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
public static final int STAR = 207; |
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
public static final int PREFIX = 208; |
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
public static final int NUMBER = 209; |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
public static final int FOR = 211; |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
public static final int DEFAULT = 212; |
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
public static final int QMARK = 213; |
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
public static final int RCURLY = 215; |
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
public static final int LET = 216; |
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
public static final int TAG = 217; |
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
public static final int PRAGMA = 218; |
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
public static final int COPY = 219; |
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
public static final int COUNT = 220; |
| 591 |
|
| 592 |
|
| 593 |
|
| 594 |
public static final int STRING_TEMPLATE_FINAL = 221; |
| 595 |
|
| 596 |
|
| 597 |
|
| 598 |
public static final int STRING_TEMPLATE_COMPLETE = 222; |
| 599 |
|
| 600 |
|
| 601 |
|
| 602 |
|
| 603 |
public static final int NEGATE = 299; |
| 604 |
|
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
public final static String[] tokens = new String[300]; |
| 612 |
|
| 613 |
static { |
| 614 |
tokens[EOF] = "<eof>"; |
| 615 |
tokens[UNION] = "|"; |
| 616 |
tokens[SLASH] = "/"; |
| 617 |
tokens[AT] = "@"; |
| 618 |
tokens[TILDE] = "~"; |
| 619 |
tokens[LSQB] = "["; |
| 620 |
tokens[LPAR] = "("; |
| 621 |
tokens[EQUALS] = "="; |
| 622 |
tokens[COMMA] = ","; |
| 623 |
tokens[SLASH_SLASH] = "//"; |
| 624 |
tokens[OR] = "or"; |
| 625 |
tokens[AND] = "and"; |
| 626 |
tokens[GT] = ">"; |
| 627 |
tokens[LT] = "<"; |
| 628 |
tokens[GE] = ">="; |
| 629 |
tokens[LE] = "<="; |
| 630 |
tokens[PLUS] = "+"; |
| 631 |
tokens[MINUS] = "-"; |
| 632 |
tokens[MULT] = "*"; |
| 633 |
tokens[DIV] = "div"; |
| 634 |
tokens[MOD] = "mod"; |
| 635 |
tokens[IS] = "is"; |
| 636 |
tokens[DOLLAR] = "$"; |
| 637 |
tokens[NE] = "!="; |
| 638 |
tokens[BANG] = "!"; |
| 639 |
tokens[CONCAT] = "||"; |
| 640 |
tokens[INTERSECT] = "intersect"; |
| 641 |
tokens[EXCEPT] = "except"; |
| 642 |
tokens[RETURN] = "return"; |
| 643 |
tokens[THEN] = "then"; |
| 644 |
tokens[ELSE] = "else"; |
| 645 |
tokens[TO] = "to"; |
| 646 |
tokens[IN] = "in"; |
| 647 |
tokens[SOME] = "some"; |
| 648 |
tokens[EVERY] = "every"; |
| 649 |
tokens[SATISFIES] = "satisfies"; |
| 650 |
tokens[FUNCTION] = "<function>("; |
| 651 |
tokens[AXIS] = "<axis>"; |
| 652 |
tokens[IF] = "if("; |
| 653 |
tokens[PRECEDES] = "<<"; |
| 654 |
tokens[FOLLOWS] = ">>"; |
| 655 |
tokens[COLONCOLON] = "::"; |
| 656 |
tokens[COLONSTAR] = ":*"; |
| 657 |
tokens[HASH] = "#"; |
| 658 |
tokens[INSTANCE_OF] = "instance of"; |
| 659 |
tokens[CAST_AS] = "cast as"; |
| 660 |
tokens[TREAT_AS] = "treat as"; |
| 661 |
tokens[FEQ] = "eq"; |
| 662 |
tokens[FNE] = "ne"; |
| 663 |
tokens[FGT] = "gt"; |
| 664 |
tokens[FGE] = "ge"; |
| 665 |
tokens[FLT] = "lt"; |
| 666 |
tokens[FLE] = "le"; |
| 667 |
tokens[IDIV] = "idiv"; |
| 668 |
tokens[CASTABLE_AS] = "castable as"; |
| 669 |
tokens[ASSIGN] = ":="; |
| 670 |
tokens[SWITCH] = "switch"; |
| 671 |
tokens[TYPESWITCH] = "typeswitch"; |
| 672 |
tokens[CASE] = "case"; |
| 673 |
tokens[DEFAULT] = "default"; |
| 674 |
|
| 675 |
|
| 676 |
tokens[AFTER] = "after"; |
| 677 |
tokens[BEFORE] = "before"; |
| 678 |
tokens[INTO] = "into"; |
| 679 |
tokens[WITH] = "with"; |
| 680 |
tokens[MODIFY] = "modify"; |
| 681 |
tokens[AS] = "as"; |
| 682 |
tokens[PILCROW] = "\u00B6"; |
| 683 |
|
| 684 |
tokens[COLON] = ":"; |
| 685 |
tokens[ARROW] = "=>"; |
| 686 |
tokens[AND_ALSO] = "andAlso"; |
| 687 |
tokens[OR_ELSE] = "orElse"; |
| 688 |
tokens[STRING_TEMPLATE_INITIAL] = "``[<string>`{"; |
| 689 |
tokens[STRING_TEMPLATE_INTERMEDIATE] = "}`<string>`{"; |
| 690 |
tokens[STRING_TEMPLATE_FINAL] = "}`<string>]``"; |
| 691 |
tokens[STRING_TEMPLATE_COMPLETE] = "``[<string>]``"; |
| 692 |
|
| 693 |
tokens[NAME] = "<name>"; |
| 694 |
tokens[STRING_LITERAL] = "<string-literal>"; |
| 695 |
tokens[RSQB] = "]"; |
| 696 |
tokens[RPAR] = ")"; |
| 697 |
tokens[DOT] = "."; |
| 698 |
tokens[DOTDOT] = ".."; |
| 699 |
tokens[STAR] = "*"; |
| 700 |
tokens[PREFIX] = "<prefix:*>"; |
| 701 |
tokens[NUMBER] = "<numeric-literal>"; |
| 702 |
tokens[NODEKIND] = "<node-type>()"; |
| 703 |
tokens[FOR] = "for"; |
| 704 |
tokens[SUFFIX] = "<*:local-name>"; |
| 705 |
tokens[QMARK] = "?"; |
| 706 |
tokens[LCURLY] = "{"; |
| 707 |
tokens[KEYWORD_CURLY] = "<keyword> {"; |
| 708 |
tokens[RCURLY] = "}"; |
| 709 |
tokens[LET] = "let"; |
| 710 |
tokens[VALIDATE] = "validate {"; |
| 711 |
tokens[TAG] = "<element>"; |
| 712 |
tokens[PRAGMA] = "(# ... #)"; |
| 713 |
tokens[SEMICOLON] = ";"; |
| 714 |
tokens[COPY] = "copy"; |
| 715 |
tokens[NEGATE] = "-"; |
| 716 |
tokens[PERCENT] = "%"; |
| 717 |
} |
| 718 |
|
| 719 |
|
| 720 |
|
| 721 |
|
| 722 |
public static HashMap<String, Integer> doubleKeywords = new HashMap<String, Integer>(30); |
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
public static final int UNKNOWN = -1; |
| 727 |
|
| 728 |
private Token() { |
| 729 |
} |
| 730 |
|
| 731 |
static { |
| 732 |
mapDouble("instance of", INSTANCE_OF); |
| 733 |
mapDouble("cast as", CAST_AS); |
| 734 |
mapDouble("treat as", TREAT_AS); |
| 735 |
mapDouble("castable as", CASTABLE_AS); |
| 736 |
mapDouble("group by", GROUP_BY); |
| 737 |
mapDouble("for tumbling", FOR_TUMBLING); |
| 738 |
mapDouble("for sliding", FOR_SLIDING); |
| 739 |
mapDouble("xquery version", XQUERY_VERSION); |
| 740 |
mapDouble("xquery encoding", XQUERY_ENCODING); |
| 741 |
mapDouble("declare namespace", DECLARE_NAMESPACE); |
| 742 |
mapDouble("declare default", DECLARE_DEFAULT); |
| 743 |
mapDouble("declare construction", DECLARE_CONSTRUCTION); |
| 744 |
mapDouble("declare base-uri", DECLARE_BASEURI); |
| 745 |
mapDouble("declare boundary-space", DECLARE_BOUNDARY_SPACE); |
| 746 |
mapDouble("declare decimal-format", DECLARE_DECIMAL_FORMAT); |
| 747 |
mapDouble("declare ordering", DECLARE_ORDERING); |
| 748 |
mapDouble("declare copy-namespaces", DECLARE_COPY_NAMESPACES); |
| 749 |
mapDouble("declare option", DECLARE_OPTION); |
| 750 |
mapDouble("declare revalidation", DECLARE_REVALIDATION); |
| 751 |
mapDouble("declare type", DECLARE_TYPE); |
| 752 |
mapDouble("import schema", IMPORT_SCHEMA); |
| 753 |
mapDouble("import module", IMPORT_MODULE); |
| 754 |
mapDouble("declare variable", DECLARE_VARIABLE); |
| 755 |
mapDouble("declare context", DECLARE_CONTEXT); |
| 756 |
mapDouble("declare function", DECLARE_FUNCTION); |
| 757 |
mapDouble("declare updating", DECLARE_UPDATING); |
| 758 |
mapDouble("module namespace", MODULE_NAMESPACE); |
| 759 |
mapDouble("validate strict", VALIDATE_STRICT); |
| 760 |
mapDouble("validate lax", VALIDATE_LAX); |
| 761 |
mapDouble("validate type", VALIDATE_TYPE); |
| 762 |
mapDouble("insert node", INSERT_NODE); |
| 763 |
mapDouble("insert nodes", INSERT_NODE); |
| 764 |
mapDouble("delete node", DELETE_NODE); |
| 765 |
mapDouble("delete nodes", DELETE_NODE); |
| 766 |
mapDouble("replace node", REPLACE_NODE); |
| 767 |
mapDouble("replace value", REPLACE_VALUE); |
| 768 |
mapDouble("rename node", RENAME_NODE); |
| 769 |
mapDouble("rename nodes", RENAME_NODE); |
| 770 |
mapDouble("first into", FIRST_INTO); |
| 771 |
mapDouble("last into", LAST_INTO); |
| 772 |
} |
| 773 |
|
| 774 |
private static void mapDouble(String doubleKeyword, int token) { |
| 775 |
doubleKeywords.put(doubleKeyword, token); |
| 776 |
tokens[token] = doubleKeyword; |
| 777 |
} |
| 778 |
|
| 779 |
|
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
public static int inverse(int operator) { |
| 788 |
switch (operator) { |
| 789 |
case LT: |
| 790 |
return GT; |
| 791 |
case LE: |
| 792 |
return GE; |
| 793 |
case GT: |
| 794 |
return LT; |
| 795 |
case GE: |
| 796 |
return LE; |
| 797 |
case FLT: |
| 798 |
return FGT; |
| 799 |
case FLE: |
| 800 |
return FGE; |
| 801 |
case FGT: |
| 802 |
return FLT; |
| 803 |
case FGE: |
| 804 |
return FLE; |
| 805 |
default: |
| 806 |
return operator; |
| 807 |
} |
| 808 |
} |
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
|
| 817 |
|
| 818 |
public static int negate(int operator) { |
| 819 |
switch (operator) { |
| 820 |
case FEQ: |
| 821 |
return FNE; |
| 822 |
case FNE: |
| 823 |
return FEQ; |
| 824 |
case FLT: |
| 825 |
return FGE; |
| 826 |
case FLE: |
| 827 |
return FGT; |
| 828 |
case FGT: |
| 829 |
return FLE; |
| 830 |
case FGE: |
| 831 |
return FLT; |
| 832 |
default: |
| 833 |
throw new IllegalArgumentException("Invalid operator for negate()"); |
| 834 |
} |
| 835 |
} |
| 836 |
|
| 837 |
public static boolean isOrderedOperator(int operator) { |
| 838 |
return operator != FEQ && operator != FNE; |
| 839 |
} |
| 840 |
} |
| 841 |
|