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