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