4
#line 2 "pgscript/lex.pgs.cc"
6
#line 4 "pgscript/lex.pgs.cc"
8
#define YY_INT_ALIGNED short int
10
/* A lexical scanner generated by flex */
13
#define YY_FLEX_MAJOR_VERSION 2
14
#define YY_FLEX_MINOR_VERSION 5
15
#define YY_FLEX_SUBMINOR_VERSION 33
16
#if YY_FLEX_SUBMINOR_VERSION > 0
20
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
21
* following macro. This is required in order to pass the c++-multiple-scanners
22
* test in the regression suite. We get reports that it breaks inheritance.
23
* We will address this in a future release of flex, or omit the C++ scanner
26
#define yyFlexLexer pgsFlexLexer
28
/* First, we deal with platform-specific or compiler-specific issues. */
30
/* begin standard C headers. */
32
/* end standard C headers. */
34
/* flex integer type definitions */
39
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
41
#if __STDC_VERSION__ >= 199901L
43
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
44
* if you want the limit (max/min) macros for int types.
46
#ifndef __STDC_LIMIT_MACROS
47
#define __STDC_LIMIT_MACROS 1
51
typedef int8_t flex_int8_t;
52
typedef uint8_t flex_uint8_t;
53
typedef int16_t flex_int16_t;
54
typedef uint16_t flex_uint16_t;
55
typedef int32_t flex_int32_t;
56
typedef uint32_t flex_uint32_t;
58
typedef signed char flex_int8_t;
59
typedef short int flex_int16_t;
60
typedef int flex_int32_t;
61
typedef unsigned char flex_uint8_t;
62
typedef unsigned short int flex_uint16_t;
63
typedef unsigned int flex_uint32_t;
66
/* Limits of integral types. */
68
#define INT8_MIN (-128)
71
#define INT16_MIN (-32767-1)
74
#define INT32_MIN (-2147483647-1)
77
#define INT8_MAX (127)
80
#define INT16_MAX (32767)
83
#define INT32_MAX (2147483647)
86
#define UINT8_MAX (255U)
89
#define UINT16_MAX (65535U)
92
#define UINT32_MAX (4294967295U)
95
#endif /* ! FLEXINT_H */
97
/* begin standard C++ headers. */
102
/* end standard C++ headers. */
106
/* The "const" storage-class-modifier is valid. */
109
#else /* ! __cplusplus */
115
#endif /* __STDC__ */
116
#endif /* ! __cplusplus */
119
#define yyconst const
124
/* Returned upon end-of-file. */
127
/* Promotes a possibly negative, possibly signed char to an unsigned
128
* integer for use as an array index. If the signed char is negative,
129
* we want to instead treat it as an 8-bit unsigned char, hence the
132
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
134
/* Enter a start condition. This macro really ought to take a parameter,
135
* but we do it the disgusting crufty way forced on us by the ()-less
136
* definition of BEGIN.
138
#define BEGIN (yy_start) = 1 + 2 *
140
/* Translate the current start state into a value that can be later handed
141
* to BEGIN to return to the state. The YYSTATE alias is for lex
144
#define YY_START (((yy_start) - 1) / 2)
145
#define YYSTATE YY_START
147
/* Action number for EOF rule of a given start state. */
148
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
150
/* Special action meaning "start processing a new file". */
151
#define YY_NEW_FILE yyrestart( yyin )
153
#define YY_END_OF_BUFFER_CHAR 0
155
/* Size of default input buffer. */
157
#define YY_BUF_SIZE 16384
160
/* The state buf must be large enough to hold one state per character in the main buffer.
162
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
164
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
165
#define YY_TYPEDEF_YY_BUFFER_STATE
166
typedef struct yy_buffer_state *YY_BUFFER_STATE;
171
#define EOB_ACT_CONTINUE_SCAN 0
172
#define EOB_ACT_END_OF_FILE 1
173
#define EOB_ACT_LAST_MATCH 2
175
#define YY_LESS_LINENO(n)
177
/* Return all but the first "n" matched characters back to the input stream. */
181
/* Undo effects of setting up yytext. */ \
182
int yyless_macro_arg = (n); \
183
YY_LESS_LINENO(yyless_macro_arg);\
184
*yy_cp = (yy_hold_char); \
185
YY_RESTORE_YY_MORE_OFFSET \
186
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
187
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
191
#define unput(c) yyunput( c, (yytext_ptr) )
193
/* The following is because we cannot portably get our hands on size_t
194
* (without autoconf's help, which isn't available because we want
195
* flex-generated scanners to compile on their own).
198
#ifndef YY_TYPEDEF_YY_SIZE_T
199
#define YY_TYPEDEF_YY_SIZE_T
200
typedef unsigned int yy_size_t;
203
#ifndef YY_STRUCT_YY_BUFFER_STATE
204
#define YY_STRUCT_YY_BUFFER_STATE
205
struct yy_buffer_state
208
std::istream* yy_input_file;
210
char *yy_ch_buf; /* input buffer */
211
char *yy_buf_pos; /* current position in input buffer */
213
/* Size of input buffer in bytes, not including room for EOB
216
yy_size_t yy_buf_size;
218
/* Number of characters read into yy_ch_buf, not including EOB
223
/* Whether we "own" the buffer - i.e., we know we created it,
224
* and can realloc() it to grow it, and should free() it to
227
int yy_is_our_buffer;
229
/* Whether this is an "interactive" input source; if so, and
230
* if we're using stdio for input, then we want to use getc()
231
* instead of fread(), to make sure we stop fetching input after
234
int yy_is_interactive;
236
/* Whether we're considered to be at the beginning of a line.
237
* If so, '^' rules will be active on the next match, otherwise
242
int yy_bs_lineno; /**< The line count. */
243
int yy_bs_column; /**< The column count. */
245
/* Whether to try to fill the input buffer when we reach the
250
int yy_buffer_status;
252
#define YY_BUFFER_NEW 0
253
#define YY_BUFFER_NORMAL 1
254
/* When an EOF's been seen but there's still some text to process
255
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
256
* shouldn't try reading from the input source any more. We might
257
* still have a bunch of tokens to match, though, because of
258
* possible backing-up.
260
* When we actually see the EOF, we change the status to "new"
261
* (via yyrestart()), so that the user can continue scanning by
262
* just pointing yyin at a new input file.
264
#define YY_BUFFER_EOF_PENDING 2
267
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
269
/* We provide macros for accessing buffer states in case in the
270
* future we want to put the buffer states in a more general
273
* Returns the top of the stack, or NULL.
275
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
276
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
279
/* Same as previous macro, but useful when we know that the buffer stack is not
280
* NULL or when we need an lvalue. For internal use only.
282
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
284
void *pgsalloc (yy_size_t );
285
void *pgsrealloc (void *,yy_size_t );
286
void pgsfree (void * );
288
#define yy_new_buffer yy_create_buffer
290
#define yy_set_interactive(is_interactive) \
292
if ( ! YY_CURRENT_BUFFER ){ \
293
yyensure_buffer_stack (); \
294
YY_CURRENT_BUFFER_LVALUE = \
295
yy_create_buffer( yyin, YY_BUF_SIZE ); \
297
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
300
#define yy_set_bol(at_bol) \
302
if ( ! YY_CURRENT_BUFFER ){\
303
yyensure_buffer_stack (); \
304
YY_CURRENT_BUFFER_LVALUE = \
305
yy_create_buffer( yyin, YY_BUF_SIZE ); \
307
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
310
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
312
/* Begin user sect3 */
315
#define YY_SKIP_YYWRAP
317
typedef unsigned char YY_CHAR;
319
#define yytext_ptr yytext
321
#include "pgscript/FlexLexer.h"
323
/* Done after the current pattern has been matched and before the
324
* corresponding action - sets up yytext.
326
#define YY_DO_BEFORE_ACTION \
327
(yytext_ptr) = yy_bp; \
328
yyleng = (size_t) (yy_cp - yy_bp); \
329
(yy_hold_char) = *yy_cp; \
331
(yy_c_buf_p) = yy_cp;
333
#define YY_NUM_RULES 137
334
#define YY_END_OF_BUFFER 138
335
/* This struct is not used in this scanner,
336
but its presence is necessary. */
339
flex_int32_t yy_verify;
342
static yyconst flex_int16_t yy_accept[444] =
344
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
345
138, 114, 111, 113, 112, 61, 64, 50, 51, 59,
346
58, 55, 57, 54, 60, 35, 49, 46, 62, 43,
347
63, 34, 52, 53, 114, 114, 114, 114, 114, 114,
348
114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
349
114, 114, 114, 47, 48, 114, 130, 129, 128, 130,
350
122, 121, 120, 122, 115, 118, 119, 122, 122, 117,
351
126, 125, 124, 126, 136, 135, 134, 133, 136, 111,
352
48, 0, 36, 2, 38, 35, 0, 53, 47, 52,
353
41, 45, 42, 34, 0, 0, 0, 11, 0, 0,
355
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
356
0, 0, 0, 0, 13, 0, 8, 0, 0, 0,
357
0, 0, 40, 0, 0, 0, 0, 0, 0, 0,
358
0, 0, 0, 0, 0, 0, 0, 0, 44, 127,
359
0, 116, 3, 0, 123, 131, 132, 0, 1, 0,
360
36, 0, 0, 37, 0, 0, 0, 39, 0, 0,
361
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
362
0, 0, 0, 0, 0, 0, 0, 33, 0, 0,
363
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
364
56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
366
0, 0, 0, 0, 0, 0, 103, 0, 0, 0,
367
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
368
36, 0, 0, 38, 0, 0, 0, 0, 0, 0,
369
19, 0, 0, 0, 0, 0, 0, 75, 0, 26,
370
0, 0, 0, 0, 81, 9, 0, 0, 0, 0,
371
25, 0, 0, 0, 0, 0, 90, 91, 92, 0,
372
0, 0, 22, 0, 0, 0, 0, 0, 0, 0,
373
0, 0, 0, 0, 0, 0, 0, 104, 0, 0,
374
27, 17, 0, 0, 0, 0, 0, 0, 0, 0,
375
36, 65, 66, 0, 0, 32, 5, 0, 71, 0,
377
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
378
0, 0, 0, 0, 86, 87, 0, 0, 16, 0,
379
0, 0, 14, 0, 0, 0, 24, 0, 0, 98,
380
0, 0, 0, 0, 0, 0, 30, 105, 0, 0,
381
0, 0, 0, 0, 0, 4, 0, 12, 0, 0,
382
0, 0, 0, 74, 0, 76, 0, 0, 0, 79,
383
0, 0, 0, 0, 0, 88, 0, 89, 93, 0,
384
0, 20, 0, 0, 0, 6, 99, 18, 0, 0,
385
102, 23, 0, 0, 108, 109, 110, 0, 67, 0,
386
0, 0, 72, 15, 73, 0, 0, 0, 78, 80,
388
0, 0, 84, 85, 21, 94, 0, 0, 96, 97,
389
0, 0, 0, 0, 10, 0, 0, 0, 7, 28,
390
0, 0, 0, 83, 95, 0, 100, 0, 106, 107,
391
0, 0, 0, 0, 31, 82, 29, 101, 68, 69,
395
static yyconst flex_int32_t yy_ec[256] =
397
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
398
4, 4, 5, 1, 1, 1, 1, 1, 1, 1,
399
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400
1, 2, 1, 1, 6, 7, 8, 1, 9, 10,
401
11, 12, 13, 14, 15, 16, 17, 18, 18, 18,
402
18, 18, 18, 18, 18, 18, 18, 19, 20, 21,
403
22, 23, 1, 24, 28, 29, 30, 31, 32, 33,
404
34, 35, 36, 6, 37, 38, 39, 40, 41, 42,
405
6, 43, 44, 45, 46, 47, 48, 49, 50, 51,
406
25, 26, 27, 1, 6, 1, 28, 29, 30, 31,
408
32, 33, 34, 35, 36, 6, 37, 38, 39, 40,
409
41, 42, 6, 43, 44, 45, 46, 47, 48, 49,
410
50, 51, 52, 1, 53, 54, 1, 1, 1, 1,
411
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
412
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
416
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
417
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
static yyconst flex_int32_t yy_meta[55] =
429
1, 1, 2, 1, 1, 3, 4, 1, 1, 1,
430
1, 1, 1, 1, 1, 1, 1, 3, 1, 1,
431
1, 1, 1, 3, 1, 1, 1, 3, 3, 3,
432
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
433
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
437
static yyconst flex_int16_t yy_base[453] =
439
0, 0, 52, 53, 63, 81, 56, 64, 76, 84,
440
507, 508, 58, 508, 508, 483, 508, 508, 508, 508,
441
508, 508, 490, 486, 491, 79, 479, 508, 86, 508,
442
479, 0, 508, 508, 74, 72, 78, 92, 85, 90,
443
34, 67, 91, 459, 458, 455, 454, 97, 105, 103,
444
101, 468, 114, 508, 508, 473, 508, 508, 508, 477,
445
508, 508, 508, 486, 508, 508, 508, 477, 479, 508,
446
508, 508, 508, 483, 508, 508, 508, 480, 0, 143,
447
508, 485, 99, 508, 112, 135, 139, 508, 508, 508,
448
508, 508, 508, 0, 446, 441, 127, 441, 450, 451,
450
438, 449, 115, 124, 448, 434, 140, 434, 436, 432,
451
444, 127, 429, 435, 508, 444, 508, 127, 133, 146,
452
424, 425, 508, 143, 152, 431, 430, 420, 146, 425,
453
155, 426, 156, 426, 432, 151, 426, 425, 508, 508,
454
453, 508, 508, 452, 508, 508, 508, 455, 508, 188,
455
175, 195, 439, 438, 412, 422, 415, 508, 420, 415,
456
422, 404, 418, 403, 402, 399, 405, 398, 392, 413,
457
408, 401, 400, 405, 406, 393, 402, 431, 402, 393,
458
400, 397, 388, 395, 394, 393, 379, 392, 385, 389,
459
384, 377, 378, 38, 376, 384, 383, 374, 381, 380,
461
365, 369, 373, 370, 375, 374, 403, 356, 360, 366,
462
369, 361, 359, 362, 369, 350, 349, 349, 355, 374,
463
373, 196, 372, 371, 343, 344, 336, 342, 344, 346,
464
508, 345, 349, 335, 340, 168, 342, 508, 332, 331,
465
337, 346, 328, 344, 508, 508, 185, 325, 342, 334,
466
508, 323, 324, 332, 321, 332, 508, 508, 508, 330,
467
334, 316, 508, 316, 316, 315, 308, 325, 327, 309,
468
310, 315, 311, 321, 307, 318, 192, 508, 302, 306,
469
508, 508, 315, 300, 298, 296, 309, 307, 307, 320,
470
319, 508, 508, 285, 290, 332, 508, 291, 508, 300,
472
291, 290, 284, 288, 295, 290, 284, 281, 291, 279,
473
278, 279, 274, 282, 508, 508, 272, 284, 508, 275,
474
264, 270, 508, 276, 280, 278, 508, 277, 264, 508,
475
267, 274, 273, 276, 262, 257, 508, 508, 267, 272,
476
254, 266, 258, 252, 254, 508, 262, 508, 193, 252,
477
249, 247, 245, 508, 243, 508, 249, 257, 254, 508,
478
254, 256, 240, 250, 241, 508, 237, 508, 508, 247,
479
244, 508, 237, 227, 243, 508, 508, 508, 244, 237,
480
508, 508, 227, 239, 508, 508, 508, 227, 508, 220,
481
199, 203, 508, 508, 508, 205, 204, 207, 232, 508,
483
192, 194, 508, 508, 508, 508, 189, 198, 508, 508,
484
189, 185, 192, 183, 508, 194, 178, 180, 508, 508,
485
174, 203, 174, 508, 508, 185, 508, 170, 508, 508,
486
172, 128, 115, 116, 508, 508, 508, 508, 508, 508,
487
508, 508, 508, 241, 245, 249, 253, 96, 255, 257,
491
static yyconst flex_int16_t yy_def[453] =
493
443, 1, 444, 444, 445, 445, 446, 446, 447, 447,
494
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
495
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
496
443, 448, 443, 443, 443, 443, 443, 443, 443, 443,
497
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
498
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
499
443, 443, 443, 449, 443, 443, 443, 443, 443, 443,
500
443, 443, 443, 450, 443, 443, 443, 443, 451, 443,
501
443, 452, 443, 443, 443, 443, 443, 443, 443, 443,
502
443, 443, 443, 448, 443, 443, 443, 443, 443, 443,
504
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
505
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
506
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
507
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
508
449, 443, 443, 450, 443, 443, 443, 452, 443, 443,
509
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
510
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
511
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
512
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
513
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
515
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
516
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
517
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
518
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
519
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
520
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
521
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
522
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
523
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
524
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
526
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
527
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
528
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
529
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
530
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
531
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
532
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
533
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
534
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
535
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
537
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
538
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
539
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
540
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
541
443, 443, 0, 443, 443, 443, 443, 443, 443, 443,
545
static yyconst flex_int16_t yy_nxt[563] =
547
12, 13, 14, 13, 15, 12, 12, 16, 17, 18,
548
19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
549
29, 30, 31, 32, 33, 12, 34, 35, 36, 37,
550
38, 39, 40, 41, 12, 42, 12, 43, 44, 45,
551
46, 47, 48, 49, 50, 51, 52, 53, 12, 12,
552
12, 54, 55, 56, 58, 58, 59, 59, 72, 80,
553
73, 80, 74, 60, 60, 62, 72, 63, 73, 64,
554
74, 65, 66, 67, 115, 263, 116, 68, 76, 69,
555
77, 264, 70, 62, 78, 63, 76, 64, 77, 65,
556
66, 67, 78, 89, 85, 68, 86, 69, 94, 117,
558
70, 79, 95, 99, 90, 101, 118, 91, 92, 79,
559
87, 96, 102, 97, 100, 103, 83, 98, 104, 106,
560
105, 113, 110, 107, 111, 114, 119, 108, 125, 151,
561
150, 120, 128, 112, 109, 126, 129, 127, 132, 130,
562
134, 137, 135, 152, 80, 133, 80, 442, 138, 131,
563
85, 153, 86, 153, 157, 164, 154, 158, 179, 441,
564
165, 166, 167, 168, 440, 169, 87, 172, 180, 173,
565
184, 185, 186, 188, 192, 189, 187, 174, 193, 194,
566
216, 195, 209, 206, 196, 197, 247, 198, 217, 199,
567
207, 212, 151, 277, 349, 200, 201, 210, 202, 302,
569
220, 213, 220, 303, 422, 221, 222, 223, 290, 223,
570
290, 439, 224, 291, 438, 337, 437, 436, 434, 433,
571
432, 431, 430, 429, 428, 427, 435, 426, 425, 311,
572
424, 423, 312, 422, 421, 420, 419, 390, 418, 417,
573
391, 57, 57, 57, 57, 61, 61, 61, 61, 71,
574
71, 71, 71, 75, 75, 75, 75, 141, 141, 144,
575
144, 147, 416, 147, 147, 148, 148, 148, 148, 415,
576
414, 413, 412, 411, 410, 409, 408, 407, 406, 405,
577
404, 403, 402, 401, 400, 399, 398, 397, 396, 395,
578
394, 393, 392, 389, 388, 387, 386, 385, 384, 383,
580
382, 381, 380, 379, 378, 377, 376, 375, 374, 373,
581
372, 371, 370, 369, 368, 367, 366, 365, 364, 363,
582
362, 361, 360, 359, 358, 357, 356, 355, 354, 353,
583
352, 351, 350, 349, 348, 347, 291, 291, 346, 345,
584
344, 343, 342, 341, 340, 339, 338, 336, 335, 334,
585
333, 332, 331, 330, 329, 328, 327, 326, 325, 324,
586
323, 322, 321, 320, 319, 318, 317, 316, 315, 314,
587
313, 310, 309, 308, 307, 306, 305, 304, 301, 300,
588
299, 298, 297, 296, 295, 294, 293, 292, 224, 224,
589
221, 221, 289, 288, 287, 286, 285, 284, 283, 282,
591
281, 280, 279, 278, 277, 276, 275, 274, 273, 272,
592
271, 270, 269, 268, 267, 266, 265, 262, 261, 260,
593
259, 258, 257, 256, 255, 254, 253, 252, 251, 250,
594
249, 248, 247, 246, 245, 244, 243, 242, 241, 240,
595
239, 238, 237, 236, 235, 234, 233, 232, 231, 230,
596
229, 228, 227, 226, 225, 154, 154, 149, 145, 142,
597
219, 218, 215, 214, 211, 208, 205, 204, 203, 191,
598
190, 183, 182, 181, 178, 177, 176, 175, 171, 170,
599
163, 162, 161, 160, 159, 156, 155, 149, 146, 145,
600
143, 82, 142, 140, 139, 136, 124, 123, 122, 121,
602
93, 88, 84, 83, 82, 81, 443, 11, 443, 443,
603
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
604
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
605
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
606
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
607
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
611
static yyconst flex_int16_t yy_chk[563] =
613
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
614
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
615
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
616
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
617
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
618
1, 1, 1, 1, 3, 4, 3, 4, 7, 13,
619
7, 13, 7, 3, 4, 5, 8, 5, 8, 5,
620
8, 5, 5, 5, 41, 194, 41, 5, 9, 5,
621
9, 194, 5, 6, 9, 6, 10, 6, 10, 6,
622
6, 6, 10, 29, 26, 6, 26, 6, 448, 42,
624
6, 9, 35, 36, 29, 37, 42, 29, 29, 10,
625
26, 35, 37, 35, 36, 37, 83, 35, 37, 38,
626
37, 40, 39, 38, 39, 40, 43, 38, 48, 85,
627
83, 43, 49, 39, 38, 48, 49, 48, 50, 49,
628
51, 53, 51, 85, 80, 50, 80, 434, 53, 49,
629
86, 87, 86, 87, 97, 103, 87, 97, 112, 433,
630
103, 104, 104, 104, 432, 104, 86, 107, 112, 107,
631
118, 118, 119, 120, 124, 120, 119, 107, 124, 125,
632
136, 125, 131, 129, 125, 125, 247, 125, 136, 125,
633
129, 133, 151, 277, 349, 125, 125, 131, 125, 236,
635
150, 133, 150, 236, 422, 150, 151, 152, 222, 152,
636
222, 431, 152, 222, 428, 277, 426, 423, 421, 418,
637
417, 416, 414, 413, 412, 411, 422, 408, 407, 247,
638
402, 401, 247, 399, 398, 397, 396, 349, 392, 391,
639
349, 444, 444, 444, 444, 445, 445, 445, 445, 446,
640
446, 446, 446, 447, 447, 447, 447, 449, 449, 450,
641
450, 451, 390, 451, 451, 452, 452, 452, 452, 388,
642
384, 383, 380, 379, 375, 374, 373, 371, 370, 367,
643
365, 364, 363, 362, 361, 359, 358, 357, 355, 353,
644
352, 351, 350, 347, 345, 344, 343, 342, 341, 340,
646
339, 336, 335, 334, 333, 332, 331, 329, 328, 326,
647
325, 324, 322, 321, 320, 318, 317, 314, 313, 312,
648
311, 310, 309, 308, 307, 306, 305, 304, 303, 302,
649
301, 300, 298, 296, 295, 294, 291, 290, 289, 288,
650
287, 286, 285, 284, 283, 280, 279, 276, 275, 274,
651
273, 272, 271, 270, 269, 268, 267, 266, 265, 264,
652
262, 261, 260, 256, 255, 254, 253, 252, 250, 249,
653
248, 244, 243, 242, 241, 240, 239, 237, 235, 234,
654
233, 232, 230, 229, 228, 227, 226, 225, 224, 223,
655
221, 220, 219, 218, 217, 216, 215, 214, 213, 212,
657
211, 210, 209, 208, 207, 206, 205, 204, 203, 202,
658
201, 200, 199, 198, 197, 196, 195, 193, 192, 191,
659
190, 189, 188, 187, 186, 185, 184, 183, 182, 181,
660
180, 179, 178, 177, 176, 175, 174, 173, 172, 171,
661
170, 169, 168, 167, 166, 165, 164, 163, 162, 161,
662
160, 159, 157, 156, 155, 154, 153, 148, 144, 141,
663
138, 137, 135, 134, 132, 130, 128, 127, 126, 122,
664
121, 116, 114, 113, 111, 110, 109, 108, 106, 105,
665
102, 101, 100, 99, 98, 96, 95, 82, 78, 74,
666
69, 68, 64, 60, 56, 52, 47, 46, 45, 44,
668
31, 27, 25, 24, 23, 16, 11, 443, 443, 443,
669
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
670
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
671
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
672
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
673
443, 443, 443, 443, 443, 443, 443, 443, 443, 443,
677
/* The intent behind this definition is that it'll catch
678
* any uses of REJECT which flex missed.
680
#define REJECT reject_used_but_not_detected
681
#define yymore() yymore_used_but_not_detected
682
#define YY_MORE_ADJ 0
683
#define YY_RESTORE_YY_MORE_OFFSET
684
#line 1 "pgscript/pgsScanner.ll"
685
#line 6 "pgscript/pgsScanner.ll"
687
//////////////////////////////////////////////////////////////////////////
689
// pgScript - PostgreSQL Tools
690
// RCS-ID: $Id: pgsScanner.ll,v 1.5 2008/08/10 22:11:29 pgunittest Exp $
691
// Copyright (C) 2002 - 2009, The pgAdmin Development Team
692
// This software is released under the BSD Licence
694
//////////////////////////////////////////////////////////////////////////
696
#include "pgscript/pgScript.h"
697
#include "pgscript/parser.tab.hh"
698
#include "pgscript/utilities/pgsScanner.h"
700
/* Import the parser's token type into a local typedef */
701
typedef pgscript::pgsParser::token token;
702
typedef pgscript::pgsParser::token_type token_type;
704
/* Work around an incompatibility in flex (at least versions 2.5.31 through
705
* 2.5.33): it generates code that does not conform to C89. See Debian bug
706
* 333231 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>. */
710
/* By default yylex returns int, we use token_type. Unfortunately yyterminate
711
* by default returns 0, which is not of token_type. */
712
#define yyterminate() return token::PGS_END
714
/* This disables inclusion of unistd.h, which is not available under Visual C++
715
* on Win32. The C++ scanner uses STL streams instead. */
716
#define YY_NO_UNISTD_H
718
/*** Flex Declarations and Options ***/
719
/* Enable C++ scanner class generation */
720
/* Change the name of the scanner class. Results in "pgsFlexLexer" */
721
/* Case insensitive */
722
/* The manual says "somewhat more optimized" */
723
/* Prevent isatty warning in VC++ */
724
/* For using start conditions */
725
/* No support for include files is planned */
726
/* The following paragraph suffices to track locations accurately. Each time
727
* yylex is invoked, the begin position is moved onto the end position. */
728
#line 66 "pgscript/pgsScanner.ll"
729
#define YY_USER_ACTION yylloc->columns(yyleng);
734
#line 732 "pgscript/lex.pgs.cc"
742
#ifndef YY_NO_UNISTD_H
743
/* Special case for "unistd.h", since it is non-ANSI. We include it way
744
* down here because we want the user's section 1 to have been scanned first.
745
* The user has a chance to override it with an option.
750
#ifndef YY_EXTRA_TYPE
751
#define YY_EXTRA_TYPE void *
755
static void yy_flex_strncpy (char *,yyconst char *,int );
758
#ifdef YY_NEED_STRLEN
759
static int yy_flex_strlen (yyconst char * );
766
/* Amount of stuff to slurp up with each read. */
767
#ifndef YY_READ_BUF_SIZE
768
#define YY_READ_BUF_SIZE 8192
771
/* Copy whatever the last rule matched to the standard output. */
773
#define ECHO LexerOutput( yytext, yyleng )
776
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
777
* is returned in "result".
780
#define YY_INPUT(buf,result,max_size) \
782
if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
783
YY_FATAL_ERROR( "input in flex scanner failed" );
787
/* No semi-colon after return; correct usage is to write "yyterminate();" -
788
* we don't want an extra ';' after the "return" because that will cause
789
* some compilers to complain about unreachable statements.
792
#define yyterminate() return YY_NULL
795
/* Number of entries by which start-condition stack grows. */
796
#ifndef YY_START_STACK_INCR
797
#define YY_START_STACK_INCR 25
800
/* Report a fatal error. */
801
#ifndef YY_FATAL_ERROR
802
#define YY_FATAL_ERROR(msg) LexerError( msg )
805
/* end tables serialization structures and prototypes */
807
/* Default declaration of generated scanner - a define so the user can
808
* easily add parameters.
811
#define YY_DECL_IS_OURS 1
812
#define YY_DECL int yyFlexLexer::yylex()
813
#endif /* !YY_DECL */
815
/* Code executed at the beginning of each rule, after yytext and yyleng
818
#ifndef YY_USER_ACTION
819
#define YY_USER_ACTION
822
/* Code executed at the end of each rule. */
824
#define YY_BREAK break;
827
#define YY_RULE_SETUP \
830
/** The main scanner function which does all the work.
834
register yy_state_type yy_current_state;
835
register char *yy_cp, *yy_bp;
838
#line 74 "pgscript/pgsScanner.ll"
841
/* Code to place at the beginning of yylex() */
847
#line 845 "pgscript/lex.pgs.cc"
858
(yy_start) = 1; /* first start state */
866
if ( ! YY_CURRENT_BUFFER ) {
867
yyensure_buffer_stack ();
868
YY_CURRENT_BUFFER_LVALUE =
869
yy_create_buffer( yyin, YY_BUF_SIZE );
872
yy_load_buffer_state( );
875
while ( 1 ) /* loops until end-of-file is reached */
877
yy_cp = (yy_c_buf_p);
879
/* Support of yytext. */
880
*yy_cp = (yy_hold_char);
882
/* yy_bp points to the position in yy_ch_buf of the start of
887
yy_current_state = (yy_start);
891
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
892
if ( yy_accept[yy_current_state] )
894
(yy_last_accepting_state) = yy_current_state;
895
(yy_last_accepting_cpos) = yy_cp;
897
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
899
yy_current_state = (int) yy_def[yy_current_state];
900
if ( yy_current_state >= 444 )
901
yy_c = yy_meta[(unsigned int) yy_c];
903
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
906
while ( yy_current_state != 443 );
907
yy_cp = (yy_last_accepting_cpos);
908
yy_current_state = (yy_last_accepting_state);
911
yy_act = yy_accept[yy_current_state];
915
do_action: /* This label is used only to access EOF actions. */
918
{ /* beginning of action switch */
919
case 0: /* must back up */
920
/* undo the effects of YY_DO_BEFORE_ACTION */
921
*yy_cp = (yy_hold_char);
922
yy_cp = (yy_last_accepting_cpos);
923
yy_current_state = (yy_last_accepting_state);
927
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
928
(yy_c_buf_p) = yy_cp -= 1;
929
YY_DO_BEFORE_ACTION; /* set up yytext again */
931
#line 82 "pgscript/pgsScanner.ll"
932
{ /* Ignore SQL comment */ }
936
#line 83 "pgscript/pgsScanner.ll"
937
{ comment_caller = INITIAL; BEGIN(SC_COMMENT); }
941
#line 84 "pgscript/pgsScanner.ll"
942
{ comment_caller = SC_QUERY; BEGIN(SC_COMMENT); }
947
#line 87 "pgscript/pgsScanner.ll"
948
{ return token::PGS_WHILE; }
952
#line 88 "pgscript/pgsScanner.ll"
953
{ return token::PGS_BREAK; }
957
#line 89 "pgscript/pgsScanner.ll"
958
{ return token::PGS_RETURN; }
962
#line 90 "pgscript/pgsScanner.ll"
963
{ return token::PGS_CONTINUE; }
967
#line 91 "pgscript/pgsScanner.ll"
968
{ return token::PGS_IF; }
972
#line 92 "pgscript/pgsScanner.ll"
973
{ return token::PGS_ELSE; }
977
#line 93 "pgscript/pgsScanner.ll"
978
{ return token::PGS_WAITFOR; }
982
#line 94 "pgscript/pgsScanner.ll"
983
{ return token::PGS_AS; }
987
#line 96 "pgscript/pgsScanner.ll"
988
{ return token::PGS_ASSERT; }
992
#line 97 "pgscript/pgsScanner.ll"
997
#line 98 "pgscript/pgsScanner.ll"
998
{ return token::PGS_PRINT; }
1002
#line 100 "pgscript/pgsScanner.ll"
1003
{ return token::PGS_CNT_COLUMNS; }
1007
#line 101 "pgscript/pgsScanner.ll"
1008
{ return token::PGS_CNT_LINES; }
1012
#line 102 "pgscript/pgsScanner.ll"
1013
{ return token::PGS_TRIM; }
1017
#line 103 "pgscript/pgsScanner.ll"
1018
{ return token::PGS_RM_LINE; }
1022
#line 104 "pgscript/pgsScanner.ll"
1023
{ return token::PGS_CAST; }
1027
#line 106 "pgscript/pgsScanner.ll"
1028
{ return token::PGS_RECORD; }
1032
#line 108 "pgscript/pgsScanner.ll"
1033
{ return token::PGS_INTEGER; }
1037
#line 109 "pgscript/pgsScanner.ll"
1038
{ return token::PGS_REAL; }
1042
#line 110 "pgscript/pgsScanner.ll"
1043
{ return token::PGS_STRING; }
1047
#line 111 "pgscript/pgsScanner.ll"
1048
{ return token::PGS_REGEX; }
1052
#line 112 "pgscript/pgsScanner.ll"
1053
{ return token::PGS_FILE; }
1057
#line 113 "pgscript/pgsScanner.ll"
1058
{ return token::PGS_DATE; }
1062
#line 114 "pgscript/pgsScanner.ll"
1063
{ return token::PGS_TIME; }
1067
#line 115 "pgscript/pgsScanner.ll"
1068
{ return token::PGS_DATE_TIME; }
1072
#line 116 "pgscript/pgsScanner.ll"
1073
{ return token::PGS_REFERENCE; }
1077
#line 119 "pgscript/pgsScanner.ll"
1078
{ unput('@'); yylloc->end.columns(-1);
1079
return token::PGS_SET_ASSIGN; }
1083
#line 121 "pgscript/pgsScanner.ll"
1084
{ unput('@'); yylloc->end.columns(-1);
1085
return token::PGS_DECLARE_ASSGN; }
1089
#line 124 "pgscript/pgsScanner.ll"
1090
{ /* Block opening */ return token::PGS_OPEN; }
1094
#line 125 "pgscript/pgsScanner.ll"
1095
{ /* Block closing */ return token::PGS_CLOSE; }
1099
#line 127 "pgscript/pgsScanner.ll"
1100
{ yylval->str = pnew wxString(yytext, m_conv);
1101
return token::PGS_IDENTIFIER; }
1105
#line 130 "pgscript/pgsScanner.ll"
1106
{ yylval->str = pnew wxString(yytext, m_conv);
1107
return token::PGS_VAL_INT; }
1111
#line 133 "pgscript/pgsScanner.ll"
1112
{ yylval->str = pnew wxString(yytext, m_conv);
1113
return token::PGS_VAL_REAL; }
1117
#line 135 "pgscript/pgsScanner.ll"
1118
{ yylval->str = pnew wxString(yytext, m_conv);
1119
return token::PGS_VAL_REAL; }
1123
#line 137 "pgscript/pgsScanner.ll"
1124
{ yylval->str = pnew wxString(yytext, m_conv);
1125
return token::PGS_VAL_REAL; }
1129
#line 140 "pgscript/pgsScanner.ll"
1130
{ return token::PGS_AND_OP; }
1134
#line 141 "pgscript/pgsScanner.ll"
1135
{ return token::PGS_OR_OP; }
1139
#line 142 "pgscript/pgsScanner.ll"
1140
{ return token::PGS_LE_OP; }
1144
#line 143 "pgscript/pgsScanner.ll"
1145
{ return token::PGS_GE_OP; }
1149
#line 144 "pgscript/pgsScanner.ll"
1150
{ return token::PGS_EQ_OP; }
1154
#line 145 "pgscript/pgsScanner.ll"
1155
{ return token::PGS_AE_OP; }
1159
#line 146 "pgscript/pgsScanner.ll"
1160
{ return token::PGS_NE_OP; }
1164
#line 147 "pgscript/pgsScanner.ll"
1165
{ return wx_static_cast(token_type, ';'); }
1169
#line 148 "pgscript/pgsScanner.ll"
1170
{ return wx_static_cast(token_type, '{'); }
1174
#line 149 "pgscript/pgsScanner.ll"
1175
{ return wx_static_cast(token_type, '}'); }
1179
#line 150 "pgscript/pgsScanner.ll"
1180
{ return wx_static_cast(token_type, ':'); }
1184
#line 151 "pgscript/pgsScanner.ll"
1185
{ return wx_static_cast(token_type, '('); }
1189
#line 152 "pgscript/pgsScanner.ll"
1190
{ return wx_static_cast(token_type, ')'); }
1194
#line 153 "pgscript/pgsScanner.ll"
1195
{ return wx_static_cast(token_type, '['); }
1199
#line 154 "pgscript/pgsScanner.ll"
1200
{ return wx_static_cast(token_type, ']'); }
1204
#line 155 "pgscript/pgsScanner.ll"
1205
{ return wx_static_cast(token_type, '.'); }
1209
#line 156 "pgscript/pgsScanner.ll"
1210
{ return wx_static_cast(token_type, ','); }
1214
#line 157 "pgscript/pgsScanner.ll"
1215
{ return token::PGS_NOT_OP; }
1219
#line 158 "pgscript/pgsScanner.ll"
1220
{ return wx_static_cast(token_type, '-'); }
1224
#line 159 "pgscript/pgsScanner.ll"
1225
{ return wx_static_cast(token_type, '+'); }
1229
#line 160 "pgscript/pgsScanner.ll"
1230
{ return wx_static_cast(token_type, '*'); }
1234
#line 161 "pgscript/pgsScanner.ll"
1235
{ return wx_static_cast(token_type, '/'); }
1239
#line 162 "pgscript/pgsScanner.ll"
1240
{ return wx_static_cast(token_type, '%'); }
1244
#line 163 "pgscript/pgsScanner.ll"
1245
{ return wx_static_cast(token_type, '<'); }
1249
#line 164 "pgscript/pgsScanner.ll"
1250
{ return wx_static_cast(token_type, '>'); }
1254
#line 166 "pgscript/pgsScanner.ll"
1255
{ string_caller = INITIAL; BEGIN(SC_STRING); }
1259
#line 168 "pgscript/pgsScanner.ll"
1260
{ query += yytext; query_token = token::PGS_ABORT;
1265
#line 170 "pgscript/pgsScanner.ll"
1266
{ query += yytext; query_token = token::PGS_ALTER;
1271
#line 172 "pgscript/pgsScanner.ll"
1272
{ query += yytext; query_token = token::PGS_ANALYZE;
1277
#line 174 "pgscript/pgsScanner.ll"
1278
{ query += yytext; query_token = token::PGS_BEGIN;
1283
#line 176 "pgscript/pgsScanner.ll"
1284
{ query += yytext; query_token = token::PGS_BEGIN;
1289
#line 178 "pgscript/pgsScanner.ll"
1290
{ query += yytext; query_token = token::PGS_CHECKPOINT;
1295
#line 180 "pgscript/pgsScanner.ll"
1296
{ query += yytext; query_token = token::PGS_CLOSE_ST;
1301
#line 182 "pgscript/pgsScanner.ll"
1302
{ query += yytext; query_token = token::PGS_CLUSTER;
1307
#line 184 "pgscript/pgsScanner.ll"
1308
{ query += yytext; query_token = token::PGS_COMMENT;
1313
#line 186 "pgscript/pgsScanner.ll"
1314
{ query += yytext; query_token = token::PGS_COMMIT;
1319
#line 188 "pgscript/pgsScanner.ll"
1320
{ query += yytext; query_token = token::PGS_COPY;
1325
#line 190 "pgscript/pgsScanner.ll"
1326
{ query += yytext; query_token = token::PGS_CREATE;
1331
#line 192 "pgscript/pgsScanner.ll"
1332
{ query += yytext; query_token = token::PGS_DEALLOCATE;
1337
#line 194 "pgscript/pgsScanner.ll"
1338
{ query += yytext; query_token = token::PGS_DECLARE;
1343
#line 196 "pgscript/pgsScanner.ll"
1344
{ query += yytext; query_token = token::PGS_DELETE;
1349
#line 198 "pgscript/pgsScanner.ll"
1350
{ query += yytext; query_token = token::PGS_DISCARD;
1355
#line 200 "pgscript/pgsScanner.ll"
1356
{ query += yytext; query_token = token::PGS_DROP;
1361
#line 202 "pgscript/pgsScanner.ll"
1362
{ query += yytext; query_token = token::PGS_END_ST;
1367
#line 204 "pgscript/pgsScanner.ll"
1368
{ query += yytext; query_token = token::PGS_END_ST;
1373
#line 206 "pgscript/pgsScanner.ll"
1374
{ query += yytext; query_token = token::PGS_EXECUTE;
1379
#line 208 "pgscript/pgsScanner.ll"
1380
{ query += yytext; query_token = token::PGS_EXPLAIN;
1385
#line 210 "pgscript/pgsScanner.ll"
1386
{ query += yytext; query_token = token::PGS_FETCH;
1391
#line 212 "pgscript/pgsScanner.ll"
1392
{ query += yytext; query_token = token::PGS_GRANT;
1397
#line 214 "pgscript/pgsScanner.ll"
1398
{ query += yytext; query_token = token::PGS_INSERT;
1403
#line 216 "pgscript/pgsScanner.ll"
1404
{ query += yytext; query_token = token::PGS_LISTEN;
1409
#line 218 "pgscript/pgsScanner.ll"
1410
{ query += yytext; query_token = token::PGS_LOAD;
1415
#line 220 "pgscript/pgsScanner.ll"
1416
{ query += yytext; query_token = token::PGS_LOCK;
1421
#line 222 "pgscript/pgsScanner.ll"
1422
{ query += yytext; query_token = token::PGS_MOVE;
1427
#line 224 "pgscript/pgsScanner.ll"
1428
{ query += yytext; query_token = token::PGS_NOTIFY;
1433
#line 226 "pgscript/pgsScanner.ll"
1434
{ query += yytext; query_token = token::PGS_PREPARE;
1439
#line 228 "pgscript/pgsScanner.ll"
1440
{ query += yytext; query_token = token::PGS_REASSIGN;
1445
#line 230 "pgscript/pgsScanner.ll"
1446
{ query += yytext; query_token = token::PGS_REINDEX;
1451
#line 232 "pgscript/pgsScanner.ll"
1452
{ query += yytext; query_token = token::PGS_RELEASE;
1457
#line 234 "pgscript/pgsScanner.ll"
1458
{ query += yytext; query_token = token::PGS_RESET;
1463
#line 236 "pgscript/pgsScanner.ll"
1464
{ query += yytext; query_token = token::PGS_REVOKE;
1469
#line 238 "pgscript/pgsScanner.ll"
1470
{ query += yytext; query_token = token::PGS_ROLLBACK;
1475
#line 240 "pgscript/pgsScanner.ll"
1476
{ query += yytext; query_token = token::PGS_SAVEPOINT;
1481
#line 242 "pgscript/pgsScanner.ll"
1482
{ query += yytext; query_token = token::PGS_SELECT;
1487
#line 244 "pgscript/pgsScanner.ll"
1488
{ query += yytext; query_token = token::PGS_SET;
1493
#line 246 "pgscript/pgsScanner.ll"
1494
{ query += yytext; query_token = token::PGS_SHOW;
1499
#line 248 "pgscript/pgsScanner.ll"
1500
{ query += yytext; query_token = token::PGS_START;
1505
#line 250 "pgscript/pgsScanner.ll"
1506
{ query += yytext; query_token = token::PGS_TRUNCATE;
1511
#line 252 "pgscript/pgsScanner.ll"
1512
{ query += yytext; query_token = token::PGS_UNLISTEN;
1517
#line 254 "pgscript/pgsScanner.ll"
1518
{ query += yytext; query_token = token::PGS_UPDATE;
1523
#line 256 "pgscript/pgsScanner.ll"
1524
{ query += yytext; query_token = token::PGS_VACUUM;
1529
#line 258 "pgscript/pgsScanner.ll"
1530
{ query += yytext; query_token = token::PGS_VALUES;
1535
#line 261 "pgscript/pgsScanner.ll"
1540
#line 262 "pgscript/pgsScanner.ll"
1544
/* rule 113 can match eol */
1546
#line 263 "pgscript/pgsScanner.ll"
1547
{ yylloc->lines(yyleng); yylloc->step(); }
1551
#line 264 "pgscript/pgsScanner.ll"
1552
{ return token::PGS_UNKNOWN; }
1558
#line 268 "pgscript/pgsScanner.ll"
1559
{ query += yytext; string_caller = SC_QUERY; BEGIN(SC_STRING); }
1563
#line 269 "pgscript/pgsScanner.ll"
1564
{ query += yytext; dollar = yytext; BEGIN(SC_DOLLAR); }
1568
#line 270 "pgscript/pgsScanner.ll"
1569
{ yylval->str = pnew wxString(query.c_str(), m_conv);
1570
query.clear(); unput(';'); yylloc->end.columns(-1);
1571
BEGIN(INITIAL); m_parent = 0; return query_token; }
1575
#line 273 "pgscript/pgsScanner.ll"
1576
{ ++m_parent; query += yytext; }
1580
#line 274 "pgscript/pgsScanner.ll"
1585
yylval->str = pnew wxString(query.c_str(), m_conv);
1586
query.clear(); unput(')'); yylloc->end.columns(-1);
1587
BEGIN(INITIAL); m_parent = 0; return query_token;
1597
#line 287 "pgscript/pgsScanner.ll"
1598
{ query += yytext; yylloc->step(); }
1601
/* rule 121 can match eol */
1603
#line 288 "pgscript/pgsScanner.ll"
1604
{ query += yytext; yylloc->lines(yyleng); yylloc->step(); }
1606
case YY_STATE_EOF(SC_QUERY):
1607
#line 289 "pgscript/pgsScanner.ll"
1608
{ yylval->str = pnew wxString(query.c_str(), m_conv);
1609
query.clear(); m_parent = 0; return query_token; }
1613
#line 291 "pgscript/pgsScanner.ll"
1614
{ yylloc->columns(columns(*yytext)); query += yytext; }
1620
#line 295 "pgscript/pgsScanner.ll"
1622
if (std::string(yytext) == dollar) BEGIN(SC_QUERY); }
1626
#line 297 "pgscript/pgsScanner.ll"
1627
{ query += yytext; yylloc->step(); }
1630
/* rule 125 can match eol */
1632
#line 298 "pgscript/pgsScanner.ll"
1633
{ query += yytext; yylloc->lines(yyleng); yylloc->step(); }
1635
case YY_STATE_EOF(SC_DOLLAR):
1636
#line 299 "pgscript/pgsScanner.ll"
1637
{ query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv);
1638
query.clear(); m_parent = 0; return query_token; }
1642
#line 301 "pgscript/pgsScanner.ll"
1643
{ yylloc->columns(columns(*yytext)); query += yytext; }
1649
#line 305 "pgscript/pgsScanner.ll"
1650
{ BEGIN(comment_caller); }
1654
#line 306 "pgscript/pgsScanner.ll"
1658
/* rule 129 can match eol */
1660
#line 307 "pgscript/pgsScanner.ll"
1661
{ yylloc->lines(yyleng); yylloc->step(); }
1665
#line 308 "pgscript/pgsScanner.ll"
1666
{ yylloc->columns(columns(*yytext)); }
1672
#line 312 "pgscript/pgsScanner.ll"
1674
if (string_caller == SC_QUERY)
1682
#line 318 "pgscript/pgsScanner.ll"
1684
if (string_caller == SC_QUERY)
1687
str += *(yytext + 1);
1688
yylloc->columns(columns(*(yytext + 1)));
1693
#line 325 "pgscript/pgsScanner.ll"
1695
if (string_caller == SC_QUERY)
1698
BEGIN(string_caller);
1702
yylval->str = pnew wxString(str.c_str(), m_conv);
1704
BEGIN(string_caller);
1705
return token::PGS_VAL_STR;
1711
#line 339 "pgscript/pgsScanner.ll"
1713
if (string_caller == SC_QUERY)
1721
/* rule 135 can match eol */
1723
#line 346 "pgscript/pgsScanner.ll"
1725
if (string_caller == SC_QUERY)
1729
yylloc->lines(yyleng); yylloc->step();
1732
case YY_STATE_EOF(SC_STRING):
1733
#line 353 "pgscript/pgsScanner.ll"
1735
if (string_caller == SC_QUERY)
1737
query += yytext; yylval->str = pnew wxString(query.c_str(), m_conv);
1738
query.clear(); m_parent = 0; return query_token;
1742
yylval->str = pnew wxString(str.c_str(), m_conv);
1744
BEGIN(string_caller);
1745
return token::PGS_VAL_STR;
1751
#line 367 "pgscript/pgsScanner.ll"
1753
if (string_caller == SC_QUERY)
1757
yylloc->columns(columns(*yytext));
1763
#line 376 "pgscript/pgsScanner.ll"
1766
#line 1764 "pgscript/lex.pgs.cc"
1767
case YY_STATE_EOF(INITIAL):
1768
case YY_STATE_EOF(SC_COMMENT):
1771
case YY_END_OF_BUFFER:
1773
/* Amount of text matched not including the EOB char. */
1774
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1776
/* Undo the effects of YY_DO_BEFORE_ACTION. */
1777
*yy_cp = (yy_hold_char);
1778
YY_RESTORE_YY_MORE_OFFSET
1780
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1782
/* We're scanning a new file or input source. It's
1783
* possible that this happened because the user
1784
* just pointed yyin at a new source and called
1785
* yylex(). If so, then we have to assure
1786
* consistency between YY_CURRENT_BUFFER and our
1787
* globals. Here is the right place to do so, because
1788
* this is the first action (other than possibly a
1789
* back-up) that will match for the new input source.
1791
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1792
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1793
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1796
/* Note that here we test for yy_c_buf_p "<=" to the position
1797
* of the first EOB in the buffer, since yy_c_buf_p will
1798
* already have been incremented past the NUL character
1799
* (since all states make transitions on EOB to the
1800
* end-of-buffer state). Contrast this with the test
1803
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1804
{ /* This was really a NUL. */
1805
yy_state_type yy_next_state;
1807
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1809
yy_current_state = yy_get_previous_state( );
1811
/* Okay, we're now positioned to make the NUL
1812
* transition. We couldn't have
1813
* yy_get_previous_state() go ahead and do it
1814
* for us because it doesn't know how to deal
1815
* with the possibility of jamming (and we don't
1816
* want to build jamming into it because then it
1817
* will run more slowly).
1820
yy_next_state = yy_try_NUL_trans( yy_current_state );
1822
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1824
if ( yy_next_state )
1826
/* Consume the NUL. */
1827
yy_cp = ++(yy_c_buf_p);
1828
yy_current_state = yy_next_state;
1834
yy_cp = (yy_last_accepting_cpos);
1835
yy_current_state = (yy_last_accepting_state);
1836
goto yy_find_action;
1840
else switch ( yy_get_next_buffer( ) )
1842
case EOB_ACT_END_OF_FILE:
1844
(yy_did_buffer_switch_on_eof) = 0;
1848
/* Note: because we've taken care in
1849
* yy_get_next_buffer() to have set up
1850
* yytext, we can now set up
1851
* yy_c_buf_p so that if some total
1852
* hoser (like flex itself) wants to
1853
* call the scanner after we return the
1854
* YY_NULL, it'll still work - another
1855
* YY_NULL will get returned.
1857
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1859
yy_act = YY_STATE_EOF(YY_START);
1865
if ( ! (yy_did_buffer_switch_on_eof) )
1871
case EOB_ACT_CONTINUE_SCAN:
1873
(yytext_ptr) + yy_amount_of_matched_text;
1875
yy_current_state = yy_get_previous_state( );
1877
yy_cp = (yy_c_buf_p);
1878
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1881
case EOB_ACT_LAST_MATCH:
1883
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1885
yy_current_state = yy_get_previous_state( );
1887
yy_cp = (yy_c_buf_p);
1888
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1889
goto yy_find_action;
1896
"fatal flex scanner internal error--no action found" );
1897
} /* end of action switch */
1898
} /* end of scanning one token */
1899
} /* end of yylex */
1901
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1909
yylineno = 1; // this will only get updated if %option yylineno
1911
yy_did_buffer_switch_on_eof = 0;
1913
yy_looking_for_trail_begin = 0;
1916
yy_more_offset = yy_prev_more_offset = 0;
1918
yy_start_stack_ptr = yy_start_stack_depth = 0;
1919
yy_start_stack = NULL;
1921
(yy_buffer_stack) = 0;
1922
(yy_buffer_stack_top) = 0;
1923
(yy_buffer_stack_max) = 0;
1929
yyFlexLexer::~yyFlexLexer()
1931
delete [] yy_state_buf;
1932
pgsfree(yy_start_stack );
1933
yy_delete_buffer( YY_CURRENT_BUFFER );
1936
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1940
yy_delete_buffer( YY_CURRENT_BUFFER );
1941
yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
1948
#ifdef YY_INTERACTIVE
1949
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1951
int yyFlexLexer::LexerInput( char* buf, int max_size )
1954
if ( yyin->eof() || yyin->fail() )
1957
#ifdef YY_INTERACTIVE
1958
yyin->get( buf[0] );
1969
(void) yyin->read( buf, max_size );
1974
return yyin->gcount();
1978
void yyFlexLexer::LexerOutput( const char* buf, int size )
1980
(void) yyout->write( buf, size );
1983
/* yy_get_next_buffer - try to read in a new buffer
1985
* Returns a code representing an action:
1986
* EOB_ACT_LAST_MATCH -
1987
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1988
* EOB_ACT_END_OF_FILE - end of file
1990
int yyFlexLexer::yy_get_next_buffer()
1992
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1993
register char *source = (yytext_ptr);
1994
register int number_to_move, i;
1997
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1999
"fatal flex scanner internal error--end of buffer missed" );
2001
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2002
{ /* Don't try to fill the buffer, so this is an EOF. */
2003
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2005
/* We matched a single character, the EOB, so
2006
* treat this as a final EOF.
2008
return EOB_ACT_END_OF_FILE;
2013
/* We matched some text prior to the EOB, first
2016
return EOB_ACT_LAST_MATCH;
2020
/* Try to read more data. */
2022
/* First move last chars to start of buffer. */
2023
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2025
for ( i = 0; i < number_to_move; ++i )
2026
*(dest++) = *(source++);
2028
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2029
/* don't do the read, it's not guaranteed to return an EOF,
2032
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2037
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2039
while ( num_to_read <= 0 )
2040
{ /* Not enough room in the buffer - grow it. */
2042
/* just a shorter name for the current buffer */
2043
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2045
int yy_c_buf_p_offset =
2046
(int) ((yy_c_buf_p) - b->yy_ch_buf);
2048
if ( b->yy_is_our_buffer )
2050
int new_size = b->yy_buf_size * 2;
2052
if ( new_size <= 0 )
2053
b->yy_buf_size += b->yy_buf_size / 8;
2055
b->yy_buf_size *= 2;
2057
b->yy_ch_buf = (char *)
2058
/* Include room in for 2 EOB chars. */
2059
pgsrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
2062
/* Can't grow it, we don't own it. */
2065
if ( ! b->yy_ch_buf )
2067
"fatal error - scanner input buffer overflow" );
2069
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2071
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2076
if ( num_to_read > YY_READ_BUF_SIZE )
2077
num_to_read = YY_READ_BUF_SIZE;
2079
/* Read in more data. */
2080
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2081
(yy_n_chars), num_to_read );
2083
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2086
if ( (yy_n_chars) == 0 )
2088
if ( number_to_move == YY_MORE_ADJ )
2090
ret_val = EOB_ACT_END_OF_FILE;
2096
ret_val = EOB_ACT_LAST_MATCH;
2097
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2098
YY_BUFFER_EOF_PENDING;
2103
ret_val = EOB_ACT_CONTINUE_SCAN;
2105
(yy_n_chars) += number_to_move;
2106
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2107
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2109
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2114
/* yy_get_previous_state - get the state just before the EOB char was reached */
2116
yy_state_type yyFlexLexer::yy_get_previous_state()
2118
register yy_state_type yy_current_state;
2119
register char *yy_cp;
2121
yy_current_state = (yy_start);
2123
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2125
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2126
if ( yy_accept[yy_current_state] )
2128
(yy_last_accepting_state) = yy_current_state;
2129
(yy_last_accepting_cpos) = yy_cp;
2131
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2133
yy_current_state = (int) yy_def[yy_current_state];
2134
if ( yy_current_state >= 444 )
2135
yy_c = yy_meta[(unsigned int) yy_c];
2137
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2140
return yy_current_state;
2143
/* yy_try_NUL_trans - try to make a transition on the NUL character
2146
* next_state = yy_try_NUL_trans( current_state );
2148
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
2150
register int yy_is_jam;
2151
register char *yy_cp = (yy_c_buf_p);
2153
register YY_CHAR yy_c = 1;
2154
if ( yy_accept[yy_current_state] )
2156
(yy_last_accepting_state) = yy_current_state;
2157
(yy_last_accepting_cpos) = yy_cp;
2159
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2161
yy_current_state = (int) yy_def[yy_current_state];
2162
if ( yy_current_state >= 444 )
2163
yy_c = yy_meta[(unsigned int) yy_c];
2165
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2166
yy_is_jam = (yy_current_state == 443);
2168
return yy_is_jam ? 0 : yy_current_state;
2171
void yyFlexLexer::yyunput( int c, register char* yy_bp)
2173
register char *yy_cp;
2175
yy_cp = (yy_c_buf_p);
2177
/* undo effects of setting up yytext */
2178
*yy_cp = (yy_hold_char);
2180
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2181
{ /* need to shift things up to make room */
2182
/* +2 for EOB chars. */
2183
register int number_to_move = (yy_n_chars) + 2;
2184
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2185
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2186
register char *source =
2187
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2189
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2190
*--dest = *--source;
2192
yy_cp += (int) (dest - source);
2193
yy_bp += (int) (dest - source);
2194
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2195
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2197
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2198
YY_FATAL_ERROR( "flex scanner push-back overflow" );
2201
*--yy_cp = (char) c;
2203
(yytext_ptr) = yy_bp;
2204
(yy_hold_char) = *yy_cp;
2205
(yy_c_buf_p) = yy_cp;
2208
int yyFlexLexer::yyinput()
2212
*(yy_c_buf_p) = (yy_hold_char);
2214
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2216
/* yy_c_buf_p now points to the character we want to return.
2217
* If this occurs *before* the EOB characters, then it's a
2218
* valid NUL; if not, then we've hit the end of the buffer.
2220
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2221
/* This was really a NUL. */
2222
*(yy_c_buf_p) = '\0';
2225
{ /* need more input */
2226
int offset = (yy_c_buf_p) - (yytext_ptr);
2229
switch ( yy_get_next_buffer( ) )
2231
case EOB_ACT_LAST_MATCH:
2232
/* This happens because yy_g_n_b()
2233
* sees that we've accumulated a
2234
* token and flags that we need to
2235
* try matching the token before
2236
* proceeding. But for input(),
2237
* there's no matching to consider.
2238
* So convert the EOB_ACT_LAST_MATCH
2239
* to EOB_ACT_END_OF_FILE.
2242
/* Reset buffer status. */
2247
case EOB_ACT_END_OF_FILE:
2252
if ( ! (yy_did_buffer_switch_on_eof) )
2261
case EOB_ACT_CONTINUE_SCAN:
2262
(yy_c_buf_p) = (yytext_ptr) + offset;
2268
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2269
*(yy_c_buf_p) = '\0'; /* preserve yytext */
2270
(yy_hold_char) = *++(yy_c_buf_p);
2275
/** Immediately switch to a different input stream.
2276
* @param input_file A readable stream.
2278
* @note This function does not reset the start condition to @c INITIAL .
2280
void yyFlexLexer::yyrestart( std::istream* input_file )
2283
if ( ! YY_CURRENT_BUFFER ){
2284
yyensure_buffer_stack ();
2285
YY_CURRENT_BUFFER_LVALUE =
2286
yy_create_buffer( yyin, YY_BUF_SIZE );
2289
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
2290
yy_load_buffer_state( );
2293
/** Switch to a different input buffer.
2294
* @param new_buffer The new input buffer.
2297
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2300
/* TODO. We should be able to replace this entire function body
2302
* yypop_buffer_state();
2303
* yypush_buffer_state(new_buffer);
2305
yyensure_buffer_stack ();
2306
if ( YY_CURRENT_BUFFER == new_buffer )
2309
if ( YY_CURRENT_BUFFER )
2311
/* Flush out information for old buffer. */
2312
*(yy_c_buf_p) = (yy_hold_char);
2313
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2314
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2317
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2318
yy_load_buffer_state( );
2320
/* We don't actually know whether we did this switch during
2321
* EOF (yywrap()) processing, but the only time this flag
2322
* is looked at is after yywrap() is called, so it's safe
2323
* to go ahead and always set it.
2325
(yy_did_buffer_switch_on_eof) = 1;
2328
void yyFlexLexer::yy_load_buffer_state()
2330
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2331
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2332
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2333
(yy_hold_char) = *(yy_c_buf_p);
2336
/** Allocate and initialize an input buffer state.
2337
* @param file A readable stream.
2338
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2340
* @return the allocated buffer state.
2342
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2346
b = (YY_BUFFER_STATE) pgsalloc(sizeof( struct yy_buffer_state ) );
2348
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2350
b->yy_buf_size = size;
2352
/* yy_ch_buf has to be 2 characters longer than the size given because
2353
* we need to put in 2 end-of-buffer characters.
2355
b->yy_ch_buf = (char *) pgsalloc(b->yy_buf_size + 2 );
2356
if ( ! b->yy_ch_buf )
2357
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2359
b->yy_is_our_buffer = 1;
2361
yy_init_buffer( b, file );
2366
/** Destroy the buffer.
2367
* @param b a buffer created with yy_create_buffer()
2370
void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2376
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2377
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2379
if ( b->yy_is_our_buffer )
2380
pgsfree((void *) b->yy_ch_buf );
2382
pgsfree((void *) b );
2385
/* Initializes or reinitializes a buffer.
2386
* This function is sometimes called more than once on the same buffer,
2387
* such as during a yyrestart() or at EOF.
2389
void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2394
yy_flush_buffer( b );
2396
b->yy_input_file = file;
2397
b->yy_fill_buffer = 1;
2399
/* If b is the current buffer, then yy_init_buffer was _probably_
2400
* called from yyrestart() or through yy_get_next_buffer.
2401
* In that case, we don't want to reset the lineno or column.
2403
if (b != YY_CURRENT_BUFFER){
2404
b->yy_bs_lineno = 1;
2405
b->yy_bs_column = 0;
2408
b->yy_is_interactive = 0;
2412
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2413
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2416
void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2423
/* We always need two end-of-buffer characters. The first causes
2424
* a transition to the end-of-buffer state. The second causes
2425
* a jam in that state.
2427
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2428
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2430
b->yy_buf_pos = &b->yy_ch_buf[0];
2433
b->yy_buffer_status = YY_BUFFER_NEW;
2435
if ( b == YY_CURRENT_BUFFER )
2436
yy_load_buffer_state( );
2439
/** Pushes the new state onto the stack. The new state becomes
2440
* the current state. This function will allocate the stack
2442
* @param new_buffer The new state.
2445
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2447
if (new_buffer == NULL)
2450
yyensure_buffer_stack();
2452
/* This block is copied from yy_switch_to_buffer. */
2453
if ( YY_CURRENT_BUFFER )
2455
/* Flush out information for old buffer. */
2456
*(yy_c_buf_p) = (yy_hold_char);
2457
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2458
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2461
/* Only push if top exists. Otherwise, replace top. */
2462
if (YY_CURRENT_BUFFER)
2463
(yy_buffer_stack_top)++;
2464
YY_CURRENT_BUFFER_LVALUE = new_buffer;
2466
/* copied from yy_switch_to_buffer. */
2467
yy_load_buffer_state( );
2468
(yy_did_buffer_switch_on_eof) = 1;
2471
/** Removes and deletes the top of the stack, if present.
2472
* The next element becomes the new top.
2475
void yyFlexLexer::yypop_buffer_state (void)
2477
if (!YY_CURRENT_BUFFER)
2480
yy_delete_buffer(YY_CURRENT_BUFFER );
2481
YY_CURRENT_BUFFER_LVALUE = NULL;
2482
if ((yy_buffer_stack_top) > 0)
2483
--(yy_buffer_stack_top);
2485
if (YY_CURRENT_BUFFER) {
2486
yy_load_buffer_state( );
2487
(yy_did_buffer_switch_on_eof) = 1;
2491
/* Allocates the stack if it does not exist.
2492
* Guarantees space for at least one push.
2494
void yyFlexLexer::yyensure_buffer_stack(void)
2498
if (!(yy_buffer_stack)) {
2500
/* First allocation is just for 2 elements, since we don't know if this
2501
* scanner will even need a stack. We use 2 instead of 1 to avoid an
2502
* immediate realloc on the next call.
2505
(yy_buffer_stack) = (struct yy_buffer_state**)pgsalloc
2506
(num_to_alloc * sizeof(struct yy_buffer_state*)
2509
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2511
(yy_buffer_stack_max) = num_to_alloc;
2512
(yy_buffer_stack_top) = 0;
2516
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2518
/* Increase the buffer to prepare for a possible push. */
2519
int grow_size = 8 /* arbitrary grow size */;
2521
num_to_alloc = (yy_buffer_stack_max) + grow_size;
2522
(yy_buffer_stack) = (struct yy_buffer_state**)pgsrealloc
2524
num_to_alloc * sizeof(struct yy_buffer_state*)
2527
/* zero only the new slots.*/
2528
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2529
(yy_buffer_stack_max) = num_to_alloc;
2533
void yyFlexLexer::yy_push_state( int new_state )
2535
if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
2539
(yy_start_stack_depth) += YY_START_STACK_INCR;
2540
new_size = (yy_start_stack_depth) * sizeof( int );
2542
if ( ! (yy_start_stack) )
2543
(yy_start_stack) = (int *) pgsalloc(new_size );
2546
(yy_start_stack) = (int *) pgsrealloc((void *) (yy_start_stack),new_size );
2548
if ( ! (yy_start_stack) )
2550
"out of memory expanding start-condition stack" );
2553
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
2558
void yyFlexLexer::yy_pop_state()
2560
if ( --(yy_start_stack_ptr) < 0 )
2561
YY_FATAL_ERROR( "start-condition stack underflow" );
2563
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
2566
int yyFlexLexer::yy_top_state()
2568
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
2571
#ifndef YY_EXIT_FAILURE
2572
#define YY_EXIT_FAILURE 2
2575
void yyFlexLexer::LexerError( yyconst char msg[] )
2577
std::cerr << msg << std::endl;
2578
exit( YY_EXIT_FAILURE );
2581
/* Redefine yyless() so it works in section 3 code. */
2587
/* Undo effects of setting up yytext. */ \
2588
int yyless_macro_arg = (n); \
2589
YY_LESS_LINENO(yyless_macro_arg);\
2590
yytext[yyleng] = (yy_hold_char); \
2591
(yy_c_buf_p) = yytext + yyless_macro_arg; \
2592
(yy_hold_char) = *(yy_c_buf_p); \
2593
*(yy_c_buf_p) = '\0'; \
2594
yyleng = yyless_macro_arg; \
2598
/* Accessor methods (get/set functions) to struct members. */
2601
* Internal utility routines.
2605
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2608
for ( i = 0; i < n; ++i )
2613
#ifdef YY_NEED_STRLEN
2614
static int yy_flex_strlen (yyconst char * s )
2617
for ( n = 0; s[n]; ++n )
2624
void *pgsalloc (yy_size_t size )
2626
return (void *) malloc( size );
2629
void *pgsrealloc (void * ptr, yy_size_t size )
2631
/* The cast to (char *) in the following accommodates both
2632
* implementations that use char* generic pointers, and those
2633
* that use void* generic pointers. It works with the latter
2634
* because both ANSI C and C++ allow castless assignment from
2635
* any pointer type to void*, and deal with argument conversions
2636
* as though doing an assignment.
2638
return (void *) realloc( (char *) ptr, size );
2641
void pgsfree (void * ptr )
2643
free( (char *) ptr ); /* see pgsrealloc() for (char *) cast */
2646
#define YYTABLES_NAME "yytables"
2648
#line 376 "pgscript/pgsScanner.ll"
2655
pgsScanner::pgsScanner(wxMBConv & conv, std::istream * in, std::ostream * out) :
2656
pgsFlexLexer(in, out), m_parent(0), m_conv(conv)
2661
pgsScanner::~pgsScanner()
2666
void pgsScanner::set_debug(bool b)
2671
int pgsScanner::columns(const char & c)
2673
if ((c & 0xF0) == 0xF0) // 4 bytes
2675
else if ((c & 0xE0) == 0xE0) // 3 bytes
2677
else if ((c & 0xC0) == 0xC0) // 2 bytes
2684
/* This implementation of pgsFlexLexer::yylex() is required to fill the
2685
* vtable of the class pgsFlexLexer. We define the scanner's main yylex
2686
* function via YY_DECL to reside in the pgsScanner class instead. */
2692
int pgsFlexLexer::yylex()