~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Olaf van der Spek
  • Date: 2011-02-28 14:09:50 UTC
  • mfrom: (2207 bootstrap)
  • mto: (2209.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2210.
  • Revision ID: olafvdspek@gmail.com-20110228140950-2nu0hyzhuww3wssx
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include <drizzled/lookup_symbol.h>
31
31
#include <drizzled/index_hint.h>
32
32
#include <drizzled/select_result.h>
 
33
#include <drizzled/item/subselect.h>
33
34
 
34
35
#include <cstdio>
35
36
#include <ctype.h>
1061
1062
      lip->yyUnget();                   // Safety against eof
1062
1063
      state = MY_LEX_START;             // Try again
1063
1064
      break;
 
1065
 
1064
1066
    case MY_LEX_LONG_COMMENT:           /* Long C comment? */
1065
1067
      if (lip->yyPeek() != '*')
1066
1068
      {
1158
1160
      lip->in_comment= NO_COMMENT;
1159
1161
      lip->set_echo(true);
1160
1162
      break;
 
1163
 
1161
1164
    case MY_LEX_END_LONG_COMMENT:
1162
1165
      if ((lip->in_comment != NO_COMMENT) && lip->yyPeek() == '/')
1163
1166
      {
1174
1177
      else
1175
1178
        state=MY_LEX_CHAR;              // Return '*'
1176
1179
      break;
 
1180
 
1177
1181
    case MY_LEX_SET_VAR:                // Check if ':='
1178
1182
      if (lip->yyPeek() != '=')
1179
1183
      {
1182
1186
      }
1183
1187
      lip->yySkip();
1184
1188
      return (SET_VAR);
 
1189
 
1185
1190
    case MY_LEX_SEMICOLON:                      // optional line terminator
1186
1191
      if (lip->yyPeek())
1187
1192
      {
1190
1195
      }
1191
1196
      lip->next_state=MY_LEX_END;       // Mark for next loop
1192
1197
      return(END_OF_INPUT);
 
1198
 
1193
1199
    case MY_LEX_EOL:
1194
1200
      if (lip->eof())
1195
1201
      {
1205
1211
      }
1206
1212
      state=MY_LEX_CHAR;
1207
1213
      break;
 
1214
 
1208
1215
    case MY_LEX_END:
1209
1216
      lip->next_state=MY_LEX_END;
1210
1217
      return false;                     // We found end of input last time
1211
1218
 
1212
1219
      /* Actually real shouldn't start with . but allow them anyhow */
 
1220
 
1213
1221
    case MY_LEX_REAL_OR_POINT:
1214
1222
      if (my_isdigit(cs,lip->yyPeek()))
1215
1223
        state= MY_LEX_REAL;             // Real
1219
1227
        lip->yyUnget();                 // Put back '.'
1220
1228
      }
1221
1229
      break;
 
1230
 
1222
1231
    case MY_LEX_USER_END:               // end '@' of user@hostname
1223
1232
      switch (state_map[(uint8_t)lip->yyPeek()]) {
1224
1233
      case MY_LEX_STRING:
1235
1244
      yylval->lex_str.str=(char*) lip->get_ptr();
1236
1245
      yylval->lex_str.length=1;
1237
1246
      return((int) '@');
 
1247
 
1238
1248
    case MY_LEX_HOSTNAME:               // end '@' of user@hostname
1239
1249
      for (c=lip->yyGet() ;
1240
1250
           my_isalnum(cs,c) || c == '.' || c == '_' ||  c == '$';
1241
1251
           c= lip->yyGet()) ;
1242
1252
      yylval->lex_str=get_token(lip, 0, lip->yyLength());
1243
1253
      return(LEX_HOSTNAME);
 
1254
 
1244
1255
    case MY_LEX_SYSTEM_VAR:
1245
1256
      yylval->lex_str.str=(char*) lip->get_ptr();
1246
1257
      yylval->lex_str.length=1;
1250
1261
                        MY_LEX_OPERATOR_OR_IDENT :
1251
1262
                        MY_LEX_IDENT_OR_KEYWORD);
1252
1263
      return((int) '@');
 
1264
 
1253
1265
    case MY_LEX_IDENT_OR_KEYWORD:
1254
1266
      /*
1255
1267
        We come here when we have found two '@' in a row.
1263
1275
 
1264
1276
      if (c == '.')
1265
1277
        lip->next_state=MY_LEX_IDENT_SEP;
 
1278
 
1266
1279
      length= lip->yyLength();
1267
1280
      if (length == 0)
1268
1281
        return(ABORT_SYM);              // Names must be nonempty.
 
1282
 
1269
1283
      if ((tokval= find_keyword(lip, length,0)))
1270
1284
      {
1271
1285
        lip->yyUnget();                         // Put back 'c'