~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Mark Atwood
  • Date: 2011-10-25 19:08:35 UTC
  • mfrom: (2445.1.6 rf)
  • Revision ID: me@mark.atwood.name-20111025190835-g21cn911ypxjd5fi
mergeĀ lp:~olafvdspek/drizzle/refactor7

Show diffs side-by-side

added added

removed removed

Lines of Context:
274
274
  const char *tok= lip->get_tok_start();
275
275
  uint32_t tok_pos= 0;
276
276
  for (;tok_pos<len && tok_pos<63;tok_pos++)
277
 
    tok_upper[tok_pos]=my_toupper(system_charset_info, tok[tok_pos]);
 
277
    tok_upper[tok_pos]= system_charset_info->toupper(tok[tok_pos]);
278
278
  tok_upper[tok_pos]=0;
279
279
 
280
280
  const SYMBOL *symbol= lookup_symbol(tok_upper, len, function);
658
658
    case MY_LEX_CHAR:                   // Unknown or single char token
659
659
    case MY_LEX_SKIP:                   // This should not happen
660
660
      if (c == '-' && lip->yyPeek() == '-' &&
661
 
          (my_isspace(cs,lip->yyPeekn(1)) ||
662
 
           my_iscntrl(cs,lip->yyPeekn(1))))
 
661
          (cs->isspace(lip->yyPeekn(1)) ||
 
662
           cs->iscntrl(lip->yyPeekn(1))))
663
663
      {
664
664
        state=MY_LEX_COMMENT;
665
665
        break;
773
773
        c= lip->yyGet();
774
774
        if (c == 'x')
775
775
        {
776
 
          while (my_isxdigit(cs,(c = lip->yyGet()))) ;
 
776
          while (cs->isxdigit((c = lip->yyGet()))) ;
777
777
          if ((lip->yyLength() >= 3) && !ident_map[c])
778
778
          {
779
779
            /* skip '0x' */
800
800
        lip->yyUnget();
801
801
      }
802
802
 
803
 
      while (my_isdigit(cs, (c = lip->yyGet()))) ;
 
803
      while (cs->isdigit((c = lip->yyGet()))) ;
804
804
      if (!ident_map[c])
805
805
      {                                 // Can't be identifier
806
806
        state=MY_LEX_INT_OR_REAL;
809
809
      if (c == 'e' || c == 'E')
810
810
      {
811
811
        // The following test is written this way to allow numbers of type 1e1
812
 
        if (my_isdigit(cs,lip->yyPeek()) ||
 
812
        if (cs->isdigit(lip->yyPeek()) ||
813
813
            (c=(lip->yyGet())) == '+' || c == '-')
814
814
        {                               // Allow 1E+10
815
 
          if (my_isdigit(cs,lip->yyPeek()))     // Number must have digit after sign
 
815
          if (cs->isdigit(lip->yyPeek()))     // Number must have digit after sign
816
816
          {
817
817
            lip->yySkip();
818
 
            while (my_isdigit(cs,lip->yyGet())) ;
 
818
            while (cs->isdigit(lip->yyGet())) ;
819
819
            yylval->lex_str=get_token(lip, 0, lip->yyLength());
820
820
            return(FLOAT_NUM);
821
821
          }
896
896
      }
897
897
      // fall through
898
898
    case MY_LEX_REAL:                   // Incomplete real number
899
 
      while (my_isdigit(cs,c = lip->yyGet())) ;
 
899
      while (cs->isdigit(c = lip->yyGet())) ;
900
900
 
901
901
      if (c == 'e' || c == 'E')
902
902
      {
903
903
        c = lip->yyGet();
904
904
        if (c == '-' || c == '+')
905
905
                c = lip->yyGet();                     // Skip sign
906
 
        if (!my_isdigit(cs,c))
 
906
        if (!cs->isdigit(c))
907
907
        {                               // No digit after sign
908
908
          state= MY_LEX_CHAR;
909
909
          break;
910
910
        }
911
 
        while (my_isdigit(cs,lip->yyGet())) ;
 
911
        while (cs->isdigit(lip->yyGet())) ;
912
912
        yylval->lex_str=get_token(lip, 0, lip->yyLength());
913
913
        return(FLOAT_NUM);
914
914
      }
917
917
 
918
918
    case MY_LEX_HEX_NUMBER:             // Found x'hexstring'
919
919
      lip->yySkip();                    // Accept opening '
920
 
      while (my_isxdigit(cs, (c= lip->yyGet()))) ;
 
920
      while (cs->isxdigit((c= lip->yyGet()))) ;
921
921
      if (c != '\'')
922
922
        return(ABORT_SYM);              // Illegal hex constant
923
923
      lip->yySkip();                    // Accept closing '
1164
1164
      /* Actually real shouldn't start with . but allow them anyhow */
1165
1165
 
1166
1166
    case MY_LEX_REAL_OR_POINT:
1167
 
      if (my_isdigit(cs,lip->yyPeek()))
 
1167
      if (cs->isdigit(lip->yyPeek()))
1168
1168
        state= MY_LEX_REAL;             // Real
1169
1169
      else
1170
1170
      {
1191
1191
 
1192
1192
    case MY_LEX_HOSTNAME:               // end '@' of user@hostname
1193
1193
      for (c=lip->yyGet() ;
1194
 
           my_isalnum(cs,c) || c == '.' || c == '_' ||  c == '$';
 
1194
           cs->isalnum(c) || c == '.' || c == '_' ||  c == '$';
1195
1195
           c= lip->yyGet()) ;
1196
1196
      yylval->lex_str=get_token(lip, 0, lip->yyLength());
1197
1197
      return(LEX_HOSTNAME);