UnQL

Check-in [1296cc1b15]
Login

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

Overview
Comment:Add ===, !== and >>> operators.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 1296cc1b15f8e1b92fbc830b96cb0870cd91b3a5
User & Date: drh 2011-07-15 19:33:05
Context
2011-07-15
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
18:36
Change the NOT operator into !. check-in: 59096a3d9c user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/parse.y.

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
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.
%left GT LE LT GE.
%right ESCAPE.
%left BITAND BITOR LSHIFT RSHIFT.
%left PLUS MINUS.
%left STAR SLASH REM.
%left CONCAT.
%left COLLATE.
%right BITNOT.

%include {
................................................................................



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(OP) expr(Y).         {A = biExpr(p,X,@OP,Y);}
expr(A) ::= expr(X) BITAND|BITOR|LSHIFT|RSHIFT(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;}







|


|







 







|
|







111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
...
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
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 {
................................................................................



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;}

Changes to src/tokenize.c.

229
230
231
232
233
234
235
236
237
238



239
240
241
242
243
244
245
246
247
248
...
256
257
258
259
260
261
262
263
264
265



266
267
268
269
270
271
272
273
274



275
276
277
278
279
280
281
      return i;
    }
    case '%': {
      *tokenType = TK_REM;
      return 1;
    }
    case '=': {
      if( z[1]=='=' ){
        *tokenType = TK_EQEQ;
        return 2;



      }else{
        *tokenType = TK_EQ;
        return 1;
      }
    }
    case '<': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_LE;
        return 2;
      }else if( c=='>' ){
................................................................................
        return 1;
      }
    }
    case '>': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_GE;
        return 2;
      }else if( c=='>' ){
        *tokenType = TK_RSHIFT;
        return 2;



      }else{
        *tokenType = TK_GT;
        return 1;
      }
    }
    case '!': {
      if( z[1]!='=' ){
        *tokenType = TK_BANG;
        return 1;



      }else{
        *tokenType = TK_NE;
        return 2;
      }
    }
    case '|': {
      if( z[1]!='|' ){







|
|
|
>
>
>

|
|







 







|
|
|
>
>
>

|
|






>
>
>







229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
      return i;
    }
    case '%': {
      *tokenType = TK_REM;
      return 1;
    }
    case '=': {
      if( z[1]!='=' ){
        *tokenType = TK_EQ;
        return 1;
      }else if( z[2]=='=' ){
        *tokenType = TK_EQ3;
        return 3;
      }else{
        *tokenType = TK_EQEQ;
        return 2;
      }
    }
    case '<': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_LE;
        return 2;
      }else if( c=='>' ){
................................................................................
        return 1;
      }
    }
    case '>': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_GE;
        return 2;
      }else if( c!='>' ){
        *tokenType = TK_GT;
        return 1;
      }else if( z[2]=='>' ){
        *tokenType = TK_URSHIFT;
        return 3;
      }else{
        *tokenType = TK_RSHIFT;
        return 2;
      }
    }
    case '!': {
      if( z[1]!='=' ){
        *tokenType = TK_BANG;
        return 1;
      }else if( z[2]=='=' ){
        *tokenType = TK_NE3;
        return 3;
      }else{
        *tokenType = TK_NE;
        return 2;
      }
    }
    case '|': {
      if( z[1]!='|' ){