1 | #line 1 "third_party/libpg_query/src_backend_parser_scan.cpp" |
2 | /*------------------------------------------------------------------------- |
3 | * |
4 | * scan.l |
5 | * lexical scanner for PostgreSQL |
6 | * |
7 | * NOTE NOTE NOTE: |
8 | * |
9 | * The rules in this file must be kept in sync with src/fe_utils/psqlscan.l! |
10 | * |
11 | * The rules are designed so that the scanner never has to backtrack, |
12 | * in the sense that there is always a rule that can match the input |
13 | * consumed so far (the rule action may internally throw back some input |
14 | * with yyless(), however). As explained in the flex manual, this makes |
15 | * for a useful speed increase --- about a third faster than a plain -CF |
16 | * lexer, in simple testing. The extra complexity is mostly in the rules |
17 | * for handling float numbers and continued string literals. If you change |
18 | * the lexical rules, verify that you haven't broken the no-backtrack ' |
19 | * property by running flex with the "-b" option and checking that the |
20 | * resulting "lex.backup" file says that no backing up is needed. (As of |
21 | * Postgres 9.2, this check is made automatically by the Makefile.) |
22 | * |
23 | * |
24 | * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group |
25 | * Portions Copyright (c) 1994, Regents of the University of California |
26 | * |
27 | * IDENTIFICATION |
28 | * src/backend/parser/scan.l |
29 | * |
30 | *------------------------------------------------------------------------- |
31 | */ |
32 | #include <ctype.h> |
33 | //#include <unistd.h> |
34 | #include "pg_functions.hpp" |
35 | |
36 | #include "parser/gramparse.hpp" |
37 | #include "parser/parser.hpp" /* only needed for GUC variables */ |
38 | #include "parser/scansup.hpp" |
39 | #include "mb/pg_wchar.hpp" |
40 | |
41 | #include <stdexcept> |
42 | |
43 | #line 43 "third_party/libpg_query/src_backend_parser_scan.cpp" |
44 | |
45 | #define YY_INT_ALIGNED short int |
46 | |
47 | /* A lexical scanner generated by flex */ |
48 | |
49 | #define FLEX_SCANNER |
50 | #define YY_FLEX_MAJOR_VERSION 2 |
51 | #define YY_FLEX_MINOR_VERSION 6 |
52 | #define YY_FLEX_SUBMINOR_VERSION 4 |
53 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
54 | #define FLEX_BETA |
55 | #endif |
56 | |
57 | #ifdef yy_create_buffer |
58 | #define core_yy_create_buffer_ALREADY_DEFINED |
59 | #else |
60 | #define yy_create_buffer core_yy_create_buffer |
61 | #endif |
62 | |
63 | #ifdef yy_delete_buffer |
64 | #define core_yy_delete_buffer_ALREADY_DEFINED |
65 | #else |
66 | #define yy_delete_buffer core_yy_delete_buffer |
67 | #endif |
68 | |
69 | #ifdef yy_scan_buffer |
70 | #define core_yy_scan_buffer_ALREADY_DEFINED |
71 | #else |
72 | #define yy_scan_buffer core_yy_scan_buffer |
73 | #endif |
74 | |
75 | #ifdef yy_scan_string |
76 | #define core_yy_scan_string_ALREADY_DEFINED |
77 | #else |
78 | #define yy_scan_string core_yy_scan_string |
79 | #endif |
80 | |
81 | #ifdef yy_scan_bytes |
82 | #define core_yy_scan_bytes_ALREADY_DEFINED |
83 | #else |
84 | #define yy_scan_bytes core_yy_scan_bytes |
85 | #endif |
86 | |
87 | #ifdef yy_init_buffer |
88 | #define core_yy_init_buffer_ALREADY_DEFINED |
89 | #else |
90 | #define yy_init_buffer core_yy_init_buffer |
91 | #endif |
92 | |
93 | #ifdef yy_flush_buffer |
94 | #define core_yy_flush_buffer_ALREADY_DEFINED |
95 | #else |
96 | #define yy_flush_buffer core_yy_flush_buffer |
97 | #endif |
98 | |
99 | #ifdef yy_load_buffer_state |
100 | #define core_yy_load_buffer_state_ALREADY_DEFINED |
101 | #else |
102 | #define yy_load_buffer_state core_yy_load_buffer_state |
103 | #endif |
104 | |
105 | #ifdef yy_switch_to_buffer |
106 | #define core_yy_switch_to_buffer_ALREADY_DEFINED |
107 | #else |
108 | #define yy_switch_to_buffer core_yy_switch_to_buffer |
109 | #endif |
110 | |
111 | #ifdef yypush_buffer_state |
112 | #define core_yypush_buffer_state_ALREADY_DEFINED |
113 | #else |
114 | #define yypush_buffer_state core_yypush_buffer_state |
115 | #endif |
116 | |
117 | #ifdef yypop_buffer_state |
118 | #define core_yypop_buffer_state_ALREADY_DEFINED |
119 | #else |
120 | #define yypop_buffer_state core_yypop_buffer_state |
121 | #endif |
122 | |
123 | #ifdef yyensure_buffer_stack |
124 | #define core_yyensure_buffer_stack_ALREADY_DEFINED |
125 | #else |
126 | #define yyensure_buffer_stack core_yyensure_buffer_stack |
127 | #endif |
128 | |
129 | #ifdef yylex |
130 | #define core_yylex_ALREADY_DEFINED |
131 | #else |
132 | #define yylex core_yylex |
133 | #endif |
134 | |
135 | #ifdef yyrestart |
136 | #define core_yyrestart_ALREADY_DEFINED |
137 | #else |
138 | #define yyrestart core_yyrestart |
139 | #endif |
140 | |
141 | #ifdef yylex_init |
142 | #define core_yylex_init_ALREADY_DEFINED |
143 | #else |
144 | #define yylex_init core_yylex_init |
145 | #endif |
146 | |
147 | #ifdef yylex_init_extra |
148 | #define core_yylex_init_extra_ALREADY_DEFINED |
149 | #else |
150 | #define |
151 | #endif |
152 | |
153 | #ifdef yylex_destroy |
154 | #define core_yylex_destroy_ALREADY_DEFINED |
155 | #else |
156 | #define yylex_destroy core_yylex_destroy |
157 | #endif |
158 | |
159 | #ifdef yyget_debug |
160 | #define core_yyget_debug_ALREADY_DEFINED |
161 | #else |
162 | #define yyget_debug core_yyget_debug |
163 | #endif |
164 | |
165 | #ifdef yyset_debug |
166 | #define core_yyset_debug_ALREADY_DEFINED |
167 | #else |
168 | #define yyset_debug core_yyset_debug |
169 | #endif |
170 | |
171 | #ifdef yyget_extra |
172 | #define core_yyget_extra_ALREADY_DEFINED |
173 | #else |
174 | #define |
175 | #endif |
176 | |
177 | #ifdef yyset_extra |
178 | #define core_yyset_extra_ALREADY_DEFINED |
179 | #else |
180 | #define |
181 | #endif |
182 | |
183 | #ifdef yyget_in |
184 | #define core_yyget_in_ALREADY_DEFINED |
185 | #else |
186 | #define yyget_in core_yyget_in |
187 | #endif |
188 | |
189 | #ifdef yyset_in |
190 | #define core_yyset_in_ALREADY_DEFINED |
191 | #else |
192 | #define yyset_in core_yyset_in |
193 | #endif |
194 | |
195 | #ifdef yyget_out |
196 | #define core_yyget_out_ALREADY_DEFINED |
197 | #else |
198 | #define yyget_out core_yyget_out |
199 | #endif |
200 | |
201 | #ifdef yyset_out |
202 | #define core_yyset_out_ALREADY_DEFINED |
203 | #else |
204 | #define yyset_out core_yyset_out |
205 | #endif |
206 | |
207 | #ifdef yyget_leng |
208 | #define core_yyget_leng_ALREADY_DEFINED |
209 | #else |
210 | #define yyget_leng core_yyget_leng |
211 | #endif |
212 | |
213 | #ifdef yyget_text |
214 | #define core_yyget_text_ALREADY_DEFINED |
215 | #else |
216 | #define yyget_text core_yyget_text |
217 | #endif |
218 | |
219 | #ifdef yyget_lineno |
220 | #define core_yyget_lineno_ALREADY_DEFINED |
221 | #else |
222 | #define yyget_lineno core_yyget_lineno |
223 | #endif |
224 | |
225 | #ifdef yyset_lineno |
226 | #define core_yyset_lineno_ALREADY_DEFINED |
227 | #else |
228 | #define yyset_lineno core_yyset_lineno |
229 | #endif |
230 | |
231 | #ifdef yyget_column |
232 | #define core_yyget_column_ALREADY_DEFINED |
233 | #else |
234 | #define yyget_column core_yyget_column |
235 | #endif |
236 | |
237 | #ifdef yyset_column |
238 | #define core_yyset_column_ALREADY_DEFINED |
239 | #else |
240 | #define yyset_column core_yyset_column |
241 | #endif |
242 | |
243 | #ifdef yywrap |
244 | #define core_yywrap_ALREADY_DEFINED |
245 | #else |
246 | #define yywrap core_yywrap |
247 | #endif |
248 | |
249 | #ifdef yyget_lval |
250 | #define core_yyget_lval_ALREADY_DEFINED |
251 | #else |
252 | #define yyget_lval core_yyget_lval |
253 | #endif |
254 | |
255 | #ifdef yyset_lval |
256 | #define core_yyset_lval_ALREADY_DEFINED |
257 | #else |
258 | #define yyset_lval core_yyset_lval |
259 | #endif |
260 | |
261 | #ifdef yyget_lloc |
262 | #define core_yyget_lloc_ALREADY_DEFINED |
263 | #else |
264 | #define yyget_lloc core_yyget_lloc |
265 | #endif |
266 | |
267 | #ifdef yyset_lloc |
268 | #define core_yyset_lloc_ALREADY_DEFINED |
269 | #else |
270 | #define yyset_lloc core_yyset_lloc |
271 | #endif |
272 | |
273 | #ifdef yyalloc |
274 | #define core_yyalloc_ALREADY_DEFINED |
275 | #else |
276 | #define yyalloc core_yyalloc |
277 | #endif |
278 | |
279 | #ifdef yyrealloc |
280 | #define core_yyrealloc_ALREADY_DEFINED |
281 | #else |
282 | #define yyrealloc core_yyrealloc |
283 | #endif |
284 | |
285 | #ifdef yyfree |
286 | #define core_yyfree_ALREADY_DEFINED |
287 | #else |
288 | #define yyfree core_yyfree |
289 | #endif |
290 | |
291 | /* First, we deal with platform-specific or compiler-specific issues. */ |
292 | |
293 | /* begin standard C headers. */ |
294 | #include <stdio.h> |
295 | #include <string.h> |
296 | #include <errno.h> |
297 | #include <stdlib.h> |
298 | |
299 | /* end standard C headers. */ |
300 | |
301 | /* flex integer type definitions */ |
302 | |
303 | #ifndef FLEXINT_H |
304 | #define FLEXINT_H |
305 | namespace duckdb_libpgquery { |
306 | |
307 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
308 | |
309 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
310 | |
311 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, |
312 | * if you want the limit (max/min) macros for int types. |
313 | */ |
314 | #ifndef __STDC_LIMIT_MACROS |
315 | #define __STDC_LIMIT_MACROS 1 |
316 | #endif |
317 | |
318 | #include <inttypes.h> |
319 | typedef int8_t flex_int8_t; |
320 | typedef uint8_t flex_uint8_t; |
321 | typedef int16_t flex_int16_t; |
322 | typedef uint16_t flex_uint16_t; |
323 | typedef int32_t flex_int32_t; |
324 | typedef uint32_t flex_uint32_t; |
325 | typedef uint64_t flex_uint64_t; |
326 | #else |
327 | typedef signed char flex_int8_t; |
328 | typedef short int flex_int16_t; |
329 | typedef int flex_int32_t; |
330 | typedef unsigned char flex_uint8_t; |
331 | typedef unsigned short int flex_uint16_t; |
332 | typedef unsigned int flex_uint32_t; |
333 | |
334 | /* Limits of integral types. */ |
335 | #ifndef INT8_MIN |
336 | #define INT8_MIN (-128) |
337 | #endif |
338 | #ifndef INT16_MIN |
339 | #define INT16_MIN (-32767-1) |
340 | #endif |
341 | #ifndef INT32_MIN |
342 | #define INT32_MIN (-2147483647-1) |
343 | #endif |
344 | #ifndef INT8_MAX |
345 | #define INT8_MAX (127) |
346 | #endif |
347 | #ifndef INT16_MAX |
348 | #define INT16_MAX (32767) |
349 | #endif |
350 | #ifndef INT32_MAX |
351 | #define INT32_MAX (2147483647) |
352 | #endif |
353 | #ifndef UINT8_MAX |
354 | #define UINT8_MAX (255U) |
355 | #endif |
356 | #ifndef UINT16_MAX |
357 | #define UINT16_MAX (65535U) |
358 | #endif |
359 | #ifndef UINT32_MAX |
360 | #define UINT32_MAX (4294967295U) |
361 | #endif |
362 | |
363 | #ifndef SIZE_MAX |
364 | #define SIZE_MAX (~(size_t)0) |
365 | #endif |
366 | |
367 | #endif /* ! C99 */ |
368 | |
369 | #endif /* ! FLEXINT_H */ |
370 | |
371 | /* begin standard C++ headers. */ |
372 | |
373 | /* TODO: this is always defined, so inline it */ |
374 | #define yyconst const |
375 | |
376 | #if defined(__GNUC__) && __GNUC__ >= 3 |
377 | #define yynoreturn __attribute__((__noreturn__)) |
378 | #else |
379 | #define yynoreturn |
380 | #endif |
381 | |
382 | /* Returned upon end-of-file. */ |
383 | #define YY_NULL 0 |
384 | |
385 | /* Promotes a possibly negative, possibly signed char to an |
386 | * integer in range [0..255] for use as an array index. |
387 | */ |
388 | #define YY_SC_TO_UI(c) ((YY_CHAR) (c)) |
389 | |
390 | /* An opaque pointer. */ |
391 | #ifndef YY_TYPEDEF_YY_SCANNER_T |
392 | #define YY_TYPEDEF_YY_SCANNER_T |
393 | typedef void* yyscan_t; |
394 | #endif |
395 | |
396 | /* For convenience, these vars (plus the bison vars far below) |
397 | are macros in the reentrant scanner. */ |
398 | #define yyin yyg->yyin_r |
399 | #define yyout yyg->yyout_r |
400 | #define yyg->yyextra_r |
401 | #define yyleng yyg->yyleng_r |
402 | #define yytext yyg->yytext_r |
403 | #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) |
404 | #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) |
405 | #define yy_flex_debug yyg->yy_flex_debug_r |
406 | |
407 | /* Enter a start condition. This macro really ought to take a parameter, |
408 | * but we do it the disgusting crufty way forced on us by the ()-less |
409 | * definition of BEGIN. |
410 | */ |
411 | #define BEGIN yyg->yy_start = 1 + 2 * |
412 | /* Translate the current start state into a value that can be later handed |
413 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
414 | * compatibility. |
415 | */ |
416 | #define YY_START ((yyg->yy_start - 1) / 2) |
417 | #define YYSTATE YY_START |
418 | /* Action number for EOF rule of a given start state. */ |
419 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
420 | /* Special action meaning "start processing a new file". */ |
421 | #define YY_NEW_FILE yyrestart( yyin , yyscanner ) |
422 | #define YY_END_OF_BUFFER_CHAR 0 |
423 | |
424 | /* Size of default input buffer. */ |
425 | #ifndef YY_BUF_SIZE |
426 | #ifdef __ia64__ |
427 | /* On IA-64, the buffer size is 16k, not 8k. |
428 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. |
429 | * Ditto for the __ia64__ case accordingly. |
430 | */ |
431 | #define YY_BUF_SIZE 32768 |
432 | #else |
433 | #define YY_BUF_SIZE 16384 |
434 | #endif /* __ia64__ */ |
435 | #endif |
436 | |
437 | /* The state buf must be large enough to hold one state per character in the main buffer. |
438 | */ |
439 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) |
440 | |
441 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
442 | #define YY_TYPEDEF_YY_BUFFER_STATE |
443 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
444 | #endif |
445 | |
446 | #ifndef YY_TYPEDEF_YY_SIZE_T |
447 | #define YY_TYPEDEF_YY_SIZE_T |
448 | typedef size_t yy_size_t; |
449 | #endif |
450 | |
451 | #define EOB_ACT_CONTINUE_SCAN 0 |
452 | #define EOB_ACT_END_OF_FILE 1 |
453 | #define EOB_ACT_LAST_MATCH 2 |
454 | |
455 | #define YY_LESS_LINENO(n) |
456 | #define YY_LINENO_REWIND_TO(ptr) |
457 | |
458 | /* Return all but the first "n" matched characters back to the input stream. */ |
459 | #define yyless(n) \ |
460 | do \ |
461 | { \ |
462 | /* Undo effects of setting up yytext. */ \ |
463 | int yyless_macro_arg = (n); \ |
464 | YY_LESS_LINENO(yyless_macro_arg);\ |
465 | *yy_cp = yyg->yy_hold_char; \ |
466 | YY_RESTORE_YY_MORE_OFFSET \ |
467 | yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ |
468 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
469 | } \ |
470 | while ( 0 ) |
471 | #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) |
472 | |
473 | #ifndef YY_STRUCT_YY_BUFFER_STATE |
474 | #define YY_STRUCT_YY_BUFFER_STATE |
475 | struct yy_buffer_state |
476 | { |
477 | FILE *yy_input_file; |
478 | |
479 | char *yy_ch_buf; /* input buffer */ |
480 | char *yy_buf_pos; /* current position in input buffer */ |
481 | |
482 | /* Size of input buffer in bytes, not including room for EOB |
483 | * characters. |
484 | */ |
485 | yy_size_t yy_buf_size; |
486 | |
487 | /* Number of characters read into yy_ch_buf, not including EOB |
488 | * characters. |
489 | */ |
490 | yy_size_t yy_n_chars; |
491 | |
492 | /* Whether we "own" the buffer - i.e., we know we created it, |
493 | * and can realloc() it to grow it, and should free() it to |
494 | * delete it. |
495 | */ |
496 | int yy_is_our_buffer; |
497 | |
498 | /* Whether this is an "interactive" input source; if so, and |
499 | * if we're using stdio for input, then we want to use getc() |
500 | * instead of fread(), to make sure we stop fetching input after |
501 | * each newline. |
502 | */ |
503 | int yy_is_interactive; |
504 | |
505 | /* Whether we're considered to be at the beginning of a line. |
506 | * If so, '^' rules will be active on the next match, otherwise |
507 | * not. |
508 | */ |
509 | int yy_at_bol; |
510 | |
511 | int yy_bs_lineno; /**< The line count. */ |
512 | int yy_bs_column; /**< The column count. */ |
513 | |
514 | /* Whether to try to fill the input buffer when we reach the |
515 | * end of it. |
516 | */ |
517 | int yy_fill_buffer; |
518 | |
519 | int yy_buffer_status; |
520 | |
521 | #define YY_BUFFER_NEW 0 |
522 | #define YY_BUFFER_NORMAL 1 |
523 | /* When an EOF's been seen but there's still some text to process |
524 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
525 | * shouldn't try reading from the input source any more. We might |
526 | * still have a bunch of tokens to match, though, because of |
527 | * possible backing-up. |
528 | * |
529 | * When we actually see the EOF, we change the status to "new" |
530 | * (via yyrestart()), so that the user can continue scanning by |
531 | * just pointing yyin at a new input file. |
532 | */ |
533 | #define YY_BUFFER_EOF_PENDING 2 |
534 | |
535 | }; |
536 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ |
537 | |
538 | /* We provide macros for accessing buffer states in case in the |
539 | * future we want to put the buffer states in a more general |
540 | * "scanner state". |
541 | * |
542 | * Returns the top of the stack, or NULL. |
543 | */ |
544 | #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ |
545 | ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ |
546 | : NULL) |
547 | /* Same as previous macro, but useful when we know that the buffer stack is not |
548 | * NULL or when we need an lvalue. For internal use only. |
549 | */ |
550 | #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] |
551 | |
552 | void yyrestart ( FILE *input_file , yyscan_t yyscanner ); |
553 | void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
554 | YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); |
555 | void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
556 | void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); |
557 | void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); |
558 | void yypop_buffer_state ( yyscan_t yyscanner ); |
559 | |
560 | static void yyensure_buffer_stack ( yyscan_t yyscanner ); |
561 | static void yy_load_buffer_state ( yyscan_t yyscanner ); |
562 | static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); |
563 | #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) |
564 | |
565 | YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); |
566 | YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); |
567 | YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, yy_size_t len , yyscan_t yyscanner ); |
568 | |
569 | void *yyalloc ( yy_size_t , yyscan_t yyscanner ); |
570 | void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); |
571 | void yyfree ( void * , yyscan_t yyscanner ); |
572 | |
573 | #define yy_new_buffer yy_create_buffer |
574 | #define yy_set_interactive(is_interactive) \ |
575 | { \ |
576 | if ( ! YY_CURRENT_BUFFER ){ \ |
577 | yyensure_buffer_stack (yyscanner); \ |
578 | YY_CURRENT_BUFFER_LVALUE = \ |
579 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
580 | } \ |
581 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ |
582 | } |
583 | #define yy_set_bol(at_bol) \ |
584 | { \ |
585 | if ( ! YY_CURRENT_BUFFER ){\ |
586 | yyensure_buffer_stack (yyscanner); \ |
587 | YY_CURRENT_BUFFER_LVALUE = \ |
588 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ |
589 | } \ |
590 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ |
591 | } |
592 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) |
593 | |
594 | /* Begin user sect3 */ |
595 | |
596 | #define core_yywrap(yyscanner) (/*CONSTCOND*/1) |
597 | #define YY_SKIP_YYWRAP |
598 | typedef flex_uint8_t YY_CHAR; |
599 | |
600 | typedef int yy_state_type; |
601 | |
602 | #define yytext_ptr yytext_r |
603 | |
604 | static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); |
605 | static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); |
606 | static int yy_get_next_buffer ( yyscan_t yyscanner ); |
607 | static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); |
608 | |
609 | /* Done after the current pattern has been matched and before the |
610 | * corresponding action - sets up yytext. |
611 | */ |
612 | #define YY_DO_BEFORE_ACTION \ |
613 | yyg->yytext_ptr = yy_bp; \ |
614 | yyleng = (yy_size_t) (yy_cp - yy_bp); \ |
615 | yyg->yy_hold_char = *yy_cp; \ |
616 | *yy_cp = '\0'; \ |
617 | yyg->yy_c_buf_p = yy_cp; |
618 | #define YY_NUM_RULES 84 |
619 | #define YY_END_OF_BUFFER 85 |
620 | /* This struct is not used in this scanner, |
621 | but its presence is necessary. */ |
622 | struct yy_trans_info |
623 | { |
624 | flex_int32_t yy_verify; |
625 | flex_int32_t yy_nxt; |
626 | }; |
627 | static const flex_int16_t yy_accept[297] = |
628 | { 0, |
629 | 0, 0, 12, 12, 0, 0, 0, 0, 11, 11, |
630 | 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, |
631 | 0, 0, 28, 28, 0, 0, 85, 83, 1, 1, |
632 | 73, 49, 83, 72, 73, 19, 72, 72, 72, 72, |
633 | 72, 76, 72, 72, 72, 72, 83, 82, 82, 82, |
634 | 82, 82, 82, 12, 9, 5, 5, 6, 6, 58, |
635 | 51, 11, 16, 32, 32, 22, 42, 31, 22, 46, |
636 | 46, 48, 52, 54, 53, 53, 54, 54, 24, 27, |
637 | 26, 26, 27, 27, 35, 36, 35, 1, 73, 71, |
638 | 43, 74, 44, 65, 1, 63, 61, 77, 2, 66, |
639 | |
640 | 77, 76, 80, 60, 62, 68, 70, 67, 69, 75, |
641 | 82, 8, 20, 18, 59, 15, 12, 9, 9, 10, |
642 | 5, 7, 4, 3, 58, 57, 11, 16, 16, 17, |
643 | 32, 22, 22, 30, 23, 38, 39, 37, 37, 38, |
644 | 31, 46, 45, 47, 53, 53, 55, 24, 24, 25, |
645 | 26, 26, 28, 37, 37, 44, 1, 1, 64, 2, |
646 | 78, 77, 81, 79, 50, 21, 9, 14, 10, 9, |
647 | 3, 16, 13, 17, 16, 22, 41, 23, 22, 39, |
648 | 37, 37, 40, 47, 53, 55, 24, 25, 24, 26, |
649 | 28, 37, 37, 9, 9, 9, 9, 16, 16, 16, |
650 | |
651 | 16, 22, 22, 22, 22, 39, 37, 37, 40, 55, |
652 | 24, 24, 24, 24, 28, 37, 37, 9, 9, 9, |
653 | 9, 9, 16, 16, 16, 16, 16, 22, 22, 22, |
654 | 22, 22, 37, 37, 55, 24, 24, 24, 24, 24, |
655 | 28, 37, 37, 9, 16, 22, 37, 33, 55, 24, |
656 | 28, 37, 34, 37, 55, 28, 37, 37, 55, 55, |
657 | 55, 28, 28, 28, 37, 37, 55, 55, 28, 28, |
658 | 37, 56, 55, 55, 55, 55, 29, 28, 28, 28, |
659 | 28, 55, 55, 55, 55, 55, 28, 28, 28, 28, |
660 | 28, 55, 55, 28, 28, 0 |
661 | |
662 | } ; |
663 | |
664 | static const YY_CHAR yy_ec[256] = |
665 | { 0, |
666 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
667 | 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, |
668 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
669 | 1, 2, 5, 6, 1, 7, 8, 9, 10, 11, |
670 | 11, 12, 13, 11, 14, 15, 16, 17, 17, 17, |
671 | 17, 17, 17, 17, 17, 18, 18, 19, 11, 20, |
672 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 28, |
673 | 30, 30, 30, 30, 30, 30, 30, 31, 30, 32, |
674 | 30, 30, 33, 30, 34, 30, 30, 35, 30, 30, |
675 | 11, 36, 11, 8, 30, 24, 25, 26, 27, 28, |
676 | |
677 | 29, 28, 30, 30, 30, 30, 30, 30, 30, 31, |
678 | 30, 32, 30, 30, 33, 30, 37, 30, 30, 38, |
679 | 30, 30, 1, 24, 1, 24, 1, 30, 30, 30, |
680 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
681 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
682 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
683 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
684 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
685 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
686 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
687 | |
688 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
689 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
690 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
691 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
692 | 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, |
693 | 30, 30, 30, 30, 30 |
694 | } ; |
695 | |
696 | static const YY_CHAR yy_meta[39] = |
697 | { 0, |
698 | 1, 1, 2, 2, 3, 4, 5, 3, 3, 6, |
699 | 1, 7, 3, 3, 1, 7, 8, 8, 1, 3, |
700 | 3, 3, 1, 3, 9, 9, 9, 9, 9, 10, |
701 | 10, 10, 10, 10, 10, 11, 10, 10 |
702 | } ; |
703 | |
704 | static const flex_int16_t yy_base[364] = |
705 | { 0, |
706 | 0, 0, 415, 409, 34, 54, 412, 400, 395, 393, |
707 | 41, 50, 392, 380, 38, 54, 383, 378, 85, 121, |
708 | 373, 367, 157, 193, 37, 46, 376, 1215, 77, 81, |
709 | 343, 1215, 83, 0, 0, 1215, 1215, 351, 50, 76, |
710 | 53, 80, 83, 84, 339, 339, 90, 0, 338, 337, |
711 | 332, 332, 324, 0, 112, 0, 0, 80, 315, 0, |
712 | 315, 0, 125, 0, 0, 128, 103, 0, 142, 0, |
713 | 0, 312, 312, 1215, 108, 145, 297, 275, 160, 1215, |
714 | 163, 173, 283, 260, 1215, 1215, 84, 176, 0, 0, |
715 | 1215, 116, 278, 0, 226, 262, 1215, 155, 0, 0, |
716 | |
717 | 170, 175, 188, 1215, 1215, 0, 0, 0, 0, 133, |
718 | 0, 1215, 1215, 1215, 107, 1215, 0, 206, 209, 267, |
719 | 0, 141, 1215, 0, 0, 1215, 0, 212, 241, 266, |
720 | 0, 250, 255, 1215, 259, 1215, 254, 0, 0, 0, |
721 | 0, 0, 1215, 263, 179, 0, 230, 258, 264, 242, |
722 | 273, 0, 216, 0, 0, 234, 0, 274, 0, 0, |
723 | 1215, 200, 151, 204, 1215, 1215, 289, 1215, 223, 298, |
724 | 0, 303, 1215, 222, 306, 312, 1215, 219, 321, 215, |
725 | 0, 0, 0, 221, 0, 198, 326, 210, 329, 0, |
726 | 176, 0, 0, 335, 342, 348, 351, 355, 364, 368, |
727 | |
728 | 371, 377, 384, 390, 393, 1215, 0, 0, 1215, 175, |
729 | 397, 406, 410, 413, 173, 0, 0, 419, 426, 432, |
730 | 435, 441, 448, 454, 457, 461, 470, 474, 477, 483, |
731 | 492, 496, 0, 0, 157, 499, 505, 512, 521, 525, |
732 | 154, 0, 0, 528, 534, 541, 0, 1215, 125, 547, |
733 | 114, 0, 1215, 0, 550, 555, 0, 0, 564, 0, |
734 | 122, 569, 0, 89, 0, 0, 61, 578, 42, 583, |
735 | 0, 1215, 592, 597, 606, 611, 1215, 620, 625, 634, |
736 | 639, 648, 653, 662, 667, 676, 681, 690, 695, 704, |
737 | 709, 718, 0, 723, 0, 1215, 737, 748, 759, 770, |
738 | |
739 | 781, 792, 803, 814, 825, 836, 845, 848, 854, 864, |
740 | 875, 886, 897, 908, 918, 929, 940, 947, 953, 963, |
741 | 972, 977, 977, 979, 981, 986, 996, 1007, 1011, 1013, |
742 | 1022, 1033, 1044, 1048, 1050, 1052, 1061, 1065, 1067, 1076, |
743 | 1087, 1098, 1102, 1104, 1113, 1117, 1119, 1121, 1123, 1125, |
744 | 1127, 1129, 1131, 1133, 1135, 1137, 1146, 1157, 1161, 1170, |
745 | 1181, 1192, 1203 |
746 | } ; |
747 | |
748 | static const flex_int16_t yy_def[364] = |
749 | { 0, |
750 | 296, 1, 297, 297, 298, 298, 299, 299, 300, 300, |
751 | 301, 301, 302, 302, 303, 303, 299, 299, 304, 304, |
752 | 302, 302, 305, 305, 306, 306, 296, 296, 296, 296, |
753 | 307, 296, 308, 307, 307, 296, 296, 307, 307, 296, |
754 | 307, 296, 296, 307, 307, 307, 296, 309, 309, 309, |
755 | 309, 309, 309, 310, 296, 311, 311, 296, 296, 312, |
756 | 296, 313, 296, 314, 314, 296, 315, 316, 296, 317, |
757 | 317, 318, 296, 296, 296, 296, 296, 296, 296, 296, |
758 | 296, 296, 296, 296, 296, 296, 296, 296, 307, 307, |
759 | 296, 296, 319, 307, 320, 307, 296, 296, 321, 307, |
760 | |
761 | 296, 296, 296, 296, 296, 307, 307, 307, 307, 296, |
762 | 309, 296, 296, 296, 296, 296, 310, 296, 296, 296, |
763 | 311, 296, 296, 322, 312, 296, 313, 296, 296, 296, |
764 | 314, 296, 296, 296, 296, 296, 296, 323, 324, 325, |
765 | 316, 317, 296, 326, 296, 327, 296, 296, 296, 296, |
766 | 296, 328, 296, 329, 330, 319, 320, 320, 307, 321, |
767 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 331, |
768 | 322, 296, 296, 296, 332, 296, 296, 296, 333, 296, |
769 | 334, 335, 336, 326, 327, 296, 296, 296, 337, 328, |
770 | 296, 338, 339, 340, 331, 331, 331, 341, 332, 332, |
771 | |
772 | 332, 342, 333, 333, 333, 296, 343, 344, 296, 296, |
773 | 345, 337, 337, 337, 296, 346, 347, 340, 340, 296, |
774 | 340, 331, 341, 341, 296, 341, 332, 342, 342, 296, |
775 | 342, 333, 348, 349, 296, 345, 345, 296, 345, 337, |
776 | 296, 350, 351, 340, 341, 342, 352, 296, 296, 345, |
777 | 296, 353, 296, 354, 296, 296, 355, 356, 296, 357, |
778 | 296, 296, 358, 296, 359, 349, 296, 360, 296, 361, |
779 | 351, 296, 360, 360, 362, 360, 296, 361, 361, 363, |
780 | 361, 360, 360, 296, 360, 360, 361, 361, 296, 361, |
781 | 361, 362, 357, 363, 358, 0, 296, 296, 296, 296, |
782 | |
783 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
784 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
785 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
786 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
787 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
788 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
789 | 296, 296, 296 |
790 | } ; |
791 | |
792 | static const flex_int16_t yy_nxt[1254] = |
793 | { 0, |
794 | 28, 29, 30, 29, 31, 32, 33, 34, 35, 36, |
795 | 37, 38, 34, 39, 40, 41, 42, 42, 43, 44, |
796 | 45, 46, 47, 35, 48, 49, 48, 48, 50, 48, |
797 | 51, 48, 48, 52, 53, 28, 52, 53, 57, 86, |
798 | 71, 57, 57, 65, 72, 58, 57, 57, 86, 59, |
799 | 66, 277, 65, 57, 57, 57, 71, 57, 57, 66, |
800 | 72, 57, 57, 95, 99, 58, 57, 57, 100, 59, |
801 | 272, 96, 87, 57, 57, 57, 67, 57, 88, 88, |
802 | 88, 87, 88, 88, 88, 67, 75, 76, 75, 91, |
803 | 97, 122, 98, 98, 101, 123, 102, 102, 77, 92, |
804 | |
805 | 92, 104, 270, 105, 106, 107, 110, 110, 103, 145, |
806 | 145, 145, 165, 118, 119, 119, 166, 154, 78, 137, |
807 | 155, 78, 75, 76, 75, 120, 128, 129, 129, 132, |
808 | 133, 133, 92, 92, 77, 268, 138, 134, 130, 139, |
809 | 140, 135, 256, 132, 133, 133, 145, 145, 145, 110, |
810 | 110, 134, 122, 255, 78, 135, 123, 78, 81, 82, |
811 | 81, 148, 149, 149, 151, 151, 151, 164, 164, 134, |
812 | 83, 98, 98, 150, 151, 151, 151, 88, 88, 88, |
813 | 145, 145, 145, 103, 161, 251, 162, 162, 249, 101, |
814 | 84, 102, 102, 84, 81, 82, 81, 241, 103, 235, |
815 | |
816 | 163, 163, 215, 103, 164, 164, 83, 118, 119, 119, |
817 | 167, 167, 167, 128, 129, 129, 162, 162, 168, 120, |
818 | 164, 164, 169, 211, 210, 130, 84, 143, 103, 84, |
819 | 158, 206, 202, 158, 158, 198, 194, 158, 158, 158, |
820 | 91, 158, 172, 172, 172, 158, 158, 158, 191, 158, |
821 | 173, 132, 133, 133, 174, 189, 176, 176, 176, 148, |
822 | 149, 149, 186, 135, 177, 187, 187, 187, 178, 143, |
823 | 180, 150, 179, 177, 151, 151, 151, 188, 158, 175, |
824 | 170, 158, 158, 159, 91, 158, 158, 158, 153, 158, |
825 | 167, 167, 167, 158, 158, 158, 152, 158, 168, 196, |
826 | |
827 | 119, 119, 169, 147, 172, 172, 172, 200, 129, 129, |
828 | 146, 197, 173, 176, 176, 176, 174, 126, 143, 201, |
829 | 126, 177, 204, 133, 133, 178, 124, 187, 187, 187, |
830 | 213, 149, 149, 116, 205, 177, 219, 220, 220, 188, |
831 | 115, 114, 214, 196, 119, 119, 113, 112, 221, 196, |
832 | 119, 119, 196, 119, 119, 197, 224, 225, 225, 109, |
833 | 108, 197, 94, 90, 222, 200, 129, 129, 226, 200, |
834 | 129, 129, 200, 129, 129, 296, 79, 201, 229, 230, |
835 | 230, 201, 79, 73, 227, 204, 133, 133, 73, 69, |
836 | 231, 204, 133, 133, 204, 133, 133, 205, 237, 238, |
837 | |
838 | 238, 69, 63, 205, 63, 61, 232, 213, 149, 149, |
839 | 239, 213, 149, 149, 213, 149, 149, 61, 55, 214, |
840 | 219, 220, 220, 214, 55, 296, 240, 219, 220, 220, |
841 | 296, 296, 221, 167, 167, 167, 219, 220, 220, 221, |
842 | 296, 168, 196, 119, 119, 169, 296, 296, 244, 224, |
843 | 225, 225, 296, 296, 222, 224, 225, 225, 172, 172, |
844 | 172, 226, 224, 225, 225, 296, 173, 226, 296, 296, |
845 | 174, 200, 129, 129, 245, 229, 230, 230, 229, 230, |
846 | 230, 296, 296, 227, 176, 176, 176, 231, 296, 296, |
847 | 231, 296, 177, 229, 230, 230, 178, 204, 133, 133, |
848 | |
849 | 237, 238, 238, 296, 296, 246, 237, 238, 238, 232, |
850 | 296, 296, 239, 187, 187, 187, 296, 296, 239, 296, |
851 | 296, 177, 237, 238, 238, 188, 213, 149, 149, 219, |
852 | 220, 220, 296, 296, 250, 224, 225, 225, 240, 296, |
853 | 296, 244, 229, 230, 230, 296, 296, 245, 237, 238, |
854 | 238, 259, 259, 259, 246, 296, 262, 262, 262, 260, |
855 | 250, 296, 296, 261, 263, 259, 259, 259, 264, 296, |
856 | 262, 262, 262, 260, 296, 296, 296, 261, 263, 274, |
857 | 259, 259, 264, 296, 279, 262, 262, 275, 296, 296, |
858 | 296, 276, 280, 274, 259, 259, 281, 296, 274, 259, |
859 | |
860 | 259, 275, 296, 296, 296, 276, 275, 283, 284, 284, |
861 | 276, 296, 274, 259, 259, 275, 296, 296, 296, 285, |
862 | 275, 279, 262, 262, 286, 296, 279, 262, 262, 280, |
863 | 296, 296, 296, 281, 280, 288, 289, 289, 281, 296, |
864 | 279, 262, 262, 280, 296, 296, 296, 290, 280, 274, |
865 | 259, 259, 291, 296, 274, 259, 259, 292, 296, 296, |
866 | 296, 276, 292, 259, 259, 259, 276, 296, 274, 259, |
867 | 259, 293, 296, 296, 296, 261, 292, 274, 259, 259, |
868 | 286, 296, 279, 262, 262, 275, 296, 296, 296, 286, |
869 | 294, 279, 262, 262, 281, 296, 262, 262, 262, 294, |
870 | |
871 | 296, 296, 296, 281, 295, 279, 262, 262, 264, 296, |
872 | 279, 262, 262, 294, 296, 296, 296, 291, 280, 283, |
873 | 284, 284, 291, 296, 288, 289, 289, 275, 296, 296, |
874 | 296, 285, 280, 296, 296, 296, 290, 54, 54, 54, |
875 | 54, 54, 54, 54, 54, 54, 54, 54, 56, 56, |
876 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 60, |
877 | 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, |
878 | 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, |
879 | 62, 64, 64, 64, 64, 64, 64, 64, 64, 64, |
880 | 64, 64, 68, 68, 68, 68, 68, 68, 68, 68, |
881 | |
882 | 68, 68, 68, 70, 70, 70, 70, 70, 70, 70, |
883 | 70, 70, 70, 70, 74, 74, 74, 74, 74, 74, |
884 | 74, 74, 74, 74, 74, 80, 80, 80, 80, 80, |
885 | 80, 80, 80, 80, 80, 80, 85, 85, 85, 85, |
886 | 85, 85, 85, 85, 85, 85, 85, 89, 296, 296, |
887 | 296, 89, 93, 296, 296, 93, 93, 93, 111, 296, |
888 | 296, 111, 111, 111, 117, 117, 117, 117, 117, 296, |
889 | 117, 117, 117, 117, 117, 121, 121, 121, 121, 121, |
890 | 121, 296, 121, 121, 121, 121, 125, 125, 125, 296, |
891 | 125, 125, 125, 125, 125, 125, 125, 127, 127, 127, |
892 | |
893 | 127, 127, 296, 127, 127, 127, 127, 127, 131, 131, |
894 | 131, 131, 131, 296, 131, 131, 131, 131, 136, 136, |
895 | 136, 136, 136, 136, 136, 136, 136, 136, 136, 141, |
896 | 141, 141, 141, 141, 296, 141, 141, 141, 141, 141, |
897 | 142, 142, 142, 142, 296, 142, 142, 142, 142, 142, |
898 | 142, 144, 296, 296, 296, 144, 144, 156, 296, 296, |
899 | 156, 156, 156, 157, 296, 157, 157, 157, 157, 157, |
900 | 157, 157, 157, 157, 160, 296, 296, 296, 160, 171, |
901 | 296, 296, 296, 171, 181, 181, 182, 182, 183, 183, |
902 | 184, 296, 296, 184, 184, 184, 185, 296, 185, 185, |
903 | |
904 | 185, 185, 185, 185, 185, 185, 185, 190, 296, 190, |
905 | 190, 190, 190, 190, 190, 190, 190, 190, 192, 192, |
906 | 193, 193, 195, 195, 195, 195, 195, 195, 195, 195, |
907 | 195, 195, 195, 199, 199, 199, 199, 199, 199, 199, |
908 | 199, 199, 199, 199, 203, 203, 203, 203, 203, 203, |
909 | 203, 203, 203, 203, 203, 207, 207, 208, 208, 209, |
910 | 209, 212, 212, 212, 212, 212, 212, 212, 212, 212, |
911 | 212, 212, 216, 216, 217, 217, 218, 218, 218, 218, |
912 | 218, 218, 218, 218, 218, 218, 218, 223, 223, 223, |
913 | 223, 223, 223, 223, 223, 223, 223, 223, 228, 228, |
914 | |
915 | 228, 228, 228, 228, 228, 228, 228, 228, 228, 233, |
916 | 233, 234, 234, 236, 236, 236, 236, 236, 236, 236, |
917 | 236, 236, 236, 236, 242, 242, 243, 243, 247, 247, |
918 | 248, 248, 252, 252, 253, 253, 254, 254, 257, 257, |
919 | 258, 258, 265, 265, 266, 266, 267, 267, 267, 267, |
920 | 267, 296, 267, 267, 267, 267, 267, 269, 269, 269, |
921 | 269, 269, 296, 269, 269, 269, 269, 269, 271, 271, |
922 | 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, |
923 | 273, 278, 278, 278, 278, 278, 278, 278, 278, 278, |
924 | 278, 278, 282, 282, 282, 282, 282, 282, 282, 282, |
925 | |
926 | 282, 282, 282, 287, 287, 287, 287, 287, 287, 287, |
927 | 287, 287, 287, 287, 27, 296, 296, 296, 296, 296, |
928 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
929 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
930 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
931 | 296, 296, 296 |
932 | } ; |
933 | |
934 | static const flex_int16_t yy_chk[1254] = |
935 | { 0, |
936 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
937 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
938 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
939 | 1, 1, 1, 1, 1, 1, 1, 1, 5, 25, |
940 | 15, 5, 5, 11, 15, 5, 5, 5, 26, 5, |
941 | 11, 269, 12, 5, 5, 5, 16, 5, 6, 12, |
942 | 16, 6, 6, 39, 41, 6, 6, 6, 41, 6, |
943 | 267, 39, 25, 6, 6, 6, 11, 6, 29, 29, |
944 | 29, 26, 30, 30, 30, 12, 19, 19, 19, 33, |
945 | 40, 58, 40, 40, 42, 58, 42, 42, 19, 33, |
946 | |
947 | 33, 43, 264, 43, 44, 44, 47, 47, 42, 75, |
948 | 75, 75, 115, 55, 55, 55, 115, 87, 19, 67, |
949 | 87, 19, 20, 20, 20, 55, 63, 63, 63, 66, |
950 | 66, 66, 92, 92, 20, 261, 67, 66, 63, 67, |
951 | 67, 66, 251, 69, 69, 69, 76, 76, 76, 110, |
952 | 110, 69, 122, 249, 20, 69, 122, 20, 23, 23, |
953 | 23, 79, 79, 79, 81, 81, 81, 163, 163, 79, |
954 | 23, 98, 98, 79, 82, 82, 82, 88, 88, 88, |
955 | 145, 145, 145, 98, 101, 241, 101, 101, 235, 102, |
956 | 23, 102, 102, 23, 24, 24, 24, 215, 101, 210, |
957 | |
958 | 103, 103, 191, 102, 103, 103, 24, 118, 118, 118, |
959 | 119, 119, 119, 128, 128, 128, 162, 162, 119, 118, |
960 | 164, 164, 119, 188, 186, 128, 24, 184, 162, 24, |
961 | 95, 180, 178, 95, 95, 174, 169, 95, 95, 95, |
962 | 156, 95, 129, 129, 129, 95, 95, 95, 153, 95, |
963 | 129, 132, 132, 132, 129, 150, 133, 133, 133, 148, |
964 | 148, 148, 147, 132, 133, 149, 149, 149, 133, 144, |
965 | 137, 148, 135, 149, 151, 151, 151, 149, 158, 130, |
966 | 120, 158, 158, 96, 93, 158, 158, 158, 84, 158, |
967 | 167, 167, 167, 158, 158, 158, 83, 158, 167, 170, |
968 | |
969 | 170, 170, 167, 78, 172, 172, 172, 175, 175, 175, |
970 | 77, 170, 172, 176, 176, 176, 172, 73, 72, 175, |
971 | 61, 176, 179, 179, 179, 176, 59, 187, 187, 187, |
972 | 189, 189, 189, 53, 179, 187, 194, 194, 194, 187, |
973 | 52, 51, 189, 195, 195, 195, 50, 49, 194, 196, |
974 | 196, 196, 197, 197, 197, 195, 198, 198, 198, 46, |
975 | 45, 196, 38, 31, 197, 199, 199, 199, 198, 200, |
976 | 200, 200, 201, 201, 201, 27, 22, 199, 202, 202, |
977 | 202, 200, 21, 18, 201, 203, 203, 203, 17, 14, |
978 | 202, 204, 204, 204, 205, 205, 205, 203, 211, 211, |
979 | |
980 | 211, 13, 10, 204, 9, 8, 205, 212, 212, 212, |
981 | 211, 213, 213, 213, 214, 214, 214, 7, 4, 212, |
982 | 218, 218, 218, 213, 3, 0, 214, 219, 219, 219, |
983 | 0, 0, 218, 220, 220, 220, 221, 221, 221, 219, |
984 | 0, 220, 222, 222, 222, 220, 0, 0, 221, 223, |
985 | 223, 223, 0, 0, 222, 224, 224, 224, 225, 225, |
986 | 225, 223, 226, 226, 226, 0, 225, 224, 0, 0, |
987 | 225, 227, 227, 227, 226, 228, 228, 228, 229, 229, |
988 | 229, 0, 0, 227, 230, 230, 230, 228, 0, 0, |
989 | 229, 0, 230, 231, 231, 231, 230, 232, 232, 232, |
990 | |
991 | 236, 236, 236, 0, 0, 231, 237, 237, 237, 232, |
992 | 0, 0, 236, 238, 238, 238, 0, 0, 237, 0, |
993 | 0, 238, 239, 239, 239, 238, 240, 240, 240, 244, |
994 | 244, 244, 0, 0, 239, 245, 245, 245, 240, 0, |
995 | 0, 244, 246, 246, 246, 0, 0, 245, 250, 250, |
996 | 250, 255, 255, 255, 246, 0, 256, 256, 256, 255, |
997 | 250, 0, 0, 255, 256, 259, 259, 259, 256, 0, |
998 | 262, 262, 262, 259, 0, 0, 0, 259, 262, 268, |
999 | 268, 268, 262, 0, 270, 270, 270, 268, 0, 0, |
1000 | 0, 268, 270, 273, 273, 273, 270, 0, 274, 274, |
1001 | |
1002 | 274, 273, 0, 0, 0, 273, 274, 275, 275, 275, |
1003 | 274, 0, 276, 276, 276, 275, 0, 0, 0, 275, |
1004 | 276, 278, 278, 278, 276, 0, 279, 279, 279, 278, |
1005 | 0, 0, 0, 278, 279, 280, 280, 280, 279, 0, |
1006 | 281, 281, 281, 280, 0, 0, 0, 280, 281, 282, |
1007 | 282, 282, 281, 0, 283, 283, 283, 282, 0, 0, |
1008 | 0, 282, 283, 284, 284, 284, 283, 0, 285, 285, |
1009 | 285, 284, 0, 0, 0, 284, 285, 286, 286, 286, |
1010 | 285, 0, 287, 287, 287, 286, 0, 0, 0, 286, |
1011 | 287, 288, 288, 288, 287, 0, 289, 289, 289, 288, |
1012 | |
1013 | 0, 0, 0, 288, 289, 290, 290, 290, 289, 0, |
1014 | 291, 291, 291, 290, 0, 0, 0, 290, 291, 292, |
1015 | 292, 292, 291, 0, 294, 294, 294, 292, 0, 0, |
1016 | 0, 292, 294, 0, 0, 0, 294, 297, 297, 297, |
1017 | 297, 297, 297, 297, 297, 297, 297, 297, 298, 298, |
1018 | 298, 298, 298, 298, 298, 298, 298, 298, 298, 299, |
1019 | 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, |
1020 | 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, |
1021 | 300, 301, 301, 301, 301, 301, 301, 301, 301, 301, |
1022 | 301, 301, 302, 302, 302, 302, 302, 302, 302, 302, |
1023 | |
1024 | 302, 302, 302, 303, 303, 303, 303, 303, 303, 303, |
1025 | 303, 303, 303, 303, 304, 304, 304, 304, 304, 304, |
1026 | 304, 304, 304, 304, 304, 305, 305, 305, 305, 305, |
1027 | 305, 305, 305, 305, 305, 305, 306, 306, 306, 306, |
1028 | 306, 306, 306, 306, 306, 306, 306, 307, 0, 0, |
1029 | 0, 307, 308, 0, 0, 308, 308, 308, 309, 0, |
1030 | 0, 309, 309, 309, 310, 310, 310, 310, 310, 0, |
1031 | 310, 310, 310, 310, 310, 311, 311, 311, 311, 311, |
1032 | 311, 0, 311, 311, 311, 311, 312, 312, 312, 0, |
1033 | 312, 312, 312, 312, 312, 312, 312, 313, 313, 313, |
1034 | |
1035 | 313, 313, 0, 313, 313, 313, 313, 313, 314, 314, |
1036 | 314, 314, 314, 0, 314, 314, 314, 314, 315, 315, |
1037 | 315, 315, 315, 315, 315, 315, 315, 315, 315, 316, |
1038 | 316, 316, 316, 316, 0, 316, 316, 316, 316, 316, |
1039 | 317, 317, 317, 317, 0, 317, 317, 317, 317, 317, |
1040 | 317, 318, 0, 0, 0, 318, 318, 319, 0, 0, |
1041 | 319, 319, 319, 320, 0, 320, 320, 320, 320, 320, |
1042 | 320, 320, 320, 320, 321, 0, 0, 0, 321, 322, |
1043 | 0, 0, 0, 322, 323, 323, 324, 324, 325, 325, |
1044 | 326, 0, 0, 326, 326, 326, 327, 0, 327, 327, |
1045 | |
1046 | 327, 327, 327, 327, 327, 327, 327, 328, 0, 328, |
1047 | 328, 328, 328, 328, 328, 328, 328, 328, 329, 329, |
1048 | 330, 330, 331, 331, 331, 331, 331, 331, 331, 331, |
1049 | 331, 331, 331, 332, 332, 332, 332, 332, 332, 332, |
1050 | 332, 332, 332, 332, 333, 333, 333, 333, 333, 333, |
1051 | 333, 333, 333, 333, 333, 334, 334, 335, 335, 336, |
1052 | 336, 337, 337, 337, 337, 337, 337, 337, 337, 337, |
1053 | 337, 337, 338, 338, 339, 339, 340, 340, 340, 340, |
1054 | 340, 340, 340, 340, 340, 340, 340, 341, 341, 341, |
1055 | 341, 341, 341, 341, 341, 341, 341, 341, 342, 342, |
1056 | |
1057 | 342, 342, 342, 342, 342, 342, 342, 342, 342, 343, |
1058 | 343, 344, 344, 345, 345, 345, 345, 345, 345, 345, |
1059 | 345, 345, 345, 345, 346, 346, 347, 347, 348, 348, |
1060 | 349, 349, 350, 350, 351, 351, 352, 352, 353, 353, |
1061 | 354, 354, 355, 355, 356, 356, 357, 357, 357, 357, |
1062 | 357, 0, 357, 357, 357, 357, 357, 358, 358, 358, |
1063 | 358, 358, 0, 358, 358, 358, 358, 358, 359, 359, |
1064 | 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, |
1065 | 360, 361, 361, 361, 361, 361, 361, 361, 361, 361, |
1066 | 361, 361, 362, 362, 362, 362, 362, 362, 362, 362, |
1067 | |
1068 | 362, 362, 362, 363, 363, 363, 363, 363, 363, 363, |
1069 | 363, 363, 363, 363, 296, 296, 296, 296, 296, 296, |
1070 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
1071 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
1072 | 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, |
1073 | 296, 296, 296 |
1074 | } ; |
1075 | |
1076 | /* The intent behind this definition is that it'll catch |
1077 | * any uses of REJECT which flex missed. |
1078 | */ |
1079 | #define REJECT reject_used_but_not_detected |
1080 | #define yymore() yymore_used_but_not_detected |
1081 | #define YY_MORE_ADJ 0 |
1082 | #define YY_RESTORE_YY_MORE_OFFSET |
1083 | #line 1 "third_party/libpg_query/scan.l" |
1084 | |
1085 | #line 46 "third_party/libpg_query/scan.l" |
1086 | |
1087 | /* LCOV_EXCL_START */ |
1088 | |
1089 | /* |
1090 | * GUC variables. This is a DIRECT violation of the warning given at the |
1091 | * head of gram.y, ie flex/bison code must not depend on any GUC variables; |
1092 | * as such, changing their values can induce very unintuitive behavior. |
1093 | * But we shall have to live with it until we can remove these variables. |
1094 | */ |
1095 | |
1096 | int backslash_quote = PG_BACKSLASH_QUOTE_SAFE_ENCODING; |
1097 | bool escape_string_warning = true; |
1098 | bool standard_conforming_strings = true; |
1099 | |
1100 | /* |
1101 | * Set the type of YYSTYPE. |
1102 | */ |
1103 | #define YYSTYPE core_YYSTYPE |
1104 | |
1105 | /* |
1106 | * Set the type of yyextra. All state variables used by the scanner should |
1107 | * be in yyextra, *not* statically allocated. |
1108 | */ |
1109 | #define core_yy_extra_type * |
1110 | |
1111 | /* |
1112 | * Each call to yylex must set yylloc to the location of the found token |
1113 | * (expressed as a byte offset from the start of the input text). |
1114 | * When we parse a token that requires multiple lexer rules to process, |
1115 | * this should be done in the first such rule, else yylloc will point |
1116 | * into the middle of the token. |
1117 | */ |
1118 | #define SET_YYLLOC() (*(yylloc) = yytext - yyextra->scanbuf) |
1119 | |
1120 | /* |
1121 | * Advance yylloc by the given number of bytes. |
1122 | */ |
1123 | #define ADVANCE_YYLLOC(delta) ( *(yylloc) += (delta) ) |
1124 | |
1125 | #define startlit() ( yyextra->literallen = 0 ) |
1126 | static void addlit(char *ytext, int yleng, core_yyscan_t yyscanner); |
1127 | static void addlitchar(unsigned char ychar, core_yyscan_t yyscanner); |
1128 | static char *litbufdup(core_yyscan_t yyscanner); |
1129 | static char *litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner); |
1130 | static unsigned char unescape_single_char(unsigned char c, core_yyscan_t yyscanner); |
1131 | static int process_integer_literal(const char *token, YYSTYPE *lval); |
1132 | static bool is_utf16_surrogate_first(pg_wchar c); |
1133 | static bool is_utf16_surrogate_second(pg_wchar c); |
1134 | static pg_wchar surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second); |
1135 | static void addunicode(pg_wchar c, yyscan_t yyscanner); |
1136 | static bool check_uescapechar(unsigned char escape); |
1137 | |
1138 | #define yyerror(msg) scanner_yyerror(msg, yyscanner) |
1139 | |
1140 | #define lexer_errposition() scanner_errposition(*(yylloc), yyscanner) |
1141 | |
1142 | static void check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner); |
1143 | static void check_escape_warning(core_yyscan_t yyscanner); |
1144 | |
1145 | /* |
1146 | * Work around a bug in flex 2.5.35: it emits a couple of functions that |
1147 | * it forgets to emit declarations for. Since we use -Wmissing-prototypes, |
1148 | * this would cause warnings. Providing our own declarations should be |
1149 | * harmless even when the bug gets fixed. |
1150 | */ |
1151 | extern int core_yyget_column(yyscan_t yyscanner); |
1152 | extern void core_yyset_column(int column_no, yyscan_t yyscanner); |
1153 | |
1154 | #line 1153 "third_party/libpg_query/src_backend_parser_scan.cpp" |
1155 | #define YY_NO_INPUT 1 |
1156 | /* |
1157 | * OK, here is a short description of lex/flex rules behavior. |
1158 | * The longest pattern which matches an input string is always chosen. |
1159 | * For equal-length patterns, the first occurring in the rules list is chosen. |
1160 | * INITIAL is the starting state, to which all non-conditional rules apply. |
1161 | * Exclusive states change parsing rules while the state is active. When in |
1162 | * an exclusive state, only those rules defined for that state apply. |
1163 | * |
1164 | * We use exclusive states for quoted strings, extended comments, |
1165 | * and to eliminate parsing troubles for numeric strings. |
1166 | * Exclusive states: |
1167 | * <xb> bit string literal |
1168 | * <xc> extended C-style comments |
1169 | * <xd> delimited identifiers (double-quoted identifiers) |
1170 | * <xh> hexadecimal numeric string |
1171 | * <xq> standard quoted strings |
1172 | * <xe> extended quoted strings (support backslash escape sequences) |
1173 | * <xdolq> $foo$ quoted strings |
1174 | * <xui> quoted identifier with Unicode escapes |
1175 | * <xuiend> end of a quoted identifier with Unicode escapes, UESCAPE can follow |
1176 | * <xus> quoted string with Unicode escapes |
1177 | * <xusend> end of a quoted string with Unicode escapes, UESCAPE can follow |
1178 | * <xeu> Unicode surrogate pair in extended quoted string |
1179 | * |
1180 | * Remember to add an <<EOF>> case whenever you add a new exclusive state! |
1181 | * The default one is probably not the right thing. |
1182 | */ |
1183 | |
1184 | /* |
1185 | * In order to make the world safe for Windows and Mac clients as well as |
1186 | * Unix ones, we accept either \n or \r as a newline. A DOS-style \r\n |
1187 | * sequence will be seen as two successive newlines, but that doesn't cause ' |
1188 | * any problems. Comments that start with -- and extend to the next |
1189 | * newline are treated as equivalent to a single whitespace character. |
1190 | * |
1191 | * NOTE a fine point: if there is no newline following --, we will absorb |
1192 | * everything to the end of the input as a comment. This is correct. Older |
1193 | * versions of Postgres failed to recognize -- as a comment if the input |
1194 | * did not end with a newline. |
1195 | * |
1196 | * XXX perhaps \f (formfeed) should be treated as a newline as well? |
1197 | * |
1198 | * XXX if you change the set of whitespace characters, fix scanner_isspace() |
1199 | * to agree, and see also the plpgsql lexer. |
1200 | */ |
1201 | /* |
1202 | * SQL requires at least one newline in the whitespace separating |
1203 | * string literals that are to be concatenated. Silly, but who are we |
1204 | * to argue? Note that {whitespace_with_newline} should not have * after |
1205 | * it, whereas {whitespace} should generally have a * after it... |
1206 | */ |
1207 | /* |
1208 | * To ensure that {quotecontinue} can be scanned without having to back up |
1209 | * if the full pattern isn't matched, we include trailing whitespace in |
1210 | * {quotestop}. This matches all cases where {quotecontinue} fails to match, |
1211 | * except for {quote} followed by whitespace and just one "-" (not two, |
1212 | * which would start a {comment}). To cover that we have {quotefail}. |
1213 | * The actions for {quotestop} and {quotefail} must throw back characters |
1214 | * beyond the quote proper. |
1215 | */ |
1216 | /* Bit string |
1217 | * It is tempting to scan the string for only those characters |
1218 | * which are allowed. However, this leads to silently swallowed |
1219 | * characters if illegal characters are included in the string. |
1220 | * For example, if xbinside is [01] then B'ABCD' is interpreted |
1221 | * as a zero-length string, and the ABCD' is lost! |
1222 | * Better to pass the string forward and let the input routines |
1223 | * validate the contents. |
1224 | */ |
1225 | /* Hexadecimal number */ |
1226 | /* National character */ |
1227 | /* Quoted string that allows backslash escapes */ |
1228 | /* Extended quote |
1229 | * xqdouble implements embedded quote, '''' |
1230 | */ |
1231 | /* $foo$ style quotes ("dollar quoting") |
1232 | * The quoted string starts with $foo$ where "foo" is an optional string |
1233 | * in the form of an identifier, except that it may not contain "$", |
1234 | * and extends to the first occurrence of an identical string. |
1235 | * There is *no* processing of the quoted text. |
1236 | * |
1237 | * {dolqfailed} is an error rule to avoid scanner backup when {dolqdelim} |
1238 | * fails to match its trailing "$". |
1239 | */ |
1240 | /* Double quote |
1241 | * Allows embedded spaces and other special characters into identifiers. |
1242 | */ |
1243 | /* Unicode escapes */ |
1244 | /* error rule to avoid backup */ |
1245 | /* Quoted identifier with Unicode escapes */ |
1246 | /* Quoted string with Unicode escapes */ |
1247 | /* Optional UESCAPE after a quoted string or identifier with Unicode escapes. */ |
1248 | /* error rule to avoid backup */ |
1249 | /* C-style comments |
1250 | * |
1251 | * The "extended comment" syntax closely resembles allowable operator syntax. |
1252 | * The tricky part here is to get lex to recognize a string starting with |
1253 | * slash-star as a comment, when interpreting it as an operator would produce |
1254 | * a longer match --- remember lex will prefer a longer match! Also, if we |
1255 | * have something like plus-slash-star, lex will think this is a 3-character |
1256 | * operator whereas we want to see it as a + operator and a comment start. |
1257 | * The solution is two-fold: |
1258 | * 1. append {op_chars}* to xcstart so that it matches as much text as |
1259 | * {operator} would. Then the tie-breaker (first matching rule of same |
1260 | * length) ensures xcstart wins. We put back the extra stuff with yyless() |
1261 | * in case it contains a star-slash that should terminate the comment. |
1262 | * 2. In the operator rule, check for slash-star within the operator, and |
1263 | * if found throw it back with yyless(). This handles the plus-slash-star |
1264 | * problem. |
1265 | * Dash-dash comments have similar interactions with the operator rule. |
1266 | */ |
1267 | /* Assorted special-case operators and operator-like tokens */ |
1268 | /* " */ |
1269 | /* |
1270 | * These operator-like tokens (unlike the above ones) also match the {operator} |
1271 | * rule, which means that they might be overridden by a longer match if they |
1272 | * are followed by a comment start or a + or - character. Accordingly, if you |
1273 | * add to this list, you must also add corresponding code to the {operator} |
1274 | * block to return the correct token in such cases. (This is not needed in |
1275 | * psqlscan.l since the token value is ignored there.) |
1276 | */ |
1277 | /* |
1278 | * "self" is the set of chars that should be returned as single-character |
1279 | * tokens. "op_chars" is the set of chars that can make up "Op" tokens, |
1280 | * which can be one or more characters long (but if a single-char token |
1281 | * appears in the "self" set, it is not to be returned as an Op). Note |
1282 | * that the sets overlap, but each has some chars that are not in the other. |
1283 | * |
1284 | * If you change either set, adjust the character lists appearing in the |
1285 | * rule for "operator"! |
1286 | */ |
1287 | /* we no longer allow unary minus in numbers. |
1288 | * instead we pass it separately to parser. there it gets |
1289 | * coerced via doNegate() -- Leon aug 20 1999 |
1290 | * |
1291 | * {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10. |
1292 | * |
1293 | * {realfail1} and {realfail2} are added to prevent the need for scanner |
1294 | * backup when the {real} rule fails to match completely. |
1295 | */ |
1296 | /* |
1297 | * Dollar quoted strings are totally opaque, and no escaping is done on them. |
1298 | * Other quoted strings must allow some special characters such as single-quote |
1299 | * and newline. |
1300 | * Embedded single-quotes are implemented both in the SQL standard |
1301 | * style of two adjacent single quotes "''" and in the Postgres/Java style |
1302 | * of escaped-quote "\'". |
1303 | * Other embedded escaped characters are matched explicitly and the leading |
1304 | * backslash is dropped from the string. |
1305 | * Note that xcstart must appear before operator, as explained above! |
1306 | * Also whitespace (comment) must appear before operator. |
1307 | */ |
1308 | #line 1307 "third_party/libpg_query/src_backend_parser_scan.cpp" |
1309 | |
1310 | #define INITIAL 0 |
1311 | #define xb 1 |
1312 | #define xc 2 |
1313 | #define xd 3 |
1314 | #define xh 4 |
1315 | #define xe 5 |
1316 | #define xq 6 |
1317 | #define xdolq 7 |
1318 | #define xui 8 |
1319 | #define xuiend 9 |
1320 | #define xus 10 |
1321 | #define xusend 11 |
1322 | #define xeu 12 |
1323 | |
1324 | #ifndef YY_EXTRA_TYPE |
1325 | #define YY_EXTRA_TYPE void * |
1326 | #endif |
1327 | |
1328 | /* Holds the entire state of the reentrant scanner. */ |
1329 | struct yyguts_t |
1330 | { |
1331 | |
1332 | /* User-defined. Not touched by flex. */ |
1333 | YY_EXTRA_TYPE ; |
1334 | |
1335 | /* The rest are the same as the globals declared in the non-reentrant scanner. */ |
1336 | FILE *yyin_r, *yyout_r; |
1337 | size_t yy_buffer_stack_top; /**< index of top of stack. */ |
1338 | size_t yy_buffer_stack_max; /**< capacity of stack. */ |
1339 | YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ |
1340 | char yy_hold_char; |
1341 | yy_size_t yy_n_chars; |
1342 | yy_size_t yyleng_r; |
1343 | char *yy_c_buf_p; |
1344 | int yy_init; |
1345 | int yy_start; |
1346 | int yy_did_buffer_switch_on_eof; |
1347 | int yy_start_stack_ptr; |
1348 | int yy_start_stack_depth; |
1349 | int *yy_start_stack; |
1350 | yy_state_type yy_last_accepting_state; |
1351 | char* yy_last_accepting_cpos; |
1352 | |
1353 | int yylineno_r; |
1354 | int yy_flex_debug_r; |
1355 | |
1356 | char *yytext_r; |
1357 | int yy_more_flag; |
1358 | int yy_more_len; |
1359 | |
1360 | YYSTYPE * yylval_r; |
1361 | |
1362 | YYLTYPE * yylloc_r; |
1363 | |
1364 | }; /* end struct yyguts_t */ |
1365 | |
1366 | static int yy_init_globals ( yyscan_t yyscanner ); |
1367 | |
1368 | /* This must go here because YYSTYPE and YYLTYPE are included |
1369 | * from bison output in section 1.*/ |
1370 | # define yylval yyg->yylval_r |
1371 | |
1372 | # define yylloc yyg->yylloc_r |
1373 | |
1374 | int yylex_init (yyscan_t* scanner); |
1375 | |
1376 | int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); |
1377 | |
1378 | /* Accessor methods to globals. |
1379 | These are made visible to non-reentrant scanners for convenience. */ |
1380 | |
1381 | int yylex_destroy ( yyscan_t yyscanner ); |
1382 | |
1383 | int yyget_debug ( yyscan_t yyscanner ); |
1384 | |
1385 | void yyset_debug ( int debug_flag , yyscan_t yyscanner ); |
1386 | |
1387 | YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); |
1388 | |
1389 | void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); |
1390 | |
1391 | FILE *yyget_in ( yyscan_t yyscanner ); |
1392 | |
1393 | void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); |
1394 | |
1395 | FILE *yyget_out ( yyscan_t yyscanner ); |
1396 | |
1397 | void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); |
1398 | |
1399 | yy_size_t yyget_leng ( yyscan_t yyscanner ); |
1400 | |
1401 | char *yyget_text ( yyscan_t yyscanner ); |
1402 | |
1403 | int yyget_lineno ( yyscan_t yyscanner ); |
1404 | |
1405 | void yyset_lineno ( int _line_number , yyscan_t yyscanner ); |
1406 | |
1407 | int yyget_column ( yyscan_t yyscanner ); |
1408 | |
1409 | void yyset_column ( int _column_no , yyscan_t yyscanner ); |
1410 | |
1411 | YYSTYPE * yyget_lval ( yyscan_t yyscanner ); |
1412 | |
1413 | void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); |
1414 | |
1415 | YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); |
1416 | |
1417 | void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); |
1418 | |
1419 | /* Macros after this point can all be overridden by user definitions in |
1420 | * section 1. |
1421 | */ |
1422 | |
1423 | #ifndef YY_SKIP_YYWRAP |
1424 | #ifdef __cplusplus |
1425 | extern "C" int yywrap ( yyscan_t yyscanner ); |
1426 | #else |
1427 | extern int yywrap ( yyscan_t yyscanner ); |
1428 | #endif |
1429 | #endif |
1430 | |
1431 | #ifndef YY_NO_UNPUT |
1432 | |
1433 | #endif |
1434 | |
1435 | #ifndef yytext_ptr |
1436 | static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); |
1437 | #endif |
1438 | |
1439 | #ifdef YY_NEED_STRLEN |
1440 | static int yy_flex_strlen ( const char * , yyscan_t yyscanner); |
1441 | #endif |
1442 | |
1443 | #ifndef YY_NO_INPUT |
1444 | #ifdef __cplusplus |
1445 | static int yyinput ( yyscan_t yyscanner ); |
1446 | #else |
1447 | static int input ( yyscan_t yyscanner ); |
1448 | #endif |
1449 | |
1450 | #endif |
1451 | |
1452 | /* Amount of stuff to slurp up with each read. */ |
1453 | #ifndef YY_READ_BUF_SIZE |
1454 | #ifdef __ia64__ |
1455 | /* On IA-64, the buffer size is 16k, not 8k */ |
1456 | #define YY_READ_BUF_SIZE 16384 |
1457 | #else |
1458 | #define YY_READ_BUF_SIZE 8192 |
1459 | #endif /* __ia64__ */ |
1460 | #endif |
1461 | |
1462 | /* Copy whatever the last rule matched to the standard output. */ |
1463 | #ifndef ECHO |
1464 | /* This used to be an fputs(), but since the string might contain NUL's, |
1465 | * we now use fwrite(). |
1466 | */ |
1467 | #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) |
1468 | #endif |
1469 | |
1470 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
1471 | * is returned in "result". |
1472 | */ |
1473 | #ifndef YY_INPUT |
1474 | #define YY_INPUT(buf,result,max_size) \ |
1475 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
1476 | { \ |
1477 | int c = '*'; \ |
1478 | yy_size_t n; \ |
1479 | for ( n = 0; n < max_size && \ |
1480 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
1481 | buf[n] = (char) c; \ |
1482 | if ( c == '\n' ) \ |
1483 | buf[n++] = (char) c; \ |
1484 | if ( c == EOF && ferror( yyin ) ) \ |
1485 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1486 | result = n; \ |
1487 | } \ |
1488 | else \ |
1489 | { \ |
1490 | errno=0; \ |
1491 | while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ |
1492 | { \ |
1493 | if( errno != EINTR) \ |
1494 | { \ |
1495 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
1496 | break; \ |
1497 | } \ |
1498 | errno=0; \ |
1499 | clearerr(yyin); \ |
1500 | } \ |
1501 | }\ |
1502 | \ |
1503 | |
1504 | #endif |
1505 | |
1506 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
1507 | * we don't want an extra ';' after the "return" because that will cause |
1508 | * some compilers to complain about unreachable statements. |
1509 | */ |
1510 | #ifndef yyterminate |
1511 | #define yyterminate() return YY_NULL |
1512 | #endif |
1513 | |
1514 | /* Number of entries by which start-condition stack grows. */ |
1515 | #ifndef YY_START_STACK_INCR |
1516 | #define YY_START_STACK_INCR 25 |
1517 | #endif |
1518 | |
1519 | /* Report a fatal error. */ |
1520 | #ifndef YY_FATAL_ERROR |
1521 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) |
1522 | #endif |
1523 | |
1524 | /* end tables serialization structures and prototypes */ |
1525 | |
1526 | /* Default declaration of generated scanner - a define so the user can |
1527 | * easily add parameters. |
1528 | */ |
1529 | #ifndef YY_DECL |
1530 | #define YY_DECL_IS_OURS 1 |
1531 | |
1532 | extern int yylex \ |
1533 | (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); |
1534 | |
1535 | #define YY_DECL int yylex \ |
1536 | (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) |
1537 | #endif /* !YY_DECL */ |
1538 | |
1539 | /* Code executed at the beginning of each rule, after yytext and yyleng |
1540 | * have been set up. |
1541 | */ |
1542 | #ifndef YY_USER_ACTION |
1543 | #define YY_USER_ACTION |
1544 | #endif |
1545 | |
1546 | /* Code executed at the end of each rule. */ |
1547 | #ifndef YY_BREAK |
1548 | #define YY_BREAK /*LINTED*/break; |
1549 | #endif |
1550 | |
1551 | #define YY_RULE_SETUP \ |
1552 | YY_USER_ACTION |
1553 | |
1554 | /** The main scanner function which does all the work. |
1555 | */ |
1556 | YY_DECL |
1557 | { |
1558 | yy_state_type yy_current_state; |
1559 | char *yy_cp, *yy_bp; |
1560 | int yy_act; |
1561 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
1562 | |
1563 | yylval = yylval_param; |
1564 | |
1565 | yylloc = yylloc_param; |
1566 | |
1567 | if ( !yyg->yy_init ) |
1568 | { |
1569 | yyg->yy_init = 1; |
1570 | |
1571 | #ifdef YY_USER_INIT |
1572 | YY_USER_INIT; |
1573 | #endif |
1574 | |
1575 | if ( ! yyg->yy_start ) |
1576 | yyg->yy_start = 1; /* first start state */ |
1577 | if ( ! YY_CURRENT_BUFFER ) { |
1578 | yyensure_buffer_stack (yyscanner); |
1579 | YY_CURRENT_BUFFER_LVALUE = |
1580 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
1581 | } |
1582 | |
1583 | yy_load_buffer_state( yyscanner ); |
1584 | } |
1585 | |
1586 | { |
1587 | #line 404 "third_party/libpg_query/scan.l" |
1588 | |
1589 | |
1590 | #line 1596 "third_party/libpg_query/src_backend_parser_scan.cpp" |
1591 | |
1592 | while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ |
1593 | { |
1594 | yy_cp = yyg->yy_c_buf_p; |
1595 | |
1596 | /* Support of yytext. */ |
1597 | *yy_cp = yyg->yy_hold_char; |
1598 | |
1599 | /* yy_bp points to the position in yy_ch_buf of the start of |
1600 | * the current run. |
1601 | */ |
1602 | yy_bp = yy_cp; |
1603 | |
1604 | yy_current_state = yyg->yy_start; |
1605 | yy_match: |
1606 | do |
1607 | { |
1608 | YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; |
1609 | if ( yy_accept[yy_current_state] ) |
1610 | { |
1611 | yyg->yy_last_accepting_state = yy_current_state; |
1612 | yyg->yy_last_accepting_cpos = yy_cp; |
1613 | } |
1614 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
1615 | { |
1616 | yy_current_state = (int) yy_def[yy_current_state]; |
1617 | if ( yy_current_state >= 297 ) |
1618 | yy_c = yy_meta[yy_c]; |
1619 | } |
1620 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
1621 | ++yy_cp; |
1622 | } |
1623 | while ( yy_current_state != 296 ); |
1624 | yy_cp = yyg->yy_last_accepting_cpos; |
1625 | yy_current_state = yyg->yy_last_accepting_state; |
1626 | |
1627 | yy_find_action: |
1628 | yy_act = yy_accept[yy_current_state]; |
1629 | |
1630 | YY_DO_BEFORE_ACTION; |
1631 | |
1632 | do_action: /* This label is used only to access EOF actions. */ |
1633 | |
1634 | switch ( yy_act ) |
1635 | { /* beginning of action switch */ |
1636 | case 0: /* must back up */ |
1637 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
1638 | *yy_cp = yyg->yy_hold_char; |
1639 | yy_cp = yyg->yy_last_accepting_cpos; |
1640 | yy_current_state = yyg->yy_last_accepting_state; |
1641 | goto yy_find_action; |
1642 | |
1643 | case 1: |
1644 | /* rule 1 can match eol */ |
1645 | YY_RULE_SETUP |
1646 | #line 406 "third_party/libpg_query/scan.l" |
1647 | { |
1648 | /* ignore */ |
1649 | } |
1650 | YY_BREAK |
1651 | case 2: |
1652 | YY_RULE_SETUP |
1653 | #line 410 "third_party/libpg_query/scan.l" |
1654 | { |
1655 | /* Set location in case of syntax error in comment */ |
1656 | SET_YYLLOC(); |
1657 | yyextra->xcdepth = 0; |
1658 | BEGIN(xc); |
1659 | /* Put back any characters past slash-star; see above */ |
1660 | yyless(2); |
1661 | } |
1662 | YY_BREAK |
1663 | case 3: |
1664 | YY_RULE_SETUP |
1665 | #line 419 "third_party/libpg_query/scan.l" |
1666 | { |
1667 | (yyextra->xcdepth)++; |
1668 | /* Put back any characters past slash-star; see above */ |
1669 | yyless(2); |
1670 | } |
1671 | YY_BREAK |
1672 | case 4: |
1673 | YY_RULE_SETUP |
1674 | #line 425 "third_party/libpg_query/scan.l" |
1675 | { |
1676 | if (yyextra->xcdepth <= 0) |
1677 | BEGIN(INITIAL); |
1678 | else |
1679 | (yyextra->xcdepth)--; |
1680 | } |
1681 | YY_BREAK |
1682 | case 5: |
1683 | /* rule 5 can match eol */ |
1684 | YY_RULE_SETUP |
1685 | #line 432 "third_party/libpg_query/scan.l" |
1686 | { |
1687 | /* ignore */ |
1688 | } |
1689 | YY_BREAK |
1690 | case 6: |
1691 | YY_RULE_SETUP |
1692 | #line 436 "third_party/libpg_query/scan.l" |
1693 | { |
1694 | /* ignore */ |
1695 | } |
1696 | YY_BREAK |
1697 | case 7: |
1698 | YY_RULE_SETUP |
1699 | #line 440 "third_party/libpg_query/scan.l" |
1700 | { |
1701 | /* ignore */ |
1702 | } |
1703 | YY_BREAK |
1704 | case YY_STATE_EOF(xc): |
1705 | #line 444 "third_party/libpg_query/scan.l" |
1706 | { yyerror("unterminated /* comment" ); } |
1707 | YY_BREAK |
1708 | case 8: |
1709 | YY_RULE_SETUP |
1710 | #line 446 "third_party/libpg_query/scan.l" |
1711 | { |
1712 | /* Binary bit type. |
1713 | * At some point we should simply pass the string |
1714 | * forward to the parser and label it there. |
1715 | * In the meantime, place a leading "b" on the string |
1716 | * to mark it for the input routine as a binary string. |
1717 | */ |
1718 | SET_YYLLOC(); |
1719 | BEGIN(xb); |
1720 | startlit(); |
1721 | addlitchar(ychar: 'b', yyscanner); |
1722 | } |
1723 | YY_BREAK |
1724 | case 9: |
1725 | /* rule 9 can match eol */ |
1726 | #line 459 "third_party/libpg_query/scan.l" |
1727 | case 10: |
1728 | /* rule 10 can match eol */ |
1729 | YY_RULE_SETUP |
1730 | #line 459 "third_party/libpg_query/scan.l" |
1731 | { |
1732 | yyless(1); |
1733 | BEGIN(INITIAL); |
1734 | yylval->str = litbufdup(yyscanner); |
1735 | return BCONST; |
1736 | } |
1737 | YY_BREAK |
1738 | case 11: |
1739 | /* rule 11 can match eol */ |
1740 | #line 466 "third_party/libpg_query/scan.l" |
1741 | case 12: |
1742 | /* rule 12 can match eol */ |
1743 | YY_RULE_SETUP |
1744 | #line 466 "third_party/libpg_query/scan.l" |
1745 | { |
1746 | addlit(yytext, yyleng, yyscanner); |
1747 | } |
1748 | YY_BREAK |
1749 | case 13: |
1750 | /* rule 13 can match eol */ |
1751 | #line 470 "third_party/libpg_query/scan.l" |
1752 | case 14: |
1753 | /* rule 14 can match eol */ |
1754 | YY_RULE_SETUP |
1755 | #line 470 "third_party/libpg_query/scan.l" |
1756 | { |
1757 | /* ignore */ |
1758 | } |
1759 | YY_BREAK |
1760 | case YY_STATE_EOF(xb): |
1761 | #line 473 "third_party/libpg_query/scan.l" |
1762 | { yyerror("unterminated bit string literal" ); } |
1763 | YY_BREAK |
1764 | case 15: |
1765 | YY_RULE_SETUP |
1766 | #line 475 "third_party/libpg_query/scan.l" |
1767 | { |
1768 | /* Hexadecimal bit type. |
1769 | * At some point we should simply pass the string |
1770 | * forward to the parser and label it there. |
1771 | * In the meantime, place a leading "x" on the string |
1772 | * to mark it for the input routine as a hex string. |
1773 | */ |
1774 | SET_YYLLOC(); |
1775 | BEGIN(xh); |
1776 | startlit(); |
1777 | addlitchar(ychar: 'x', yyscanner); |
1778 | } |
1779 | YY_BREAK |
1780 | case 16: |
1781 | /* rule 16 can match eol */ |
1782 | #line 488 "third_party/libpg_query/scan.l" |
1783 | case 17: |
1784 | /* rule 17 can match eol */ |
1785 | YY_RULE_SETUP |
1786 | #line 488 "third_party/libpg_query/scan.l" |
1787 | { |
1788 | yyless(1); |
1789 | BEGIN(INITIAL); |
1790 | yylval->str = litbufdup(yyscanner); |
1791 | return XCONST; |
1792 | } |
1793 | YY_BREAK |
1794 | case YY_STATE_EOF(xh): |
1795 | #line 494 "third_party/libpg_query/scan.l" |
1796 | { yyerror("unterminated hexadecimal string literal" ); } |
1797 | YY_BREAK |
1798 | case 18: |
1799 | YY_RULE_SETUP |
1800 | #line 496 "third_party/libpg_query/scan.l" |
1801 | { |
1802 | /* National character. |
1803 | * We will pass this along as a normal character string, |
1804 | * but preceded with an internally-generated "NCHAR". |
1805 | */ |
1806 | const PGScanKeyword *keyword; |
1807 | |
1808 | SET_YYLLOC(); |
1809 | yyless(1); /* eat only 'n' this time */ |
1810 | |
1811 | keyword = ScanKeywordLookup(text: "nchar" , |
1812 | yyextra->keywords, |
1813 | yyextra->num_keywords); |
1814 | if (keyword != NULL) |
1815 | { |
1816 | yylval->keyword = keyword->name; |
1817 | return keyword->value; |
1818 | } |
1819 | else |
1820 | { |
1821 | /* If NCHAR isn't a keyword, just return "n" */ |
1822 | yylval->str = pstrdup(in: "n" ); |
1823 | return IDENT; |
1824 | } |
1825 | } |
1826 | YY_BREAK |
1827 | case 19: |
1828 | YY_RULE_SETUP |
1829 | #line 522 "third_party/libpg_query/scan.l" |
1830 | { |
1831 | yyextra->warn_on_first_escape = true; |
1832 | yyextra->saw_non_ascii = false; |
1833 | SET_YYLLOC(); |
1834 | if (yyextra->standard_conforming_strings) |
1835 | BEGIN(xq); |
1836 | else |
1837 | BEGIN(xe); |
1838 | startlit(); |
1839 | } |
1840 | YY_BREAK |
1841 | case 20: |
1842 | YY_RULE_SETUP |
1843 | #line 532 "third_party/libpg_query/scan.l" |
1844 | { |
1845 | yyextra->warn_on_first_escape = false; |
1846 | yyextra->saw_non_ascii = false; |
1847 | SET_YYLLOC(); |
1848 | BEGIN(xe); |
1849 | startlit(); |
1850 | } |
1851 | YY_BREAK |
1852 | case 21: |
1853 | YY_RULE_SETUP |
1854 | #line 539 "third_party/libpg_query/scan.l" |
1855 | { |
1856 | SET_YYLLOC(); |
1857 | if (!yyextra->standard_conforming_strings) |
1858 | ereport(code: ERROR, |
1859 | (errcode(sqlerrcode: PG_ERRCODE_FEATURE_NOT_SUPPORTED), |
1860 | errmsg(fmt: "unsafe use of string constant with Unicode escapes" ), |
1861 | errdetail(fmt: "String constants with Unicode escapes cannot be used when standard_conforming_strings is off." ), |
1862 | lexer_errposition())); |
1863 | BEGIN(xus); |
1864 | startlit(); |
1865 | } |
1866 | YY_BREAK |
1867 | case 22: |
1868 | /* rule 22 can match eol */ |
1869 | #line 551 "third_party/libpg_query/scan.l" |
1870 | case 23: |
1871 | /* rule 23 can match eol */ |
1872 | YY_RULE_SETUP |
1873 | #line 551 "third_party/libpg_query/scan.l" |
1874 | { |
1875 | yyless(1); |
1876 | BEGIN(INITIAL); |
1877 | /* |
1878 | * check that the data remains valid if it might have been |
1879 | * made invalid by unescaping any chars. |
1880 | */ |
1881 | if (yyextra->saw_non_ascii) |
1882 | pg_verifymbstr(yyextra->literalbuf, |
1883 | yyextra->literallen, |
1884 | noError: false); |
1885 | yylval->str = litbufdup(yyscanner); |
1886 | return SCONST; |
1887 | } |
1888 | YY_BREAK |
1889 | case 24: |
1890 | /* rule 24 can match eol */ |
1891 | #line 566 "third_party/libpg_query/scan.l" |
1892 | case 25: |
1893 | /* rule 25 can match eol */ |
1894 | YY_RULE_SETUP |
1895 | #line 566 "third_party/libpg_query/scan.l" |
1896 | { |
1897 | /* throw back all but the quote */ |
1898 | yyless(1); |
1899 | /* xusend state looks for possible UESCAPE */ |
1900 | BEGIN(xusend); |
1901 | } |
1902 | YY_BREAK |
1903 | case 26: |
1904 | /* rule 26 can match eol */ |
1905 | YY_RULE_SETUP |
1906 | #line 572 "third_party/libpg_query/scan.l" |
1907 | { |
1908 | /* stay in xusend state over whitespace */ |
1909 | } |
1910 | YY_BREAK |
1911 | case YY_STATE_EOF(xusend): |
1912 | #line 575 "third_party/libpg_query/scan.l" |
1913 | case 27: |
1914 | /* rule 27 can match eol */ |
1915 | #line 577 "third_party/libpg_query/scan.l" |
1916 | case 28: |
1917 | /* rule 28 can match eol */ |
1918 | YY_RULE_SETUP |
1919 | #line 577 "third_party/libpg_query/scan.l" |
1920 | { |
1921 | /* no UESCAPE after the quote, throw back everything */ |
1922 | yyless(0); |
1923 | BEGIN(INITIAL); |
1924 | yylval->str = litbuf_udeescape(escape: '\\', yyscanner); |
1925 | return SCONST; |
1926 | } |
1927 | YY_BREAK |
1928 | case 29: |
1929 | /* rule 29 can match eol */ |
1930 | YY_RULE_SETUP |
1931 | #line 584 "third_party/libpg_query/scan.l" |
1932 | { |
1933 | /* found UESCAPE after the end quote */ |
1934 | BEGIN(INITIAL); |
1935 | if (!check_uescapechar(yytext[yyleng - 2])) |
1936 | { |
1937 | SET_YYLLOC(); |
1938 | ADVANCE_YYLLOC(yyleng - 2); |
1939 | yyerror("invalid Unicode escape character" ); |
1940 | } |
1941 | yylval->str = litbuf_udeescape(yytext[yyleng - 2], |
1942 | yyscanner); |
1943 | return SCONST; |
1944 | } |
1945 | YY_BREAK |
1946 | case 30: |
1947 | YY_RULE_SETUP |
1948 | #line 597 "third_party/libpg_query/scan.l" |
1949 | { |
1950 | addlitchar(ychar: '\'', yyscanner); |
1951 | } |
1952 | YY_BREAK |
1953 | case 31: |
1954 | /* rule 31 can match eol */ |
1955 | YY_RULE_SETUP |
1956 | #line 600 "third_party/libpg_query/scan.l" |
1957 | { |
1958 | addlit(yytext, yyleng, yyscanner); |
1959 | } |
1960 | YY_BREAK |
1961 | case 32: |
1962 | /* rule 32 can match eol */ |
1963 | YY_RULE_SETUP |
1964 | #line 603 "third_party/libpg_query/scan.l" |
1965 | { |
1966 | addlit(yytext, yyleng, yyscanner); |
1967 | } |
1968 | YY_BREAK |
1969 | case 33: |
1970 | YY_RULE_SETUP |
1971 | #line 606 "third_party/libpg_query/scan.l" |
1972 | { |
1973 | pg_wchar c = strtoul(yytext + 2, NULL, base: 16); |
1974 | |
1975 | check_escape_warning(yyscanner); |
1976 | |
1977 | if (is_utf16_surrogate_first(c)) |
1978 | { |
1979 | yyextra->utf16_first_part = c; |
1980 | BEGIN(xeu); |
1981 | } |
1982 | else if (is_utf16_surrogate_second(c)) |
1983 | yyerror("invalid Unicode surrogate pair" ); |
1984 | else |
1985 | addunicode(c, yyscanner); |
1986 | } |
1987 | YY_BREAK |
1988 | case 34: |
1989 | YY_RULE_SETUP |
1990 | #line 621 "third_party/libpg_query/scan.l" |
1991 | { |
1992 | pg_wchar c = strtoul(yytext + 2, NULL, base: 16); |
1993 | |
1994 | if (!is_utf16_surrogate_second(c)) |
1995 | yyerror("invalid Unicode surrogate pair" ); |
1996 | |
1997 | c = surrogate_pair_to_codepoint(yyextra->utf16_first_part, second: c); |
1998 | |
1999 | addunicode(c, yyscanner); |
2000 | |
2001 | BEGIN(xe); |
2002 | } |
2003 | YY_BREAK |
2004 | case 35: |
2005 | YY_RULE_SETUP |
2006 | #line 633 "third_party/libpg_query/scan.l" |
2007 | { yyerror("invalid Unicode surrogate pair" ); } |
2008 | YY_BREAK |
2009 | case 36: |
2010 | /* rule 36 can match eol */ |
2011 | YY_RULE_SETUP |
2012 | #line 634 "third_party/libpg_query/scan.l" |
2013 | { yyerror("invalid Unicode surrogate pair" ); } |
2014 | YY_BREAK |
2015 | case YY_STATE_EOF(xeu): |
2016 | #line 635 "third_party/libpg_query/scan.l" |
2017 | { yyerror("invalid Unicode surrogate pair" ); } |
2018 | YY_BREAK |
2019 | case 37: |
2020 | YY_RULE_SETUP |
2021 | #line 636 "third_party/libpg_query/scan.l" |
2022 | { |
2023 | ereport(code: ERROR, |
2024 | (errcode(sqlerrcode: PG_ERRCODE_INVALID_ESCAPE_SEQUENCE), |
2025 | errmsg(fmt: "invalid Unicode escape" ), |
2026 | errhint(msg: "Unicode escapes must be \\uXXXX or \\UXXXXXXXX." ), |
2027 | lexer_errposition())); |
2028 | } |
2029 | YY_BREAK |
2030 | case 38: |
2031 | /* rule 38 can match eol */ |
2032 | YY_RULE_SETUP |
2033 | #line 643 "third_party/libpg_query/scan.l" |
2034 | { |
2035 | // if (yytext[1] == '\'') |
2036 | // { |
2037 | // if (yyextra->backslash_quote == PG_BACKSLASH_QUOTE_OFF || |
2038 | // (yyextra->backslash_quote == PG_BACKSLASH_QUOTE_SAFE_ENCODING && |
2039 | // PG_ENCODING_IS_CLIENT_ONLY(pg_get_client_encoding()))) |
2040 | // ereport(ERROR, |
2041 | // (errcode(PG_ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER), |
2042 | // errmsg("unsafe use of \\' in a string literal"), |
2043 | // errhint("Use '' to write quotes in strings. \\' is insecure in client-only encodings."), |
2044 | // lexer_errposition())); |
2045 | // } |
2046 | check_string_escape_warning(yytext[1], yyscanner); |
2047 | addlitchar(ychar: unescape_single_char(yytext[1], yyscanner), |
2048 | yyscanner); |
2049 | } |
2050 | YY_BREAK |
2051 | case 39: |
2052 | YY_RULE_SETUP |
2053 | #line 659 "third_party/libpg_query/scan.l" |
2054 | { |
2055 | unsigned char c = strtoul(yytext + 1, NULL, base: 8); |
2056 | |
2057 | check_escape_warning(yyscanner); |
2058 | addlitchar(ychar: c, yyscanner); |
2059 | if (c == '\0' || IS_HIGHBIT_SET(c)) |
2060 | yyextra->saw_non_ascii = true; |
2061 | } |
2062 | YY_BREAK |
2063 | case 40: |
2064 | YY_RULE_SETUP |
2065 | #line 667 "third_party/libpg_query/scan.l" |
2066 | { |
2067 | unsigned char c = strtoul(yytext + 2, NULL, base: 16); |
2068 | |
2069 | check_escape_warning(yyscanner); |
2070 | addlitchar(ychar: c, yyscanner); |
2071 | if (c == '\0' || IS_HIGHBIT_SET(c)) |
2072 | yyextra->saw_non_ascii = true; |
2073 | } |
2074 | YY_BREAK |
2075 | case 41: |
2076 | /* rule 41 can match eol */ |
2077 | YY_RULE_SETUP |
2078 | #line 675 "third_party/libpg_query/scan.l" |
2079 | { |
2080 | /* ignore */ |
2081 | } |
2082 | YY_BREAK |
2083 | case 42: |
2084 | YY_RULE_SETUP |
2085 | #line 678 "third_party/libpg_query/scan.l" |
2086 | { |
2087 | /* This is only needed for \ just before EOF */ |
2088 | addlitchar(yytext[0], yyscanner); |
2089 | } |
2090 | YY_BREAK |
2091 | case YY_STATE_EOF(xq): |
2092 | case YY_STATE_EOF(xe): |
2093 | case YY_STATE_EOF(xus): |
2094 | #line 682 "third_party/libpg_query/scan.l" |
2095 | { yyerror("unterminated quoted string" ); } |
2096 | YY_BREAK |
2097 | case 43: |
2098 | YY_RULE_SETUP |
2099 | #line 684 "third_party/libpg_query/scan.l" |
2100 | { |
2101 | SET_YYLLOC(); |
2102 | yyextra->dolqstart = pstrdup(yytext); |
2103 | BEGIN(xdolq); |
2104 | startlit(); |
2105 | } |
2106 | YY_BREAK |
2107 | case 44: |
2108 | YY_RULE_SETUP |
2109 | #line 690 "third_party/libpg_query/scan.l" |
2110 | { |
2111 | SET_YYLLOC(); |
2112 | /* throw back all but the initial "$" */ |
2113 | yyless(1); |
2114 | /* and treat it as {other} */ |
2115 | return yytext[0]; |
2116 | } |
2117 | YY_BREAK |
2118 | case 45: |
2119 | YY_RULE_SETUP |
2120 | #line 697 "third_party/libpg_query/scan.l" |
2121 | { |
2122 | if (strcmp(yytext, yyextra->dolqstart) == 0) |
2123 | { |
2124 | pfree(yyextra->dolqstart); |
2125 | yyextra->dolqstart = NULL; |
2126 | BEGIN(INITIAL); |
2127 | yylval->str = litbufdup(yyscanner); |
2128 | return SCONST; |
2129 | } |
2130 | else |
2131 | { |
2132 | /* |
2133 | * When we fail to match $...$ to dolqstart, transfer |
2134 | * the $... part to the output, but put back the final |
2135 | * $ for rescanning. Consider $delim$...$junk$delim$ |
2136 | */ |
2137 | addlit(yytext, yyleng - 1, yyscanner); |
2138 | yyless(yyleng - 1); |
2139 | } |
2140 | } |
2141 | YY_BREAK |
2142 | case 46: |
2143 | /* rule 46 can match eol */ |
2144 | YY_RULE_SETUP |
2145 | #line 717 "third_party/libpg_query/scan.l" |
2146 | { |
2147 | addlit(yytext, yyleng, yyscanner); |
2148 | } |
2149 | YY_BREAK |
2150 | case 47: |
2151 | YY_RULE_SETUP |
2152 | #line 720 "third_party/libpg_query/scan.l" |
2153 | { |
2154 | addlit(yytext, yyleng, yyscanner); |
2155 | } |
2156 | YY_BREAK |
2157 | case 48: |
2158 | YY_RULE_SETUP |
2159 | #line 723 "third_party/libpg_query/scan.l" |
2160 | { |
2161 | /* This is only needed for $ inside the quoted text */ |
2162 | addlitchar(yytext[0], yyscanner); |
2163 | } |
2164 | YY_BREAK |
2165 | case YY_STATE_EOF(xdolq): |
2166 | #line 727 "third_party/libpg_query/scan.l" |
2167 | { yyerror("unterminated dollar-quoted string" ); } |
2168 | YY_BREAK |
2169 | case 49: |
2170 | YY_RULE_SETUP |
2171 | #line 729 "third_party/libpg_query/scan.l" |
2172 | { |
2173 | SET_YYLLOC(); |
2174 | BEGIN(xd); |
2175 | startlit(); |
2176 | } |
2177 | YY_BREAK |
2178 | case 50: |
2179 | YY_RULE_SETUP |
2180 | #line 734 "third_party/libpg_query/scan.l" |
2181 | { |
2182 | SET_YYLLOC(); |
2183 | BEGIN(xui); |
2184 | startlit(); |
2185 | } |
2186 | YY_BREAK |
2187 | case 51: |
2188 | YY_RULE_SETUP |
2189 | #line 739 "third_party/libpg_query/scan.l" |
2190 | { |
2191 | char *ident; |
2192 | |
2193 | BEGIN(INITIAL); |
2194 | if (yyextra->literallen == 0) |
2195 | yyerror("zero-length delimited identifier" ); |
2196 | ident = litbufdup(yyscanner); |
2197 | yylval->str = ident; |
2198 | return IDENT; |
2199 | } |
2200 | YY_BREAK |
2201 | case 52: |
2202 | YY_RULE_SETUP |
2203 | #line 749 "third_party/libpg_query/scan.l" |
2204 | { |
2205 | yyless(1); |
2206 | /* xuiend state looks for possible UESCAPE */ |
2207 | BEGIN(xuiend); |
2208 | } |
2209 | YY_BREAK |
2210 | case 53: |
2211 | /* rule 53 can match eol */ |
2212 | YY_RULE_SETUP |
2213 | #line 754 "third_party/libpg_query/scan.l" |
2214 | { |
2215 | /* stay in xuiend state over whitespace */ |
2216 | } |
2217 | YY_BREAK |
2218 | case YY_STATE_EOF(xuiend): |
2219 | #line 757 "third_party/libpg_query/scan.l" |
2220 | case 54: |
2221 | /* rule 54 can match eol */ |
2222 | #line 759 "third_party/libpg_query/scan.l" |
2223 | case 55: |
2224 | /* rule 55 can match eol */ |
2225 | YY_RULE_SETUP |
2226 | #line 759 "third_party/libpg_query/scan.l" |
2227 | { |
2228 | /* no UESCAPE after the quote, throw back everything */ |
2229 | char *ident; |
2230 | |
2231 | yyless(0); |
2232 | |
2233 | BEGIN(INITIAL); |
2234 | if (yyextra->literallen == 0) |
2235 | yyerror("zero-length delimited identifier" ); |
2236 | ident = litbuf_udeescape(escape: '\\', yyscanner); |
2237 | yylval->str = ident; |
2238 | return IDENT; |
2239 | } |
2240 | YY_BREAK |
2241 | case 56: |
2242 | /* rule 56 can match eol */ |
2243 | YY_RULE_SETUP |
2244 | #line 772 "third_party/libpg_query/scan.l" |
2245 | { |
2246 | /* found UESCAPE after the end quote */ |
2247 | char *ident; |
2248 | |
2249 | BEGIN(INITIAL); |
2250 | if (yyextra->literallen == 0) |
2251 | yyerror("zero-length delimited identifier" ); |
2252 | if (!check_uescapechar(yytext[yyleng - 2])) |
2253 | { |
2254 | SET_YYLLOC(); |
2255 | ADVANCE_YYLLOC(yyleng - 2); |
2256 | yyerror("invalid Unicode escape character" ); |
2257 | } |
2258 | ident = litbuf_udeescape(yytext[yyleng - 2], yyscanner); |
2259 | yylval->str = ident; |
2260 | return IDENT; |
2261 | } |
2262 | YY_BREAK |
2263 | case 57: |
2264 | YY_RULE_SETUP |
2265 | #line 789 "third_party/libpg_query/scan.l" |
2266 | { |
2267 | addlitchar(ychar: '"', yyscanner); |
2268 | } |
2269 | YY_BREAK |
2270 | case 58: |
2271 | /* rule 58 can match eol */ |
2272 | YY_RULE_SETUP |
2273 | #line 792 "third_party/libpg_query/scan.l" |
2274 | { |
2275 | addlit(yytext, yyleng, yyscanner); |
2276 | } |
2277 | YY_BREAK |
2278 | case YY_STATE_EOF(xd): |
2279 | case YY_STATE_EOF(xui): |
2280 | #line 795 "third_party/libpg_query/scan.l" |
2281 | { yyerror("unterminated quoted identifier" ); } |
2282 | YY_BREAK |
2283 | case 59: |
2284 | YY_RULE_SETUP |
2285 | #line 797 "third_party/libpg_query/scan.l" |
2286 | { |
2287 | char *ident; |
2288 | |
2289 | SET_YYLLOC(); |
2290 | /* throw back all but the initial u/U */ |
2291 | yyless(1); |
2292 | /* and treat it as {identifier} */ |
2293 | ident = downcase_truncate_identifier(yytext, yyleng, warn: true); |
2294 | yylval->str = ident; |
2295 | return IDENT; |
2296 | } |
2297 | YY_BREAK |
2298 | case 60: |
2299 | YY_RULE_SETUP |
2300 | #line 809 "third_party/libpg_query/scan.l" |
2301 | { |
2302 | SET_YYLLOC(); |
2303 | return TYPECAST; |
2304 | } |
2305 | YY_BREAK |
2306 | case 61: |
2307 | YY_RULE_SETUP |
2308 | #line 814 "third_party/libpg_query/scan.l" |
2309 | { |
2310 | SET_YYLLOC(); |
2311 | return DOT_DOT; |
2312 | } |
2313 | YY_BREAK |
2314 | case 62: |
2315 | YY_RULE_SETUP |
2316 | #line 819 "third_party/libpg_query/scan.l" |
2317 | { |
2318 | SET_YYLLOC(); |
2319 | return COLON_EQUALS; |
2320 | } |
2321 | YY_BREAK |
2322 | case 63: |
2323 | YY_RULE_SETUP |
2324 | #line 824 "third_party/libpg_query/scan.l" |
2325 | { |
2326 | SET_YYLLOC(); |
2327 | return LAMBDA_ARROW; |
2328 | } |
2329 | YY_BREAK |
2330 | case 64: |
2331 | YY_RULE_SETUP |
2332 | #line 829 "third_party/libpg_query/scan.l" |
2333 | { |
2334 | SET_YYLLOC(); |
2335 | return DOUBLE_ARROW; |
2336 | } |
2337 | YY_BREAK |
2338 | case 65: |
2339 | YY_RULE_SETUP |
2340 | #line 834 "third_party/libpg_query/scan.l" |
2341 | { |
2342 | SET_YYLLOC(); |
2343 | return POWER_OF; |
2344 | } |
2345 | YY_BREAK |
2346 | case 66: |
2347 | YY_RULE_SETUP |
2348 | #line 839 "third_party/libpg_query/scan.l" |
2349 | { |
2350 | SET_YYLLOC(); |
2351 | return INTEGER_DIVISION; |
2352 | } |
2353 | YY_BREAK |
2354 | case 67: |
2355 | YY_RULE_SETUP |
2356 | #line 844 "third_party/libpg_query/scan.l" |
2357 | { |
2358 | SET_YYLLOC(); |
2359 | return EQUALS_GREATER; |
2360 | } |
2361 | YY_BREAK |
2362 | case 68: |
2363 | YY_RULE_SETUP |
2364 | #line 849 "third_party/libpg_query/scan.l" |
2365 | { |
2366 | SET_YYLLOC(); |
2367 | return LESS_EQUALS; |
2368 | } |
2369 | YY_BREAK |
2370 | case 69: |
2371 | YY_RULE_SETUP |
2372 | #line 854 "third_party/libpg_query/scan.l" |
2373 | { |
2374 | SET_YYLLOC(); |
2375 | return GREATER_EQUALS; |
2376 | } |
2377 | YY_BREAK |
2378 | case 70: |
2379 | YY_RULE_SETUP |
2380 | #line 859 "third_party/libpg_query/scan.l" |
2381 | { |
2382 | /* We accept both "<>" and "!=" as meaning NOT_EQUALS */ |
2383 | SET_YYLLOC(); |
2384 | return NOT_EQUALS; |
2385 | } |
2386 | YY_BREAK |
2387 | case 71: |
2388 | YY_RULE_SETUP |
2389 | #line 865 "third_party/libpg_query/scan.l" |
2390 | { |
2391 | /* We accept both "<>" and "!=" as meaning NOT_EQUALS */ |
2392 | SET_YYLLOC(); |
2393 | return NOT_EQUALS; |
2394 | } |
2395 | YY_BREAK |
2396 | case 72: |
2397 | YY_RULE_SETUP |
2398 | #line 871 "third_party/libpg_query/scan.l" |
2399 | { |
2400 | SET_YYLLOC(); |
2401 | return yytext[0]; |
2402 | } |
2403 | YY_BREAK |
2404 | case 73: |
2405 | YY_RULE_SETUP |
2406 | #line 876 "third_party/libpg_query/scan.l" |
2407 | { |
2408 | /* |
2409 | * Check for embedded slash-star or dash-dash; those |
2410 | * are comment starts, so operator must stop there. |
2411 | * Note that slash-star or dash-dash at the first |
2412 | * character will match a prior rule, not this one. |
2413 | */ |
2414 | int nchars = yyleng; |
2415 | char *slashstar = strstr(yytext, needle: "/*" ); /* slash star */ |
2416 | char *dashdash = strstr(yytext, needle: "--" ); |
2417 | |
2418 | if (slashstar && dashdash) { |
2419 | /* if both appear, take the first one */ |
2420 | if (slashstar > dashdash) |
2421 | slashstar = dashdash; |
2422 | } else if (!slashstar) { |
2423 | slashstar = dashdash; |
2424 | } |
2425 | if (slashstar) { |
2426 | nchars = slashstar - yytext; |
2427 | } |
2428 | |
2429 | /* |
2430 | * For SQL compatibility, '+' and '-' cannot be the |
2431 | * last char of a multi-char operator unless the operator |
2432 | * contains chars that are not in SQL operators. |
2433 | * The idea is to lex '=-' as two operators, but not |
2434 | * to forbid operator names like '?-' that could not be |
2435 | * sequences of SQL operators. |
2436 | */ |
2437 | while (nchars > 1 && |
2438 | (yytext[nchars - 1] == '+' || |
2439 | yytext[nchars - 1] == '-')) |
2440 | { |
2441 | int ic; |
2442 | |
2443 | for (ic = nchars - 2; ic >= 0; ic--) |
2444 | { |
2445 | if (strchr(s: "~!@^&|`?%" , yytext[ic])) |
2446 | break; |
2447 | } |
2448 | if (ic >= 0) |
2449 | break; /* found a char that makes it OK */ |
2450 | nchars--; /* else remove the +/-, and check again */ |
2451 | } |
2452 | |
2453 | /* We don't accept leading ? in any multi-character operators |
2454 | * except for those in use by hstore, JSON and geometric operators. |
2455 | * |
2456 | * We don't accept contained or trailing ? in any |
2457 | * multi-character operators. |
2458 | * |
2459 | * This is necessary in order to support normalized queries without |
2460 | * spacing between ? as a substition character and a simple operator (e.g. "?=?") |
2461 | */ |
2462 | if (yytext[0] == '?' && |
2463 | strcmp(yytext, s2: "?|" ) != 0 && strcmp(yytext, s2: "?&" ) != 0 && |
2464 | strcmp(yytext, s2: "?-" ) != 0 && |
2465 | strcmp(yytext, s2: "?-|" ) != 0 && strcmp(yytext, s2: "?||" ) != 0) { |
2466 | nchars = 1; |
2467 | } |
2468 | |
2469 | if (yytext[0] != '?' && strchr(yytext, c: '?')) { |
2470 | /* Lex up to just before the ? character */ |
2471 | nchars = strchr(yytext, c: '?') - yytext; |
2472 | } |
2473 | |
2474 | SET_YYLLOC(); |
2475 | |
2476 | if ((yy_size_t) nchars < yyleng) |
2477 | { |
2478 | /* Strip the unwanted chars from the token */ |
2479 | yyless(nchars); |
2480 | /* |
2481 | * If what we have left is only one char, and it's |
2482 | * one of the characters matching "self", then |
2483 | * return it as a character token the same way |
2484 | * that the "self" rule would have. |
2485 | */ |
2486 | if (nchars == 1 && |
2487 | strchr(s: ",()[].;:+-*/%^<>=?" , yytext[0])) { |
2488 | return yytext[0]; |
2489 | } |
2490 | /* |
2491 | * Likewise, if what we have left is two chars, and |
2492 | * those match the tokens ">=", "<=", "=>", "<>" or |
2493 | * "!=", then we must return the appropriate token |
2494 | * rather than the generic Op. |
2495 | */ |
2496 | if (nchars == 2) |
2497 | { |
2498 | if (yytext[0] == '=' && yytext[1] == '>') |
2499 | return EQUALS_GREATER; |
2500 | if (yytext[0] == '>' && yytext[1] == '=') |
2501 | return GREATER_EQUALS; |
2502 | if (yytext[0] == '<' && yytext[1] == '=') |
2503 | return LESS_EQUALS; |
2504 | if (yytext[0] == '<' && yytext[1] == '>') |
2505 | return NOT_EQUALS; |
2506 | if (yytext[0] == '!' && yytext[1] == '=') |
2507 | return NOT_EQUALS; |
2508 | } |
2509 | } |
2510 | |
2511 | /* |
2512 | * Complain if operator is too long. Unlike the case |
2513 | * for identifiers, we make this an error not a notice- |
2514 | * and-truncate, because the odds are we are looking at |
2515 | * a syntactic mistake anyway. NAMEDDATALEN |
2516 | */ |
2517 | if (nchars >= 64) |
2518 | yyerror("operator too long: operators longer than 64 bytes are not supported" ); |
2519 | |
2520 | yylval->str = pstrdup(yytext); |
2521 | return Op; |
2522 | } |
2523 | YY_BREAK |
2524 | case 74: |
2525 | YY_RULE_SETUP |
2526 | #line 993 "third_party/libpg_query/scan.l" |
2527 | { |
2528 | SET_YYLLOC(); |
2529 | yylval->ival = atol(yytext + 1); |
2530 | return PARAM; |
2531 | } |
2532 | YY_BREAK |
2533 | case 75: |
2534 | YY_RULE_SETUP |
2535 | #line 999 "third_party/libpg_query/scan.l" |
2536 | { |
2537 | SET_YYLLOC(); |
2538 | yylval->ival = atol(yytext + 1); |
2539 | return PARAM; |
2540 | } |
2541 | YY_BREAK |
2542 | case 76: |
2543 | YY_RULE_SETUP |
2544 | #line 1005 "third_party/libpg_query/scan.l" |
2545 | { |
2546 | SET_YYLLOC(); |
2547 | return process_integer_literal(yytext, yylval); |
2548 | } |
2549 | YY_BREAK |
2550 | case 77: |
2551 | YY_RULE_SETUP |
2552 | #line 1009 "third_party/libpg_query/scan.l" |
2553 | { |
2554 | SET_YYLLOC(); |
2555 | yylval->str = pstrdup(yytext); |
2556 | return FCONST; |
2557 | } |
2558 | YY_BREAK |
2559 | case 78: |
2560 | YY_RULE_SETUP |
2561 | #line 1014 "third_party/libpg_query/scan.l" |
2562 | { |
2563 | /* throw back the .., and treat as integer */ |
2564 | yyless(yyleng - 2); |
2565 | SET_YYLLOC(); |
2566 | return process_integer_literal(yytext, yylval); |
2567 | } |
2568 | YY_BREAK |
2569 | case 79: |
2570 | YY_RULE_SETUP |
2571 | #line 1020 "third_party/libpg_query/scan.l" |
2572 | { |
2573 | SET_YYLLOC(); |
2574 | yylval->str = pstrdup(yytext); |
2575 | return FCONST; |
2576 | } |
2577 | YY_BREAK |
2578 | case 80: |
2579 | YY_RULE_SETUP |
2580 | #line 1025 "third_party/libpg_query/scan.l" |
2581 | { |
2582 | /* |
2583 | * throw back the [Ee], and treat as {decimal}. Note |
2584 | * that it is possible the input is actually {integer}, |
2585 | * but since this case will almost certainly lead to a |
2586 | * syntax error anyway, we don't bother to distinguish. |
2587 | */ |
2588 | yyless(yyleng - 1); |
2589 | SET_YYLLOC(); |
2590 | yylval->str = pstrdup(yytext); |
2591 | return FCONST; |
2592 | } |
2593 | YY_BREAK |
2594 | case 81: |
2595 | YY_RULE_SETUP |
2596 | #line 1037 "third_party/libpg_query/scan.l" |
2597 | { |
2598 | /* throw back the [Ee][+-], and proceed as above */ |
2599 | yyless(yyleng - 2); |
2600 | SET_YYLLOC(); |
2601 | yylval->str = pstrdup(yytext); |
2602 | return FCONST; |
2603 | } |
2604 | YY_BREAK |
2605 | case 82: |
2606 | YY_RULE_SETUP |
2607 | #line 1046 "third_party/libpg_query/scan.l" |
2608 | { |
2609 | const PGScanKeyword *keyword; |
2610 | char *ident; |
2611 | char *keyword_text = pstrdup(yytext); |
2612 | |
2613 | SET_YYLLOC(); |
2614 | |
2615 | if (yytext[yyleng - 1] == '?') { |
2616 | keyword_text[yyleng - 1] = '\0'; |
2617 | } |
2618 | |
2619 | /* Is it a keyword? */ |
2620 | keyword = ScanKeywordLookup(text: keyword_text, |
2621 | yyextra->keywords, |
2622 | yyextra->num_keywords); |
2623 | if (keyword != NULL) |
2624 | { |
2625 | if (keyword_text[yyleng - 1] == '\0') { |
2626 | yyless(yyleng - 1); |
2627 | } |
2628 | yylval->keyword = keyword_text; |
2629 | return keyword->value; |
2630 | } |
2631 | |
2632 | /* |
2633 | * No. Convert the identifier to lower case, and truncate |
2634 | * if necessary. |
2635 | */ |
2636 | ident = downcase_truncate_identifier(yytext, yyleng, warn: true); |
2637 | yylval->str = ident; |
2638 | return IDENT; |
2639 | } |
2640 | YY_BREAK |
2641 | case 83: |
2642 | YY_RULE_SETUP |
2643 | #line 1079 "third_party/libpg_query/scan.l" |
2644 | { |
2645 | SET_YYLLOC(); |
2646 | return yytext[0]; |
2647 | } |
2648 | YY_BREAK |
2649 | case YY_STATE_EOF(INITIAL): |
2650 | #line 1084 "third_party/libpg_query/scan.l" |
2651 | { |
2652 | SET_YYLLOC(); |
2653 | yyterminate(); |
2654 | } |
2655 | YY_BREAK |
2656 | case 84: |
2657 | YY_RULE_SETUP |
2658 | #line 1089 "third_party/libpg_query/scan.l" |
2659 | YY_FATAL_ERROR( "flex scanner jammed" ); |
2660 | YY_BREAK |
2661 | #line 2667 "third_party/libpg_query/src_backend_parser_scan.cpp" |
2662 | |
2663 | case YY_END_OF_BUFFER: |
2664 | { |
2665 | /* Amount of text matched not including the EOB char. */ |
2666 | int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; |
2667 | |
2668 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
2669 | *yy_cp = yyg->yy_hold_char; |
2670 | YY_RESTORE_YY_MORE_OFFSET |
2671 | |
2672 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) |
2673 | { |
2674 | /* We're scanning a new file or input source. It's |
2675 | * possible that this happened because the user |
2676 | * just pointed yyin at a new source and called |
2677 | * yylex(). If so, then we have to assure |
2678 | * consistency between YY_CURRENT_BUFFER and our |
2679 | * globals. Here is the right place to do so, because |
2680 | * this is the first action (other than possibly a |
2681 | * back-up) that will match for the new input source. |
2682 | */ |
2683 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
2684 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; |
2685 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; |
2686 | } |
2687 | |
2688 | /* Note that here we test for yy_c_buf_p "<=" to the position |
2689 | * of the first EOB in the buffer, since yy_c_buf_p will |
2690 | * already have been incremented past the NUL character |
2691 | * (since all states make transitions on EOB to the |
2692 | * end-of-buffer state). Contrast this with the test |
2693 | * in input(). |
2694 | */ |
2695 | if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
2696 | { /* This was really a NUL. */ |
2697 | yy_state_type yy_next_state; |
2698 | |
2699 | yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; |
2700 | |
2701 | yy_current_state = yy_get_previous_state( yyscanner ); |
2702 | |
2703 | /* Okay, we're now positioned to make the NUL |
2704 | * transition. We couldn't have |
2705 | * yy_get_previous_state() go ahead and do it |
2706 | * for us because it doesn't know how to deal |
2707 | * with the possibility of jamming (and we don't |
2708 | * want to build jamming into it because then it |
2709 | * will run more slowly). |
2710 | */ |
2711 | |
2712 | yy_next_state = yy_try_NUL_trans( current_state: yy_current_state , yyscanner); |
2713 | |
2714 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
2715 | |
2716 | if ( yy_next_state ) |
2717 | { |
2718 | /* Consume the NUL. */ |
2719 | yy_cp = ++yyg->yy_c_buf_p; |
2720 | yy_current_state = yy_next_state; |
2721 | goto yy_match; |
2722 | } |
2723 | |
2724 | else |
2725 | { |
2726 | yy_cp = yyg->yy_last_accepting_cpos; |
2727 | yy_current_state = yyg->yy_last_accepting_state; |
2728 | goto yy_find_action; |
2729 | } |
2730 | } |
2731 | |
2732 | else switch ( yy_get_next_buffer( yyscanner ) ) |
2733 | { |
2734 | case EOB_ACT_END_OF_FILE: |
2735 | { |
2736 | yyg->yy_did_buffer_switch_on_eof = 0; |
2737 | |
2738 | if ( yywrap( yyscanner ) ) |
2739 | { |
2740 | /* Note: because we've taken care in |
2741 | * yy_get_next_buffer() to have set up |
2742 | * yytext, we can now set up |
2743 | * yy_c_buf_p so that if some total |
2744 | * hoser (like flex itself) wants to |
2745 | * call the scanner after we return the |
2746 | * YY_NULL, it'll still work - another |
2747 | * YY_NULL will get returned. |
2748 | */ |
2749 | yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; |
2750 | |
2751 | yy_act = YY_STATE_EOF(YY_START); |
2752 | goto do_action; |
2753 | } |
2754 | |
2755 | else |
2756 | { |
2757 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
2758 | YY_NEW_FILE; |
2759 | } |
2760 | break; |
2761 | } |
2762 | |
2763 | case EOB_ACT_CONTINUE_SCAN: |
2764 | yyg->yy_c_buf_p = |
2765 | yyg->yytext_ptr + yy_amount_of_matched_text; |
2766 | |
2767 | yy_current_state = yy_get_previous_state( yyscanner ); |
2768 | |
2769 | yy_cp = yyg->yy_c_buf_p; |
2770 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
2771 | goto yy_match; |
2772 | |
2773 | case EOB_ACT_LAST_MATCH: |
2774 | yyg->yy_c_buf_p = |
2775 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; |
2776 | |
2777 | yy_current_state = yy_get_previous_state( yyscanner ); |
2778 | |
2779 | yy_cp = yyg->yy_c_buf_p; |
2780 | yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; |
2781 | goto yy_find_action; |
2782 | } |
2783 | break; |
2784 | } |
2785 | |
2786 | default: |
2787 | YY_FATAL_ERROR( |
2788 | "fatal flex scanner internal error--no action found" ); |
2789 | } /* end of action switch */ |
2790 | } /* end of scanning one token */ |
2791 | } /* end of user's declarations */ |
2792 | } /* end of yylex */ |
2793 | |
2794 | /* yy_get_next_buffer - try to read in a new buffer |
2795 | * |
2796 | * Returns a code representing an action: |
2797 | * EOB_ACT_LAST_MATCH - |
2798 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
2799 | * EOB_ACT_END_OF_FILE - end of file |
2800 | */ |
2801 | static int yy_get_next_buffer (yyscan_t yyscanner) |
2802 | { |
2803 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2804 | char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; |
2805 | char *source = yyg->yytext_ptr; |
2806 | int number_to_move, i; |
2807 | int ret_val; |
2808 | |
2809 | if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) |
2810 | YY_FATAL_ERROR( |
2811 | "fatal flex scanner internal error--end of buffer missed" ); |
2812 | |
2813 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) |
2814 | { /* Don't try to fill the buffer, so this is an EOF. */ |
2815 | if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) |
2816 | { |
2817 | /* We matched a single character, the EOB, so |
2818 | * treat this as a final EOF. |
2819 | */ |
2820 | return EOB_ACT_END_OF_FILE; |
2821 | } |
2822 | |
2823 | else |
2824 | { |
2825 | /* We matched some text prior to the EOB, first |
2826 | * process it. |
2827 | */ |
2828 | return EOB_ACT_LAST_MATCH; |
2829 | } |
2830 | } |
2831 | |
2832 | /* Try to read more data. */ |
2833 | |
2834 | /* First move last chars to start of buffer. */ |
2835 | number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); |
2836 | |
2837 | for ( i = 0; i < number_to_move; ++i ) |
2838 | *(dest++) = *(source++); |
2839 | |
2840 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
2841 | /* don't do the read, it's not guaranteed to return an EOF, |
2842 | * just force an EOF |
2843 | */ |
2844 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; |
2845 | |
2846 | else |
2847 | { |
2848 | yy_size_t num_to_read = |
2849 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
2850 | |
2851 | while ( num_to_read <= 0 ) |
2852 | { /* Not enough room in the buffer - grow it. */ |
2853 | |
2854 | /* just a shorter name for the current buffer */ |
2855 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; |
2856 | |
2857 | int yy_c_buf_p_offset = |
2858 | (int) (yyg->yy_c_buf_p - b->yy_ch_buf); |
2859 | |
2860 | if ( b->yy_is_our_buffer ) |
2861 | { |
2862 | yy_size_t new_size = b->yy_buf_size * 2; |
2863 | |
2864 | if ( new_size <= 0 ) |
2865 | b->yy_buf_size += b->yy_buf_size / 8; |
2866 | else |
2867 | b->yy_buf_size *= 2; |
2868 | |
2869 | b->yy_ch_buf = (char *) |
2870 | /* Include room in for 2 EOB chars. */ |
2871 | yyrealloc( (void *) b->yy_ch_buf, |
2872 | (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
2873 | } |
2874 | else |
2875 | /* Can't grow it, we don't own it. */ |
2876 | b->yy_ch_buf = NULL; |
2877 | |
2878 | if ( ! b->yy_ch_buf ) |
2879 | YY_FATAL_ERROR( |
2880 | "fatal error - scanner input buffer overflow" ); |
2881 | |
2882 | yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
2883 | |
2884 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - |
2885 | number_to_move - 1; |
2886 | |
2887 | } |
2888 | |
2889 | if ( num_to_read > YY_READ_BUF_SIZE ) |
2890 | num_to_read = YY_READ_BUF_SIZE; |
2891 | |
2892 | /* Read in more data. */ |
2893 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), |
2894 | yyg->yy_n_chars, num_to_read ); |
2895 | |
2896 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
2897 | } |
2898 | |
2899 | if ( yyg->yy_n_chars == 0 ) |
2900 | { |
2901 | if ( number_to_move == YY_MORE_ADJ ) |
2902 | { |
2903 | ret_val = EOB_ACT_END_OF_FILE; |
2904 | yyrestart( yyin , yyscanner); |
2905 | } |
2906 | |
2907 | else |
2908 | { |
2909 | ret_val = EOB_ACT_LAST_MATCH; |
2910 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = |
2911 | YY_BUFFER_EOF_PENDING; |
2912 | } |
2913 | } |
2914 | |
2915 | else |
2916 | ret_val = EOB_ACT_CONTINUE_SCAN; |
2917 | |
2918 | if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { |
2919 | /* Extend the array by 50%, plus the number we really need. */ |
2920 | yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); |
2921 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( |
2922 | (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); |
2923 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) |
2924 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); |
2925 | /* "- 2" to take care of EOB's */ |
2926 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); |
2927 | } |
2928 | |
2929 | yyg->yy_n_chars += number_to_move; |
2930 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
2931 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
2932 | |
2933 | yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; |
2934 | |
2935 | return ret_val; |
2936 | } |
2937 | |
2938 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
2939 | |
2940 | static yy_state_type yy_get_previous_state (yyscan_t yyscanner) |
2941 | { |
2942 | yy_state_type yy_current_state; |
2943 | char *yy_cp; |
2944 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
2945 | |
2946 | yy_current_state = yyg->yy_start; |
2947 | |
2948 | for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) |
2949 | { |
2950 | YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); |
2951 | if ( yy_accept[yy_current_state] ) |
2952 | { |
2953 | yyg->yy_last_accepting_state = yy_current_state; |
2954 | yyg->yy_last_accepting_cpos = yy_cp; |
2955 | } |
2956 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2957 | { |
2958 | yy_current_state = (int) yy_def[yy_current_state]; |
2959 | if ( yy_current_state >= 297 ) |
2960 | yy_c = yy_meta[yy_c]; |
2961 | } |
2962 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2963 | } |
2964 | |
2965 | return yy_current_state; |
2966 | } |
2967 | |
2968 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
2969 | * |
2970 | * synopsis |
2971 | * next_state = yy_try_NUL_trans( current_state ); |
2972 | */ |
2973 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) |
2974 | { |
2975 | int yy_is_jam; |
2976 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ |
2977 | char *yy_cp = yyg->yy_c_buf_p; |
2978 | |
2979 | YY_CHAR yy_c = 1; |
2980 | if ( yy_accept[yy_current_state] ) |
2981 | { |
2982 | yyg->yy_last_accepting_state = yy_current_state; |
2983 | yyg->yy_last_accepting_cpos = yy_cp; |
2984 | } |
2985 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
2986 | { |
2987 | yy_current_state = (int) yy_def[yy_current_state]; |
2988 | if ( yy_current_state >= 297 ) |
2989 | yy_c = yy_meta[yy_c]; |
2990 | } |
2991 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
2992 | yy_is_jam = (yy_current_state == 296); |
2993 | |
2994 | (void)yyg; |
2995 | return yy_is_jam ? 0 : yy_current_state; |
2996 | } |
2997 | |
2998 | #ifndef YY_NO_UNPUT |
2999 | |
3000 | #endif |
3001 | |
3002 | #ifndef YY_NO_INPUT |
3003 | #ifdef __cplusplus |
3004 | static int yyinput (yyscan_t yyscanner) |
3005 | #else |
3006 | static int input (yyscan_t yyscanner) |
3007 | #endif |
3008 | |
3009 | { |
3010 | int c; |
3011 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3012 | |
3013 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
3014 | |
3015 | if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
3016 | { |
3017 | /* yy_c_buf_p now points to the character we want to return. |
3018 | * If this occurs *before* the EOB characters, then it's a |
3019 | * valid NUL; if not, then we've hit the end of the buffer. |
3020 | */ |
3021 | if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) |
3022 | /* This was really a NUL. */ |
3023 | *yyg->yy_c_buf_p = '\0'; |
3024 | |
3025 | else |
3026 | { /* need more input */ |
3027 | yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; |
3028 | ++yyg->yy_c_buf_p; |
3029 | |
3030 | switch ( yy_get_next_buffer( yyscanner ) ) |
3031 | { |
3032 | case EOB_ACT_LAST_MATCH: |
3033 | /* This happens because yy_g_n_b() |
3034 | * sees that we've accumulated a |
3035 | * token and flags that we need to |
3036 | * try matching the token before |
3037 | * proceeding. But for input(), |
3038 | * there's no matching to consider. |
3039 | * So convert the EOB_ACT_LAST_MATCH |
3040 | * to EOB_ACT_END_OF_FILE. |
3041 | */ |
3042 | |
3043 | /* Reset buffer status. */ |
3044 | yyrestart( yyin , yyscanner); |
3045 | |
3046 | /*FALLTHROUGH*/ |
3047 | |
3048 | case EOB_ACT_END_OF_FILE: |
3049 | { |
3050 | if ( yywrap( yyscanner ) ) |
3051 | return 0; |
3052 | |
3053 | if ( ! yyg->yy_did_buffer_switch_on_eof ) |
3054 | YY_NEW_FILE; |
3055 | #ifdef __cplusplus |
3056 | return yyinput(yyscanner); |
3057 | #else |
3058 | return input(yyscanner); |
3059 | #endif |
3060 | } |
3061 | |
3062 | case EOB_ACT_CONTINUE_SCAN: |
3063 | yyg->yy_c_buf_p = yyg->yytext_ptr + offset; |
3064 | break; |
3065 | } |
3066 | } |
3067 | } |
3068 | |
3069 | c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */ |
3070 | *yyg->yy_c_buf_p = '\0'; /* preserve yytext */ |
3071 | yyg->yy_hold_char = *++yyg->yy_c_buf_p; |
3072 | |
3073 | return c; |
3074 | } |
3075 | #endif /* ifndef YY_NO_INPUT */ |
3076 | |
3077 | /** Immediately switch to a different input stream. |
3078 | * @param input_file A readable stream. |
3079 | * @param yyscanner The scanner object. |
3080 | * @note This function does not reset the start condition to @c INITIAL . |
3081 | */ |
3082 | void yyrestart (FILE * input_file , yyscan_t yyscanner) |
3083 | { |
3084 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3085 | |
3086 | if ( ! YY_CURRENT_BUFFER ){ |
3087 | yyensure_buffer_stack (yyscanner); |
3088 | YY_CURRENT_BUFFER_LVALUE = |
3089 | yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); |
3090 | } |
3091 | |
3092 | yy_init_buffer( YY_CURRENT_BUFFER, file: input_file , yyscanner); |
3093 | yy_load_buffer_state( yyscanner ); |
3094 | } |
3095 | |
3096 | /** Switch to a different input buffer. |
3097 | * @param new_buffer The new input buffer. |
3098 | * @param yyscanner The scanner object. |
3099 | */ |
3100 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
3101 | { |
3102 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3103 | |
3104 | /* TODO. We should be able to replace this entire function body |
3105 | * with |
3106 | * yypop_buffer_state(); |
3107 | * yypush_buffer_state(new_buffer); |
3108 | */ |
3109 | yyensure_buffer_stack (yyscanner); |
3110 | if ( YY_CURRENT_BUFFER == new_buffer ) |
3111 | return; |
3112 | |
3113 | if ( YY_CURRENT_BUFFER ) |
3114 | { |
3115 | /* Flush out information for old buffer. */ |
3116 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
3117 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
3118 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
3119 | } |
3120 | |
3121 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
3122 | yy_load_buffer_state( yyscanner ); |
3123 | |
3124 | /* We don't actually know whether we did this switch during |
3125 | * EOF (yywrap()) processing, but the only time this flag |
3126 | * is looked at is after yywrap() is called, so it's safe |
3127 | * to go ahead and always set it. |
3128 | */ |
3129 | yyg->yy_did_buffer_switch_on_eof = 1; |
3130 | } |
3131 | |
3132 | static void yy_load_buffer_state (yyscan_t yyscanner) |
3133 | { |
3134 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3135 | yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; |
3136 | yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; |
3137 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; |
3138 | yyg->yy_hold_char = *yyg->yy_c_buf_p; |
3139 | } |
3140 | |
3141 | /** Allocate and initialize an input buffer state. |
3142 | * @param file A readable stream. |
3143 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. |
3144 | * @param yyscanner The scanner object. |
3145 | * @return the allocated buffer state. |
3146 | */ |
3147 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) |
3148 | { |
3149 | YY_BUFFER_STATE b; |
3150 | |
3151 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
3152 | if ( ! b ) |
3153 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
3154 | |
3155 | b->yy_buf_size = size; |
3156 | |
3157 | /* yy_ch_buf has to be 2 characters longer than the size given because |
3158 | * we need to put in 2 end-of-buffer characters. |
3159 | */ |
3160 | b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); |
3161 | if ( ! b->yy_ch_buf ) |
3162 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
3163 | |
3164 | b->yy_is_our_buffer = 1; |
3165 | |
3166 | yy_init_buffer( b, file , yyscanner); |
3167 | |
3168 | return b; |
3169 | } |
3170 | |
3171 | /** Destroy the buffer. |
3172 | * @param b a buffer created with yy_create_buffer() |
3173 | * @param yyscanner The scanner object. |
3174 | */ |
3175 | void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
3176 | { |
3177 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3178 | |
3179 | if ( ! b ) |
3180 | return; |
3181 | |
3182 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ |
3183 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; |
3184 | |
3185 | if ( b->yy_is_our_buffer ) |
3186 | yyfree( (void *) b->yy_ch_buf , yyscanner ); |
3187 | |
3188 | yyfree( (void *) b , yyscanner ); |
3189 | } |
3190 | |
3191 | /* Initializes or reinitializes a buffer. |
3192 | * This function is sometimes called more than once on the same buffer, |
3193 | * such as during a yyrestart() or at EOF. |
3194 | */ |
3195 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) |
3196 | |
3197 | { |
3198 | int oerrno = errno; |
3199 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3200 | |
3201 | yy_flush_buffer( b , yyscanner); |
3202 | |
3203 | b->yy_input_file = file; |
3204 | b->yy_fill_buffer = 1; |
3205 | |
3206 | /* If b is the current buffer, then yy_init_buffer was _probably_ |
3207 | * called from yyrestart() or through yy_get_next_buffer. |
3208 | * In that case, we don't want to reset the lineno or column. |
3209 | */ |
3210 | if (b != YY_CURRENT_BUFFER){ |
3211 | b->yy_bs_lineno = 1; |
3212 | b->yy_bs_column = 0; |
3213 | } |
3214 | |
3215 | b->yy_is_interactive = 0; |
3216 | |
3217 | errno = oerrno; |
3218 | } |
3219 | |
3220 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. |
3221 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. |
3222 | * @param yyscanner The scanner object. |
3223 | */ |
3224 | void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) |
3225 | { |
3226 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3227 | if ( ! b ) |
3228 | return; |
3229 | |
3230 | b->yy_n_chars = 0; |
3231 | |
3232 | /* We always need two end-of-buffer characters. The first causes |
3233 | * a transition to the end-of-buffer state. The second causes |
3234 | * a jam in that state. |
3235 | */ |
3236 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
3237 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
3238 | |
3239 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
3240 | |
3241 | b->yy_at_bol = 1; |
3242 | b->yy_buffer_status = YY_BUFFER_NEW; |
3243 | |
3244 | if ( b == YY_CURRENT_BUFFER ) |
3245 | yy_load_buffer_state( yyscanner ); |
3246 | } |
3247 | |
3248 | /** Pushes the new state onto the stack. The new state becomes |
3249 | * the current state. This function will allocate the stack |
3250 | * if necessary. |
3251 | * @param new_buffer The new state. |
3252 | * @param yyscanner The scanner object. |
3253 | */ |
3254 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) |
3255 | { |
3256 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3257 | if (new_buffer == NULL) |
3258 | return; |
3259 | |
3260 | yyensure_buffer_stack(yyscanner); |
3261 | |
3262 | /* This block is copied from yy_switch_to_buffer. */ |
3263 | if ( YY_CURRENT_BUFFER ) |
3264 | { |
3265 | /* Flush out information for old buffer. */ |
3266 | *yyg->yy_c_buf_p = yyg->yy_hold_char; |
3267 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p; |
3268 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; |
3269 | } |
3270 | |
3271 | /* Only push if top exists. Otherwise, replace top. */ |
3272 | if (YY_CURRENT_BUFFER) |
3273 | yyg->yy_buffer_stack_top++; |
3274 | YY_CURRENT_BUFFER_LVALUE = new_buffer; |
3275 | |
3276 | /* copied from yy_switch_to_buffer. */ |
3277 | yy_load_buffer_state( yyscanner ); |
3278 | yyg->yy_did_buffer_switch_on_eof = 1; |
3279 | } |
3280 | |
3281 | /** Removes and deletes the top of the stack, if present. |
3282 | * The next element becomes the new top. |
3283 | * @param yyscanner The scanner object. |
3284 | */ |
3285 | void yypop_buffer_state (yyscan_t yyscanner) |
3286 | { |
3287 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3288 | if (!YY_CURRENT_BUFFER) |
3289 | return; |
3290 | |
3291 | yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); |
3292 | YY_CURRENT_BUFFER_LVALUE = NULL; |
3293 | if (yyg->yy_buffer_stack_top > 0) |
3294 | --yyg->yy_buffer_stack_top; |
3295 | |
3296 | if (YY_CURRENT_BUFFER) { |
3297 | yy_load_buffer_state( yyscanner ); |
3298 | yyg->yy_did_buffer_switch_on_eof = 1; |
3299 | } |
3300 | } |
3301 | |
3302 | /* Allocates the stack if it does not exist. |
3303 | * Guarantees space for at least one push. |
3304 | */ |
3305 | static void yyensure_buffer_stack (yyscan_t yyscanner) |
3306 | { |
3307 | yy_size_t num_to_alloc; |
3308 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3309 | |
3310 | if (!yyg->yy_buffer_stack) { |
3311 | |
3312 | /* First allocation is just for 2 elements, since we don't know if this |
3313 | * scanner will even need a stack. We use 2 instead of 1 to avoid an |
3314 | * immediate realloc on the next call. |
3315 | */ |
3316 | num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ |
3317 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc |
3318 | (num_to_alloc * sizeof(struct yy_buffer_state*) |
3319 | , yyscanner); |
3320 | if ( ! yyg->yy_buffer_stack ) |
3321 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
3322 | |
3323 | memset(s: yyg->yy_buffer_stack, c: 0, n: num_to_alloc * sizeof(struct yy_buffer_state*)); |
3324 | |
3325 | yyg->yy_buffer_stack_max = num_to_alloc; |
3326 | yyg->yy_buffer_stack_top = 0; |
3327 | return; |
3328 | } |
3329 | |
3330 | if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ |
3331 | |
3332 | /* Increase the buffer to prepare for a possible push. */ |
3333 | yy_size_t grow_size = 8 /* arbitrary grow size */; |
3334 | |
3335 | num_to_alloc = yyg->yy_buffer_stack_max + grow_size; |
3336 | yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc |
3337 | (yyg->yy_buffer_stack, |
3338 | num_to_alloc * sizeof(struct yy_buffer_state*) |
3339 | , yyscanner); |
3340 | if ( ! yyg->yy_buffer_stack ) |
3341 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); |
3342 | |
3343 | /* zero only the new slots.*/ |
3344 | memset(s: yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, c: 0, n: grow_size * sizeof(struct yy_buffer_state*)); |
3345 | yyg->yy_buffer_stack_max = num_to_alloc; |
3346 | } |
3347 | } |
3348 | |
3349 | /** Setup the input buffer state to scan directly from a user-specified character buffer. |
3350 | * @param base the character buffer |
3351 | * @param size the size in bytes of the character buffer |
3352 | * @param yyscanner The scanner object. |
3353 | * @return the newly allocated buffer state object. |
3354 | */ |
3355 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) |
3356 | { |
3357 | YY_BUFFER_STATE b; |
3358 | |
3359 | if ( size < 2 || |
3360 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
3361 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
3362 | /* They forgot to leave room for the EOB's. */ |
3363 | return NULL; |
3364 | |
3365 | b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); |
3366 | if ( ! b ) |
3367 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
3368 | |
3369 | b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ |
3370 | b->yy_buf_pos = b->yy_ch_buf = base; |
3371 | b->yy_is_our_buffer = 0; |
3372 | b->yy_input_file = NULL; |
3373 | b->yy_n_chars = b->yy_buf_size; |
3374 | b->yy_is_interactive = 0; |
3375 | b->yy_at_bol = 1; |
3376 | b->yy_fill_buffer = 0; |
3377 | b->yy_buffer_status = YY_BUFFER_NEW; |
3378 | |
3379 | yy_switch_to_buffer( new_buffer: b , yyscanner ); |
3380 | |
3381 | return b; |
3382 | } |
3383 | |
3384 | /** Setup the input buffer state to scan a string. The next call to yylex() will |
3385 | * scan from a @e copy of @a str. |
3386 | * @param yystr a NUL-terminated string to scan |
3387 | * @param yyscanner The scanner object. |
3388 | * @return the newly allocated buffer state object. |
3389 | * @note If you want to scan bytes that may contain NUL values, then use |
3390 | * yy_scan_bytes() instead. |
3391 | */ |
3392 | YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) |
3393 | { |
3394 | |
3395 | return yy_scan_bytes( bytes: yystr, len: (int) strlen(s: yystr) , yyscanner); |
3396 | } |
3397 | |
3398 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
3399 | * scan from a @e copy of @a bytes. |
3400 | * @param yybytes the byte buffer to scan |
3401 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
3402 | * @param yyscanner The scanner object. |
3403 | * @return the newly allocated buffer state object. |
3404 | */ |
3405 | YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) |
3406 | { |
3407 | YY_BUFFER_STATE b; |
3408 | char *buf; |
3409 | yy_size_t n; |
3410 | yy_size_t i; |
3411 | |
3412 | /* Get memory for full buffer, including space for trailing EOB's. */ |
3413 | n = (yy_size_t) (_yybytes_len + 2); |
3414 | buf = (char *) yyalloc( n , yyscanner ); |
3415 | if ( ! buf ) |
3416 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
3417 | |
3418 | for ( i = 0; i < _yybytes_len; ++i ) |
3419 | buf[i] = yybytes[i]; |
3420 | |
3421 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
3422 | |
3423 | b = yy_scan_buffer( base: buf, size: n , yyscanner); |
3424 | if ( ! b ) |
3425 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
3426 | |
3427 | /* It's okay to grow etc. this buffer, and we should throw it |
3428 | * away when we're done. |
3429 | */ |
3430 | b->yy_is_our_buffer = 1; |
3431 | |
3432 | return b; |
3433 | } |
3434 | |
3435 | #ifndef YY_EXIT_FAILURE |
3436 | #define YY_EXIT_FAILURE 2 |
3437 | #endif |
3438 | |
3439 | static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) |
3440 | { |
3441 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3442 | (void)yyg; |
3443 | //( stderr, "%s\n", msg ); |
3444 | throw std::runtime_error(msg); // YY_EXIT_FAILURE ); |
3445 | } |
3446 | |
3447 | /* Redefine yyless() so it works in section 3 code. */ |
3448 | |
3449 | #undef yyless |
3450 | #define yyless(n) \ |
3451 | do \ |
3452 | { \ |
3453 | /* Undo effects of setting up yytext. */ \ |
3454 | yy_size_t yyless_macro_arg = (n); \ |
3455 | YY_LESS_LINENO(yyless_macro_arg);\ |
3456 | yytext[yyleng] = yyg->yy_hold_char; \ |
3457 | yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ |
3458 | yyg->yy_hold_char = *yyg->yy_c_buf_p; \ |
3459 | *yyg->yy_c_buf_p = '\0'; \ |
3460 | yyleng = yyless_macro_arg; \ |
3461 | } \ |
3462 | while ( 0 ) |
3463 | |
3464 | /* Accessor methods (get/set functions) to struct members. */ |
3465 | |
3466 | /** Get the user-defined data for this scanner. |
3467 | * @param yyscanner The scanner object. |
3468 | */ |
3469 | YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) |
3470 | { |
3471 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3472 | return yyextra; |
3473 | } |
3474 | |
3475 | /** Get the current line number. |
3476 | * @param yyscanner The scanner object. |
3477 | */ |
3478 | int yyget_lineno (yyscan_t yyscanner) |
3479 | { |
3480 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3481 | |
3482 | if (! YY_CURRENT_BUFFER) |
3483 | return 0; |
3484 | |
3485 | return yylineno; |
3486 | } |
3487 | |
3488 | /** Get the current column number. |
3489 | * @param yyscanner The scanner object. |
3490 | */ |
3491 | int yyget_column (yyscan_t yyscanner) |
3492 | { |
3493 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3494 | |
3495 | if (! YY_CURRENT_BUFFER) |
3496 | return 0; |
3497 | |
3498 | return yycolumn; |
3499 | } |
3500 | |
3501 | /** Get the input stream. |
3502 | * @param yyscanner The scanner object. |
3503 | */ |
3504 | FILE *yyget_in (yyscan_t yyscanner) |
3505 | { |
3506 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3507 | return yyin; |
3508 | } |
3509 | |
3510 | /** Get the output stream. |
3511 | * @param yyscanner The scanner object. |
3512 | */ |
3513 | FILE *yyget_out (yyscan_t yyscanner) |
3514 | { |
3515 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3516 | return yyout; |
3517 | } |
3518 | |
3519 | /** Get the length of the current token. |
3520 | * @param yyscanner The scanner object. |
3521 | */ |
3522 | yy_size_t yyget_leng (yyscan_t yyscanner) |
3523 | { |
3524 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3525 | return yyleng; |
3526 | } |
3527 | |
3528 | /** Get the current token. |
3529 | * @param yyscanner The scanner object. |
3530 | */ |
3531 | |
3532 | char *yyget_text (yyscan_t yyscanner) |
3533 | { |
3534 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3535 | return yytext; |
3536 | } |
3537 | |
3538 | /** Set the user-defined data. This data is never touched by the scanner. |
3539 | * @param user_defined The data to be associated with this scanner. |
3540 | * @param yyscanner The scanner object. |
3541 | */ |
3542 | void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) |
3543 | { |
3544 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3545 | yyextra = user_defined ; |
3546 | } |
3547 | |
3548 | /** Set the current line number. |
3549 | * @param _line_number line number |
3550 | * @param yyscanner The scanner object. |
3551 | */ |
3552 | void yyset_lineno (int _line_number , yyscan_t yyscanner) |
3553 | { |
3554 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3555 | |
3556 | /* lineno is only valid if an input buffer exists. */ |
3557 | if (! YY_CURRENT_BUFFER ) |
3558 | YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); |
3559 | |
3560 | yylineno = _line_number; |
3561 | } |
3562 | |
3563 | /** Set the current column. |
3564 | * @param _column_no column number |
3565 | * @param yyscanner The scanner object. |
3566 | */ |
3567 | void yyset_column (int _column_no , yyscan_t yyscanner) |
3568 | { |
3569 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3570 | |
3571 | /* column is only valid if an input buffer exists. */ |
3572 | if (! YY_CURRENT_BUFFER ) |
3573 | YY_FATAL_ERROR( "yyset_column called with no buffer" ); |
3574 | |
3575 | yycolumn = _column_no; |
3576 | } |
3577 | |
3578 | /** Set the input stream. This does not discard the current |
3579 | * input buffer. |
3580 | * @param _in_str A readable stream. |
3581 | * @param yyscanner The scanner object. |
3582 | * @see yy_switch_to_buffer |
3583 | */ |
3584 | void yyset_in (FILE * _in_str , yyscan_t yyscanner) |
3585 | { |
3586 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3587 | yyin = _in_str ; |
3588 | } |
3589 | |
3590 | void yyset_out (FILE * _out_str , yyscan_t yyscanner) |
3591 | { |
3592 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3593 | yyout = _out_str ; |
3594 | } |
3595 | |
3596 | int yyget_debug (yyscan_t yyscanner) |
3597 | { |
3598 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3599 | return yy_flex_debug; |
3600 | } |
3601 | |
3602 | void yyset_debug (int _bdebug , yyscan_t yyscanner) |
3603 | { |
3604 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3605 | yy_flex_debug = _bdebug ; |
3606 | } |
3607 | |
3608 | /* Accessor methods for yylval and yylloc */ |
3609 | |
3610 | YYSTYPE * yyget_lval (yyscan_t yyscanner) |
3611 | { |
3612 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3613 | return yylval; |
3614 | } |
3615 | |
3616 | void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) |
3617 | { |
3618 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3619 | yylval = yylval_param; |
3620 | } |
3621 | |
3622 | YYLTYPE *yyget_lloc (yyscan_t yyscanner) |
3623 | { |
3624 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3625 | return yylloc; |
3626 | } |
3627 | |
3628 | void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) |
3629 | { |
3630 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3631 | yylloc = yylloc_param; |
3632 | } |
3633 | |
3634 | /* User-visible API */ |
3635 | |
3636 | /* yylex_init is special because it creates the scanner itself, so it is |
3637 | * the ONLY reentrant function that doesn't take the scanner as the last argument. |
3638 | * That's why we explicitly handle the declaration, instead of using our macros. |
3639 | */ |
3640 | int yylex_init(yyscan_t* ptr_yy_globals) |
3641 | { |
3642 | if (ptr_yy_globals == NULL){ |
3643 | errno = EINVAL; |
3644 | return 1; |
3645 | } |
3646 | |
3647 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); |
3648 | |
3649 | if (*ptr_yy_globals == NULL){ |
3650 | errno = ENOMEM; |
3651 | return 1; |
3652 | } |
3653 | |
3654 | /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ |
3655 | memset(s: *ptr_yy_globals,c: 0x00,n: sizeof(struct yyguts_t)); |
3656 | |
3657 | return yy_init_globals ( yyscanner: *ptr_yy_globals ); |
3658 | } |
3659 | |
3660 | /* yylex_init_extra has the same functionality as yylex_init, but follows the |
3661 | * convention of taking the scanner as the last argument. Note however, that |
3662 | * this is a *pointer* to a scanner, as it will be allocated by this call (and |
3663 | * is the reason, too, why this function also must handle its own declaration). |
3664 | * The user defined value in the first argument will be available to yyalloc in |
3665 | * the yyextra field. |
3666 | */ |
3667 | int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) |
3668 | { |
3669 | struct yyguts_t dummy_yyguts; |
3670 | |
3671 | yyset_extra (user_defined: yy_user_defined, yyscanner: &dummy_yyguts); |
3672 | |
3673 | if (ptr_yy_globals == NULL){ |
3674 | errno = EINVAL; |
3675 | return 1; |
3676 | } |
3677 | |
3678 | *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), yyscanner: &dummy_yyguts ); |
3679 | |
3680 | if (*ptr_yy_globals == NULL){ |
3681 | errno = ENOMEM; |
3682 | return 1; |
3683 | } |
3684 | |
3685 | /* By setting to 0xAA, we expose bugs in |
3686 | yy_init_globals. Leave at 0x00 for releases. */ |
3687 | memset(s: *ptr_yy_globals,c: 0x00,n: sizeof(struct yyguts_t)); |
3688 | |
3689 | yyset_extra (user_defined: yy_user_defined, yyscanner: *ptr_yy_globals); |
3690 | |
3691 | return yy_init_globals ( yyscanner: *ptr_yy_globals ); |
3692 | } |
3693 | |
3694 | static int yy_init_globals (yyscan_t yyscanner) |
3695 | { |
3696 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3697 | /* Initialization is the same as for the non-reentrant scanner. |
3698 | * This function is called from yylex_destroy(), so don't allocate here. |
3699 | */ |
3700 | |
3701 | yyg->yy_buffer_stack = NULL; |
3702 | yyg->yy_buffer_stack_top = 0; |
3703 | yyg->yy_buffer_stack_max = 0; |
3704 | yyg->yy_c_buf_p = NULL; |
3705 | yyg->yy_init = 0; |
3706 | yyg->yy_start = 0; |
3707 | |
3708 | yyg->yy_start_stack_ptr = 0; |
3709 | yyg->yy_start_stack_depth = 0; |
3710 | yyg->yy_start_stack = NULL; |
3711 | |
3712 | /* Defined in main.c */ |
3713 | #ifdef YY_STDINIT |
3714 | yyin = stdin; |
3715 | yyout = stdout; |
3716 | #else |
3717 | yyin = NULL; |
3718 | yyout = NULL; |
3719 | #endif |
3720 | |
3721 | /* For future reference: Set errno on error, since we are called by |
3722 | * yylex_init() |
3723 | */ |
3724 | return 0; |
3725 | } |
3726 | |
3727 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ |
3728 | int yylex_destroy (yyscan_t yyscanner) |
3729 | { |
3730 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3731 | |
3732 | /* Pop the buffer stack, destroying each element. */ |
3733 | while(YY_CURRENT_BUFFER){ |
3734 | yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); |
3735 | YY_CURRENT_BUFFER_LVALUE = NULL; |
3736 | yypop_buffer_state(yyscanner); |
3737 | } |
3738 | |
3739 | /* Destroy the stack itself. */ |
3740 | yyfree(yyg->yy_buffer_stack , yyscanner); |
3741 | yyg->yy_buffer_stack = NULL; |
3742 | |
3743 | /* Destroy the start condition stack. */ |
3744 | yyfree( yyg->yy_start_stack , yyscanner ); |
3745 | yyg->yy_start_stack = NULL; |
3746 | |
3747 | /* Reset the globals. This is important in a non-reentrant scanner so the next time |
3748 | * yylex() is called, initialization will occur. */ |
3749 | yy_init_globals( yyscanner); |
3750 | |
3751 | /* Destroy the main struct (reentrant only). */ |
3752 | yyfree ( yyscanner , yyscanner ); |
3753 | yyscanner = NULL; |
3754 | return 0; |
3755 | } |
3756 | |
3757 | /* |
3758 | * Internal utility routines. |
3759 | */ |
3760 | |
3761 | #ifndef yytext_ptr |
3762 | static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) |
3763 | { |
3764 | struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; |
3765 | (void)yyg; |
3766 | |
3767 | int i; |
3768 | for ( i = 0; i < n; ++i ) |
3769 | s1[i] = s2[i]; |
3770 | } |
3771 | #endif |
3772 | |
3773 | #ifdef YY_NEED_STRLEN |
3774 | static int yy_flex_strlen (const char * s , yyscan_t yyscanner) |
3775 | { |
3776 | int n; |
3777 | for ( n = 0; s[n]; ++n ) |
3778 | ; |
3779 | |
3780 | return n; |
3781 | } |
3782 | #endif |
3783 | |
3784 | #define YYTABLES_NAME "yytables" |
3785 | |
3786 | #line 1089 "third_party/libpg_query/scan.l" |
3787 | |
3788 | |
3789 | /* LCOV_EXCL_STOP */ |
3790 | |
3791 | /* |
3792 | * Arrange access to yyextra for subroutines of the main yylex() function. |
3793 | * We expect each subroutine to have a yyscanner parameter. Rather than |
3794 | * use the yyget_xxx functions, which might or might not get inlined by the |
3795 | * compiler, we cheat just a bit and cast yyscanner to the right type. |
3796 | */ |
3797 | #undef yyextra |
3798 | #define (((struct yyguts_t *) yyscanner)->yyextra_r) |
3799 | |
3800 | /* Likewise for a couple of other things we need. */ |
3801 | #undef yylloc |
3802 | #define yylloc (((struct yyguts_t *) yyscanner)->yylloc_r) |
3803 | #undef yyleng |
3804 | #define yyleng (((struct yyguts_t *) yyscanner)->yyleng_r) |
3805 | |
3806 | |
3807 | /* |
3808 | * scanner_errposition |
3809 | * Report a lexer or grammar error cursor position, if possible. |
3810 | * |
3811 | * This is expected to be used within an ereport() call. The return value |
3812 | * is a dummy (always 0, in fact). |
3813 | * |
3814 | * Note that this can only be used for messages emitted during raw parsing |
3815 | * (essentially, scan.l and gram.y), since it requires the yyscanner struct |
3816 | * to still be available. |
3817 | */ |
3818 | int |
3819 | scanner_errposition(int location, core_yyscan_t yyscanner) |
3820 | { |
3821 | int pos; |
3822 | |
3823 | if (location < 0) |
3824 | return 0; /* no-op if location is unknown */ |
3825 | |
3826 | /* Convert byte offset to character number */ |
3827 | pos = pg_mbstrlen_with_len(yyextra->scanbuf, len: location) + 1; |
3828 | /* And pass it to the ereport mechanism */ |
3829 | return errposition(cursorpos: pos); |
3830 | } |
3831 | |
3832 | /* |
3833 | * scanner_yyerror |
3834 | * Report a lexer or grammar error. |
3835 | * |
3836 | * The message's cursor position is whatever YYLLOC was last set to, |
3837 | * ie, the start of the current token if called within yylex(), or the |
3838 | * most recently lexed token if called from the grammar. |
3839 | * This is OK for syntax error messages from the Bison parser, because Bison |
3840 | * parsers report error as soon as the first unparsable token is reached. |
3841 | * Beware of using yyerror for other purposes, as the cursor position might |
3842 | * be misleading! |
3843 | */ |
3844 | void |
3845 | scanner_yyerror(const char *message, core_yyscan_t yyscanner) |
3846 | { |
3847 | const char *loc = yyextra->scanbuf + *yylloc; |
3848 | |
3849 | if (*loc == YY_END_OF_BUFFER_CHAR) |
3850 | { |
3851 | ereport(code: ERROR, |
3852 | (errcode(sqlerrcode: PG_ERRCODE_SYNTAX_ERROR), |
3853 | /* translator: %s is typically the translation of "syntax error" */ |
3854 | errmsg(fmt: "%s at end of input" , _(message)), |
3855 | lexer_errposition())); |
3856 | } |
3857 | else |
3858 | { |
3859 | ereport(code: ERROR, |
3860 | (errcode(sqlerrcode: PG_ERRCODE_SYNTAX_ERROR), |
3861 | /* translator: first %s is typically the translation of "syntax error" */ |
3862 | errmsg(fmt: "%s at or near \"%s\"" , _(message), loc), |
3863 | lexer_errposition())); |
3864 | } |
3865 | } |
3866 | |
3867 | |
3868 | /* |
3869 | * Called before any actual parsing is done |
3870 | */ |
3871 | core_yyscan_t |
3872 | (const char *str, |
3873 | core_yy_extra_type *yyext, |
3874 | const PGScanKeyword *keywords, |
3875 | int num_keywords) |
3876 | { |
3877 | PGSize slen = strlen(s: str); |
3878 | yyscan_t scanner; |
3879 | |
3880 | if (yylex_init(ptr_yy_globals: &scanner) != 0) |
3881 | elog(code: ERROR, fmt: "yylex_init() failed: %m" ); |
3882 | |
3883 | core_yyset_extra(user_defined: yyext, yyscanner: scanner); |
3884 | |
3885 | yyext->keywords = keywords; |
3886 | yyext->num_keywords = num_keywords; |
3887 | |
3888 | yyext->backslash_quote = backslash_quote; |
3889 | yyext->escape_string_warning = escape_string_warning; |
3890 | yyext->standard_conforming_strings = standard_conforming_strings; |
3891 | |
3892 | /* |
3893 | * Make a scan buffer with special termination needed by flex. |
3894 | */ |
3895 | yyext->scanbuf = (char *) palloc(n: slen + 2); |
3896 | yyext->scanbuflen = slen; |
3897 | memcpy(dest: yyext->scanbuf, src: str, n: slen); |
3898 | yyext->scanbuf[slen] = yyext->scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR; |
3899 | yy_scan_buffer(base: yyext->scanbuf, size: slen + 2, yyscanner: scanner); |
3900 | |
3901 | /* initialize literal buffer to a reasonable but expansible size */ |
3902 | yyext->literalalloc = 1024; |
3903 | yyext->literalbuf = (char *) palloc(n: yyext->literalalloc); |
3904 | yyext->literallen = 0; |
3905 | |
3906 | return scanner; |
3907 | } |
3908 | |
3909 | |
3910 | /* |
3911 | * Called after parsing is done to clean up after scanner_init() |
3912 | */ |
3913 | void |
3914 | scanner_finish(core_yyscan_t yyscanner) |
3915 | { |
3916 | /* |
3917 | * We don't bother to call yylex_destroy(), because all it would do is |
3918 | * pfree a small amount of control storage. It's cheaper to leak the |
3919 | * storage until the parsing context is destroyed. The amount of space |
3920 | * involved is usually negligible compared to the output parse tree |
3921 | * anyway. |
3922 | * |
3923 | * We do bother to pfree the scanbuf and literal buffer, but only if they |
3924 | * represent a nontrivial amount of space. The 8K cutoff is arbitrary. |
3925 | */ |
3926 | if (yyextra->scanbuflen >= 8192) |
3927 | pfree(yyextra->scanbuf); |
3928 | if (yyextra->literalalloc >= 8192) |
3929 | pfree(yyextra->literalbuf); |
3930 | } |
3931 | |
3932 | |
3933 | static void |
3934 | addlit(char *ytext, int yleng, core_yyscan_t yyscanner) |
3935 | { |
3936 | /* enlarge buffer if needed */ |
3937 | if ((yyextra->literallen + yleng) >= yyextra->literalalloc) |
3938 | { |
3939 | do |
3940 | { |
3941 | yyextra->literalalloc *= 2; |
3942 | } while ((yyextra->literallen + yleng) >= yyextra->literalalloc); |
3943 | yyextra->literalbuf = (char *) repalloc(yyextra->literalbuf, |
3944 | yyextra->literalalloc); |
3945 | } |
3946 | /* append new data */ |
3947 | memcpy(yyextra->literalbuf + yyextra->literallen, src: ytext, n: yleng); |
3948 | yyextra->literallen += yleng; |
3949 | } |
3950 | |
3951 | |
3952 | static void |
3953 | addlitchar(unsigned char ychar, core_yyscan_t yyscanner) |
3954 | { |
3955 | /* enlarge buffer if needed */ |
3956 | if ((yyextra->literallen + 1) >= yyextra->literalalloc) |
3957 | { |
3958 | yyextra->literalalloc *= 2; |
3959 | yyextra->literalbuf = (char *) repalloc(yyextra->literalbuf, |
3960 | yyextra->literalalloc); |
3961 | } |
3962 | /* append new data */ |
3963 | yyextra->literalbuf[yyextra->literallen] = ychar; |
3964 | yyextra->literallen += 1; |
3965 | } |
3966 | |
3967 | |
3968 | /* |
3969 | * Create a palloc'd copy of literalbuf, adding a trailing null. |
3970 | */ |
3971 | static char * |
3972 | litbufdup(core_yyscan_t yyscanner) |
3973 | { |
3974 | int llen = yyextra->literallen; |
3975 | char *newbuf; |
3976 | |
3977 | newbuf = (char*) palloc(n: llen + 1); |
3978 | memcpy(dest: newbuf, yyextra->literalbuf, n: llen); |
3979 | newbuf[llen] = '\0'; |
3980 | return newbuf; |
3981 | } |
3982 | |
3983 | static int |
3984 | process_integer_literal(const char *token, YYSTYPE *lval) |
3985 | { |
3986 | long val; |
3987 | char *endptr; |
3988 | |
3989 | errno = 0; |
3990 | val = strtol(nptr: token, endptr: &endptr, base: 10); |
3991 | if (*endptr != '\0' || errno == ERANGE |
3992 | /* if long > 32 bits, check for overflow of int4_t */ |
3993 | || val != (long) ((int32_t) val) ) |
3994 | { |
3995 | /* integer too large, treat it as a float */ |
3996 | lval->str = pstrdup(in: token); |
3997 | return FCONST; |
3998 | } |
3999 | lval->ival = val; |
4000 | return ICONST; |
4001 | } |
4002 | |
4003 | static unsigned int |
4004 | hexval(unsigned char c) |
4005 | { |
4006 | if (c >= '0' && c <= '9') |
4007 | return c - '0'; |
4008 | if (c >= 'a' && c <= 'f') |
4009 | return c - 'a' + 0xA; |
4010 | if (c >= 'A' && c <= 'F') |
4011 | return c - 'A' + 0xA; |
4012 | elog(code: ERROR, fmt: "invalid hexadecimal digit" ); |
4013 | return 0; /* not reached */ |
4014 | } |
4015 | |
4016 | static void |
4017 | check_unicode_value(pg_wchar c, char *loc, core_yyscan_t yyscanner) |
4018 | { |
4019 | // database encoding is always UTF8 |
4020 | // if (GetDatabaseEncoding() == PG_UTF8) |
4021 | // return; |
4022 | |
4023 | // if (c > 0x7F) |
4024 | // { |
4025 | // ADVANCE_YYLLOC(loc - yyextra->literalbuf + 3); /* 3 for U&" */ |
4026 | // yyerror("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8"); |
4027 | // } |
4028 | } |
4029 | |
4030 | static bool |
4031 | is_utf16_surrogate_first(pg_wchar c) |
4032 | { |
4033 | return (c >= 0xD800 && c <= 0xDBFF); |
4034 | } |
4035 | |
4036 | static bool |
4037 | is_utf16_surrogate_second(pg_wchar c) |
4038 | { |
4039 | return (c >= 0xDC00 && c <= 0xDFFF); |
4040 | } |
4041 | |
4042 | static pg_wchar |
4043 | surrogate_pair_to_codepoint(pg_wchar first, pg_wchar second) |
4044 | { |
4045 | return ((first & 0x3FF) << 10) + 0x10000 + (second & 0x3FF); |
4046 | } |
4047 | |
4048 | static void |
4049 | addunicode(pg_wchar c, core_yyscan_t yyscanner) |
4050 | { |
4051 | char buf[8]; |
4052 | |
4053 | if (c == 0 || c > 0x10FFFF) |
4054 | yyerror("invalid Unicode escape value" ); |
4055 | if (c > 0x7F) |
4056 | { |
4057 | // if (GetDatabaseEncoding() != PG_UTF8) |
4058 | // yyerror("Unicode escape values cannot be used for code point values above 007F when the server encoding is not UTF8"); |
4059 | yyextra->saw_non_ascii = true; |
4060 | } |
4061 | unicode_to_utf8(c, utf8string: (unsigned char *) buf); |
4062 | addlit(ytext: buf, yleng: pg_mblen(mbstr: buf), yyscanner); |
4063 | } |
4064 | |
4065 | /* is 'escape' acceptable as Unicode escape character (UESCAPE syntax) ? */ |
4066 | static bool |
4067 | check_uescapechar(unsigned char escape) |
4068 | { |
4069 | if (isxdigit(c: escape) |
4070 | || escape == '+' |
4071 | || escape == '\'' |
4072 | || escape == '"' |
4073 | || scanner_isspace(ch: escape)) |
4074 | { |
4075 | return false; |
4076 | } |
4077 | else |
4078 | return true; |
4079 | } |
4080 | |
4081 | /* like litbufdup, but handle unicode escapes */ |
4082 | static char * |
4083 | litbuf_udeescape(unsigned char escape, core_yyscan_t yyscanner) |
4084 | { |
4085 | char *newbuf; |
4086 | char *litbuf, |
4087 | *in, |
4088 | *out; |
4089 | pg_wchar pair_first = 0; |
4090 | |
4091 | /* Make literalbuf null-terminated to simplify the scanning loop */ |
4092 | litbuf = yyextra->literalbuf; |
4093 | litbuf[yyextra->literallen] = '\0'; |
4094 | |
4095 | /* |
4096 | * This relies on the subtle assumption that a UTF-8 expansion cannot be |
4097 | * longer than its escaped representation. |
4098 | */ |
4099 | newbuf = (char*) palloc(yyextra->literallen + 1); |
4100 | |
4101 | in = litbuf; |
4102 | out = newbuf; |
4103 | while (*in) |
4104 | { |
4105 | if (in[0] == escape) |
4106 | { |
4107 | if (in[1] == escape) |
4108 | { |
4109 | if (pair_first) |
4110 | { |
4111 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4112 | yyerror("invalid Unicode surrogate pair" ); |
4113 | } |
4114 | *out++ = escape; |
4115 | in += 2; |
4116 | } |
4117 | else if (isxdigit(c: (unsigned char) in[1]) && |
4118 | isxdigit(c: (unsigned char) in[2]) && |
4119 | isxdigit(c: (unsigned char) in[3]) && |
4120 | isxdigit(c: (unsigned char) in[4])) |
4121 | { |
4122 | pg_wchar unicode; |
4123 | |
4124 | unicode = (hexval(c: in[1]) << 12) + |
4125 | (hexval(c: in[2]) << 8) + |
4126 | (hexval(c: in[3]) << 4) + |
4127 | hexval(c: in[4]); |
4128 | check_unicode_value(c: unicode, loc: in, yyscanner); |
4129 | if (pair_first) |
4130 | { |
4131 | if (is_utf16_surrogate_second(c: unicode)) |
4132 | { |
4133 | unicode = surrogate_pair_to_codepoint(first: pair_first, second: unicode); |
4134 | pair_first = 0; |
4135 | } |
4136 | else |
4137 | { |
4138 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4139 | yyerror("invalid Unicode surrogate pair" ); |
4140 | } |
4141 | } |
4142 | else if (is_utf16_surrogate_second(c: unicode)) |
4143 | yyerror("invalid Unicode surrogate pair" ); |
4144 | |
4145 | if (is_utf16_surrogate_first(c: unicode)) |
4146 | pair_first = unicode; |
4147 | else |
4148 | { |
4149 | unicode_to_utf8(c: unicode, utf8string: (unsigned char *) out); |
4150 | out += pg_mblen(mbstr: out); |
4151 | } |
4152 | in += 5; |
4153 | } |
4154 | else if (in[1] == '+' && |
4155 | isxdigit(c: (unsigned char) in[2]) && |
4156 | isxdigit(c: (unsigned char) in[3]) && |
4157 | isxdigit(c: (unsigned char) in[4]) && |
4158 | isxdigit(c: (unsigned char) in[5]) && |
4159 | isxdigit(c: (unsigned char) in[6]) && |
4160 | isxdigit(c: (unsigned char) in[7])) |
4161 | { |
4162 | pg_wchar unicode; |
4163 | |
4164 | unicode = (hexval(c: in[2]) << 20) + |
4165 | (hexval(c: in[3]) << 16) + |
4166 | (hexval(c: in[4]) << 12) + |
4167 | (hexval(c: in[5]) << 8) + |
4168 | (hexval(c: in[6]) << 4) + |
4169 | hexval(c: in[7]); |
4170 | check_unicode_value(c: unicode, loc: in, yyscanner); |
4171 | if (pair_first) |
4172 | { |
4173 | if (is_utf16_surrogate_second(c: unicode)) |
4174 | { |
4175 | unicode = surrogate_pair_to_codepoint(first: pair_first, second: unicode); |
4176 | pair_first = 0; |
4177 | } |
4178 | else |
4179 | { |
4180 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4181 | yyerror("invalid Unicode surrogate pair" ); |
4182 | } |
4183 | } |
4184 | else if (is_utf16_surrogate_second(c: unicode)) |
4185 | yyerror("invalid Unicode surrogate pair" ); |
4186 | |
4187 | if (is_utf16_surrogate_first(c: unicode)) |
4188 | pair_first = unicode; |
4189 | else |
4190 | { |
4191 | unicode_to_utf8(c: unicode, utf8string: (unsigned char *) out); |
4192 | out += pg_mblen(mbstr: out); |
4193 | } |
4194 | in += 8; |
4195 | } |
4196 | else |
4197 | { |
4198 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4199 | yyerror("invalid Unicode escape value" ); |
4200 | } |
4201 | } |
4202 | else |
4203 | { |
4204 | if (pair_first) |
4205 | { |
4206 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4207 | yyerror("invalid Unicode surrogate pair" ); |
4208 | } |
4209 | *out++ = *in++; |
4210 | } |
4211 | } |
4212 | |
4213 | /* unfinished surrogate pair? */ |
4214 | if (pair_first) |
4215 | { |
4216 | ADVANCE_YYLLOC(in - litbuf + 3); /* 3 for U&" */ |
4217 | yyerror("invalid Unicode surrogate pair" ); |
4218 | } |
4219 | |
4220 | *out = '\0'; |
4221 | |
4222 | /* |
4223 | * We could skip pg_verifymbstr if we didn't process any non-7-bit-ASCII |
4224 | * codes; but it's probably not worth the trouble, since this isn't likely |
4225 | * to be a performance-critical path. |
4226 | */ |
4227 | pg_verifymbstr(mbstr: newbuf, len: out - newbuf, noError: false); |
4228 | return newbuf; |
4229 | } |
4230 | |
4231 | static unsigned char |
4232 | unescape_single_char(unsigned char c, core_yyscan_t yyscanner) |
4233 | { |
4234 | switch (c) |
4235 | { |
4236 | case 'b': |
4237 | return '\b'; |
4238 | case 'f': |
4239 | return '\f'; |
4240 | case 'n': |
4241 | return '\n'; |
4242 | case 'r': |
4243 | return '\r'; |
4244 | case 't': |
4245 | return '\t'; |
4246 | default: |
4247 | /* check for backslash followed by non-7-bit-ASCII */ |
4248 | if (c == '\0' || IS_HIGHBIT_SET(c)) |
4249 | yyextra->saw_non_ascii = true; |
4250 | |
4251 | return c; |
4252 | } |
4253 | } |
4254 | |
4255 | static void |
4256 | check_string_escape_warning(unsigned char ychar, core_yyscan_t yyscanner) |
4257 | { |
4258 | if (ychar == '\'') |
4259 | { |
4260 | if (yyextra->warn_on_first_escape && yyextra->escape_string_warning) |
4261 | ereport(code: PGWARNING, |
4262 | (errcode(sqlerrcode: PG_ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER), |
4263 | errmsg(fmt: "nonstandard use of \\' in a string literal" ), |
4264 | errhint(msg: "Use '' to write quotes in strings, or use the escape string syntax (E'...')." ), |
4265 | lexer_errposition())); |
4266 | yyextra->warn_on_first_escape = false; /* warn only once per string */ |
4267 | } |
4268 | else if (ychar == '\\') |
4269 | { |
4270 | if (yyextra->warn_on_first_escape && yyextra->escape_string_warning) |
4271 | ereport(code: PGWARNING, |
4272 | (errcode(sqlerrcode: PG_ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER), |
4273 | errmsg(fmt: "nonstandard use of \\\\ in a string literal" ), |
4274 | errhint(msg: "Use the escape string syntax for backslashes, e.g., E'\\\\'." ), |
4275 | lexer_errposition())); |
4276 | yyextra->warn_on_first_escape = false; /* warn only once per string */ |
4277 | } |
4278 | else |
4279 | check_escape_warning(yyscanner); |
4280 | } |
4281 | |
4282 | static void |
4283 | check_escape_warning(core_yyscan_t yyscanner) |
4284 | { |
4285 | if (yyextra->warn_on_first_escape && yyextra->escape_string_warning) |
4286 | ereport(code: PGWARNING, |
4287 | (errcode(sqlerrcode: PG_ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER), |
4288 | errmsg(fmt: "nonstandard use of escape in a string literal" ), |
4289 | errhint(msg: "Use the escape string syntax for escapes, e.g., E'\\r\\n'." ), |
4290 | lexer_errposition())); |
4291 | yyextra->warn_on_first_escape = false; /* warn only once per string */ |
4292 | } |
4293 | |
4294 | /* |
4295 | * Interface functions to make flex use palloc() instead of malloc(). |
4296 | * It'd be better to make these static, but flex insists otherwise. |
4297 | */ |
4298 | |
4299 | void * |
4300 | core_yyalloc(yy_size_t bytes, core_yyscan_t yyscanner) |
4301 | { |
4302 | return palloc(n: bytes); |
4303 | } |
4304 | |
4305 | void * |
4306 | core_yyrealloc(void *ptr, yy_size_t bytes, core_yyscan_t yyscanner) |
4307 | { |
4308 | if (ptr) |
4309 | return repalloc(ptr, n: bytes); |
4310 | else |
4311 | return palloc(n: bytes); |
4312 | } |
4313 | |
4314 | void |
4315 | core_yyfree(void *ptr, core_yyscan_t yyscanner) |
4316 | { |
4317 | if (ptr) |
4318 | pfree(ptr); |
4319 | } |
4320 | |
4321 | #undef yyerror |
4322 | #undef yylloc |
4323 | #undef yylval |
4324 | #undef yyin |
4325 | #undef yyout |
4326 | #undef yyextra |
4327 | #undef yyleng |
4328 | #undef yytext |
4329 | #undef yylineno |
4330 | #undef yycolumn |
4331 | #undef yy_flex_debug |
4332 | #undef yyless |
4333 | #undef YYSTYPE |
4334 | #undef YY_EXTRA_TYPE |
4335 | #undef SET_YYLLOC |
4336 | #undef ADVANCE_YYLLOC |
4337 | #undef BEGIN |
4338 | #undef REJECT |
4339 | #undef INITIAL |
4340 | #undef xb |
4341 | #undef xc |
4342 | #undef xd |
4343 | #undef xh |
4344 | #undef xe |
4345 | #undef xq |
4346 | #undef xdolq |
4347 | #undef xui |
4348 | #undef xuiend |
4349 | #undef xus |
4350 | #undef xusend |
4351 | #undef xeu |
4352 | #undef ECHO |
4353 | |
4354 | |
4355 | } /* duckdb_libpgquery */ |
4356 | |