1
#line 2 "PetriEngine/PQL/PQLQueryTokens.lexer.cpp"
3
#line 4 "PetriEngine/PQL/PQLQueryTokens.lexer.cpp"
5
#define YY_INT_ALIGNED short int
7
/* A lexical scanner generated by flex */
9
#define yy_create_buffer pqlq_create_buffer
10
#define yy_delete_buffer pqlq_delete_buffer
11
#define yy_flex_debug pqlq_flex_debug
12
#define yy_init_buffer pqlq_init_buffer
13
#define yy_flush_buffer pqlq_flush_buffer
14
#define yy_load_buffer_state pqlq_load_buffer_state
15
#define yy_switch_to_buffer pqlq_switch_to_buffer
17
#define yyleng pqlqleng
19
#define yylineno pqlqlineno
21
#define yyrestart pqlqrestart
22
#define yytext pqlqtext
23
#define yywrap pqlqwrap
24
#define yyalloc pqlqalloc
25
#define yyrealloc pqlqrealloc
26
#define yyfree pqlqfree
29
#define YY_FLEX_MAJOR_VERSION 2
30
#define YY_FLEX_MINOR_VERSION 6
31
#define YY_FLEX_SUBMINOR_VERSION 1
32
#if YY_FLEX_SUBMINOR_VERSION > 0
36
/* First, we deal with platform-specific or compiler-specific issues. */
38
/* begin standard C headers. */
44
/* end standard C headers. */
46
/* flex integer type definitions */
51
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56
* if you want the limit (max/min) macros for int types.
58
#ifndef __STDC_LIMIT_MACROS
59
#define __STDC_LIMIT_MACROS 1
63
typedef int8_t flex_int8_t;
64
typedef uint8_t flex_uint8_t;
65
typedef int16_t flex_int16_t;
66
typedef uint16_t flex_uint16_t;
67
typedef int32_t flex_int32_t;
68
typedef uint32_t flex_uint32_t;
70
typedef signed char flex_int8_t;
71
typedef short int flex_int16_t;
72
typedef int flex_int32_t;
73
typedef unsigned char flex_uint8_t;
74
typedef unsigned short int flex_uint16_t;
75
typedef unsigned int flex_uint32_t;
77
/* Limits of integral types. */
79
#define INT8_MIN (-128)
82
#define INT16_MIN (-32767-1)
85
#define INT32_MIN (-2147483647-1)
88
#define INT8_MAX (127)
91
#define INT16_MAX (32767)
94
#define INT32_MAX (2147483647)
97
#define UINT8_MAX (255U)
100
#define UINT16_MAX (65535U)
103
#define UINT32_MAX (4294967295U)
108
#endif /* ! FLEXINT_H */
110
/* TODO: this is always defined, so inline it */
111
#define yyconst const
113
#if defined(__GNUC__) && __GNUC__ >= 3
114
#define yynoreturn __attribute__((__noreturn__))
119
/* Returned upon end-of-file. */
122
/* Promotes a possibly negative, possibly signed char to an unsigned
123
* integer for use as an array index. If the signed char is negative,
124
* we want to instead treat it as an 8-bit unsigned char, hence the
127
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
129
/* Enter a start condition. This macro really ought to take a parameter,
130
* but we do it the disgusting crufty way forced on us by the ()-less
131
* definition of BEGIN.
133
#define BEGIN (yy_start) = 1 + 2 *
135
/* Translate the current start state into a value that can be later handed
136
* to BEGIN to return to the state. The YYSTATE alias is for lex
139
#define YY_START (((yy_start) - 1) / 2)
140
#define YYSTATE YY_START
142
/* Action number for EOF rule of a given start state. */
143
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
145
/* Special action meaning "start processing a new file". */
146
#define YY_NEW_FILE pqlqrestart(pqlqin )
148
#define YY_END_OF_BUFFER_CHAR 0
150
/* Size of default input buffer. */
153
/* On IA-64, the buffer size is 16k, not 8k.
154
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
155
* Ditto for the __ia64__ case accordingly.
157
#define YY_BUF_SIZE 32768
159
#define YY_BUF_SIZE 16384
160
#endif /* __ia64__ */
163
/* The state buf must be large enough to hold one state per character in the main buffer.
165
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
167
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
168
#define YY_TYPEDEF_YY_BUFFER_STATE
169
typedef struct yy_buffer_state *YY_BUFFER_STATE;
172
#ifndef YY_TYPEDEF_YY_SIZE_T
173
#define YY_TYPEDEF_YY_SIZE_T
174
typedef size_t yy_size_t;
179
extern FILE *pqlqin, *pqlqout;
181
#define EOB_ACT_CONTINUE_SCAN 0
182
#define EOB_ACT_END_OF_FILE 1
183
#define EOB_ACT_LAST_MATCH 2
185
#define YY_LESS_LINENO(n)
186
#define YY_LINENO_REWIND_TO(ptr)
188
/* Return all but the first "n" matched characters back to the input stream. */
192
/* Undo effects of setting up pqlqtext. */ \
193
yy_size_t yyless_macro_arg = (n); \
194
YY_LESS_LINENO(yyless_macro_arg);\
195
*yy_cp = (yy_hold_char); \
196
YY_RESTORE_YY_MORE_OFFSET \
197
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
198
YY_DO_BEFORE_ACTION; /* set up pqlqtext again */ \
202
#define unput(c) yyunput( c, (yytext_ptr) )
204
#ifndef YY_STRUCT_YY_BUFFER_STATE
205
#define YY_STRUCT_YY_BUFFER_STATE
206
struct yy_buffer_state
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
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 pqlqrestart()), so that the user can continue scanning by
262
* just pointing pqlqin at a new input file.
264
#define YY_BUFFER_EOF_PENDING 2
267
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
269
/* Stack of input buffers. */
270
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
271
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
272
static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
274
/* We provide macros for accessing buffer states in case in the
275
* future we want to put the buffer states in a more general
278
* Returns the top of the stack, or NULL.
280
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
281
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
284
/* Same as previous macro, but useful when we know that the buffer stack is not
285
* NULL or when we need an lvalue. For internal use only.
287
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
289
/* yy_hold_char holds the character lost when pqlqtext is formed. */
290
static char yy_hold_char;
291
static int yy_n_chars; /* number of characters read into yy_ch_buf */
294
/* Points to current character in buffer. */
295
static char *yy_c_buf_p = NULL;
296
static int yy_init = 0; /* whether we need to initialize */
297
static int yy_start = 0; /* start state number */
299
/* Flag which is used to allow pqlqwrap()'s to do buffer switches
300
* instead of setting up a fresh pqlqin. A bit of a hack ...
302
static int yy_did_buffer_switch_on_eof;
304
void pqlqrestart (FILE *input_file );
305
void pqlq_switch_to_buffer (YY_BUFFER_STATE new_buffer );
306
YY_BUFFER_STATE pqlq_create_buffer (FILE *file,int size );
307
void pqlq_delete_buffer (YY_BUFFER_STATE b );
308
void pqlq_flush_buffer (YY_BUFFER_STATE b );
309
void pqlqpush_buffer_state (YY_BUFFER_STATE new_buffer );
310
void pqlqpop_buffer_state (void );
312
static void pqlqensure_buffer_stack (void );
313
static void pqlq_load_buffer_state (void );
314
static void pqlq_init_buffer (YY_BUFFER_STATE b,FILE *file );
316
#define YY_FLUSH_BUFFER pqlq_flush_buffer(YY_CURRENT_BUFFER )
318
YY_BUFFER_STATE pqlq_scan_buffer (char *base,yy_size_t size );
319
YY_BUFFER_STATE pqlq_scan_string (yyconst char *yy_str );
320
YY_BUFFER_STATE pqlq_scan_bytes (yyconst char *bytes,int len );
322
void *pqlqalloc (yy_size_t );
323
void *pqlqrealloc (void *,yy_size_t );
324
void pqlqfree (void * );
326
#define yy_new_buffer pqlq_create_buffer
328
#define yy_set_interactive(is_interactive) \
330
if ( ! YY_CURRENT_BUFFER ){ \
331
pqlqensure_buffer_stack (); \
332
YY_CURRENT_BUFFER_LVALUE = \
333
pqlq_create_buffer(pqlqin,YY_BUF_SIZE ); \
335
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
338
#define yy_set_bol(at_bol) \
340
if ( ! YY_CURRENT_BUFFER ){\
341
pqlqensure_buffer_stack (); \
342
YY_CURRENT_BUFFER_LVALUE = \
343
pqlq_create_buffer(pqlqin,YY_BUF_SIZE ); \
345
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
348
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
350
/* Begin user sect3 */
352
typedef unsigned char YY_CHAR;
354
FILE *pqlqin = NULL, *pqlqout = NULL;
356
typedef int yy_state_type;
358
extern int pqlqlineno;
362
extern char *pqlqtext;
366
#define yytext_ptr pqlqtext
368
static yy_state_type yy_get_previous_state (void );
369
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
370
static int yy_get_next_buffer (void );
371
static void yynoreturn yy_fatal_error (yyconst char* msg );
373
/* Done after the current pattern has been matched and before the
374
* corresponding action - sets up pqlqtext.
376
#define YY_DO_BEFORE_ACTION \
377
(yytext_ptr) = yy_bp; \
378
pqlqleng = (int) (yy_cp - yy_bp); \
379
(yy_hold_char) = *yy_cp; \
381
(yy_c_buf_p) = yy_cp;
383
#define YY_NUM_RULES 30
384
#define YY_END_OF_BUFFER 31
385
/* This struct is not used in this scanner,
386
but its presence is necessary. */
389
flex_int32_t yy_verify;
392
static yyconst flex_int16_t yy_accept[69] =
394
0, 0, 31, 29, 1, 1, 16, 29, 29, 23,
395
24, 27, 25, 26, 12, 19, 28, 21, 11, 11,
396
11, 11, 11, 11, 11, 11, 11, 11, 29, 18,
397
0, 13, 0, 14, 12, 20, 17, 22, 11, 11,
398
11, 8, 11, 11, 11, 11, 7, 11, 15, 0,
399
13, 0, 6, 10, 5, 11, 11, 9, 11, 11,
400
11, 2, 11, 3, 11, 11, 4, 0
403
static yyconst YY_CHAR yy_ec[256] =
405
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
406
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
407
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408
1, 2, 4, 5, 1, 1, 1, 6, 1, 7,
409
8, 9, 10, 1, 11, 1, 1, 12, 12, 12,
410
12, 12, 12, 12, 12, 12, 12, 1, 1, 13,
411
14, 15, 1, 1, 16, 17, 17, 18, 17, 17,
412
17, 17, 17, 17, 17, 17, 17, 19, 20, 17,
413
17, 21, 17, 22, 17, 17, 17, 17, 17, 17,
414
1, 23, 1, 1, 17, 1, 24, 17, 25, 26,
416
27, 28, 17, 17, 17, 17, 29, 30, 17, 31,
417
32, 17, 17, 33, 34, 35, 36, 17, 17, 17,
418
17, 17, 1, 37, 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,
424
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
425
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435
static yyconst YY_CHAR yy_meta[38] =
437
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438
1, 2, 1, 1, 1, 2, 2, 2, 2, 2,
439
2, 2, 1, 2, 2, 2, 2, 2, 2, 2,
443
static yyconst flex_uint16_t yy_base[72] =
445
0, 0, 89, 90, 90, 90, 74, 33, 81, 90,
446
90, 90, 90, 90, 74, 71, 70, 69, 63, 0,
447
61, 59, 48, 51, 53, 44, 42, 41, 36, 90,
448
34, 90, 37, 90, 60, 90, 90, 90, 0, 53,
449
48, 0, 43, 39, 32, 23, 0, 19, 90, 36,
450
38, 41, 0, 0, 0, 28, 19, 0, 25, 21,
451
23, 0, 17, 0, 23, 18, 0, 90, 64, 43,
455
static yyconst flex_int16_t yy_def[72] =
457
68, 1, 68, 68, 68, 68, 68, 69, 68, 68,
458
68, 68, 68, 68, 68, 68, 68, 68, 70, 70,
459
70, 70, 70, 70, 70, 70, 70, 70, 68, 68,
460
69, 68, 71, 68, 68, 68, 68, 68, 70, 70,
461
70, 70, 70, 70, 70, 70, 70, 70, 68, 69,
462
69, 71, 70, 70, 70, 70, 70, 70, 70, 70,
463
70, 70, 70, 70, 70, 70, 70, 0, 68, 68,
467
static yyconst flex_uint16_t yy_nxt[128] =
469
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
470
14, 15, 16, 17, 18, 19, 20, 20, 21, 22,
471
20, 20, 4, 23, 20, 24, 20, 25, 20, 20,
472
26, 27, 20, 20, 28, 20, 29, 32, 32, 31,
473
32, 51, 32, 31, 39, 51, 67, 66, 65, 64,
474
63, 62, 61, 60, 59, 33, 33, 58, 33, 52,
475
33, 57, 56, 52, 31, 31, 50, 50, 55, 54,
476
53, 35, 49, 48, 47, 46, 45, 44, 43, 42,
477
41, 40, 38, 37, 36, 35, 34, 30, 68, 3,
478
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
480
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
481
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
482
68, 68, 68, 68, 68, 68, 68
485
static yyconst flex_int16_t yy_chk[128] =
487
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
488
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
489
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
490
1, 1, 1, 1, 1, 1, 1, 8, 31, 33,
491
50, 33, 51, 52, 70, 52, 66, 65, 63, 61,
492
60, 59, 57, 56, 48, 8, 31, 46, 50, 33,
493
51, 45, 44, 52, 69, 69, 71, 71, 43, 41,
494
40, 35, 29, 28, 27, 26, 25, 24, 23, 22,
495
21, 19, 18, 17, 16, 15, 9, 7, 3, 68,
496
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
498
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
499
68, 68, 68, 68, 68, 68, 68, 68, 68, 68,
500
68, 68, 68, 68, 68, 68, 68
503
static yy_state_type yy_last_accepting_state;
504
static char *yy_last_accepting_cpos;
506
extern int pqlq_flex_debug;
507
int pqlq_flex_debug = 0;
509
/* The intent behind this definition is that it'll catch
510
* any uses of REJECT which flex missed.
512
#define REJECT reject_used_but_not_detected
513
#define yymore() yymore_used_but_not_detected
514
#define YY_MORE_ADJ 0
515
#define YY_RESTORE_YY_MORE_OFFSET
517
#line 1 "PetriEngine/PQL/PQLQueryTokens.l"
518
#line 2 "PetriEngine/PQL/PQLQueryTokens.l"
522
#include "PQLQueryParser.parser.hpp"
524
#define SAVE_TOKEN pqlqlval.string = new std::string(pqlqtext, pqlqleng)
525
#define SAVE_QUOTED_TOKEN pqlqlval.string = new std::string(pqlqtext+1, pqlqleng-2)
526
#define TOKEN(t) (pqlqlval.token = t)
529
#pragma clang diagnostic push
530
#pragma clang diagnostic ignored "-Wkeyword-macro"
531
#pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
534
#define register // Deprecated in C++11.
535
extern "C" int pqlqwrap(){return 1;}
536
extern std::shared_ptr<PetriEngine::PQL::Condition> query;
537
extern int pqlqparse();
538
#line 539 "PetriEngine/PQL/PQLQueryTokens.lexer.cpp"
542
#ifndef YY_NO_UNISTD_H
543
/* Special case for "unistd.h", since it is non-ANSI. We include it way
544
* down here because we want the user's section 1 to have been scanned first.
545
* The user has a chance to override it with an option.
550
#ifndef YY_EXTRA_TYPE
551
#define YY_EXTRA_TYPE void *
554
static int yy_init_globals (void );
556
/* Accessor methods to globals.
557
These are made visible to non-reentrant scanners for convenience. */
559
int pqlqlex_destroy (void );
561
int pqlqget_debug (void );
563
void pqlqset_debug (int debug_flag );
565
YY_EXTRA_TYPE pqlqget_extra (void );
567
void pqlqset_extra (YY_EXTRA_TYPE user_defined );
569
FILE *pqlqget_in (void );
571
void pqlqset_in (FILE * _in_str );
573
FILE *pqlqget_out (void );
575
void pqlqset_out (FILE * _out_str );
577
int pqlqget_leng (void );
579
char *pqlqget_text (void );
581
int pqlqget_lineno (void );
583
void pqlqset_lineno (int _line_number );
585
/* Macros after this point can all be overridden by user definitions in
589
#ifndef YY_SKIP_YYWRAP
591
extern "C" int pqlqwrap (void );
593
extern int pqlqwrap (void );
602
static void yy_flex_strncpy (char *,yyconst char *,int );
605
#ifdef YY_NEED_STRLEN
606
static int yy_flex_strlen (yyconst char * );
612
static int yyinput (void );
614
static int input (void );
619
/* Amount of stuff to slurp up with each read. */
620
#ifndef YY_READ_BUF_SIZE
622
/* On IA-64, the buffer size is 16k, not 8k */
623
#define YY_READ_BUF_SIZE 16384
625
#define YY_READ_BUF_SIZE 8192
626
#endif /* __ia64__ */
629
/* Copy whatever the last rule matched to the standard output. */
631
/* This used to be an fputs(), but since the string might contain NUL's,
632
* we now use fwrite().
634
#define ECHO do { if (fwrite( pqlqtext, (size_t) pqlqleng, 1, pqlqout )) {} } while (0)
637
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
638
* is returned in "result".
641
#define YY_INPUT(buf,result,max_size) \
642
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
646
for ( n = 0; n < max_size && \
647
(c = getc( pqlqin )) != EOF && c != '\n'; ++n ) \
650
buf[n++] = (char) c; \
651
if ( c == EOF && ferror( pqlqin ) ) \
652
YY_FATAL_ERROR( "input in flex scanner failed" ); \
658
while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, pqlqin)) == 0 && ferror(pqlqin)) \
660
if( errno != EINTR) \
662
YY_FATAL_ERROR( "input in flex scanner failed" ); \
673
/* No semi-colon after return; correct usage is to write "yyterminate();" -
674
* we don't want an extra ';' after the "return" because that will cause
675
* some compilers to complain about unreachable statements.
678
#define yyterminate() return YY_NULL
681
/* Number of entries by which start-condition stack grows. */
682
#ifndef YY_START_STACK_INCR
683
#define YY_START_STACK_INCR 25
686
/* Report a fatal error. */
687
#ifndef YY_FATAL_ERROR
688
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
691
/* end tables serialization structures and prototypes */
693
/* Default declaration of generated scanner - a define so the user can
694
* easily add parameters.
697
#define YY_DECL_IS_OURS 1
699
extern int pqlqlex (void);
701
#define YY_DECL int pqlqlex (void)
702
#endif /* !YY_DECL */
704
/* Code executed at the beginning of each rule, after pqlqtext and pqlqleng
707
#ifndef YY_USER_ACTION
708
#define YY_USER_ACTION
711
/* Code executed at the end of each rule. */
713
#define YY_BREAK /*LINTED*/break;
716
#define YY_RULE_SETUP \
719
/** The main scanner function which does all the work.
723
yy_state_type yy_current_state;
736
(yy_start) = 1; /* first start state */
744
if ( ! YY_CURRENT_BUFFER ) {
745
pqlqensure_buffer_stack ();
746
YY_CURRENT_BUFFER_LVALUE =
747
pqlq_create_buffer(pqlqin,YY_BUF_SIZE );
750
pqlq_load_buffer_state( );
754
#line 27 "PetriEngine/PQL/PQLQueryTokens.l"
757
#line 758 "PetriEngine/PQL/PQLQueryTokens.lexer.cpp"
759
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
761
yy_cp = (yy_c_buf_p);
763
/* Support of pqlqtext. */
764
*yy_cp = (yy_hold_char);
766
/* yy_bp points to the position in yy_ch_buf of the start of
771
yy_current_state = (yy_start);
775
YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
776
if ( yy_accept[yy_current_state] )
778
(yy_last_accepting_state) = yy_current_state;
779
(yy_last_accepting_cpos) = yy_cp;
781
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
783
yy_current_state = (int) yy_def[yy_current_state];
784
if ( yy_current_state >= 69 )
785
yy_c = yy_meta[(unsigned int) yy_c];
787
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
790
while ( yy_base[yy_current_state] != 90 );
793
yy_act = yy_accept[yy_current_state];
795
{ /* have to back up */
796
yy_cp = (yy_last_accepting_cpos);
797
yy_current_state = (yy_last_accepting_state);
798
yy_act = yy_accept[yy_current_state];
803
do_action: /* This label is used only to access EOF actions. */
806
{ /* beginning of action switch */
807
case 0: /* must back up */
808
/* undo the effects of YY_DO_BEFORE_ACTION */
809
*yy_cp = (yy_hold_char);
810
yy_cp = (yy_last_accepting_cpos);
811
yy_current_state = (yy_last_accepting_state);
815
/* rule 1 can match eol */
817
#line 29 "PetriEngine/PQL/PQLQueryTokens.l"
822
#line 30 "PetriEngine/PQL/PQLQueryTokens.l"
823
{return TOKEN(TRUE);}
827
#line 31 "PetriEngine/PQL/PQLQueryTokens.l"
828
{return TOKEN(FALSE);}
832
#line 32 "PetriEngine/PQL/PQLQueryTokens.l"
833
{return TOKEN(DEADLOCK);}
837
#line 33 "PetriEngine/PQL/PQLQueryTokens.l"
842
#line 34 "PetriEngine/PQL/PQLQueryTokens.l"
847
#line 35 "PetriEngine/PQL/PQLQueryTokens.l"
852
#line 36 "PetriEngine/PQL/PQLQueryTokens.l"
857
#line 37 "PetriEngine/PQL/PQLQueryTokens.l"
862
#line 38 "PetriEngine/PQL/PQLQueryTokens.l"
867
#line 39 "PetriEngine/PQL/PQLQueryTokens.l"
868
{SAVE_TOKEN; return ID;}
872
#line 40 "PetriEngine/PQL/PQLQueryTokens.l"
873
{SAVE_TOKEN; return INT;}
876
/* rule 13 can match eol */
878
#line 41 "PetriEngine/PQL/PQLQueryTokens.l"
879
{SAVE_QUOTED_TOKEN; return ID;}
883
#line 42 "PetriEngine/PQL/PQLQueryTokens.l"
888
#line 43 "PetriEngine/PQL/PQLQueryTokens.l"
893
#line 44 "PetriEngine/PQL/PQLQueryTokens.l"
898
#line 45 "PetriEngine/PQL/PQLQueryTokens.l"
899
{return TOKEN(EQUAL);}
903
#line 46 "PetriEngine/PQL/PQLQueryTokens.l"
904
{return TOKEN(NEQUAL);}
908
#line 47 "PetriEngine/PQL/PQLQueryTokens.l"
909
{return TOKEN(LESS);}
913
#line 48 "PetriEngine/PQL/PQLQueryTokens.l"
914
{return TOKEN(LESSEQUAL);}
918
#line 49 "PetriEngine/PQL/PQLQueryTokens.l"
919
{return TOKEN(GREATER);}
923
#line 50 "PetriEngine/PQL/PQLQueryTokens.l"
924
{return TOKEN(GREATEREQUAL);}
928
#line 51 "PetriEngine/PQL/PQLQueryTokens.l"
929
{return TOKEN(LPAREN);}
933
#line 52 "PetriEngine/PQL/PQLQueryTokens.l"
934
{return TOKEN(RPAREN);}
938
#line 53 "PetriEngine/PQL/PQLQueryTokens.l"
939
{return TOKEN(PLUS);}
943
#line 54 "PetriEngine/PQL/PQLQueryTokens.l"
944
{return TOKEN(MINUS);}
948
#line 55 "PetriEngine/PQL/PQLQueryTokens.l"
949
{return TOKEN(MULTIPLY);}
953
#line 56 "PetriEngine/PQL/PQLQueryTokens.l"
954
{return TOKEN(EQUAL);}
958
#line 57 "PetriEngine/PQL/PQLQueryTokens.l"
959
{printf("Unknown token %s!\n", pqlqtext); yyterminate();}
963
#line 59 "PetriEngine/PQL/PQLQueryTokens.l"
966
#line 967 "PetriEngine/PQL/PQLQueryTokens.lexer.cpp"
967
case YY_STATE_EOF(INITIAL):
970
case YY_END_OF_BUFFER:
972
/* Amount of text matched not including the EOB char. */
973
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
975
/* Undo the effects of YY_DO_BEFORE_ACTION. */
976
*yy_cp = (yy_hold_char);
977
YY_RESTORE_YY_MORE_OFFSET
979
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
981
/* We're scanning a new file or input source. It's
982
* possible that this happened because the user
983
* just pointed pqlqin at a new source and called
984
* pqlqlex(). If so, then we have to assure
985
* consistency between YY_CURRENT_BUFFER and our
986
* globals. Here is the right place to do so, because
987
* this is the first action (other than possibly a
988
* back-up) that will match for the new input source.
990
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
991
YY_CURRENT_BUFFER_LVALUE->yy_input_file = pqlqin;
992
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
995
/* Note that here we test for yy_c_buf_p "<=" to the position
996
* of the first EOB in the buffer, since yy_c_buf_p will
997
* already have been incremented past the NUL character
998
* (since all states make transitions on EOB to the
999
* end-of-buffer state). Contrast this with the test
1002
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1003
{ /* This was really a NUL. */
1004
yy_state_type yy_next_state;
1006
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1008
yy_current_state = yy_get_previous_state( );
1010
/* Okay, we're now positioned to make the NUL
1011
* transition. We couldn't have
1012
* yy_get_previous_state() go ahead and do it
1013
* for us because it doesn't know how to deal
1014
* with the possibility of jamming (and we don't
1015
* want to build jamming into it because then it
1016
* will run more slowly).
1019
yy_next_state = yy_try_NUL_trans( yy_current_state );
1021
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1023
if ( yy_next_state )
1025
/* Consume the NUL. */
1026
yy_cp = ++(yy_c_buf_p);
1027
yy_current_state = yy_next_state;
1033
yy_cp = (yy_c_buf_p);
1034
goto yy_find_action;
1038
else switch ( yy_get_next_buffer( ) )
1040
case EOB_ACT_END_OF_FILE:
1042
(yy_did_buffer_switch_on_eof) = 0;
1046
/* Note: because we've taken care in
1047
* yy_get_next_buffer() to have set up
1048
* pqlqtext, we can now set up
1049
* yy_c_buf_p so that if some total
1050
* hoser (like flex itself) wants to
1051
* call the scanner after we return the
1052
* YY_NULL, it'll still work - another
1053
* YY_NULL will get returned.
1055
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1057
yy_act = YY_STATE_EOF(YY_START);
1063
if ( ! (yy_did_buffer_switch_on_eof) )
1069
case EOB_ACT_CONTINUE_SCAN:
1071
(yytext_ptr) + yy_amount_of_matched_text;
1073
yy_current_state = yy_get_previous_state( );
1075
yy_cp = (yy_c_buf_p);
1076
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1079
case EOB_ACT_LAST_MATCH:
1081
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1083
yy_current_state = yy_get_previous_state( );
1085
yy_cp = (yy_c_buf_p);
1086
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1087
goto yy_find_action;
1094
"fatal flex scanner internal error--no action found" );
1095
} /* end of action switch */
1096
} /* end of scanning one token */
1097
} /* end of user's declarations */
1098
} /* end of pqlqlex */
1100
/* yy_get_next_buffer - try to read in a new buffer
1102
* Returns a code representing an action:
1103
* EOB_ACT_LAST_MATCH -
1104
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1105
* EOB_ACT_END_OF_FILE - end of file
1107
static int yy_get_next_buffer (void)
1109
char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1110
char *source = (yytext_ptr);
1111
yy_size_t number_to_move, i;
1114
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1116
"fatal flex scanner internal error--end of buffer missed" );
1118
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1119
{ /* Don't try to fill the buffer, so this is an EOF. */
1120
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1122
/* We matched a single character, the EOB, so
1123
* treat this as a final EOF.
1125
return EOB_ACT_END_OF_FILE;
1130
/* We matched some text prior to the EOB, first
1133
return EOB_ACT_LAST_MATCH;
1137
/* Try to read more data. */
1139
/* First move last chars to start of buffer. */
1140
number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1142
for ( i = 0; i < number_to_move; ++i )
1143
*(dest++) = *(source++);
1145
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1146
/* don't do the read, it's not guaranteed to return an EOF,
1149
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1154
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1156
while ( num_to_read <= 0 )
1157
{ /* Not enough room in the buffer - grow it. */
1159
/* just a shorter name for the current buffer */
1160
YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1162
int yy_c_buf_p_offset =
1163
(int) ((yy_c_buf_p) - b->yy_ch_buf);
1165
if ( b->yy_is_our_buffer )
1167
int new_size = b->yy_buf_size * 2;
1169
if ( new_size <= 0 )
1170
b->yy_buf_size += b->yy_buf_size / 8;
1172
b->yy_buf_size *= 2;
1174
b->yy_ch_buf = (char *)
1175
/* Include room in for 2 EOB chars. */
1176
pqlqrealloc((void *) b->yy_ch_buf,(yy_size_t) (b->yy_buf_size + 2) );
1179
/* Can't grow it, we don't own it. */
1180
b->yy_ch_buf = NULL;
1182
if ( ! b->yy_ch_buf )
1184
"fatal error - scanner input buffer overflow" );
1186
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1188
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1193
if ( num_to_read > YY_READ_BUF_SIZE )
1194
num_to_read = YY_READ_BUF_SIZE;
1196
/* Read in more data. */
1197
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1198
(yy_n_chars), num_to_read );
1200
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1203
if ( (yy_n_chars) == 0 )
1205
if ( number_to_move == YY_MORE_ADJ )
1207
ret_val = EOB_ACT_END_OF_FILE;
1208
pqlqrestart(pqlqin );
1213
ret_val = EOB_ACT_LAST_MATCH;
1214
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1215
YY_BUFFER_EOF_PENDING;
1220
ret_val = EOB_ACT_CONTINUE_SCAN;
1222
if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1223
/* Extend the array by 50%, plus the number we really need. */
1224
int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1225
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) pqlqrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,(yy_size_t) new_size );
1226
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1227
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1230
(yy_n_chars) += number_to_move;
1231
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1232
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1234
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1239
/* yy_get_previous_state - get the state just before the EOB char was reached */
1241
static yy_state_type yy_get_previous_state (void)
1243
yy_state_type yy_current_state;
1246
yy_current_state = (yy_start);
1248
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1250
YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1251
if ( yy_accept[yy_current_state] )
1253
(yy_last_accepting_state) = yy_current_state;
1254
(yy_last_accepting_cpos) = yy_cp;
1256
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1258
yy_current_state = (int) yy_def[yy_current_state];
1259
if ( yy_current_state >= 69 )
1260
yy_c = yy_meta[(unsigned int) yy_c];
1262
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1265
return yy_current_state;
1268
/* yy_try_NUL_trans - try to make a transition on the NUL character
1271
* next_state = yy_try_NUL_trans( current_state );
1273
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1276
char *yy_cp = (yy_c_buf_p);
1279
if ( yy_accept[yy_current_state] )
1281
(yy_last_accepting_state) = yy_current_state;
1282
(yy_last_accepting_cpos) = yy_cp;
1284
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1286
yy_current_state = (int) yy_def[yy_current_state];
1287
if ( yy_current_state >= 69 )
1288
yy_c = yy_meta[(unsigned int) yy_c];
1290
yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1291
yy_is_jam = (yy_current_state == 68);
1293
return yy_is_jam ? 0 : yy_current_state;
1302
static int yyinput (void)
1304
static int input (void)
1310
*(yy_c_buf_p) = (yy_hold_char);
1312
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1314
/* yy_c_buf_p now points to the character we want to return.
1315
* If this occurs *before* the EOB characters, then it's a
1316
* valid NUL; if not, then we've hit the end of the buffer.
1318
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1319
/* This was really a NUL. */
1320
*(yy_c_buf_p) = '\0';
1323
{ /* need more input */
1324
int offset = (yy_c_buf_p) - (yytext_ptr);
1327
switch ( yy_get_next_buffer( ) )
1329
case EOB_ACT_LAST_MATCH:
1330
/* This happens because yy_g_n_b()
1331
* sees that we've accumulated a
1332
* token and flags that we need to
1333
* try matching the token before
1334
* proceeding. But for input(),
1335
* there's no matching to consider.
1336
* So convert the EOB_ACT_LAST_MATCH
1337
* to EOB_ACT_END_OF_FILE.
1340
/* Reset buffer status. */
1341
pqlqrestart(pqlqin );
1345
case EOB_ACT_END_OF_FILE:
1350
if ( ! (yy_did_buffer_switch_on_eof) )
1359
case EOB_ACT_CONTINUE_SCAN:
1360
(yy_c_buf_p) = (yytext_ptr) + offset;
1366
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1367
*(yy_c_buf_p) = '\0'; /* preserve pqlqtext */
1368
(yy_hold_char) = *++(yy_c_buf_p);
1372
#endif /* ifndef YY_NO_INPUT */
1374
/** Immediately switch to a different input stream.
1375
* @param input_file A readable stream.
1377
* @note This function does not reset the start condition to @c INITIAL .
1379
void pqlqrestart (FILE * input_file )
1382
if ( ! YY_CURRENT_BUFFER ){
1383
pqlqensure_buffer_stack ();
1384
YY_CURRENT_BUFFER_LVALUE =
1385
pqlq_create_buffer(pqlqin,YY_BUF_SIZE );
1388
pqlq_init_buffer(YY_CURRENT_BUFFER,input_file );
1389
pqlq_load_buffer_state( );
1392
/** Switch to a different input buffer.
1393
* @param new_buffer The new input buffer.
1396
void pqlq_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1399
/* TODO. We should be able to replace this entire function body
1401
* pqlqpop_buffer_state();
1402
* pqlqpush_buffer_state(new_buffer);
1404
pqlqensure_buffer_stack ();
1405
if ( YY_CURRENT_BUFFER == new_buffer )
1408
if ( YY_CURRENT_BUFFER )
1410
/* Flush out information for old buffer. */
1411
*(yy_c_buf_p) = (yy_hold_char);
1412
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1413
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1416
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1417
pqlq_load_buffer_state( );
1419
/* We don't actually know whether we did this switch during
1420
* EOF (pqlqwrap()) processing, but the only time this flag
1421
* is looked at is after pqlqwrap() is called, so it's safe
1422
* to go ahead and always set it.
1424
(yy_did_buffer_switch_on_eof) = 1;
1427
static void pqlq_load_buffer_state (void)
1429
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1430
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1431
pqlqin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1432
(yy_hold_char) = *(yy_c_buf_p);
1435
/** Allocate and initialize an input buffer state.
1436
* @param file A readable stream.
1437
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1439
* @return the allocated buffer state.
1441
YY_BUFFER_STATE pqlq_create_buffer (FILE * file, int size )
1445
b = (YY_BUFFER_STATE) pqlqalloc(sizeof( struct yy_buffer_state ) );
1447
YY_FATAL_ERROR( "out of dynamic memory in pqlq_create_buffer()" );
1449
b->yy_buf_size = size;
1451
/* yy_ch_buf has to be 2 characters longer than the size given because
1452
* we need to put in 2 end-of-buffer characters.
1454
b->yy_ch_buf = (char *) pqlqalloc((yy_size_t) (b->yy_buf_size + 2) );
1455
if ( ! b->yy_ch_buf )
1456
YY_FATAL_ERROR( "out of dynamic memory in pqlq_create_buffer()" );
1458
b->yy_is_our_buffer = 1;
1460
pqlq_init_buffer(b,file );
1465
/** Destroy the buffer.
1466
* @param b a buffer created with pqlq_create_buffer()
1469
void pqlq_delete_buffer (YY_BUFFER_STATE b )
1475
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1476
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1478
if ( b->yy_is_our_buffer )
1479
pqlqfree((void *) b->yy_ch_buf );
1481
pqlqfree((void *) b );
1484
/* Initializes or reinitializes a buffer.
1485
* This function is sometimes called more than once on the same buffer,
1486
* such as during a pqlqrestart() or at EOF.
1488
static void pqlq_init_buffer (YY_BUFFER_STATE b, FILE * file )
1493
pqlq_flush_buffer(b );
1495
b->yy_input_file = file;
1496
b->yy_fill_buffer = 1;
1498
/* If b is the current buffer, then pqlq_init_buffer was _probably_
1499
* called from pqlqrestart() or through yy_get_next_buffer.
1500
* In that case, we don't want to reset the lineno or column.
1502
if (b != YY_CURRENT_BUFFER){
1503
b->yy_bs_lineno = 1;
1504
b->yy_bs_column = 0;
1507
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1512
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1513
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1516
void pqlq_flush_buffer (YY_BUFFER_STATE b )
1523
/* We always need two end-of-buffer characters. The first causes
1524
* a transition to the end-of-buffer state. The second causes
1525
* a jam in that state.
1527
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1528
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1530
b->yy_buf_pos = &b->yy_ch_buf[0];
1533
b->yy_buffer_status = YY_BUFFER_NEW;
1535
if ( b == YY_CURRENT_BUFFER )
1536
pqlq_load_buffer_state( );
1539
/** Pushes the new state onto the stack. The new state becomes
1540
* the current state. This function will allocate the stack
1542
* @param new_buffer The new state.
1545
void pqlqpush_buffer_state (YY_BUFFER_STATE new_buffer )
1547
if (new_buffer == NULL)
1550
pqlqensure_buffer_stack();
1552
/* This block is copied from pqlq_switch_to_buffer. */
1553
if ( YY_CURRENT_BUFFER )
1555
/* Flush out information for old buffer. */
1556
*(yy_c_buf_p) = (yy_hold_char);
1557
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1558
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1561
/* Only push if top exists. Otherwise, replace top. */
1562
if (YY_CURRENT_BUFFER)
1563
(yy_buffer_stack_top)++;
1564
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1566
/* copied from pqlq_switch_to_buffer. */
1567
pqlq_load_buffer_state( );
1568
(yy_did_buffer_switch_on_eof) = 1;
1571
/** Removes and deletes the top of the stack, if present.
1572
* The next element becomes the new top.
1575
void pqlqpop_buffer_state (void)
1577
if (!YY_CURRENT_BUFFER)
1580
pqlq_delete_buffer(YY_CURRENT_BUFFER );
1581
YY_CURRENT_BUFFER_LVALUE = NULL;
1582
if ((yy_buffer_stack_top) > 0)
1583
--(yy_buffer_stack_top);
1585
if (YY_CURRENT_BUFFER) {
1586
pqlq_load_buffer_state( );
1587
(yy_did_buffer_switch_on_eof) = 1;
1591
/* Allocates the stack if it does not exist.
1592
* Guarantees space for at least one push.
1594
static void pqlqensure_buffer_stack (void)
1598
if (!(yy_buffer_stack)) {
1600
/* First allocation is just for 2 elements, since we don't know if this
1601
* scanner will even need a stack. We use 2 instead of 1 to avoid an
1602
* immediate realloc on the next call.
1604
num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1605
(yy_buffer_stack) = (struct yy_buffer_state**)pqlqalloc
1606
(num_to_alloc * sizeof(struct yy_buffer_state*)
1608
if ( ! (yy_buffer_stack) )
1609
YY_FATAL_ERROR( "out of dynamic memory in pqlqensure_buffer_stack()" );
1611
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1613
(yy_buffer_stack_max) = num_to_alloc;
1614
(yy_buffer_stack_top) = 0;
1618
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1620
/* Increase the buffer to prepare for a possible push. */
1621
yy_size_t grow_size = 8 /* arbitrary grow size */;
1623
num_to_alloc = (yy_buffer_stack_max) + grow_size;
1624
(yy_buffer_stack) = (struct yy_buffer_state**)pqlqrealloc
1626
num_to_alloc * sizeof(struct yy_buffer_state*)
1628
if ( ! (yy_buffer_stack) )
1629
YY_FATAL_ERROR( "out of dynamic memory in pqlqensure_buffer_stack()" );
1631
/* zero only the new slots.*/
1632
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1633
(yy_buffer_stack_max) = num_to_alloc;
1637
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1638
* @param base the character buffer
1639
* @param size the size in bytes of the character buffer
1641
* @return the newly allocated buffer state object.
1643
YY_BUFFER_STATE pqlq_scan_buffer (char * base, yy_size_t size )
1648
base[size-2] != YY_END_OF_BUFFER_CHAR ||
1649
base[size-1] != YY_END_OF_BUFFER_CHAR )
1650
/* They forgot to leave room for the EOB's. */
1653
b = (YY_BUFFER_STATE) pqlqalloc(sizeof( struct yy_buffer_state ) );
1655
YY_FATAL_ERROR( "out of dynamic memory in pqlq_scan_buffer()" );
1657
b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1658
b->yy_buf_pos = b->yy_ch_buf = base;
1659
b->yy_is_our_buffer = 0;
1660
b->yy_input_file = NULL;
1661
b->yy_n_chars = b->yy_buf_size;
1662
b->yy_is_interactive = 0;
1664
b->yy_fill_buffer = 0;
1665
b->yy_buffer_status = YY_BUFFER_NEW;
1667
pqlq_switch_to_buffer(b );
1672
/** Setup the input buffer state to scan a string. The next call to pqlqlex() will
1673
* scan from a @e copy of @a str.
1674
* @param yystr a NUL-terminated string to scan
1676
* @return the newly allocated buffer state object.
1677
* @note If you want to scan bytes that may contain NUL values, then use
1678
* pqlq_scan_bytes() instead.
1680
YY_BUFFER_STATE pqlq_scan_string (yyconst char * yystr )
1683
return pqlq_scan_bytes(yystr,(int) strlen(yystr) );
1686
/** Setup the input buffer state to scan the given bytes. The next call to pqlqlex() will
1687
* scan from a @e copy of @a bytes.
1688
* @param yybytes the byte buffer to scan
1689
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1691
* @return the newly allocated buffer state object.
1693
YY_BUFFER_STATE pqlq_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1700
/* Get memory for full buffer, including space for trailing EOB's. */
1701
n = (yy_size_t) _yybytes_len + 2;
1702
buf = (char *) pqlqalloc(n );
1704
YY_FATAL_ERROR( "out of dynamic memory in pqlq_scan_bytes()" );
1706
for ( i = 0; i < _yybytes_len; ++i )
1707
buf[i] = yybytes[i];
1709
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1711
b = pqlq_scan_buffer(buf,n );
1713
YY_FATAL_ERROR( "bad buffer in pqlq_scan_bytes()" );
1715
/* It's okay to grow etc. this buffer, and we should throw it
1716
* away when we're done.
1718
b->yy_is_our_buffer = 1;
1723
#ifndef YY_EXIT_FAILURE
1724
#define YY_EXIT_FAILURE 2
1727
static void yynoreturn yy_fatal_error (yyconst char* msg )
1729
(void) fprintf( stderr, "%s\n", msg );
1730
exit( YY_EXIT_FAILURE );
1733
/* Redefine yyless() so it works in section 3 code. */
1739
/* Undo effects of setting up pqlqtext. */ \
1740
yy_size_t yyless_macro_arg = (n); \
1741
YY_LESS_LINENO(yyless_macro_arg);\
1742
pqlqtext[pqlqleng] = (yy_hold_char); \
1743
(yy_c_buf_p) = pqlqtext + yyless_macro_arg; \
1744
(yy_hold_char) = *(yy_c_buf_p); \
1745
*(yy_c_buf_p) = '\0'; \
1746
pqlqleng = yyless_macro_arg; \
1750
/* Accessor methods (get/set functions) to struct members. */
1752
/** Get the current line number.
1755
int pqlqget_lineno (void)
1761
/** Get the input stream.
1764
FILE *pqlqget_in (void)
1769
/** Get the output stream.
1772
FILE *pqlqget_out (void)
1777
/** Get the length of the current token.
1780
int pqlqget_leng (void)
1785
/** Get the current token.
1789
char *pqlqget_text (void)
1794
/** Set the current line number.
1795
* @param _line_number line number
1798
void pqlqset_lineno (int _line_number )
1801
pqlqlineno = _line_number;
1804
/** Set the input stream. This does not discard the current
1806
* @param _in_str A readable stream.
1808
* @see pqlq_switch_to_buffer
1810
void pqlqset_in (FILE * _in_str )
1815
void pqlqset_out (FILE * _out_str )
1817
pqlqout = _out_str ;
1820
int pqlqget_debug (void)
1822
return pqlq_flex_debug;
1825
void pqlqset_debug (int _bdebug )
1827
pqlq_flex_debug = _bdebug ;
1830
static int yy_init_globals (void)
1832
/* Initialization is the same as for the non-reentrant scanner.
1833
* This function is called from pqlqlex_destroy(), so don't allocate here.
1836
(yy_buffer_stack) = NULL;
1837
(yy_buffer_stack_top) = 0;
1838
(yy_buffer_stack_max) = 0;
1839
(yy_c_buf_p) = NULL;
1843
/* Defined in main.c */
1852
/* For future reference: Set errno on error, since we are called by
1858
/* pqlqlex_destroy is for both reentrant and non-reentrant scanners. */
1859
int pqlqlex_destroy (void)
1862
/* Pop the buffer stack, destroying each element. */
1863
while(YY_CURRENT_BUFFER){
1864
pqlq_delete_buffer(YY_CURRENT_BUFFER );
1865
YY_CURRENT_BUFFER_LVALUE = NULL;
1866
pqlqpop_buffer_state();
1869
/* Destroy the stack itself. */
1870
pqlqfree((yy_buffer_stack) );
1871
(yy_buffer_stack) = NULL;
1873
/* Reset the globals. This is important in a non-reentrant scanner so the next time
1874
* pqlqlex() is called, initialization will occur. */
1881
* Internal utility routines.
1885
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1889
for ( i = 0; i < n; ++i )
1894
#ifdef YY_NEED_STRLEN
1895
static int yy_flex_strlen (yyconst char * s )
1898
for ( n = 0; s[n]; ++n )
1905
void *pqlqalloc (yy_size_t size )
1907
return malloc(size);
1910
void *pqlqrealloc (void * ptr, yy_size_t size )
1913
/* The cast to (char *) in the following accommodates both
1914
* implementations that use char* generic pointers, and those
1915
* that use void* generic pointers. It works with the latter
1916
* because both ANSI C and C++ allow castless assignment from
1917
* any pointer type to void*, and deal with argument conversions
1918
* as though doing an assignment.
1920
return realloc(ptr, size);
1923
void pqlqfree (void * ptr )
1925
free( (char *) ptr ); /* see pqlqrealloc() for (char *) cast */
1928
#define YYTABLES_NAME "yytables"
1930
#line 59 "PetriEngine/PQL/PQLQueryTokens.l"
1933
namespace PetriEngine{ namespace PQL {
1934
std::shared_ptr<Condition> ParseQuery(const std::string& queryString, std::vector<std::string>& placenameforbound) {
1935
//Load up input buffer in Flex
1936
YY_BUFFER_STATE buf = pqlq_scan_string(queryString.c_str());
1938
if(pqlqparse() != 0)
1942
pqlq_delete_buffer(buf);
1947
#pragma clang diagnostic pop