~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Brian Aker
  • Date: 2011-02-17 18:06:59 UTC
  • mfrom: (2178.1.3 drizzle-staging)
  • Revision ID: brian@tangent.org-20110217180659-3so1k4syn5m436cj
Merge in all bison updates.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
** The type will be void*, so it must be  cast to (Session*) when used.
26
26
** Use the YYSession macro for this.
27
27
*/
28
 
#define YYPARSE_PARAM yysession
29
 
#define YYLEX_PARAM yysession
30
 
#define YYSession (static_cast<Session *>(yysession))
 
28
 
 
29
#define YYSession (session)
31
30
 
32
31
#define YYENABLE_NLS 0
33
32
#define YYLTYPE_IS_TRIVIAL 0
34
33
 
35
 
#define DRIZZLE_YACC
36
34
#define YYINITDEPTH 100
37
35
#define YYMAXDEPTH 3200                        /* Because of 64K stack */
38
36
#define Lex (YYSession->lex)
41
39
#include <cstdio>
42
40
#include <drizzled/parser.h>
43
41
 
44
 
int yylex(void *yylval, void *yysession);
 
42
int yylex(union ParserType *yylval, drizzled::Session *session);
45
43
 
46
44
#define yyoverflow(A,B,C,D,E,F)               \
47
45
  {                                           \
48
46
    unsigned long val= *(F);                          \
49
47
    if (drizzled::my_yyoverflow((B), (D), &val)) \
50
48
    {                                         \
51
 
      yyerror((char*) (A));                   \
 
49
      yyerror(NULL, (char*) (A));                   \
52
50
      return 2;                               \
53
51
    }                                         \
54
52
    else                                      \
70
68
    DRIZZLE_YYABORT;                      \
71
69
  }
72
70
 
73
 
 
74
 
#define YYDEBUG 0
75
 
 
76
71
namespace drizzled
77
72
{
78
73
 
108
103
  to abort from the parser.
109
104
*/
110
105
 
111
 
static void DRIZZLEerror(const char *s)
 
106
static void base_sql_error(drizzled::Session *session, const char *s)
112
107
{
113
 
  parser::errorOn(s);
 
108
  parser::errorOn(session, s);
114
109
}
115
110
 
116
111
} /* namespace drizzled; */
117
112
 
118
113
using namespace drizzled;
119
114
%}
120
 
%union {
 
115
%union ParserType {
121
116
  bool boolean;
122
117
  int  num;
123
118
  unsigned long ulong_num;
161
156
%{
162
157
namespace drizzled
163
158
{
164
 
bool my_yyoverflow(short **a, YYSTYPE **b, unsigned long *yystacksize);
 
159
bool my_yyoverflow(short **a, union ParserType **b, unsigned long *yystacksize);
165
160
}
166
161
%}
167
162
 
168
163
%debug
169
 
%pure_parser                                    /* We have threads */
 
164
%require "2.2"
 
165
%pure-parser
 
166
%name-prefix="base_sql_"
 
167
%parse-param { drizzled::Session *session }
 
168
%lex-param { drizzled::Session *session }
 
169
%verbose
 
170
 
170
171
 
171
172
/*
172
173
  Currently there are 70 shift/reduce conflicts.
777
778
query:
778
779
          END_OF_INPUT
779
780
          {
780
 
            Session *session= YYSession;
781
 
            if (!(session->lex->select_lex.options & OPTION_FOUND_COMMENT))
 
781
            if (!(YYSession->lex->select_lex.options & OPTION_FOUND_COMMENT))
782
782
            {
783
783
              my_message(ER_EMPTY_QUERY, ER(ER_EMPTY_QUERY), MYF(0));
784
784
              DRIZZLE_YYABORT;
785
785
            }
786
786
            else
787
787
            {
788
 
              session->lex->statement= new statement::EmptyQuery(YYSession);
 
788
              YYSession->lex->statement= new statement::EmptyQuery(YYSession);
789
789
            }
790
790
          }
791
791
        | verb_clause END_OF_INPUT {}