001// lexical analyzer for GSQLParser component java version 002 003/**************************************************** 004 Lexical analizer for GSQLParser Java component 005 Copyright (c) 2004-2024 by Gudu software 006****************************************************/ 007 008package gudusoft.gsqlparser; 009 010import java.util.HashMap; 011import java.io.InputStreamReader; 012 013import java.util.Locale; 014import java.io.BufferedReader; 015import java.io.IOException; 016 017 018public class TLexerDb2 extends TCustomLexer{ 019 020 static int yynmarks = 0 ; 021 static int yynmatches ; 022 static int yyntrans ; 023 static int yynstates ; 024 static int[] yyk,yym ; // 1 based 025 static int[] yytint; // 1 based 026 static TYytRec[] yyt ; // 1 based 027 static int[] yykl,yykh,yyml,yymh,yytl,yyth ; // 0 based 028 private static String[] keywordlist; 029 static String table_file; 030 static HashMap<String, Integer> keywordValueList; 031 static HashMap<Integer, Integer> keywordTypeList; 032 static int[][] yystateTable; 033 034 static { 035 keywordValueList = new HashMap<String, Integer>(); 036 keywordTypeList = new HashMap<Integer, Integer>(); 037 table_file = "/gudusoft/gsqlparser/parser/db2/db2_lex_table.txt"; 038 if (TBaseType.enterprise_edition||TBaseType.db2_edition){ 039 inittable(); 040 } 041 } 042 043 TLexerDb2(){ 044 super(); 045 dbvendor = EDbVendor.dbvdb2; 046 } 047 048public boolean canBeColumnName(int tokencode){ 049 //http://blog.csdn.net/superbeck/article/details/5387476 050 boolean ret = false; 051 int modifiers = keyword_type_identifier | keyword_type_column ; 052 Integer s = keywordTypeList.get(tokencode); 053 if (s != null){ 054 int modifier = s; 055 ret = (modifiers & modifier) == modifier; 056 } 057 058 return ret; 059} 060 061 public int iskeyword(String str){ 062 int ret = -1; 063 Integer s = keywordValueList.get(str.toUpperCase(Locale.ENGLISH)); 064 if( s != null){ 065 ret = s; 066 } 067 return ret;// -1 means not a keyword 068 } 069 070 public int getkeywordvalue(String keyword){ 071 int ret = 0; 072 Integer s = keywordValueList.get(keyword.toUpperCase(Locale.ENGLISH)); 073 if( s != null){ 074 ret = s; 075 } 076 return ret;// 0 means not a keyword 077 } 078 079 public static EKeywordType getKeywordType(String keyword){ 080 return TCustomLexer.getKeywordType(keyword,keywordValueList,keywordTypeList); 081 } 082 083 static void yystateLookupConfigure() { 084 int yystates = yytl.length; 085 yystateTable = new int[257][yystates]; 086 087 // initialize to empty 088 for(int i = 0; i < yystates; i++) { 089 for (int j = 0; j < 257; j++) 090 yystateTable[j][i] = -1; 091 } 092 093 for(int i = 0; i < yystates; i++) { 094 int low = yytl[i]; 095 int high = yyth[i]; 096 for (int j = low; j <= high; j++) { 097 for (char c: yyt[j].cc) { 098 yystateTable[c][i] = j; 099 } 100 } 101 } 102 } 103 104 int yylex(){ 105 int yyn; 106 while (true) { // top level while 107 yynew(); 108 while (true){ //scan 109 for(yyn = yykl[yystate]; yyn <= yykh[yystate]; yyn++){ 110 yymark(yyk[yyn]); 111 } 112 113 for(yyn=yymh[yystate]; yyn>= yyml[yystate]; yyn--){ 114 yymatch(yym[yyn]); 115 } 116 117 if(yytl[yystate] > yyth[yystate]){ 118 break; 119 } 120 121 yyscan(); 122// yyn = yytl[yystate]; 123 totablechar(); 124// while( (yyn <= yyth[yystate]) && (!(charinarray(yytablechar,yyt[yyn].cc))) ){ 125// yyn++; 126// } 127// if (yyn > yyth[yystate]){ 128// break; 129// } 130 131 yyn = yystateTable[yytablechar][yystate]; 132 if (yyn == -1) 133 break; 134 135 yystate = yyt[yyn].s; 136 } //scan 137 138 while (true){ //action 139 int yyrule; 140 if ( (yyrule = yyfind()) != -1 ){ 141 yyaction(yyrule); 142 if (yyreject){ 143 continue; 144 } 145 }else if( (!yydefault() ) && (yywrap()) ){ 146 yyclear(); 147 returni(0); 148 } 149 break; 150 } 151 152 if (!yydone) { 153 continue; 154 } 155 break; 156 } // top level while 157 158 return yyretval; 159 } 160 161 static void inittable(){ 162 163 //if (yynmarks > 0) return; //init table already 164 165 String line; 166 boolean inyyk=false,inyym=false,inyykl=false,inyykh=false,inyyml=false,inyymh=false,inyytl=false,inyyth=false,inyytint=false,inyyt=false,inkeyword=false; 167 int yyk_count=0,yym_count=0,yykl_count=0,yykh_count=0,yyml_count=0,yymh_count=0,yytl_count=0,yyth_count=0,yytint_count=0,yyt_count=0; 168 int c=0; 169 keywordValueList.clear(); 170 keywordTypeList.clear(); 171 172 BufferedReader br = new BufferedReader(new InputStreamReader(TLexerDb2.class.getResourceAsStream(table_file))); 173 174 try{ 175 while( (line = br.readLine()) != null){ 176 if (line.trim().startsWith("yynmarks=")){ 177 String[] ss = line.split("[=;]"); 178 yynmarks=Integer.parseInt(ss[1].trim()); 179 yyk = new int[yynmarks+1]; 180 }else if (line.trim().startsWith("yynmatches=")){ 181 String[] ss = line.split("[=;]"); 182 yynmatches=Integer.parseInt(ss[1].trim()); 183 yym = new int[yynmatches+1]; 184 }else if (line.trim().startsWith("yyntrans=")){ 185 String[] ss = line.split("[=;]"); 186 yyntrans=Integer.parseInt(ss[1].trim()); 187 yytint = new int[yyntrans+1]; 188 yyt = new TYytRec[yyntrans+1]; 189 }else if (line.trim().startsWith("yynstates=")){ 190 String[] ss = line.split("[=;]"); 191 yynstates=Integer.parseInt(ss[1].trim()); 192 yykl = new int[yynstates]; 193 yykh = new int[yynstates]; 194 yyml = new int[yynstates]; 195 yymh = new int[yynstates]; 196 yytl = new int[yynstates]; 197 yyth = new int[yynstates]; 198 }else if (line.trim().startsWith("<end>")){ 199 if (inyyk){ 200 inyyk = false; 201 if (yynmarks+1 != yyk_count ){ 202 System.out.println("required1:"+(yynmarks)+" actually:"+(yyk_count-1)); 203 } 204 } 205 else if(inyym){ 206 inyym = false; 207 if (yynmatches+1 != yym_count ){ 208 System.out.println("required2:"+(yynmatches)+" actually:"+(yym_count-1)); 209 } 210 } 211 else if(inyykl){ 212 inyykl = false; 213 if (yynstates != yykl_count ){ 214 System.out.println("required3:"+(yynstates)+" actually:"+(yykl_count)); 215 } 216 } 217 else if(inyykh){ 218 inyykh = false; 219 if (yynstates != yykh_count ){ 220 System.out.println("required4:"+(yynstates)+" actually:"+(yykh_count)); 221 } 222 } 223 else if(inyyml){ 224 inyyml = false; 225 if (yynstates != yyml_count ){ 226 System.out.println("required5:"+(yynstates)+" actually:"+(yyml_count)); 227 } 228 } 229 else if(inyymh){ 230 inyymh = false; 231 if (yynstates != yymh_count ){ 232 System.out.println("required:"+(yynstates)+" actually:"+(yymh_count)); 233 } 234 } 235 else if(inyytl){ 236 inyytl = false; 237 if (yynstates != yytl_count ){ 238 System.out.println("required6:"+(yynstates)+" actually:"+(yytl_count)); 239 } 240 } 241 else if(inyyth){ 242 inyyth = false; 243 if (yynstates != yyth_count ){ 244 System.out.println("required7:"+(yynstates)+" actually:"+(yyth_count)); 245 } 246 } 247 else if(inyytint){ 248 inyytint = false; 249 if (yyntrans + 1 != yytint_count ){ 250 System.out.println("required8:"+(yyntrans)+" actually:"+(yytint_count-1)); 251 } 252 } 253 else if(inyyt){ 254 inyyt = false; 255 if (yyntrans+1 != yyt_count ){ 256 System.out.println("required9:"+(yyntrans)+" actually:"+(yyt_count-1)); 257 } 258 } 259 else if(inkeyword){ 260 inkeyword = false; 261 } 262 }else if(line.trim().startsWith("yyk =")){ 263 inyyk = true; 264 }else if(line.trim().startsWith("yym =")){ 265 inyym = true; 266 }else if(line.trim().startsWith("yykl =")){ 267 inyykl = true; 268 }else if(line.trim().startsWith("yykh =")){ 269 inyykh = true; 270 }else if(line.trim().startsWith("yyml =")){ 271 inyyml = true; 272 }else if(line.trim().startsWith("yymh =")){ 273 inyymh = true; 274 }else if(line.trim().startsWith("yytl =")){ 275 inyytl = true; 276 }else if(line.trim().startsWith("yyth =")){ 277 inyyth = true; 278 }else if(line.trim().startsWith("yytint =")){ 279 inyytint = true; 280 }else if(line.trim().startsWith("yyt =")){ 281 inyyt = true; 282 }else if(line.trim().startsWith("keywordsvalue =")){ 283 inkeyword = true; 284 }else if(inyyk){ 285 String[] ss = line.split("[,]"); 286 for(int j=0;j<ss.length;j++){ 287 // System.out.println(ss[j].trim()); 288 yyk[yyk_count++] = Integer.parseInt(ss[j].trim()); 289 } 290 }else if(inyym){ 291 String[] ss = line.split("[,]"); 292 for(int j=0;j<ss.length;j++){ 293 // System.out.println(ss[j].trim()); 294 yym[yym_count++] = Integer.parseInt(ss[j].trim()); 295 } 296 }else if(inyykl){ 297 String[] ss = line.split("[,]"); 298 for(int j=0;j<ss.length;j++){ 299 // System.out.println(ss[j].trim()); 300 yykl[yykl_count++] = Integer.parseInt(ss[j].trim()); 301 } 302 }else if(inyykh){ 303 String[] ss = line.split("[,]"); 304 for(int j=0;j<ss.length;j++){ 305 // System.out.println(ss[j].trim()); 306 yykh[yykh_count++] = Integer.parseInt(ss[j].trim()); 307 } 308 }else if(inyyml){ 309 String[] ss = line.split("[,]"); 310 for(int j=0;j<ss.length;j++){ 311 // System.out.println(ss[j].trim()); 312 yyml[yyml_count++] = Integer.parseInt(ss[j].trim()); 313 } 314 }else if(inyymh){ 315 String[] ss = line.split("[,]"); 316 for(int j=0;j<ss.length;j++){ 317 // System.out.println(ss[j].trim()); 318 yymh[yymh_count++] = Integer.parseInt(ss[j].trim()); 319 } 320 }else if(inyytl){ 321 String[] ss = line.split("[,]"); 322 for(int j=0;j<ss.length;j++){ 323 // System.out.println(ss[j].trim()); 324 yytl[yytl_count++] = Integer.parseInt(ss[j].trim()); 325 } 326 }else if(inyyth){ 327 String[] ss = line.split("[,]"); 328 for(int j=0;j<ss.length;j++){ 329 // System.out.println(ss[j].trim()); 330 yyth[yyth_count++] = Integer.parseInt(ss[j].trim()); 331 } 332 }else if(inyytint){ 333 String[] ss = line.split("[,]"); 334 for(int j=0;j<ss.length;j++){ 335 // System.out.println(ss[j].trim()); 336 yytint[yytint_count++] = Integer.parseInt(ss[j].trim()); 337 } 338 }else if(inyyt){ 339 //System.out.println(line.trim()); 340 341 c = 0; 342 String[] st = line.trim().split(",,"); 343 char[] tmp = new char[st.length]; 344 for(int i=0;i<st.length;i++){ 345 346 if(st[i].startsWith("\'")) { 347 if(st[i].length() == 3){ // 'a' 348 tmp[c++] = st[i].charAt(1); 349 }else if(st[i].length() == 4) { // '\\' 350 tmp[c++] = st[i].charAt(2); 351 }else{ 352 System.out.println(" read yytstr error, error string is "+st[i]+ "line: "+ yyt_count); 353 } 354 }else{ 355 try{ 356 tmp[c++] = (char)Integer.parseInt(st[i]); // char in number like 32 that represent space 357 } catch (NumberFormatException nfe) { 358 System.out.println("NumberFormatException: " + nfe.getMessage()); 359 } 360 } 361 } //while hasmoreTokens 362 363 //yyt[lineno] = new YYTrec(tmp,yytint[lineno]); 364 yyt[yyt_count] = new TYytRec(tmp,yytint[yyt_count]); 365 yyt_count++; 366 367 }else if(inkeyword){ 368 String[] ss =line.split("[=]"); 369 370 int val1 = -1; 371 int val2 = -1; 372 try { 373 val1 = Integer.parseInt(ss[1]); 374 val2 = Integer.parseInt(ss[2]); 375 } 376 catch (NumberFormatException nfe) { 377 System.out.println("NumberFormatException: " + nfe.getMessage()); 378 } 379 keywordValueList.put(ss[0].toUpperCase(),val1); 380 keywordTypeList.put(val1,val2); 381 382 } 383 } 384 }catch(IOException e){ 385 System.out.println(e.toString()); 386 } 387 388 yystateLookupConfigure(); 389 390 } 391 392 393 394 void yyaction(int yyruleno){ 395 396 397 int ic; 398 char[] tmparray = {'=','+','-','*','/','>','<'}; 399 char[] tmparray2 = {':','&','?'}; 400 401 yylvalstr = getyytext(); 402 /* actions: */ 403 switch(yyruleno){ 404 case 1: 405 406 { 407 addlit(yylvalstr,yytextlen); 408 if (xcdepth <= 0) 409 { 410 start(init); 411 yylvalstr = litbufdup(); 412 returni(cmtslashstar); 413 } 414 else 415 xcdepth--; 416 417 break; 418 } 419 420 421 case 2: 422 423 { 424 xcdepth++; 425 yyless(2); 426 addlit(yylvalstr,yytextlen); 427 break; 428 } 429 430 case 3: 431 432 { 433 434 if (getyysstate() == xq) 435 { 436 nchars = yytextlen; 437 addlit(yylvalstr, yytextlen-1); 438 yyless(nchars-1); 439 return;//exit; 440 } 441 442 xcdepth = 0; 443 start(xc); 444 startlit(); 445 yyless(2); 446 addlit(yylvalstr,yytextlen); 447 448 break; 449 } 450 451 case 4: 452 453 { 454 addlit(yylvalstr,yytextlen); 455 break; 456 } 457 458 case 5: 459 460 { 461 addlitchar(yylvalstr.charAt(0)); 462 break; 463 } 464 465 case 6: 466 467 { 468 start(init); 469 addlit(yylvalstr, yytextlen); 470 yylvalstr = litbufdup(); 471 returni(sconst); 472 break; 473 } 474 475 case 7: 476 477 { 478 if (insqlpluscmd){ 479 480 yyless(0); //rollback all tokens 481 yylvalstr = litbufdup(); 482 start(init); 483 returni(sconst); 484 } 485 else 486 { addlit(yylvalstr,yytextlen);} 487 488 break; 489 } 490 491 case 8: 492 493 { 494 if (getyysstate() == xq) 495 { 496 nchars = yytextlen; 497 addlit(yylvalstr, yytextlen-1); 498 yyless(nchars-1); 499 return;//exit; 500 } 501 502 start(xq); 503 startlit(); 504 addlit(yylvalstr,yytextlen); 505 break; 506 } 507 508 case 9: 509 510 { 511 start(xq); 512 startlit(); 513 addlit(yylvalstr, yytextlen); 514 dummych1 = get_char(); 515 if (dummych1 == '\\') // recognize string like '\' 516 { 517 dummych2 = get_char(); 518 if (dummych2 == '\'') 519 { 520 start(init); 521 addlit("\\", 1); 522 addlit("\'", 1); 523 yylvalstr = litbufdup(); 524 returni(sconst); 525 } 526 else 527 { 528 unget_char(dummych2); 529 unget_char(dummych1); 530 } 531 } 532 else 533 { unget_char(dummych1);} 534 535 break; 536 } 537 538 539 case 10: 540 541 { 542 addlit(yylvalstr, yytextlen); 543 break; 544 } 545 546 case 11: 547 548 { // single quote 549 dummych1 = get_char(); 550 unget_char(dummych1); 551 if (dummych1 == (char)0){ 552 returni (error); 553 break; 554 } 555 if (dummych1 == (char)10) 556 { 557 if (insqlpluscmd){ 558 nchars = yytextlen; 559 if(yylvalstr.charAt(nchars-1) == (char)13){ 560 yyless(nchars - 1); 561 yylvalstr = yylvalstr.substring(0,nchars); 562 } 563 start(init); 564 addlit(yylvalstr, nchars-1); 565 yylvalstr = litbufdup(); 566 returni(sconst); //in sqlplus command, characters between ' and return is treated as a string 567 568 }else{ 569 dummych1 = get_char(); 570 addlit(yylvalstr+dummych1, yytextlen+1); 571 } 572 } else if (dummych1 == '\\') 573 { 574 dummych1 = get_char(); 575 dummych2 = get_char(); 576 addlit(yylvalstr+dummych1+dummych2, yytextlen+2); 577 } 578 else 579 { addlit(yylvalstr, yytextlen);} 580 581 break; 582 } 583 584 case 12: 585 586 { 587 addlit(yylvalstr, yytextlen); 588 break; 589 } 590 591 592 593 case 13: 594 595 { 596 start(init); 597 addlit(yylvalstr, yytextlen); 598 if ((literallen == 0) && (!insqlpluscmd)) 599 {returni (error);} 600 if (literallen >= namedatalen) 601 { 602 setlengthofliteralbuf(namedatalen); 603 literallen = namedatalen; 604 } 605 yylvalstr = litbufdup(); 606 returni (ident); 607 608 break; 609 } 610 611 case 14: 612 613 { 614 if (insqlpluscmd){ 615 yyless(0); 616 yylvalstr = litbufdup(); 617 start(init); 618 returni(sconst); 619 }else{ 620 addlit(yylvalstr, yytextlen); 621 } 622 623 break; 624 } 625 626 case 15: 627 628 { 629 addlit(yylvalstr, yytextlen); 630 break; 631 } 632 633 case 16: 634 635 { 636 start(xd); 637 startlit(); 638 addlit(yylvalstr, yytextlen); 639 break; 640 } 641 case 17: 642 643 { // double quote 644 dummych1 = get_char(); 645 unget_char(dummych1); 646 if (dummych1 == (char)0){ 647 returni (error); 648 break; 649 } 650 if (dummych1 == (char)10) 651 { 652 if (insqlpluscmd){ 653 nchars = yytextlen; 654 if(yylvalstr.charAt(nchars-1) == (char)13){ 655 yyless(nchars - 1); 656 yylvalstr = yylvalstr.substring(0,nchars); 657 } 658 start(init); 659 addlit(yylvalstr, nchars-1); 660 yylvalstr = litbufdup(); 661 returni(sconst); //in sqlplus command, characters between ' and return is treated as a string 662 663 }else{ 664 dummych1 = get_char(); 665 addlit(yylvalstr+dummych1, yytextlen+1); 666 667 dummych1 = get_char(); 668 unget_char(dummych1); 669 if (dummych1 == (char)0){ 670 returni (error); 671 break; 672 } 673 674 } 675 676 } else{ 677 678 addlit(yylvalstr, yytextlen); 679 } 680 break; 681 } 682 683 case 18: 684 685 { 686 returni(lexnewline); 687 break; 688 } 689 case 19: 690 691 { 692 returni(lexspace); 693 break; 694 } 695 696 case 20: 697 698 { 699 if ((getyysstate() == xq) 700 || (getyysstate() == xd) 701 || (getyysstate() == xc) 702 ) 703 { 704 addlit(yylvalstr, 1); 705 yyless(1); 706 return;//exit; 707 } 708 709 returni(cmtdoublehyphen); 710 break; 711 } 712 713 case 21: 714 715 { 716 returnc(yylvalstr.charAt(0)); 717 break; 718 } 719 720 case 22: 721 722 { 723 returni (typecast); 724 break; 725 } 726 727 case 23: 728 729 { 730 returni(cmpop); 731 break; 732 } 733 734 735 case 24: 736 737 { 738 739 if (getyysstate() == xc) 740 { 741 slashstar = yylvalstr.indexOf("*/"); 742 if (slashstar > 0) 743 { 744 start(init); 745 addlit(yylvalstr,slashstar+2); 746 yylvalstr = litbufdup(); 747 yyless(slashstar+2); 748 returni(cmtslashstar); 749 } 750 else 751 { 752 addlit(yylvalstr,1); 753 yyless(1); 754 } 755 } 756 else if (getyysstate() == xq){ 757 addlit(yylvalstr,1); 758 yyless(1); 759 } 760 else 761 { 762 nchars = yytextlen; 763 slashstar = yylvalstr.indexOf("/*"); 764 dashdash = yylvalstr.indexOf("--"); 765 if ((slashstar > 0) && (dashdash > 0)) 766 { 767 //if both appear, take the first one 768 if (slashstar > dashdash) 769 {slashstar = dashdash;} 770 } 771 else 772 { 773 // if slashstar=0 then slashstar := dashdash; 774 // add (getyysstate <> xc) to avoid something like this */--,here */ should be handled instead of -- 775 if ((slashstar > 0) && (getyysstate() != xc)) { 776 nchars = slashstar; 777 } 778 } 779 780 while ((nchars > 1) 781 && ( (yylvalstr.charAt(nchars-1) == '+' ) 782 || (yylvalstr.charAt(nchars-1) =='-')) 783 && (getyysstate() != xc)) 784 { 785 for (ic = nchars - 1; ic>=1; ic--) 786 { 787 if (isopchar(yylvalstr.charAt(ic-1))) break; 788 } 789 if (ic >= 1) break; 790 nchars--; 791 } 792 793 if (nchars < yytextlen) 794 { 795 //Strip the unwanted chars from the token 796 yyless(nchars); 797 yylvalstr = yylvalstr.substring(0,nchars); 798 } 799 800 ///* 801 // * If what we have left is only one char, and it's 802 // * one of the characters matching "self", then 803 // * return it as a character token the same way 804 // * that the "self" rule would have. 805 // * make sure @ return as self char, by james wang 806 // */ 807 if ((nchars == 1) && (isselfchar(yylvalstr.charAt(0)) || (yylvalstr.charAt(0) == '@'))) 808 { 809 returnc(yylvalstr.charAt(0)); 810 } 811 else if ( 812 (nchars >= 2) 813 &&( 814 charinarray(yylvalstr.charAt(nchars-1-1), tmparray) 815 && ( charinarray(yylvalstr.charAt(nchars-1),tmparray2)) 816 ) 817 ) 818 { 819 yyless(nchars-1); 820 yylvalstr = yylvalstr.substring(0,nchars-1); 821 if (nchars == 2) 822 returnc(yylvalstr.charAt(0)); 823 else 824 returni(op); 825 } 826 else if ( (nchars == 2) && (yylvalstr.charAt(0) == '.') && (yylvalstr.charAt(1) == '*')) 827 { 828 yyless(1); 829 returnc(yylvalstr.charAt(0)); 830 } 831 else if ( (nchars == 2) && ((yylvalstr.charAt(0) == '*')||(yylvalstr.charAt(0) == '+')||(yylvalstr.charAt(0) == '-')||(yylvalstr.charAt(0) == '/')) && (yylvalstr.charAt(1) == '.')) 832 { 833 yyless(1); 834 returnc(yylvalstr.charAt(0)); 835 } 836 else if ((nchars == 2) && ((yylvalstr.charAt(0) == '=') && ( (yylvalstr.charAt(1) == '?')) )) 837 { 838 yyless(1); 839 returnc(yylvalstr.charAt(0)); 840 } 841 else if ( (nchars >= 2) && (yylvalstr.charAt(0) == '@')) 842 { 843 yyless(1); 844 returnc(yylvalstr.charAt(0)); 845 } 846 else if ( (nchars >= 2) && (yylvalstr.charAt(0) == '?')) 847 { 848 yyless(1); 849 returnc(yylvalstr.charAt(0)); 850 } 851 else if ( (nchars >= 2) && (yylvalstr.charAt(0)== '|') && (yylvalstr.charAt(1) == '|')) 852 { //||--sss ,just get || only 853 yyless(2); 854 yylvalstr = yylvalstr.substring(0,2); 855 returni(op); 856 } 857 else if ( (nchars >= 2) && (yylvalstr.charAt(0)== '!') && (yylvalstr.charAt(1) == '=')) 858 { 859 yyless(2); 860 yylvalstr = yylvalstr.substring(0,2); 861 returni(cmpop); 862 } 863 else if ( (nchars >= 3) && (yylvalstr.charAt(nchars-1) == '$' ) && (yylvalstr.charAt(nchars-2) == '$' )) 864 { // =$$abc 865 if (nchars == 3){ 866 yyless(1); 867 returnc(yylvalstr.charAt(0)); 868 }else{ 869 yyless(nchars-2); 870 yylvalstr = yylvalstr.substring(0,nchars-2); 871 returni(cmpop); 872 } 873 } 874 else if (((nchars > 2) && (yylvalstr.charAt(0) == '*')) 875 && (yylvalstr.charAt(1) == '/') 876 && (getyysstate() == xc) 877 ) 878 { //in comment, and find */ , then it must the end of comment 879 yyless(2); 880 addlit(yylvalstr,yytextlen); 881 if (xcdepth <= 0) 882 { 883 start(init); 884 yylvalstr = litbufdup(); 885 returni(cmtslashstar); 886 } 887 else 888 xcdepth--; 889 } 890 else 891 returni(op); 892 } 893 894 break; 895 } 896 897 898 899 case 25: 900 901 { 902 returni(iconst); 903 break; 904 } 905 906 case 26: 907 908 { 909 ///* for i in 1..5 loop, we can't recognize 1. as a decimal,but 1 as decimal 910 nchars = yytextlen; 911 if (yylvalstr.charAt(nchars-1) == '.') 912 { 913 dummych1 = get_char(); 914 unget_char(dummych1); 915 if (dummych1 == '.') 916 { 917 yyless(nchars-1); 918 yylvalstr = yylvalstr.substring(0,nchars - 1); 919 returni (iconst); 920 return;//exit; 921 } 922 } 923 returni (fconst); 924 break; 925 } 926 case 27: 927 928 { 929 returni (fconst); 930 break; 931 } 932 933 case 28: 934 935 { 936 int rw; 937 if ( (rw = iskeyword(yylvalstr)) != -1) { returni(rw);} 938 else 939 {returni(ident);} 940 break; 941 } 942 943 case 29: 944 945 { 946 returni (outer_join); 947 break; 948 } 949 950 951 case 30: 952 953 { 954 returni (k_clause); 955 break; 956 } 957 958 case 31: 959 960 { 961 returni (m_clause); 962 break; 963 } 964 965 966 case 32: 967 968 { 969 returni (bind_v); 970 break; 971 } 972 973 case 33: 974 975 { 976 977 // in this case: load_timestamp::date, load_timestamp: is found, we should only return load_timestamp 978 nchars = yytextlen; 979 if (yylvalstr.charAt(nchars-1) == ':') 980 { 981 dummych1 = get_char(); 982 unget_char(dummych1); 983 if (dummych1 == ':') 984 { 985 yyless(nchars-1); 986 yylvalstr = yylvalstr.substring(0,nchars - 1); 987 returni (ident); 988 return;//exit; 989 } 990 } 991 992 returni (db2label); 993 break; 994 } 995 996 case 34: 997 998 { 999 returni (ident); 1000 break; 1001 } 1002 1003 case 35: 1004 1005 { 1006 returni (TBaseType.rrw_jdbc_escape_fn); 1007 break; 1008 } 1009 1010 case 36: 1011 1012 { 1013 returni (TBaseType.rrw_jdbc_escape_end); 1014 break; 1015 } 1016 1017 1018 1019 case 37: 1020 1021 { 1022 returni (error); 1023 break; 1024 } 1025 1026 default:{ 1027 System.out.println("fatal error in yyaction"); 1028 } 1029 }//switch 1030}/*yyaction*/; 1031 1032 1033 1034 }