@@ -224,32 +224,6 @@ digitseq {digit}+
224
224
hexint 0[Xx ]{hexdigit }+
225
225
hexintfail 0[Xx ]
226
226
227
-
228
- /*
229
- * decimal pattern covers RegularDecimalReal rule in Cypher and also accepts
230
- * "{digitseq}\." pattern (e.g. "1.") which RegularDecimalReal rule doesn't.
231
- * Decimal in JSON is represented in "(0|[1-9][0-9]*)\.[0-9]+" pattern that is
232
- * covered by decimal pattern.
233
- *
234
- * decimalfail pattern is for ranges (e.g. "0..1"). The action for the pattern
235
- * consumes digitseq and returns dot_dot back to the input stream so that
236
- * dot_dot can be matched next.
237
- */
238
- decimal {digitseq }\. {digit }* | \. {digitseq }
239
- decimalfail {digitseq }\.\.
240
-
241
- /*
242
- * decimalsci pattern covers ExponentDecimalReal rule in Cypher. It also
243
- * accepts coefficients in "{digitseq}\." pattern and explicit positive
244
- * exponents ("+") which ExponentDecimalReal rule doesn't.
245
- * Scientific notation in JSON is represented in
246
- * "(0|[1-9][0-9]*)(\.[0-9]+)?[Ee][+-]?[0-9]+" pattern that is covered by
247
- * decimalsci pattern.
248
- */
249
- decimalsci ({digitseq }| {decimal })[Ee ][+- ]? {digitseq }
250
- decimalscifail1 ({digitseq }| {decimal })[Ee ]
251
- decimalscifail2 ({digitseq }| {decimal })[Ee ][+- ]
252
-
253
227
/*
254
228
* These patterns cover StringLiteral rule in Cypher and JSON strings.
255
229
* The escape sequence "\/" has been added for JSON strings.
@@ -300,10 +274,8 @@ dolqdelim \$({dolq_start}{dolq_cont}*)?\$
300
274
dolqfailed \$ {dolq_start }{dolq_cont }*
301
275
dolqinside [^ $ ]+
302
276
303
-
304
-
305
277
sqchars [^ ' \\ ]+
306
- esascii \\ ["'/ \\ bfnrtdw1 ]
278
+ esascii \\ [^ 0 - 7 ]
307
279
esasciifail \\ [^ Uu ]?
308
280
esunicode \\ (U{hexdigit }{8 }| u{hexdigit }{4 })
309
281
esunicodefail \\ (U{hexdigit }{0,7 }| u{hexdigit }{0,3 })
@@ -325,32 +297,57 @@ bquote `
325
297
bqchars [^ ` ]+
326
298
esbquote {bquote }{bquote }
327
299
328
- /*
329
- * Parameter rule in Cypher is "$" followed by SymbolicName or DecimalInteger
330
- * rule. However, according to "Cypher Query Language Reference",
331
- *
332
- * Parameters may consist of letters and numbers, and any combination of
333
- * these, but cannot start with a number or a currency symbol.
334
- *
335
- * So, a modified version of Parameter rule that follows the above explanation
336
- * has been used.
337
- */
338
- param (\$ {id })| (\$ {digitseq })
339
-
300
+ dot_dot " .."
301
+ typecast " ::"
302
+ colon_equals " :="
340
303
/*
341
304
* These are tokens that are used as operators and language constructs in
342
305
* Cypher, and some of them are structural characters in JSON.
343
306
*/
344
307
lt_gt " <>" | " !="
345
308
lt_eq " <="
346
309
gt_eq " >="
347
- dot_dot " .."
348
310
plus_eq " +="
349
- typecast " :: "
311
+
350
312
self [?&!@#%()*+, \- .~/:;<=>[ \] ^{|} ]
351
313
operator [\~\!\|\-\<\>\=\#\%\~\!\@\^\&\`\?\+\*\/ ]+
352
314
315
+ /*
316
+ * decimal pattern covers RegularDecimalReal rule in Cypher and also accepts
317
+ * "{digitseq}\." pattern (e.g. "1.") which RegularDecimalReal rule doesn't.
318
+ * Decimal in JSON is represented in "(0|[1-9][0-9]*)\.[0-9]+" pattern that is
319
+ * covered by decimal pattern.
320
+ *
321
+ * decimalfail pattern is for ranges (e.g. "0..1"). The action for the pattern
322
+ * consumes digitseq and returns dot_dot back to the input stream so that
323
+ * dot_dot can be matched next.
324
+ */
325
+ decimal {digitseq }\. {digit }* | \. {digitseq }
326
+ decimalfail {digitseq }\.\.
353
327
328
+ /*
329
+ * real pattern covers ExponentDecimalReal rule in Cypher. It also
330
+ * accepts coefficients in "{digitseq}\." pattern and explicit positive
331
+ * exponents ("+") which ExponentDecimalReal rule doesn't.
332
+ * Scientific notation in JSON is represented in
333
+ * "(0|[1-9][0-9]*)(\.[0-9]+)?[Ee][+-]?[0-9]+" pattern that is covered by
334
+ * real pattern.
335
+ */
336
+ real ({digitseq }| {decimal })[Ee ][+- ]? {digitseq }
337
+ realfail1 ({digitseq }| {decimal })[Ee ]
338
+ realfail2 ({digitseq }| {decimal })[Ee ][+- ]
339
+
340
+ /*
341
+ * Parameter rule in Cypher is "$" followed by SymbolicName or DecimalInteger
342
+ * rule. However, according to "Cypher Query Language Reference",
343
+ *
344
+ * Parameters may consist of letters and numbers, and any combination of
345
+ * these, but cannot start with a number or a currency symbol.
346
+ *
347
+ * So, a modified version of Parameter rule that follows the above explanation
348
+ * has been used.
349
+ */
350
+ param (\$ {id })| (\$ {digitseq })
354
351
355
352
other .
356
353
@@ -363,9 +360,6 @@ typedef struct strbuf
363
360
int length;
364
361
} strbuf;
365
362
366
-
367
-
368
-
369
363
static void strbuf_trunc_buf (strbuf *sb, const int len);
370
364
static void strbuf_init (strbuf *sb, int capacity);
371
365
static void strbuf_cleanup (strbuf *sb);
@@ -525,7 +519,7 @@ ag_token token;
525
519
}
526
520
527
521
{decimal } |
528
- {decimalsci } {
522
+ {real } {
529
523
update_location ();
530
524
token.type = AG_TOKEN_DECIMAL;
531
525
token.value .s = yytext;
@@ -546,8 +540,8 @@ ag_token token;
546
540
}
547
541
548
542
549
- {decimalscifail1 } |
550
- {decimalscifail2 } {
543
+ {realfail1 } |
544
+ {realfail2 } {
551
545
update_location ();
552
546
ereport (ERROR, (errcode (ERRCODE_SYNTAX_ERROR),
553
547
scan_errmsg (" invalid scientific notation literal" ),
@@ -1354,6 +1348,14 @@ ag_token token;
1354
1348
return token;
1355
1349
}
1356
1350
1351
+ {colon_equals } {
1352
+ update_location ();
1353
+ token.type = AG_TOKEN_COLON_EQUALS;
1354
+ token.value .s = yytext;
1355
+ token.location = get_location ();
1356
+ return token;
1357
+ }
1358
+
1357
1359
{plus_eq } {
1358
1360
update_location ();
1359
1361
token.type = AG_TOKEN_PLUS_EQ;
0 commit comments