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