UnQL

Check-in [47a517ea6e]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Parser changes to bring expression processing closer to javascript.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 47a517ea6e7cf7f41b0bc1f85e1b7bd321d85921
User & Date: drh 2011-07-15 20:41:26
Context
2011-07-15
21:15
Added support for the ?: operator. check-in: a9a0c2d16e user: drh tags: trunk
20:41
Parser changes to bring expression processing closer to javascript. check-in: 47a517ea6e user: drh tags: trunk
19:33
Add ===, !== and >>> operators. check-in: 1296cc1b15 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

107
108
109
110
111
112
113
114

115
116
117


118
119
120
121
122
123
124

125
126
127
128
129
130
131
132
133
...
267
268
269
270
271
272
273



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290


291
292
293
294
295
296
297
jvalue(A) ::= INTEGER(X).              {A = jsonReal(p,&X);}
jvalue(A) ::= FLOAT(X).                {A = jsonReal(p,&X);}
jvalue(A) ::= STRING(X).               {A = jsonString(p,&X);}
jvalue(A) ::= TRUE.                    {A = jsonType(p,XJD1_TRUE);}
jvalue(A) ::= FALSE.                   {A = jsonType(p,XJD1_FALSE);}
jvalue(A) ::= NULL.                    {A = jsonType(p,XJD1_NULL);}



%left OR.
%left AND.
%right BANG.


%left IS LIKEOP BETWEEN IN NE EQEQ EQ3 NE3.
%left GT LE LT GE.
%right ESCAPE.
%left BITAND BITOR LSHIFT RSHIFT URSHIFT.
%left PLUS MINUS.
%left STAR SLASH REM.
%left CONCAT.

%left COLLATE.
%right BITNOT.

%include {
  /* Generate an Expr object from an identifer token */
  static Expr *idExpr(Parse *p, Token *pTok){
    Expr *pNew = xjd1PoolMallocZero(p->pPool, sizeof(*pNew));
    if( pNew ){
      pNew->eType = TK_ID;
................................................................................


expr(A) ::= ID(X) LP exprlist(Y) RP.  {A = funcExpr(p,&X,Y);}
expr(A) ::= expr(X) AND(OP) expr(Y).  {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) OR(OP) expr(Y).              {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) LT|GT|GE|LE(OP) expr(Y).     {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) EQEQ|NE|EQ3|NE3(OP) expr(Y). {A = biExpr(p,X,@OP,Y);}



expr(A) ::= expr(X) BITAND|BITOR|LSHIFT|RSHIFT|URSHIFT(OP) expr(Y).
                                                 {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y).      {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y).  {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) CONCAT(OP) expr(Y).          {A = biExpr(p,X,@OP,Y);}
%type likeop {int}
likeop(A) ::= LIKEOP(OP).                        {A = @OP;}
likeop(A) ::= BANG LIKEOP(OP).                   {A = 128+@OP;}
expr(A) ::= expr(X) likeop(OP) expr(Y). [LIKEOP] {A = biExpr(p,X,OP,Y);}
expr(A) ::= expr(X) IS(OP) expr(Y).              {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) IS NOT expr(Y).              {A = biExpr(p,X,TK_NOT_IS,Y);}
expr(A) ::= BANG(OP) expr(X).                    {A = biExpr(p,X,@OP,0);}
expr(A) ::= BITNOT(OP) expr(X).                  {A = biExpr(p,X,@OP,0);}
expr(A) ::= MINUS(OP) expr(X). [BITNOT]          {A = biExpr(p,X,@OP,0);}
expr(A) ::= PLUS(OP) expr(X). [BITNOT]           {A = biExpr(p,X,@OP,0);}
expr(A) ::= LP select(X) RP.                     {A = subqExpr(p,X);}
expr(A) ::= LP expr(X) RP.                       {A = X;}




%type exprlist {ExprList*}
%type nexprlist {ExprList*}
exprlist(A) ::= nexprlist(X).     {A = X;}
exprlist(A) ::= .                 {A = 0;}
nexprlist(A) ::= expr(X).                     {A = apndExpr(p,0,X,0);}







<
>


|
>
>
|
|
<
|


<
>

<







 







>
>
>
|



|
<
<
<
<
<
<






>
>







107
108
109
110
111
112
113

114
115
116
117
118
119
120
121

122
123
124

125
126

127
128
129
130
131
132
133
...
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281






282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
jvalue(A) ::= INTEGER(X).              {A = jsonReal(p,&X);}
jvalue(A) ::= FLOAT(X).                {A = jsonReal(p,&X);}
jvalue(A) ::= STRING(X).               {A = jsonString(p,&X);}
jvalue(A) ::= TRUE.                    {A = jsonType(p,XJD1_TRUE);}
jvalue(A) ::= FALSE.                   {A = jsonType(p,XJD1_FALSE);}
jvalue(A) ::= NULL.                    {A = jsonType(p,XJD1_NULL);}


%right QM.
%left OR.
%left AND.
%left BITOR.
%left BITXOR.
%left BITAND.
%left LIKEOP NE EQEQ EQ3 NE3.
%left IN GT LE LT GE.

%left LSHIFT RSHIFT URSHIFT.
%left PLUS MINUS.
%left STAR SLASH REM.

%right BITNOT BANG.
%left COLLATE.


%include {
  /* Generate an Expr object from an identifer token */
  static Expr *idExpr(Parse *p, Token *pTok){
    Expr *pNew = xjd1PoolMallocZero(p->pPool, sizeof(*pNew));
    if( pNew ){
      pNew->eType = TK_ID;
................................................................................


expr(A) ::= ID(X) LP exprlist(Y) RP.  {A = funcExpr(p,&X,Y);}
expr(A) ::= expr(X) AND(OP) expr(Y).  {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) OR(OP) expr(Y).              {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) LT|GT|GE|LE(OP) expr(Y).     {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) EQEQ|NE|EQ3|NE3(OP) expr(Y). {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) BITAND(OP) expr(Y).          {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) BITXOR(OP) expr(Y).          {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) BITOR(OP) expr(Y).           {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) LSHIFT|RSHIFT|URSHIFT(OP) expr(Y).
                                                 {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y).      {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y).  {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) LIKEOP(OP) expr(Y).          {A = biExpr(p,X,@OP,Y);}






expr(A) ::= BANG(OP) expr(X).                    {A = biExpr(p,X,@OP,0);}
expr(A) ::= BITNOT(OP) expr(X).                  {A = biExpr(p,X,@OP,0);}
expr(A) ::= MINUS(OP) expr(X). [BITNOT]          {A = biExpr(p,X,@OP,0);}
expr(A) ::= PLUS(OP) expr(X). [BITNOT]           {A = biExpr(p,X,@OP,0);}
expr(A) ::= LP select(X) RP.                     {A = subqExpr(p,X);}
expr(A) ::= LP expr(X) RP.                       {A = X;}
expr(A) ::= expr(X) COLLATE ID|STRING.           {A = X;}
expr ::= expr QM expr COLON expr.


%type exprlist {ExprList*}
%type nexprlist {ExprList*}
exprlist(A) ::= nexprlist(X).     {A = X;}
exprlist(A) ::= .                 {A = 0;}
nexprlist(A) ::= expr(X).                     {A = apndExpr(p,0,X,0);}

Changes to src/tokenize.c.

82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107
108
109
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140
141

142
143

144

145
146
147

148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
...
177
178
179
180
181
182
183




184
185
186
187
188
189
190
  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* f8..ff    ........ */
};

/**********************************************************************
** The following code is automatically generated
** by ../tool/mkkeywordhash.c
*/
/* Hash score: 55 */
static int keywordCode(const char *z, int n){
  /* zText[] encodes 293 bytes of keywords in 209 bytes */
  /*   BEGINTORDEROLLBACKELSELECTGROUPDATEACHAVINGLOBETWEENULLIKE         */
  /*   SCAPEXISTSALLIMITASCENDINGCOLLATEXCEPTCOLLECTIONOTCREATEDELETE     */
  /*   DESCENDINGDROPRAGMAFLATTENIFROMUNIONVALUEWHEREBYCOMMITINSERT       */
  /*   INTERSECTOFFSETfalsenulltrue                                       */
  static const char zText[208] = {
    'B','E','G','I','N','T','O','R','D','E','R','O','L','L','B','A','C','K',
    'E','L','S','E','L','E','C','T','G','R','O','U','P','D','A','T','E','A',
    'C','H','A','V','I','N','G','L','O','B','E','T','W','E','E','N','U','L',
    'L','I','K','E','S','C','A','P','E','X','I','S','T','S','A','L','L','I',
    'M','I','T','A','S','C','E','N','D','I','N','G','C','O','L','L','A','T',
    'E','X','C','E','P','T','C','O','L','L','E','C','T','I','O','N','O','T',
    'C','R','E','A','T','E','D','E','L','E','T','E','D','E','S','C','E','N',
    'D','I','N','G','D','R','O','P','R','A','G','M','A','F','L','A','T','T',

    'E','N','I','F','R','O','M','U','N','I','O','N','V','A','L','U','E','W',
    'H','E','R','E','B','Y','C','O','M','M','I','T','I','N','S','E','R','T',
    'I','N','T','E','R','S','E','C','T','O','F','F','S','E','T','f','a','l',
    's','e','n','u','l','l','t','r','u','e',
  };
  static const unsigned char aHash[80] = {

       0,  40,  38,  18,  32,  12,  39,   1,  47,   7,   0,  48,  25,
       8,  24,   0,   0,   4,  46,  10,  35,  34,  41,   0,   0,   0,
       0,  36,   0,   0,   0,  20,   0,   0,   0,  45,   0,   0,   6,
       0,   0,   0,   0,  37,   0,   0,   0,   0,   0,   0,   0,   0,
      23,  27,  44,  26,   9,  19,   0,   0,  31,   2,  21,  30,   0,
      43,   0,   0,   0,  33,   0,   0,  22,  28,   0,   0,   0,  29,
      42,  17,
  };
  static const unsigned char aNext[48] = {
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   5,   0,   0,   0,   0,  13,   0,   0,   0,   0,
       0,   0,  15,   3,   0,   0,   0,   0,   0,  14,   0,   0,   0,
       0,   0,  11,   0,   0,   0,   0,   0,  16,
  };
  static const unsigned char aLen[48] = {
       5,   4,   5,   8,   4,   6,   5,   6,   4,   6,   4,   7,   4,
       4,   6,   6,   2,   3,   5,   2,   3,   9,   7,   6,  10,   3,
       6,   6,   4,  10,   2,   4,   6,   7,   2,   4,   5,   5,   5,
       2,   6,   6,   9,   6,   3,   5,   4,   4,
  };
  static const unsigned short int aOffset[48] = {
       0,   3,   6,  10,  18,  20,  26,  29,  34,  37,  42,  45,  51,

      54,  57,  62,  64,  68,  70,  75,  75,  75,  84,  90,  96, 105,
     108, 114, 120, 120, 127, 130, 133, 139, 146, 147, 151, 156, 161,
     166, 168, 174, 180, 189, 192, 195, 200, 204,
  };
  static const unsigned char aCode[48] = {
    TK_BEGIN,      TK_INTO,       TK_ORDER,      TK_ROLLBACK,   TK_ELSE,       
    TK_SELECT,     TK_GROUP,      TK_UPDATE,     TK_FLATTENOP,  TK_HAVING,     
    TK_LIKEOP,     TK_BETWEEN,    TK_NULL,       TK_LIKEOP,     TK_ESCAPE,     
    TK_EXISTS,     TK_IS,         TK_ALL,        TK_LIMIT,      TK_AS,         

    TK_ASCENDING,  TK_ASCENDING,  TK_COLLATE,    TK_EXCEPT,     TK_COLLECTION, 
    TK_NOT,        TK_CREATE,     TK_DELETE,     TK_DESCENDING, TK_DESCENDING, 

    TK_IN,         TK_DROP,       TK_PRAGMA,     TK_FLATTENOP,  TK_IF,         

    TK_FROM,       TK_UNION,      TK_VALUE,      TK_WHERE,      TK_BY,         
    TK_COMMIT,     TK_INSERT,     TK_INTERSECT,  TK_OFFSET,     TK_SET,        
    TK_FALSE,      TK_NULL,       TK_TRUE,       

  };
  int h, i;
  if( n<2 ) return TK_ID;
  h = (z[0]*4 ^ z[n-1]*3 ^ n) % 80;
  for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){
    if( aLen[i]==n && memcmp(&zText[aOffset[i]],z,n)==0 ){
      return aCode[i];
    }
  }
  return TK_ID;
}
#define XJD1_N_KEYWORD 48

/* End of the automatically generated hash code
*********************************************************************/

/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
................................................................................
      if( z[1]=='-' ){
        for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
        *tokenType = TK_SPACE;
        return i;
      }
      *tokenType = TK_MINUS;
      return 1;




    }
    case '(': {
      *tokenType = TK_LP;
      return 1;
    }
    case ')': {
      *tokenType = TK_RP;







|

|
|
|
|
|
|


|
<
|
|
|
|
>
|
|
|
<


>
|
|
|
|
|
<
|

|

|
|
|

|
|
|
|
|

|
|
>
|
|
<

|


<
<
>
|
<
>
|
>
|
|
<
>











|







 







>
>
>
>







82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
115

116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134

135
136
137
138


139
140

141
142
143
144
145

146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
  0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40   /* f8..ff    ........ */
};

/**********************************************************************
** The following code is automatically generated
** by ../tool/mkkeywordhash.c
*/
/* Hash score: 51 */
static int keywordCode(const char *z, int n){
  /* zText[] encodes 278 bytes of keywords in 198 bytes */
  /*   BEGINTORDEROLLBACKELSELECTGROUPDATEACHAVINGLOBYALLIKEXISTS         */
  /*   ASCENDINGCOLLATEXCEPTCOLLECTIONULLIMITCREATEDELETEDESCENDING       */
  /*   DROPRAGMAFLATTENOTIFROMUNIONVALUEWHEREinullCOMMITINSERT            */
  /*   INTERSECTOFFSETfalsetrue                                           */
  static const char zText[197] = {
    'B','E','G','I','N','T','O','R','D','E','R','O','L','L','B','A','C','K',
    'E','L','S','E','L','E','C','T','G','R','O','U','P','D','A','T','E','A',
    'C','H','A','V','I','N','G','L','O','B','Y','A','L','L','I','K','E','X',

    'I','S','T','S','A','S','C','E','N','D','I','N','G','C','O','L','L','A',
    'T','E','X','C','E','P','T','C','O','L','L','E','C','T','I','O','N','U',
    'L','L','I','M','I','T','C','R','E','A','T','E','D','E','L','E','T','E',
    'D','E','S','C','E','N','D','I','N','G','D','R','O','P','R','A','G','M',
    'A','F','L','A','T','T','E','N','O','T','I','F','R','O','M','U','N','I',
    'O','N','V','A','L','U','E','W','H','E','R','E','i','n','u','l','l','C',
    'O','M','M','I','T','I','N','S','E','R','T','I','N','T','E','R','S','E',
    'C','T','O','F','F','S','E','T','f','a','l','s','e','t','r','u','e',

  };
  static const unsigned char aHash[80] = {
       0,  12,  36,  13,  29,   0,  37,   1,  39,   7,   0,  46,  21,
       8,  20,   0,   0,   4,  45,  10,  33,  31,  40,   0,   0,   0,
       0,  34,   0,   0,   0,  16,   0,   0,   0,  44,   0,   0,   6,
       0,   0,   0,   0,  35,   0,   0,   0,   0,   0,   0,   0,   0,
      19,  24,  43,  32,   9,  23,   0,   0,  28,   2,  17,  27,   0,
      42,   0,   0,   0,  30,   0,   0,  22,  25,   0,   0,  38,  26,

      41,   5,
  };
  static const unsigned char aNext[46] = {
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   0,   0,   0,   0,   0,  18,   0,   0,   0,   0,
       3,   0,   0,   0,   0,   0,   0,  14,   0,   0,   0,   0,   0,
       0,  11,   0,   0,   0,   0,  15,
  };
  static const unsigned char aLen[46] = {
       5,   4,   5,   8,   4,   6,   5,   6,   4,   6,   4,   2,   3,
       4,   6,   2,   3,   9,   7,   6,  10,   4,   5,   6,   6,   4,
      10,   2,   4,   6,   7,   3,   2,   4,   5,   5,   5,   2,   4,
       6,   6,   9,   6,   3,   5,   4,
  };
  static const unsigned short int aOffset[46] = {
       0,   3,   6,  10,  18,  20,  26,  29,  34,  37,  42,  45,  47,
      49,  52,  58,  58,  58,  67,  73,  79,  88,  91,  96, 102, 108,
     108, 115, 118, 121, 127, 133, 136, 137, 141, 146, 151, 156, 157,
     161, 167, 173, 182, 185, 188, 193,

  };
  static const unsigned char aCode[46] = {
    TK_BEGIN,      TK_INTO,       TK_ORDER,      TK_ROLLBACK,   TK_ELSE,       
    TK_SELECT,     TK_GROUP,      TK_UPDATE,     TK_FLATTENOP,  TK_HAVING,     


    TK_LIKEOP,     TK_BY,         TK_ALL,        TK_LIKEOP,     TK_EXISTS,     
    TK_AS,         TK_ASCENDING,  TK_ASCENDING,  TK_COLLATE,    TK_EXCEPT,     

    TK_COLLECTION, TK_NULL,       TK_LIMIT,      TK_CREATE,     TK_DELETE,     
    TK_DESCENDING, TK_DESCENDING, TK_IN,         TK_DROP,       TK_PRAGMA,     
    TK_FLATTENOP,  TK_NOT,        TK_IF,         TK_FROM,       TK_UNION,      
    TK_VALUE,      TK_WHERE,      TK_IN,         TK_NULL,       TK_COMMIT,     
    TK_INSERT,     TK_INTERSECT,  TK_OFFSET,     TK_SET,        TK_FALSE,      

    TK_TRUE,       
  };
  int h, i;
  if( n<2 ) return TK_ID;
  h = (z[0]*4 ^ z[n-1]*3 ^ n) % 80;
  for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){
    if( aLen[i]==n && memcmp(&zText[aOffset[i]],z,n)==0 ){
      return aCode[i];
    }
  }
  return TK_ID;
}
#define XJD1_N_KEYWORD 46

/* End of the automatically generated hash code
*********************************************************************/

/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
................................................................................
      if( z[1]=='-' ){
        for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
        *tokenType = TK_SPACE;
        return i;
      }
      *tokenType = TK_MINUS;
      return 1;
    }
    case '?': {
      *tokenType = TK_QM;
      return 1;
    }
    case '(': {
      *tokenType = TK_LP;
      return 1;
    }
    case ')': {
      *tokenType = TK_RP;

Changes to src/trace.c.

29
30
31
32
33
34
35

36
37
38
39


40
41
42
43



44
45
46
47
48
49
50
51
52
53

54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
..
88
89
90
91
92
93
94

95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
  { TK_SEMI,             "TK_SEMI"            },
  { TK_INTEGER,          "TK_INTEGER"         },
  { TK_FLOAT,            "TK_FLOAT"           },
  { TK_STRING,           "TK_STRING"          },
  { TK_TRUE,             "TK_TRUE"            },
  { TK_FALSE,            "TK_FALSE"           },
  { TK_NULL,             "TK_NULL"            },

  { TK_OR,               "TK_OR"              },
  { TK_AND,              "TK_AND"             },
  { TK_BANG,             "TK_BANG"            },
  { TK_IS,               "TK_IS"              },


  { TK_LIKEOP,           "TK_LIKEOP"          },
  { TK_BETWEEN,          "TK_BETWEEN"         },
  { TK_IN,               "TK_IN"              },
  { TK_NE,               "TK_NE"              },



  { TK_EQ,               "TK_EQ"              },
  { TK_GT,               "TK_GT"              },
  { TK_LE,               "TK_LE"              },
  { TK_LT,               "TK_LT"              },
  { TK_GE,               "TK_GE"              },
  { TK_ESCAPE,           "TK_ESCAPE"          },
  { TK_BITAND,           "TK_BITAND"          },
  { TK_BITOR,            "TK_BITOR"           },
  { TK_LSHIFT,           "TK_LSHIFT"          },
  { TK_RSHIFT,           "TK_RSHIFT"          },

  { TK_PLUS,             "TK_PLUS"            },
  { TK_MINUS,            "TK_MINUS"           },
  { TK_STAR,             "TK_STAR"            },
  { TK_SLASH,            "TK_SLASH"           },
  { TK_REM,              "TK_REM"             },
  { TK_CONCAT,           "TK_CONCAT"          },

  { TK_COLLATE,          "TK_COLLATE"         },
  { TK_BITNOT,           "TK_BITNOT"          },
  { TK_ID,               "TK_ID"              },
  { TK_DOT,              "TK_DOT"             },
  { TK_LB,               "TK_LB"              },
  { TK_RB,               "TK_RB"              },
  { TK_LC,               "TK_LC"              },
  { TK_RC,               "TK_RC"              },
  { TK_COLON,            "TK_COLON"           },
................................................................................
  { TK_WHERE,            "TK_WHERE"           },
  { TK_BEGIN,            "TK_BEGIN"           },
  { TK_ROLLBACK,         "TK_ROLLBACK"        },
  { TK_COMMIT,           "TK_COMMIT"          },
  { TK_CREATE,           "TK_CREATE"          },
  { TK_COLLECTION,       "TK_COLLECTION"      },
  { TK_IF,               "TK_IF"              },

  { TK_EXISTS,           "TK_EXISTS"          },
  { TK_DROP,             "TK_DROP"            },
  { TK_DELETE,           "TK_DELETE"          },
  { TK_UPDATE,           "TK_UPDATE"          },
  { TK_SET,              "TK_SET"             },

  { TK_ELSE,             "TK_ELSE"            },
  { TK_INSERT,           "TK_INSERT"          },
  { TK_INTO,             "TK_INTO"            },
  { TK_VALUE,            "TK_VALUE"           },
  { TK_PRAGMA,           "TK_PRAGMA"          },
  /* End paste of parse_txt.h */
  { TK_NOT_LIKEOP,       "TK_NOT_LIKEOP"      },
  { TK_NOT_IS,           "TK_NOT_IS"          },
  { TK_FUNCTION,         "TK_FUNCTION"        },
  { TK_SPACE,            "TK_SPACE"           },
  { TK_ILLEGAL,          "TK_ILLEGAL"         },
  { TK_CREATECOLLECTION, "TK_CREATECOLLECTION"},
  { TK_DROPCOLLECTION,   "TK_DROPCOLLECTION"  },
};

................................................................................
    case TK_LSHIFT:
    case TK_RSHIFT:
    case TK_PLUS:
    case TK_MINUS:
    case TK_STAR:
    case TK_SLASH:
    case TK_REM:
    case TK_CONCAT:
    case TK_IS:
    case TK_BANG:
    case TK_NOT_IS: {
      if( p->u.bi.pRight ){
        xjd1StringAppend(pOut, "(", 1);
        xjd1TraceExpr(pOut, p->u.bi.pLeft);
        xjd1StringAppendF(pOut, ") %s (", xjd1TokenName(p->eType));
        xjd1TraceExpr(pOut, p->u.bi.pRight);
        xjd1StringAppend(pOut, ")", 1);
      }else{







>


<
|
>
>

<
<

>
>
>
|




<
<
<


>





|
>

<







 







>





>






<
<







 







<
<
|
<







29
30
31
32
33
34
35
36
37
38

39
40
41
42


43
44
45
46
47
48
49
50
51



52
53
54
55
56
57
58
59
60
61
62

63
64
65
66
67
68
69
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108


109
110
111
112
113
114
115
...
349
350
351
352
353
354
355


356

357
358
359
360
361
362
363
  { TK_SEMI,             "TK_SEMI"            },
  { TK_INTEGER,          "TK_INTEGER"         },
  { TK_FLOAT,            "TK_FLOAT"           },
  { TK_STRING,           "TK_STRING"          },
  { TK_TRUE,             "TK_TRUE"            },
  { TK_FALSE,            "TK_FALSE"           },
  { TK_NULL,             "TK_NULL"            },
  { TK_QM,               "TK_QM"              },
  { TK_OR,               "TK_OR"              },
  { TK_AND,              "TK_AND"             },

  { TK_BITOR,            "TK_BITOR"           },
  { TK_BITXOR,           "TK_BITXOR"          },
  { TK_BITAND,           "TK_BITAND"          },
  { TK_LIKEOP,           "TK_LIKEOP"          },


  { TK_NE,               "TK_NE"              },
  { TK_EQEQ,             "TK_EQEQ"            },
  { TK_EQ3,              "TK_EQ3"             },
  { TK_NE3,              "TK_NE3"             },
  { TK_IN,               "TK_IN"              },
  { TK_GT,               "TK_GT"              },
  { TK_LE,               "TK_LE"              },
  { TK_LT,               "TK_LT"              },
  { TK_GE,               "TK_GE"              },



  { TK_LSHIFT,           "TK_LSHIFT"          },
  { TK_RSHIFT,           "TK_RSHIFT"          },
  { TK_URSHIFT,          "TK_URSHIFT"         },
  { TK_PLUS,             "TK_PLUS"            },
  { TK_MINUS,            "TK_MINUS"           },
  { TK_STAR,             "TK_STAR"            },
  { TK_SLASH,            "TK_SLASH"           },
  { TK_REM,              "TK_REM"             },
  { TK_BITNOT,           "TK_BITNOT"          },
  { TK_BANG,             "TK_BANG"            },
  { TK_COLLATE,          "TK_COLLATE"         },

  { TK_ID,               "TK_ID"              },
  { TK_DOT,              "TK_DOT"             },
  { TK_LB,               "TK_LB"              },
  { TK_RB,               "TK_RB"              },
  { TK_LC,               "TK_LC"              },
  { TK_RC,               "TK_RC"              },
  { TK_COLON,            "TK_COLON"           },
................................................................................
  { TK_WHERE,            "TK_WHERE"           },
  { TK_BEGIN,            "TK_BEGIN"           },
  { TK_ROLLBACK,         "TK_ROLLBACK"        },
  { TK_COMMIT,           "TK_COMMIT"          },
  { TK_CREATE,           "TK_CREATE"          },
  { TK_COLLECTION,       "TK_COLLECTION"      },
  { TK_IF,               "TK_IF"              },
  { TK_NOT,              "TK_NOT"             },
  { TK_EXISTS,           "TK_EXISTS"          },
  { TK_DROP,             "TK_DROP"            },
  { TK_DELETE,           "TK_DELETE"          },
  { TK_UPDATE,           "TK_UPDATE"          },
  { TK_SET,              "TK_SET"             },
  { TK_EQ,               "TK_EQ"              },
  { TK_ELSE,             "TK_ELSE"            },
  { TK_INSERT,           "TK_INSERT"          },
  { TK_INTO,             "TK_INTO"            },
  { TK_VALUE,            "TK_VALUE"           },
  { TK_PRAGMA,           "TK_PRAGMA"          },
  /* End paste of parse_txt.h */


  { TK_FUNCTION,         "TK_FUNCTION"        },
  { TK_SPACE,            "TK_SPACE"           },
  { TK_ILLEGAL,          "TK_ILLEGAL"         },
  { TK_CREATECOLLECTION, "TK_CREATECOLLECTION"},
  { TK_DROPCOLLECTION,   "TK_DROPCOLLECTION"  },
};

................................................................................
    case TK_LSHIFT:
    case TK_RSHIFT:
    case TK_PLUS:
    case TK_MINUS:
    case TK_STAR:
    case TK_SLASH:
    case TK_REM:


    case TK_BANG: {

      if( p->u.bi.pRight ){
        xjd1StringAppend(pOut, "(", 1);
        xjd1TraceExpr(pOut, p->u.bi.pLeft);
        xjd1StringAppendF(pOut, ") %s (", xjd1TokenName(p->eType));
        xjd1TraceExpr(pOut, p->u.bi.pRight);
        xjd1StringAppend(pOut, ")", 1);
      }else{

Changes to tool/mkkeywordhash.c.

58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

89
90
91
92
93
94
95
96
97
98
*/
static Keyword aKeywordTable[] = {
  { "ALL",          "TK_ALL",        },
  { "ASCENDING",    "TK_ASCENDING",  },
  { "ASC",          "TK_ASCENDING",  },
  { "AS",           "TK_AS",         },
  { "BEGIN",        "TK_BEGIN",      },
  { "BETWEEN",      "TK_BETWEEN",    },
  { "BY",           "TK_BY",         },
  { "COLLATE",      "TK_COLLATE",    },
  { "COLLECTION",   "TK_COLLECTION", },
  { "COMMIT",       "TK_COMMIT",     },
  { "CREATE",       "TK_CREATE",     },
  { "DELETE",       "TK_DELETE",     },
  { "DESCENDING",   "TK_DESCENDING", },
  { "DESC",         "TK_DESCENDING", },
  { "DROP",         "TK_DROP",       },
  { "EACH",         "TK_FLATTENOP",  },
  { "ELSE",         "TK_ELSE",       },
  { "ESCAPE",       "TK_ESCAPE",     },
  { "EXCEPT",       "TK_EXCEPT",     },
  { "EXISTS",       "TK_EXISTS",     },
  { "false",        "TK_FALSE",      },
  { "FLATTEN",      "TK_FLATTENOP",  },
  { "FROM",         "TK_FROM",       },
  { "GLOB",         "TK_LIKEOP",     },
  { "GROUP",        "TK_GROUP",      },
  { "HAVING",       "TK_HAVING",     },
  { "IF",           "TK_IF",         },
  { "INSERT",       "TK_INSERT",     },
  { "INTERSECT",    "TK_INTERSECT",  },

  { "IN",           "TK_IN",         },
  { "INTO",         "TK_INTO",       },
  { "IS",           "TK_IS",         },
  { "LIKE",         "TK_LIKEOP",     },
  { "LIMIT",        "TK_LIMIT",      },
  { "NOT",          "TK_NOT",        },
  { "NULL",         "TK_NULL",       },
  { "null",         "TK_NULL",       },
  { "OFFSET",       "TK_OFFSET",     },
  { "ORDER",        "TK_ORDER",      },







<











<











>


<







58
59
60
61
62
63
64

65
66
67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
*/
static Keyword aKeywordTable[] = {
  { "ALL",          "TK_ALL",        },
  { "ASCENDING",    "TK_ASCENDING",  },
  { "ASC",          "TK_ASCENDING",  },
  { "AS",           "TK_AS",         },
  { "BEGIN",        "TK_BEGIN",      },

  { "BY",           "TK_BY",         },
  { "COLLATE",      "TK_COLLATE",    },
  { "COLLECTION",   "TK_COLLECTION", },
  { "COMMIT",       "TK_COMMIT",     },
  { "CREATE",       "TK_CREATE",     },
  { "DELETE",       "TK_DELETE",     },
  { "DESCENDING",   "TK_DESCENDING", },
  { "DESC",         "TK_DESCENDING", },
  { "DROP",         "TK_DROP",       },
  { "EACH",         "TK_FLATTENOP",  },
  { "ELSE",         "TK_ELSE",       },

  { "EXCEPT",       "TK_EXCEPT",     },
  { "EXISTS",       "TK_EXISTS",     },
  { "false",        "TK_FALSE",      },
  { "FLATTEN",      "TK_FLATTENOP",  },
  { "FROM",         "TK_FROM",       },
  { "GLOB",         "TK_LIKEOP",     },
  { "GROUP",        "TK_GROUP",      },
  { "HAVING",       "TK_HAVING",     },
  { "IF",           "TK_IF",         },
  { "INSERT",       "TK_INSERT",     },
  { "INTERSECT",    "TK_INTERSECT",  },
  { "in",           "TK_IN",         },
  { "IN",           "TK_IN",         },
  { "INTO",         "TK_INTO",       },

  { "LIKE",         "TK_LIKEOP",     },
  { "LIMIT",        "TK_LIMIT",      },
  { "NOT",          "TK_NOT",        },
  { "NULL",         "TK_NULL",       },
  { "null",         "TK_NULL",       },
  { "OFFSET",       "TK_OFFSET",     },
  { "ORDER",        "TK_ORDER",      },