Debian Codegraph @

CodeLite/scope_optimizer.cpp

raw
1
2 #line 3 "scope_optimizer.cpp"
3
4 #define YY_INT_ALIGNED short int
5
6 /* A lexical scanner generated by flex */
7
8 #define yy_create_buffer scope_optimizer__create_buffer
9 #define yy_delete_buffer scope_optimizer__delete_buffer
10 #define yy_flex_debug scope_optimizer__flex_debug
11 #define yy_init_buffer scope_optimizer__init_buffer
12 #define yy_flush_buffer scope_optimizer__flush_buffer
13 #define yy_load_buffer_state scope_optimizer__load_buffer_state
14 #define yy_switch_to_buffer scope_optimizer__switch_to_buffer
15 #define yyin scope_optimizer_in
16 #define yyleng scope_optimizer_leng
17 #define yylex scope_optimizer_lex
18 #define yylineno scope_optimizer_lineno
19 #define yyout scope_optimizer_out
20 #define yyrestart scope_optimizer_restart
21 #define yytext scope_optimizer_text
22 #define yywrap scope_optimizer_wrap
23 #define yyalloc scope_optimizer_alloc
24 #define yyrealloc scope_optimizer_realloc
25 #define yyfree scope_optimizer_free
26
27 #define FLEX_SCANNER
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 37
31 #if YY_FLEX_SUBMINOR_VERSION > 0
32 #define FLEX_BETA
33 #endif
34
35 /* First, we deal with platform-specific or compiler-specific issues. */
36
37 /* begin standard C headers. */
38 #include <stdio.h>
39 #include <string.h>
40 #include <errno.h>
41 #include <stdlib.h>
42
43 /* end standard C headers. */
44
45 /* flex integer type definitions */
46
47 #ifndef FLEXINT_H
48 #define FLEXINT_H
49
50 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
51
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53
54 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55 * if you want the limit (max/min) macros for int types.
56 */
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
59 #endif
60
61 #include <inttypes.h>
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
68 #else
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
75
76 /* Limits of integral types. */
77 #ifndef INT8_MIN
78 #define INT8_MIN (-128)
79 #endif
80 #ifndef INT16_MIN
81 #define INT16_MIN (-32767-1)
82 #endif
83 #ifndef INT32_MIN
84 #define INT32_MIN (-2147483647-1)
85 #endif
86 #ifndef INT8_MAX
87 #define INT8_MAX (127)
88 #endif
89 #ifndef INT16_MAX
90 #define INT16_MAX (32767)
91 #endif
92 #ifndef INT32_MAX
93 #define INT32_MAX (2147483647)
94 #endif
95 #ifndef UINT8_MAX
96 #define UINT8_MAX (255U)
97 #endif
98 #ifndef UINT16_MAX
99 #define UINT16_MAX (65535U)
100 #endif
101 #ifndef UINT32_MAX
102 #define UINT32_MAX (4294967295U)
103 #endif
104
105 #endif /* ! C99 */
106
107 #endif /* ! FLEXINT_H */
108
109 #ifdef __cplusplus
110
111 /* The "const" storage-class-modifier is valid. */
112 #define YY_USE_CONST
113
114 #else /* ! __cplusplus */
115
116 /* C99 requires __STDC__ to be defined as 1. */
117 #if defined (__STDC__)
118
119 #define YY_USE_CONST
120
121 #endif /* defined (__STDC__) */
122 #endif /* ! __cplusplus */
123
124 #ifdef YY_USE_CONST
125 #define yyconst const
126 #else
127 #define yyconst
128 #endif
129
130 /* Returned upon end-of-file. */
131 #define YY_NULL 0
132
133 /* Promotes a possibly negative, possibly signed char to an unsigned
134 * integer for use as an array index. If the signed char is negative,
135 * we want to instead treat it as an 8-bit unsigned char, hence the
136 * double cast.
137 */
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
139
140 /* Enter a start condition. This macro really ought to take a parameter,
141 * but we do it the disgusting crufty way forced on us by the ()-less
142 * definition of BEGIN.
143 */
144 #define BEGIN (yy_start) = 1 + 2 *
145
146 /* Translate the current start state into a value that can be later handed
147 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 * compatibility.
149 */
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
152
153 /* Action number for EOF rule of a given start state. */
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
155
156 /* Special action meaning "start processing a new file". */
157 #define YY_NEW_FILE scope_optimizer_restart(scope_optimizer_in )
158
159 #define YY_END_OF_BUFFER_CHAR 0
160
161 /* Size of default input buffer. */
162 #ifndef YY_BUF_SIZE
163 #define YY_BUF_SIZE 16384
164 #endif
165
166 /* The state buf must be large enough to hold one state per character in the main buffer.
167 */
168 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
169
170 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
171 #define YY_TYPEDEF_YY_BUFFER_STATE
172 typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 #endif
174
175 #ifndef YY_TYPEDEF_YY_SIZE_T
176 #define YY_TYPEDEF_YY_SIZE_T
177 typedef size_t yy_size_t;
178 #endif
179
180 extern yy_size_t scope_optimizer_leng;
181
182 extern FILE *scope_optimizer_in, *scope_optimizer_out;
183
184 #define EOB_ACT_CONTINUE_SCAN 0
185 #define EOB_ACT_END_OF_FILE 1
186 #define EOB_ACT_LAST_MATCH 2
187
188 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
189 * access to the local variable yy_act. Since yyless() is a macro, it would break
190 * existing scanners that call yyless() from OUTSIDE scope_optimizer_lex.
191 * One obvious solution it to make yy_act a global. I tried that, and saw
192 * a 5% performance hit in a non-scope_optimizer_lineno scanner, because yy_act is
193 * normally declared as a register variable-- so it is not worth it.
194 */
195 #define YY_LESS_LINENO(n) \
196 do { \
197 int yyl;\
198 for ( yyl = n; yyl < scope_optimizer_leng; ++yyl )\
199 if ( scope_optimizer_text[yyl] == '\n' )\
200 --scope_optimizer_lineno;\
201 }while(0)
202
203 /* Return all but the first "n" matched characters back to the input stream. */
204 #define yyless(n) \
205 do \
206 { \
207 /* Undo effects of setting up scope_optimizer_text. */ \
208 int yyless_macro_arg = (n); \
209 YY_LESS_LINENO(yyless_macro_arg);\
210 *yy_cp = (yy_hold_char); \
211 YY_RESTORE_YY_MORE_OFFSET \
212 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
213 YY_DO_BEFORE_ACTION; /* set up scope_optimizer_text again */ \
214 } \
215 while ( 0 )
216
217 #define unput(c) yyunput( c, (yytext_ptr) )
218
219 #ifndef YY_STRUCT_YY_BUFFER_STATE
220 #define YY_STRUCT_YY_BUFFER_STATE
221 struct yy_buffer_state
222 {
223 FILE *yy_input_file;
224
225 char *yy_ch_buf; /* input buffer */
226 char *yy_buf_pos; /* current position in input buffer */
227
228 /* Size of input buffer in bytes, not including room for EOB
229 * characters.
230 */
231 yy_size_t yy_buf_size;
232
233 /* Number of characters read into yy_ch_buf, not including EOB
234 * characters.
235 */
236 yy_size_t yy_n_chars;
237
238 /* Whether we "own" the buffer - i.e., we know we created it,
239 * and can realloc() it to grow it, and should free() it to
240 * delete it.
241 */
242 int yy_is_our_buffer;
243
244 /* Whether this is an "interactive" input source; if so, and
245 * if we're using stdio for input, then we want to use getc()
246 * instead of fread(), to make sure we stop fetching input after
247 * each newline.
248 */
249 int yy_is_interactive;
250
251 /* Whether we're considered to be at the beginning of a line.
252 * If so, '^' rules will be active on the next match, otherwise
253 * not.
254 */
255 int yy_at_bol;
256
257 int yy_bs_lineno; /**< The line count. */
258 int yy_bs_column; /**< The column count. */
259
260 /* Whether to try to fill the input buffer when we reach the
261 * end of it.
262 */
263 int yy_fill_buffer;
264
265 int yy_buffer_status;
266
267 #define YY_BUFFER_NEW 0
268 #define YY_BUFFER_NORMAL 1
269 /* When an EOF's been seen but there's still some text to process
270 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
271 * shouldn't try reading from the input source any more. We might
272 * still have a bunch of tokens to match, though, because of
273 * possible backing-up.
274 *
275 * When we actually see the EOF, we change the status to "new"
276 * (via scope_optimizer_restart()), so that the user can continue scanning by
277 * just pointing scope_optimizer_in at a new input file.
278 */
279 #define YY_BUFFER_EOF_PENDING 2
280
281 };
282 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
283
284 /* Stack of input buffers. */
285 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
286 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
287 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
288
289 /* We provide macros for accessing buffer states in case in the
290 * future we want to put the buffer states in a more general
291 * "scanner state".
292 *
293 * Returns the top of the stack, or NULL.
294 */
295 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
296 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
297 : NULL)
298
299 /* Same as previous macro, but useful when we know that the buffer stack is not
300 * NULL or when we need an lvalue. For internal use only.
301 */
302 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
303
304 /* yy_hold_char holds the character lost when scope_optimizer_text is formed. */
305 static char yy_hold_char;
306 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
307 yy_size_t scope_optimizer_leng;
308
309 /* Points to current character in buffer. */
310 static char *yy_c_buf_p = (char *) 0;
311 static int yy_init = 0; /* whether we need to initialize */
312 static int yy_start = 0; /* start state number */
313
314 /* Flag which is used to allow scope_optimizer_wrap()'s to do buffer switches
315 * instead of setting up a fresh scope_optimizer_in. A bit of a hack ...
316 */
317 static int yy_did_buffer_switch_on_eof;
318
319 void scope_optimizer_restart (FILE *input_file );
320 void scope_optimizer__switch_to_buffer (YY_BUFFER_STATE new_buffer );
321 YY_BUFFER_STATE scope_optimizer__create_buffer (FILE *file,int size );
322 void scope_optimizer__delete_buffer (YY_BUFFER_STATE b );
323 void scope_optimizer__flush_buffer (YY_BUFFER_STATE b );
324 void scope_optimizer_push_buffer_state (YY_BUFFER_STATE new_buffer );
325 void scope_optimizer_pop_buffer_state (void );
326
327 static void scope_optimizer_ensure_buffer_stack (void );
328 static void scope_optimizer__load_buffer_state (void );
329 static void scope_optimizer__init_buffer (YY_BUFFER_STATE b,FILE *file );
330
331 #define YY_FLUSH_BUFFER scope_optimizer__flush_buffer(YY_CURRENT_BUFFER )
332
333 YY_BUFFER_STATE scope_optimizer__scan_buffer (char *base,yy_size_t size );
334 YY_BUFFER_STATE scope_optimizer__scan_string (yyconst char *yy_str );
335 YY_BUFFER_STATE scope_optimizer__scan_bytes (yyconst char *bytes,yy_size_t len );
336
337 void *scope_optimizer_alloc (yy_size_t );
338 void *scope_optimizer_realloc (void *,yy_size_t );
339 void scope_optimizer_free (void * );
340
341 #define yy_new_buffer scope_optimizer__create_buffer
342
343 #define yy_set_interactive(is_interactive) \
344 { \
345 if ( ! YY_CURRENT_BUFFER ){ \
346 scope_optimizer_ensure_buffer_stack (); \
347 YY_CURRENT_BUFFER_LVALUE = \
348 scope_optimizer__create_buffer(scope_optimizer_in,YY_BUF_SIZE ); \
349 } \
350 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
351 }
352
353 #define yy_set_bol(at_bol) \
354 { \
355 if ( ! YY_CURRENT_BUFFER ){\
356 scope_optimizer_ensure_buffer_stack (); \
357 YY_CURRENT_BUFFER_LVALUE = \
358 scope_optimizer__create_buffer(scope_optimizer_in,YY_BUF_SIZE ); \
359 } \
360 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
361 }
362
363 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
364
365 /* Begin user sect3 */
366
367 typedef unsigned char YY_CHAR;
368
369 FILE *scope_optimizer_in = (FILE *) 0, *scope_optimizer_out = (FILE *) 0;
370
371 typedef int yy_state_type;
372
373 extern int scope_optimizer_lineno;
374
375 int scope_optimizer_lineno = 1;
376
377 extern char *scope_optimizer_text;
378 #define yytext_ptr scope_optimizer_text
379
380 static yy_state_type yy_get_previous_state (void );
381 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
382 static int yy_get_next_buffer (void );
383 static void yy_fatal_error (yyconst char msg[] );
384
385 /* Done after the current pattern has been matched and before the
386 * corresponding action - sets up scope_optimizer_text.
387 */
388 #define YY_DO_BEFORE_ACTION \
389 (yytext_ptr) = yy_bp; \
390 scope_optimizer_leng = (size_t) (yy_cp - yy_bp); \
391 (yy_hold_char) = *yy_cp; \
392 *yy_cp = '\0'; \
393 (yy_c_buf_p) = yy_cp;
394
395 #define YY_NUM_RULES 84
396 #define YY_END_OF_BUFFER 85
397 /* This struct is not used in this scanner,
398 but its presence is necessary. */
399 struct yy_trans_info
400 {
401 flex_int32_t yy_verify;
402 flex_int32_t yy_nxt;
403 };
404 static yyconst flex_int16_t yy_accept[352] =
405 { 0,
406 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
407 0, 0, 0, 0, 85, 79, 3, 5, 4, 79,
408 14, 79, 29, 30, 79, 78, 78, 79, 78, 78,
409 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
410 78, 78, 78, 78, 78, 78, 31, 32, 17, 16,
411 15, 17, 21, 6, 8, 7, 19, 20, 21, 28,
412 9, 11, 10, 26, 27, 28, 83, 84, 83, 83,
413 81, 80, 81, 25, 25, 24, 3, 5, 0, 4,
414 0, 13, 0, 0, 0, 2, 1, 78, 0, 0,
415 0, 0, 0, 0, 78, 78, 78, 78, 78, 78,
416
417 40, 78, 78, 78, 78, 78, 78, 78, 46, 78,
418 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
419 78, 78, 78, 78, 78, 78, 78, 6, 8, 0,
420 7, 9, 11, 0, 10, 82, 24, 0, 0, 12,
421 0, 0, 0, 0, 0, 0, 78, 78, 78, 78,
422 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
423 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
424 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
425 78, 70, 78, 78, 78, 78, 78, 78, 0, 0,
426 0, 0, 0, 23, 0, 33, 78, 35, 78, 78,
427
428 78, 78, 78, 78, 78, 78, 41, 42, 78, 78,
429 0, 22, 78, 45, 78, 78, 78, 78, 50, 78,
430 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
431 78, 78, 78, 78, 78, 78, 78, 78, 78, 0,
432 0, 0, 0, 0, 34, 18, 58, 78, 78, 78,
433 78, 78, 78, 43, 44, 78, 47, 78, 78, 78,
434 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
435 78, 78, 78, 77, 78, 55, 56, 76, 78, 57,
436 0, 78, 78, 78, 38, 61, 78, 62, 48, 78,
437 63, 78, 78, 51, 78, 78, 67, 78, 52, 53,
438
439 78, 59, 54, 78, 78, 78, 78, 78, 37, 39,
440 78, 49, 78, 78, 66, 78, 78, 78, 78, 78,
441 68, 78, 36, 78, 78, 64, 78, 78, 78, 69,
442 71, 78, 78, 60, 65, 78, 78, 74, 78, 78,
443 78, 78, 78, 73, 72, 78, 78, 78, 78, 75,
444 0
445 } ;
446
447 static yyconst flex_int32_t yy_ec[256] =
448 { 0,
449 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
450 4, 5, 6, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452 1, 7, 1, 8, 9, 1, 1, 10, 11, 12,
453 13, 14, 1, 1, 1, 1, 15, 16, 16, 16,
454 16, 16, 16, 16, 16, 17, 17, 1, 1, 1,
455 18, 1, 19, 1, 20, 20, 20, 20, 20, 20,
456 21, 21, 21, 21, 21, 22, 21, 21, 21, 21,
457 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
458 23, 24, 25, 1, 26, 1, 27, 28, 29, 30,
459
460 31, 32, 33, 34, 35, 21, 36, 37, 38, 39,
461 40, 41, 21, 42, 43, 44, 45, 46, 47, 48,
462 49, 50, 51, 1, 52, 1, 1, 1, 1, 1,
463 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
464 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
465 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
466 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
470
471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
474 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
475 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
476 1, 1, 1, 1, 1
477 } ;
478
479 static yyconst flex_int32_t yy_meta[53] =
480 { 0,
481 1, 1, 2, 1, 1, 1, 1, 3, 1, 1,
482 4, 1, 1, 1, 1, 5, 6, 1, 3, 6,
483 7, 7, 1, 3, 1, 7, 5, 5, 6, 6,
484 6, 5, 7, 7, 7, 7, 7, 7, 8, 7,
485 7, 8, 7, 8, 7, 8, 7, 8, 7, 7,
486 1, 1
487 } ;
488
489 static yyconst flex_int16_t yy_base[365] =
490 { 0,
491 0, 0, 50, 51, 65, 79, 93, 107, 59, 61,
492 86, 87, 122, 0, 650, 651, 173, 651, 179, 55,
493 651, 625, 651, 651, 41, 0, 96, 185, 603, 605,
494 161, 159, 79, 19, 606, 157, 610, 617, 602, 149,
495 611, 158, 173, 167, 606, 606, 651, 651, 651, 651,
496 651, 73, 651, 214, 651, 221, 651, 651, 197, 651,
497 228, 651, 234, 651, 651, 199, 651, 651, 624, 228,
498 651, 651, 230, 651, 232, 0, 246, 651, 252, 258,
499 258, 651, 251, 257, 253, 651, 651, 0, 262, 614,
500 269, 270, 271, 603, 592, 604, 231, 607, 594, 248,
501
502 0, 593, 248, 601, 588, 587, 593, 583, 170, 255,
503 587, 587, 593, 262, 595, 259, 572, 263, 586, 582,
504 577, 569, 576, 258, 581, 573, 579, 304, 651, 312,
505 318, 324, 651, 330, 336, 651, 0, 336, 0, 651,
506 334, 0, 344, 341, 347, 578, 572, 584, 579, 580,
507 565, 312, 277, 576, 579, 573, 573, 568, 562, 350,
508 570, 560, 568, 568, 560, 561, 564, 563, 551, 559,
509 545, 546, 552, 549, 542, 555, 541, 539, 539, 541,
510 541, 0, 549, 548, 538, 538, 532, 538, 351, 368,
511 350, 390, 356, 651, 531, 0, 537, 0, 538, 528,
512
513 526, 534, 523, 528, 522, 527, 0, 0, 532, 521,
514 358, 651, 523, 0, 529, 529, 514, 519, 0, 514,
515 529, 517, 527, 522, 517, 507, 508, 509, 513, 518,
516 517, 508, 497, 504, 510, 502, 507, 494, 507, 356,
517 0, 362, 0, 380, 0, 0, 0, 511, 497, 498,
518 503, 502, 497, 0, 0, 501, 0, 498, 499, 497,
519 486, 482, 498, 480, 494, 493, 490, 481, 487, 489,
520 473, 482, 488, 0, 487, 0, 0, 0, 486, 0,
521 387, 483, 466, 466, 479, 0, 479, 0, 0, 476,
522 0, 479, 465, 0, 473, 459, 0, 455, 0, 0,
523
524 470, 0, 0, 447, 452, 437, 445, 433, 0, 0,
525 390, 0, 386, 371, 0, 380, 368, 379, 373, 372,
526 0, 359, 0, 364, 360, 0, 360, 341, 354, 0,
527 0, 335, 351, 0, 0, 346, 328, 0, 304, 256,
528 254, 153, 91, 0, 0, 86, 76, 50, 16, 0,
529 651, 422, 430, 438, 446, 454, 462, 470, 474, 478,
530 484, 490, 494, 496
531 } ;
532
533 static yyconst flex_int16_t yy_def[365] =
534 { 0,
535 351, 1, 352, 352, 353, 353, 354, 354, 355, 355,
536 356, 356, 351, 13, 351, 351, 351, 351, 351, 357,
537 351, 358, 351, 351, 351, 359, 359, 351, 359, 359,
538 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
539 359, 359, 359, 359, 359, 359, 351, 351, 351, 351,
540 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
541 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
542 351, 351, 351, 351, 351, 360, 351, 351, 351, 351,
543 357, 351, 361, 358, 362, 351, 351, 359, 357, 358,
544 351, 351, 351, 351, 359, 359, 359, 359, 359, 359,
545
546 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
547 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
548 359, 359, 359, 359, 359, 359, 359, 351, 351, 351,
549 351, 351, 351, 351, 351, 351, 360, 357, 363, 351,
550 358, 364, 351, 351, 351, 351, 359, 359, 359, 359,
551 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
552 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
553 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
554 359, 359, 359, 359, 359, 359, 359, 359, 357, 357,
555 358, 358, 351, 351, 351, 359, 359, 359, 359, 359,
556
557 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
558 351, 351, 359, 359, 359, 359, 359, 359, 359, 359,
559 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
560 359, 359, 359, 359, 359, 359, 359, 359, 359, 357,
561 190, 358, 192, 351, 359, 359, 359, 359, 359, 359,
562 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
563 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
564 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
565 351, 359, 359, 359, 359, 359, 359, 359, 359, 359,
566 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
567
568 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
569 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
570 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
571 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
572 359, 359, 359, 359, 359, 359, 359, 359, 359, 359,
573 0, 351, 351, 351, 351, 351, 351, 351, 351, 351,
574 351, 351, 351, 351
575 } ;
576
577 static yyconst flex_int16_t yy_nxt[704] =
578 { 0,
579 16, 17, 18, 19, 19, 19, 17, 20, 21, 16,
580 22, 23, 24, 16, 25, 16, 16, 16, 16, 26,
581 26, 27, 28, 16, 16, 26, 29, 30, 31, 32,
582 33, 34, 35, 26, 36, 26, 37, 26, 38, 39,
583 40, 41, 42, 43, 44, 45, 46, 26, 26, 26,
584 47, 48, 50, 50, 86, 87, 51, 51, 106, 350,
585 107, 68, 82, 68, 52, 52, 54, 55, 56, 56,
586 56, 54, 69, 70, 69, 70, 57, 58, 83, 59,
587 54, 55, 56, 56, 56, 54, 86, 87, 72, 72,
588 57, 58, 349, 59, 61, 62, 63, 63, 63, 61,
589
590 73, 73, 348, 89, 64, 65, 90, 66, 61, 62,
591 63, 63, 63, 61, 347, 103, 346, 104, 64, 65,
592 105, 66, 74, 74, 68, 74, 74, 74, 74, 74,
593 74, 74, 74, 74, 74, 74, 75, 74, 74, 74,
594 74, 76, 76, 76, 74, 74, 74, 76, 76, 76,
595 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
596 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
597 76, 76, 74, 74, 77, 78, 79, 79, 79, 77,
598 79, 78, 80, 80, 80, 79, 91, 97, 109, 100,
599 114, 91, 117, 115, 92, 110, 345, 98, 101, 163,
600
601 99, 118, 93, 120, 119, 124, 121, 102, 164, 125,
602 86, 87, 86, 87, 122, 128, 129, 130, 130, 130,
603 128, 123, 130, 129, 131, 131, 131, 130, 94, 132,
604 133, 134, 134, 134, 132, 134, 133, 135, 135, 135,
605 134, 86, 87, 86, 87, 86, 87, 77, 78, 79,
606 79, 79, 77, 79, 78, 79, 79, 79, 79, 79,
607 78, 80, 80, 80, 79, 82, 138, 140, 141, 82,
608 91, 143, 145, 149, 150, 91, 143, 145, 92, 153,
609 85, 83, 156, 165, 154, 83, 93, 184, 170, 177,
610 157, 166, 185, 174, 144, 144, 171, 344, 139, 343,
611
612 142, 172, 175, 203, 178, 128, 129, 130, 130, 130,
613 128, 204, 94, 130, 129, 130, 130, 130, 130, 130,
614 129, 131, 131, 131, 130, 132, 133, 134, 134, 134,
615 132, 134, 133, 134, 134, 134, 134, 134, 133, 135,
616 135, 135, 134, 82, 140, 143, 342, 193, 145, 191,
617 143, 189, 194, 145, 201, 202, 211, 85, 82, 83,
618 140, 212, 193, 82, 211, 242, 240, 194, 144, 212,
619 341, 144, 140, 85, 83, 82, 340, 339, 338, 83,
620 337, 281, 336, 241, 241, 85, 281, 241, 281, 335,
621 334, 83, 333, 281, 241, 241, 241, 241, 241, 241,
622
623 140, 332, 331, 330, 144, 243, 243, 329, 328, 243,
624 327, 144, 326, 85, 325, 324, 243, 243, 243, 243,
625 243, 243, 49, 49, 49, 49, 49, 49, 49, 49,
626 53, 53, 53, 53, 53, 53, 53, 53, 60, 60,
627 60, 60, 60, 60, 60, 60, 67, 67, 67, 67,
628 67, 67, 67, 67, 71, 71, 71, 71, 71, 71,
629 71, 71, 81, 323, 81, 81, 81, 81, 81, 81,
630 84, 322, 84, 321, 84, 84, 84, 84, 88, 88,
631 88, 88, 137, 137, 137, 137, 81, 81, 81, 320,
632 319, 81, 84, 84, 84, 318, 317, 84, 190, 190,
633
634 192, 192, 316, 315, 314, 313, 312, 311, 310, 309,
635 308, 307, 306, 305, 304, 303, 302, 301, 300, 299,
636 298, 297, 296, 295, 294, 293, 292, 291, 290, 289,
637 288, 287, 286, 285, 284, 283, 282, 280, 279, 278,
638 277, 276, 275, 274, 273, 272, 271, 270, 269, 268,
639 267, 266, 265, 264, 263, 262, 261, 260, 259, 258,
640 257, 256, 255, 254, 253, 252, 251, 250, 249, 248,
641 247, 246, 245, 244, 239, 238, 237, 236, 235, 234,
642 233, 232, 231, 230, 229, 228, 227, 226, 225, 224,
643 223, 222, 221, 220, 219, 218, 217, 216, 215, 214,
644
645 213, 210, 209, 208, 207, 206, 205, 200, 199, 198,
646 197, 196, 195, 188, 187, 186, 183, 182, 181, 180,
647 179, 176, 173, 169, 168, 167, 162, 161, 160, 159,
648 158, 155, 152, 151, 148, 147, 146, 85, 136, 127,
649 126, 116, 113, 112, 111, 108, 96, 95, 85, 351,
650 15, 351, 351, 351, 351, 351, 351, 351, 351, 351,
651 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
652 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
653 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
654 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
655
656 351, 351, 351
657 } ;
658
659 static yyconst flex_int16_t yy_chk[704] =
660 { 0,
661 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
662 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
663 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
664 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
665 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
666 1, 1, 3, 4, 25, 25, 3, 4, 34, 349,
667 34, 9, 20, 10, 3, 4, 5, 5, 5, 5,
668 5, 5, 9, 9, 10, 10, 5, 5, 20, 5,
669 6, 6, 6, 6, 6, 6, 52, 52, 11, 12,
670 6, 6, 348, 6, 7, 7, 7, 7, 7, 7,
671
672 11, 12, 347, 27, 7, 7, 27, 7, 8, 8,
673 8, 8, 8, 8, 346, 33, 343, 33, 8, 8,
674 33, 8, 13, 13, 13, 13, 13, 13, 13, 13,
675 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
676 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
677 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
678 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
679 13, 13, 13, 13, 17, 17, 17, 17, 17, 17,
680 19, 19, 19, 19, 19, 19, 28, 31, 36, 32,
681 40, 28, 42, 40, 28, 36, 342, 31, 32, 109,
682
683 31, 42, 28, 43, 42, 44, 43, 32, 109, 44,
684 59, 59, 66, 66, 43, 54, 54, 54, 54, 54,
685 54, 43, 56, 56, 56, 56, 56, 56, 28, 61,
686 61, 61, 61, 61, 61, 63, 63, 63, 63, 63,
687 63, 70, 70, 73, 73, 75, 75, 77, 77, 77,
688 77, 77, 77, 79, 79, 79, 79, 79, 79, 80,
689 80, 80, 80, 80, 80, 81, 83, 84, 85, 89,
690 91, 92, 93, 97, 97, 91, 92, 93, 91, 100,
691 84, 81, 103, 110, 100, 89, 91, 124, 114, 118,
692 103, 110, 124, 116, 92, 93, 114, 341, 83, 340,
693
694 85, 114, 116, 153, 118, 128, 128, 128, 128, 128,
695 128, 153, 91, 130, 130, 130, 130, 130, 130, 131,
696 131, 131, 131, 131, 131, 132, 132, 132, 132, 132,
697 132, 134, 134, 134, 134, 134, 134, 135, 135, 135,
698 135, 135, 135, 138, 141, 143, 339, 144, 145, 141,
699 143, 138, 144, 145, 152, 152, 160, 141, 189, 138,
700 191, 160, 193, 240, 211, 191, 189, 193, 143, 211,
701 337, 145, 242, 191, 189, 190, 336, 333, 332, 240,
702 329, 244, 328, 190, 190, 242, 244, 190, 281, 327,
703 325, 190, 324, 281, 190, 190, 190, 190, 190, 190,
704
705 192, 322, 320, 319, 244, 192, 192, 318, 317, 192,
706 316, 281, 314, 192, 313, 311, 192, 192, 192, 192,
707 192, 192, 352, 352, 352, 352, 352, 352, 352, 352,
708 353, 353, 353, 353, 353, 353, 353, 353, 354, 354,
709 354, 354, 354, 354, 354, 354, 355, 355, 355, 355,
710 355, 355, 355, 355, 356, 356, 356, 356, 356, 356,
711 356, 356, 357, 308, 357, 357, 357, 357, 357, 357,
712 358, 307, 358, 306, 358, 358, 358, 358, 359, 359,
713 359, 359, 360, 360, 360, 360, 361, 361, 361, 305,
714 304, 361, 362, 362, 362, 301, 298, 362, 363, 363,
715
716 364, 364, 296, 295, 293, 292, 290, 287, 285, 284,
717 283, 282, 279, 275, 273, 272, 271, 270, 269, 268,
718 267, 266, 265, 264, 263, 262, 261, 260, 259, 258,
719 256, 253, 252, 251, 250, 249, 248, 239, 238, 237,
720 236, 235, 234, 233, 232, 231, 230, 229, 228, 227,
721 226, 225, 224, 223, 222, 221, 220, 218, 217, 216,
722 215, 213, 210, 209, 206, 205, 204, 203, 202, 201,
723 200, 199, 197, 195, 188, 187, 186, 185, 184, 183,
724 181, 180, 179, 178, 177, 176, 175, 174, 173, 172,
725 171, 170, 169, 168, 167, 166, 165, 164, 163, 162,
726
727 161, 159, 158, 157, 156, 155, 154, 151, 150, 149,
728 148, 147, 146, 127, 126, 125, 123, 122, 121, 120,
729 119, 117, 115, 113, 112, 111, 108, 107, 106, 105,
730 104, 102, 99, 98, 96, 95, 94, 90, 69, 46,
731 45, 41, 39, 38, 37, 35, 30, 29, 22, 15,
732 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
733 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
734 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
735 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
736 351, 351, 351, 351, 351, 351, 351, 351, 351, 351,
737
738 351, 351, 351
739 } ;
740
741 /* Table of booleans, true if rule could match eol. */
742 static yyconst flex_int32_t yy_rule_can_match_eol[85] =
743 { 0,
744 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0,
745 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
746 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
747 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
748 1, 0, 0, 0, 0, };
749
750 static yy_state_type yy_last_accepting_state;
751 static char *yy_last_accepting_cpos;
752
753 extern int scope_optimizer__flex_debug;
754 int scope_optimizer__flex_debug = 0;
755
756 /* The intent behind this definition is that it'll catch
757 * any uses of REJECT which flex missed.
758 */
759 #define REJECT reject_used_but_not_detected
760 #define yymore() yymore_used_but_not_detected
761 #define YY_MORE_ADJ 0
762 #define YY_RESTORE_YY_MORE_OFFSET
763 char *scope_optimizer_text;
764
765 // Avoid spam output
766 #ifdef ECHO
767 #undef ECHO
768 #endif
769 #define ECHO
770
771 // Return values for lambda state
772 #define __IDENTIFIER 900
773
774 // Never exit
775 #ifdef YY_FATAL_ERROR
776 #undef YY_FATAL_ERROR
777 #endif
778 #define YY_FATAL_ERROR(msg)
779
780 #include <vector>
781 #include <string>
782
783 struct ScopeEntry {
784 std::string str;
785 int line;
786
787 ScopeEntry() : line(-1) {}
788 void clear() {
789 line = -1;
790 str.clear();
791 }
792 };
793
794 static std::vector<ScopeEntry> scope_stack;
795 static ScopeEntry current_scope;
796 static int current_state = 0;
797 static int current_brace_depth = 1;
798 static std::string catch_for_scope;
799 static void consume_lambda_signature();
800
801 #define PUSH_SCOPE(scope) {\
802 if(scope.line == -1)\
803 scope.line = scope_optimizer_lineno;\
804 scope_stack.push_back(scope);\
805 }
806
807 #define INITIAL 0
808 #define PRE_PROCESSOR_STATE 1
809 #define CATCH_STATE 2
810 #define FOR_STATE 3
811 #define C_COMMENT_STATE 4
812 #define CPP_COMMENT_STATE 5
813 #define LAMBDA_STATE 6
814
815 #ifndef YY_NO_UNISTD_H
816 /* Special case for "unistd.h", since it is non-ANSI. We include it way
817 * down here because we want the user's section 1 to have been scanned first.
818 * The user has a chance to override it with an option.
819 */
820 #include <unistd.h>
821 #endif
822
823 #ifndef YY_EXTRA_TYPE
824 #define YY_EXTRA_TYPE void *
825 #endif
826
827 static int yy_init_globals (void );
828
829 /* Accessor methods to globals.
830 These are made visible to non-reentrant scanners for convenience. */
831
832 int scope_optimizer_lex_destroy (void );
833
834 int scope_optimizer_get_debug (void );
835
836 void scope_optimizer_set_debug (int debug_flag );
837
838 YY_EXTRA_TYPE scope_optimizer_get_extra (void );
839
840 void scope_optimizer_set_extra (YY_EXTRA_TYPE user_defined );
841
842 FILE *scope_optimizer_get_in (void );
843
844 void scope_optimizer_set_in (FILE * in_str );
845
846 FILE *scope_optimizer_get_out (void );
847
848 void scope_optimizer_set_out (FILE * out_str );
849
850 yy_size_t scope_optimizer_get_leng (void );
851
852 char *scope_optimizer_get_text (void );
853
854 int scope_optimizer_get_lineno (void );
855
856 void scope_optimizer_set_lineno (int line_number );
857
858 /* Macros after this point can all be overridden by user definitions in
859 * section 1.
860 */
861
862 #ifndef YY_SKIP_YYWRAP
863 #ifdef __cplusplus
864 extern "C" int scope_optimizer_wrap (void );
865 #else
866 extern int scope_optimizer_wrap (void );
867 #endif
868 #endif
869
870 static void yyunput (int c,char *buf_ptr );
871
872 #ifndef yytext_ptr
873 static void yy_flex_strncpy (char *,yyconst char *,int );
874 #endif
875
876 #ifdef YY_NEED_STRLEN
877 static int yy_flex_strlen (yyconst char * );
878 #endif
879
880 #ifndef YY_NO_INPUT
881
882 #ifdef __cplusplus
883 static int yyinput (void );
884 #else
885 static int input (void );
886 #endif
887
888 #endif
889
890 /* Amount of stuff to slurp up with each read. */
891 #ifndef YY_READ_BUF_SIZE
892 #define YY_READ_BUF_SIZE 8192
893 #endif
894
895 /* Copy whatever the last rule matched to the standard output. */
896 #ifndef ECHO
897 /* This used to be an fputs(), but since the string might contain NUL's,
898 * we now use fwrite().
899 */
900 #define ECHO do { if (fwrite( scope_optimizer_text, scope_optimizer_leng, 1, scope_optimizer_out )) {} } while (0)
901 #endif
902
903 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
904 * is returned in "result".
905 */
906 #ifndef YY_INPUT
907 #define YY_INPUT(buf,result,max_size) \
908 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
909 { \
910 int c = '*'; \
911 size_t n; \
912 for ( n = 0; n < max_size && \
913 (c = getc( scope_optimizer_in )) != EOF && c != '\n'; ++n ) \
914 buf[n] = (char) c; \
915 if ( c == '\n' ) \
916 buf[n++] = (char) c; \
917 if ( c == EOF && ferror( scope_optimizer_in ) ) \
918 YY_FATAL_ERROR( "input in flex scanner failed" ); \
919 result = n; \
920 } \
921 else \
922 { \
923 errno=0; \
924 while ( (result = fread(buf, 1, max_size, scope_optimizer_in))==0 && ferror(scope_optimizer_in)) \
925 { \
926 if( errno != EINTR) \
927 { \
928 YY_FATAL_ERROR( "input in flex scanner failed" ); \
929 break; \
930 } \
931 errno=0; \
932 clearerr(scope_optimizer_in); \
933 } \
934 }\
935 \
936
937 #endif
938
939 /* No semi-colon after return; correct usage is to write "yyterminate();" -
940 * we don't want an extra ';' after the "return" because that will cause
941 * some compilers to complain about unreachable statements.
942 */
943 #ifndef yyterminate
944 #define yyterminate() return YY_NULL
945 #endif
946
947 /* Number of entries by which start-condition stack grows. */
948 #ifndef YY_START_STACK_INCR
949 #define YY_START_STACK_INCR 25
950 #endif
951
952 /* Report a fatal error. */
953 #ifndef YY_FATAL_ERROR
954 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
955 #endif
956
957 /* end tables serialization structures and prototypes */
958
959 /* Default declaration of generated scanner - a define so the user can
960 * easily add parameters.
961 */
962 #ifndef YY_DECL
963 #define YY_DECL_IS_OURS 1
964
965 extern int scope_optimizer_lex (void);
966
967 #define YY_DECL int scope_optimizer_lex (void)
968 #endif /* !YY_DECL */
969
970 /* Code executed at the beginning of each rule, after scope_optimizer_text and scope_optimizer_leng
971 * have been set up.
972 */
973 #ifndef YY_USER_ACTION
974 #define YY_USER_ACTION
975 #endif
976
977 /* Code executed at the end of each rule. */
978 #ifndef YY_BREAK
979 #define YY_BREAK break;
980 #endif
981
982 #define YY_RULE_SETUP \
983 YY_USER_ACTION
984
985 /** The main scanner function which does all the work.
986 */
987 YY_DECL
988 {
989 register yy_state_type yy_current_state;
990 register char *yy_cp, *yy_bp;
991 register int yy_act;
992
993 if ( !(yy_init) )
994 {
995 (yy_init) = 1;
996
997 #ifdef YY_USER_INIT
998 YY_USER_INIT;
999 #endif
1000
1001 if ( ! (yy_start) )
1002 (yy_start) = 1; /* first start state */
1003
1004 if ( ! scope_optimizer_in )
1005 scope_optimizer_in = stdin;
1006
1007 if ( ! scope_optimizer_out )
1008 scope_optimizer_out = stdout;
1009
1010 if ( ! YY_CURRENT_BUFFER ) {
1011 scope_optimizer_ensure_buffer_stack ();
1012 YY_CURRENT_BUFFER_LVALUE =
1013 scope_optimizer__create_buffer(scope_optimizer_in,YY_BUF_SIZE );
1014 }
1015
1016 scope_optimizer__load_buffer_state( );
1017 }
1018
1019 while ( 1 ) /* loops until end-of-file is reached */
1020 {
1021 yy_cp = (yy_c_buf_p);
1022
1023 /* Support of scope_optimizer_text. */
1024 *yy_cp = (yy_hold_char);
1025
1026 /* yy_bp points to the position in yy_ch_buf of the start of
1027 * the current run.
1028 */
1029 yy_bp = yy_cp;
1030
1031 yy_current_state = (yy_start);
1032 yy_match:
1033 do
1034 {
1035 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1036 if ( yy_accept[yy_current_state] )
1037 {
1038 (yy_last_accepting_state) = yy_current_state;
1039 (yy_last_accepting_cpos) = yy_cp;
1040 }
1041 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1042 {
1043 yy_current_state = (int) yy_def[yy_current_state];
1044 if ( yy_current_state >= 352 )
1045 yy_c = yy_meta[(unsigned int) yy_c];
1046 }
1047 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1048 ++yy_cp;
1049 }
1050 while ( yy_base[yy_current_state] != 651 );
1051
1052 yy_find_action:
1053 yy_act = yy_accept[yy_current_state];
1054 if ( yy_act == 0 )
1055 { /* have to back up */
1056 yy_cp = (yy_last_accepting_cpos);
1057 yy_current_state = (yy_last_accepting_state);
1058 yy_act = yy_accept[yy_current_state];
1059 }
1060
1061 YY_DO_BEFORE_ACTION;
1062
1063 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1064 {
1065 yy_size_t yyl;
1066 for ( yyl = 0; yyl < scope_optimizer_leng; ++yyl )
1067 if ( scope_optimizer_text[yyl] == '\n' )
1068
1069 scope_optimizer_lineno++;
1070 ;
1071 }
1072
1073 do_action: /* This label is used only to access EOF actions. */
1074
1075 switch ( yy_act )
1076 { /* beginning of action switch */
1077 case 0: /* must back up */
1078 /* undo the effects of YY_DO_BEFORE_ACTION */
1079 *yy_cp = (yy_hold_char);
1080 yy_cp = (yy_last_accepting_cpos);
1081 yy_current_state = (yy_last_accepting_state);
1082 goto yy_find_action;
1083
1084 case 1:
1085 YY_RULE_SETUP
1086 {
1087 BEGIN(CPP_COMMENT_STATE);
1088 }
1089 YY_BREAK
1090 case 2:
1091 YY_RULE_SETUP
1092 {
1093 BEGIN(C_COMMENT_STATE);
1094 }
1095 YY_BREAK
1096 case 3:
1097 YY_RULE_SETUP
1098 {current_scope.str += " ";}
1099 YY_BREAK
1100 case 4:
1101 YY_RULE_SETUP
1102 {current_scope.str += " ";}
1103 YY_BREAK
1104 case 5:
1105 /* rule 5 can match eol */
1106 YY_RULE_SETUP
1107 {current_scope.str += " ";}
1108 YY_BREAK
1109 case 6:
1110 YY_RULE_SETUP
1111 {catch_for_scope += " ";}
1112 YY_BREAK
1113 case 7:
1114 YY_RULE_SETUP
1115 {catch_for_scope += " ";}
1116 YY_BREAK
1117 case 8:
1118 /* rule 8 can match eol */
1119 YY_RULE_SETUP
1120 {catch_for_scope += " ";}
1121 YY_BREAK
1122 case 9:
1123 YY_RULE_SETUP
1124 {catch_for_scope += " ";}
1125 YY_BREAK
1126 case 10:
1127 YY_RULE_SETUP
1128 {catch_for_scope += " ";}
1129 YY_BREAK
1130 case 11:
1131 /* rule 11 can match eol */
1132 YY_RULE_SETUP
1133 {catch_for_scope += " ";}
1134 YY_BREAK
1135 case 12:
1136 YY_RULE_SETUP
1137 {/* eat a string */}
1138 YY_BREAK
1139 case 13:
1140 YY_RULE_SETUP
1141 {/* eat a string */}
1142 YY_BREAK
1143 case 14:
1144 YY_RULE_SETUP
1145 {BEGIN(PRE_PROCESSOR_STATE);}
1146 YY_BREAK
1147 case 15:
1148 YY_RULE_SETUP
1149 {} /* continue same state on next line */
1150 YY_BREAK
1151 case 16:
1152 /* rule 16 can match eol */
1153 YY_RULE_SETUP
1154 {BEGIN(current_state);}
1155 YY_BREAK
1156 case 17:
1157 YY_RULE_SETUP
1158 {} /* consume it */
1159 YY_BREAK
1160 case 18:
1161 YY_RULE_SETUP
1162 {
1163 current_state = CATCH_STATE;
1164 catch_for_scope.clear();
1165 BEGIN(CATCH_STATE);
1166 }
1167 YY_BREAK
1168 case 19:
1169 YY_RULE_SETUP
1170 {catch_for_scope += ";";}
1171 YY_BREAK
1172 case 20:
1173 YY_RULE_SETUP
1174 {
1175 catch_for_scope += ";";
1176 current_state = INITIAL;
1177 BEGIN(INITIAL);
1178 }
1179 YY_BREAK
1180 case 21:
1181 YY_RULE_SETUP
1182 {
1183 // default keep the current token
1184 catch_for_scope += scope_optimizer_text;
1185 }
1186 YY_BREAK
1187 case 22:
1188 YY_RULE_SETUP
1189 {
1190 current_state = FOR_STATE;
1191 BEGIN(FOR_STATE);
1192 }
1193 YY_BREAK
1194 case 23:
1195 YY_RULE_SETUP
1196 {
1197 BEGIN(LAMBDA_STATE);
1198 consume_lambda_signature();
1199 BEGIN(INITIAL);
1200 }
1201 YY_BREAK
1202 case 24:
1203 YY_RULE_SETUP
1204 {
1205 return __IDENTIFIER;
1206 }
1207 YY_BREAK
1208 case 25:
1209 YY_RULE_SETUP
1210 {
1211 return scope_optimizer_text[0];
1212 }
1213 YY_BREAK
1214 case 26:
1215 YY_RULE_SETUP
1216 {
1217 current_brace_depth++;
1218 catch_for_scope += scope_optimizer_text;
1219 }
1220 YY_BREAK
1221 case 27:
1222 YY_RULE_SETUP
1223 {
1224 current_brace_depth--;
1225 if(current_brace_depth == 0) {
1226 current_state = INITIAL;
1227 catch_for_scope += ";";
1228 current_brace_depth = 1;
1229 BEGIN(INITIAL);
1230 } else {
1231 catch_for_scope += scope_optimizer_text;
1232 }
1233 }
1234 YY_BREAK
1235 case 28:
1236 YY_RULE_SETUP
1237 {
1238 // default keep the current token
1239 catch_for_scope += scope_optimizer_text;
1240 }
1241 YY_BREAK
1242 case 29:
1243 YY_RULE_SETUP
1244 {
1245 current_scope.str += "(";
1246 if(current_scope.str.empty() == false) {
1247 PUSH_SCOPE(current_scope);
1248 }
1249 current_scope.clear();
1250 }
1251 YY_BREAK
1252 case 30:
1253 YY_RULE_SETUP
1254 {
1255 if ( !scope_stack.empty() ) {
1256 current_scope = scope_stack.back();
1257 scope_stack.pop_back();
1258
1259 current_scope.str += ")";
1260 } else {
1261 current_scope.clear();
1262 }
1263 }
1264 YY_BREAK
1265 case 31:
1266 YY_RULE_SETUP
1267 {
1268 current_scope.str += "{";
1269 PUSH_SCOPE(current_scope);
1270 current_scope.clear();
1271
1272 if(catch_for_scope.empty() == false)
1273 current_scope.str += catch_for_scope;
1274 catch_for_scope.clear();
1275 }
1276 YY_BREAK
1277 case 32:
1278 YY_RULE_SETUP
1279 {
1280 if ( !scope_stack.empty() ) {
1281 current_scope = scope_stack.back();
1282
1283 scope_stack.pop_back();
1284 current_scope.str += "}";
1285 } else {
1286 current_scope.clear();
1287 }
1288 }
1289 YY_BREAK
1290 case 33:
1291 YY_RULE_SETUP
1292 {current_scope.str += scope_optimizer_text;}
1293 YY_BREAK
1294 case 34:
1295 YY_RULE_SETUP
1296 {}
1297 YY_BREAK
1298 case 35:
1299 YY_RULE_SETUP
1300 {}
1301 YY_BREAK
1302 case 36:
1303 YY_RULE_SETUP
1304 {}
1305 YY_BREAK
1306 case 37:
1307 YY_RULE_SETUP
1308 {}
1309 YY_BREAK
1310 case 38:
1311 YY_RULE_SETUP
1312 {}
1313 YY_BREAK
1314 case 39:
1315 YY_RULE_SETUP
1316 {}
1317 YY_BREAK
1318 case 40:
1319 YY_RULE_SETUP
1320 {}
1321 YY_BREAK
1322 case 41:
1323 YY_RULE_SETUP
1324 {}
1325 YY_BREAK
1326 case 42:
1327 YY_RULE_SETUP
1328 {}
1329 YY_BREAK
1330 case 43:
1331 YY_RULE_SETUP
1332 {}
1333 YY_BREAK
1334 case 44:
1335 YY_RULE_SETUP
1336 {}
1337 YY_BREAK
1338 case 45:
1339 YY_RULE_SETUP
1340 {}
1341 YY_BREAK
1342 case 46:
1343 YY_RULE_SETUP
1344 {}
1345 YY_BREAK
1346 case 47:
1347 YY_RULE_SETUP
1348 {}
1349 YY_BREAK
1350 case 48:
1351 YY_RULE_SETUP
1352 {}
1353 YY_BREAK
1354 case 49:
1355 YY_RULE_SETUP
1356 {}
1357 YY_BREAK
1358 case 50:
1359 YY_RULE_SETUP
1360 {}
1361 YY_BREAK
1362 case 51:
1363 YY_RULE_SETUP
1364 {}
1365 YY_BREAK
1366 case 52:
1367 YY_RULE_SETUP
1368 {}
1369 YY_BREAK
1370 case 53:
1371 YY_RULE_SETUP
1372 {}
1373 YY_BREAK
1374 case 54:
1375 YY_RULE_SETUP
1376 {}
1377 YY_BREAK
1378 case 55:
1379 YY_RULE_SETUP
1380 {}
1381 YY_BREAK
1382 case 56:
1383 YY_RULE_SETUP
1384 {}
1385 YY_BREAK
1386 case 57:
1387 YY_RULE_SETUP
1388 {}
1389 YY_BREAK
1390 case 58:
1391 YY_RULE_SETUP
1392 { current_scope.str += scope_optimizer_text; }
1393 YY_BREAK
1394 case 59:
1395 YY_RULE_SETUP
1396 { current_scope.str += scope_optimizer_text; }
1397 YY_BREAK
1398 case 60:
1399 YY_RULE_SETUP
1400 { current_scope.str += scope_optimizer_text; }
1401 YY_BREAK
1402 case 61:
1403 YY_RULE_SETUP
1404 {}
1405 YY_BREAK
1406 case 62:
1407 YY_RULE_SETUP
1408 {}
1409 YY_BREAK
1410 case 63:
1411 YY_RULE_SETUP
1412 {}
1413 YY_BREAK
1414 case 64:
1415 YY_RULE_SETUP
1416 {}
1417 YY_BREAK
1418 case 65:
1419 YY_RULE_SETUP
1420 {}
1421 YY_BREAK
1422 case 66:
1423 YY_RULE_SETUP
1424 {}
1425 YY_BREAK
1426 case 67:
1427 YY_RULE_SETUP
1428 {}
1429 YY_BREAK
1430 case 68:
1431 YY_RULE_SETUP
1432 {}
1433 YY_BREAK
1434 case 69:
1435 YY_RULE_SETUP
1436 {}
1437 YY_BREAK
1438 case 70:
1439 YY_RULE_SETUP
1440 {}
1441 YY_BREAK
1442 case 71:
1443 YY_RULE_SETUP
1444 {}
1445 YY_BREAK
1446 case 72:
1447 YY_RULE_SETUP
1448 {}
1449 YY_BREAK
1450 case 73:
1451 YY_RULE_SETUP
1452 {}
1453 YY_BREAK
1454 case 74:
1455 YY_RULE_SETUP
1456 {}
1457 YY_BREAK
1458 case 75:
1459 YY_RULE_SETUP
1460 {}
1461 YY_BREAK
1462 case 76:
1463 YY_RULE_SETUP
1464 { current_scope.str += scope_optimizer_text; }
1465 YY_BREAK
1466 case 77:
1467 YY_RULE_SETUP
1468 { current_scope.str += scope_optimizer_text; }
1469 YY_BREAK
1470 case 78:
1471 case 79:
1472 YY_RULE_SETUP
1473 {
1474 if(catch_for_scope.empty() == false)
1475 catch_for_scope.clear();
1476
1477 // default keep the current token
1478 current_scope.str += scope_optimizer_text;
1479 }
1480 YY_BREAK
1481 case 80:
1482 /* rule 80 can match eol */
1483 YY_RULE_SETUP
1484 {
1485 BEGIN(current_state);
1486 }
1487 YY_BREAK
1488 case 81:
1489 YY_RULE_SETUP
1490 {}
1491 YY_BREAK
1492 case 82:
1493 YY_RULE_SETUP
1494 {
1495 BEGIN(current_state);
1496 }
1497 YY_BREAK
1498 case 83:
1499 YY_RULE_SETUP
1500 {}
1501 YY_BREAK
1502 case YY_STATE_EOF(INITIAL):
1503 case YY_STATE_EOF(PRE_PROCESSOR_STATE):
1504 case YY_STATE_EOF(CATCH_STATE):
1505 case YY_STATE_EOF(FOR_STATE):
1506 case YY_STATE_EOF(C_COMMENT_STATE):
1507 case YY_STATE_EOF(CPP_COMMENT_STATE):
1508 case YY_STATE_EOF(LAMBDA_STATE):
1509 {
1510 if(current_scope.str.empty() == false) {
1511 PUSH_SCOPE(current_scope);
1512 current_scope.clear();
1513 }
1514 yyterminate();
1515 }
1516 YY_BREAK
1517 case 84:
1518 YY_RULE_SETUP
1519 ECHO;
1520 YY_BREAK
1521
1522 case YY_END_OF_BUFFER:
1523 {
1524 /* Amount of text matched not including the EOB char. */
1525 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1526
1527 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1528 *yy_cp = (yy_hold_char);
1529 YY_RESTORE_YY_MORE_OFFSET
1530
1531 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1532 {
1533 /* We're scanning a new file or input source. It's
1534 * possible that this happened because the user
1535 * just pointed scope_optimizer_in at a new source and called
1536 * scope_optimizer_lex(). If so, then we have to assure
1537 * consistency between YY_CURRENT_BUFFER and our
1538 * globals. Here is the right place to do so, because
1539 * this is the first action (other than possibly a
1540 * back-up) that will match for the new input source.
1541 */
1542 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1543 YY_CURRENT_BUFFER_LVALUE->yy_input_file = scope_optimizer_in;
1544 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1545 }
1546
1547 /* Note that here we test for yy_c_buf_p "<=" to the position
1548 * of the first EOB in the buffer, since yy_c_buf_p will
1549 * already have been incremented past the NUL character
1550 * (since all states make transitions on EOB to the
1551 * end-of-buffer state). Contrast this with the test
1552 * in input().
1553 */
1554 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1555 { /* This was really a NUL. */
1556 yy_state_type yy_next_state;
1557
1558 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1559
1560 yy_current_state = yy_get_previous_state( );
1561
1562 /* Okay, we're now positioned to make the NUL
1563 * transition. We couldn't have
1564 * yy_get_previous_state() go ahead and do it
1565 * for us because it doesn't know how to deal
1566 * with the possibility of jamming (and we don't
1567 * want to build jamming into it because then it
1568 * will run more slowly).
1569 */
1570
1571 yy_next_state = yy_try_NUL_trans( yy_current_state );
1572
1573 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1574
1575 if ( yy_next_state )
1576 {
1577 /* Consume the NUL. */
1578 yy_cp = ++(yy_c_buf_p);
1579 yy_current_state = yy_next_state;
1580 goto yy_match;
1581 }
1582
1583 else
1584 {
1585 yy_cp = (yy_c_buf_p);
1586 goto yy_find_action;
1587 }
1588 }
1589
1590 else switch ( yy_get_next_buffer( ) )
1591 {
1592 case EOB_ACT_END_OF_FILE:
1593 {
1594 (yy_did_buffer_switch_on_eof) = 0;
1595
1596 if ( scope_optimizer_wrap( ) )
1597 {
1598 /* Note: because we've taken care in
1599 * yy_get_next_buffer() to have set up
1600 * scope_optimizer_text, we can now set up
1601 * yy_c_buf_p so that if some total
1602 * hoser (like flex itself) wants to
1603 * call the scanner after we return the
1604 * YY_NULL, it'll still work - another
1605 * YY_NULL will get returned.
1606 */
1607 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1608
1609 yy_act = YY_STATE_EOF(YY_START);
1610 goto do_action;
1611 }
1612
1613 else
1614 {
1615 if ( ! (yy_did_buffer_switch_on_eof) )
1616 YY_NEW_FILE;
1617 }
1618 break;
1619 }
1620
1621 case EOB_ACT_CONTINUE_SCAN:
1622 (yy_c_buf_p) =
1623 (yytext_ptr) + yy_amount_of_matched_text;
1624
1625 yy_current_state = yy_get_previous_state( );
1626
1627 yy_cp = (yy_c_buf_p);
1628 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1629 goto yy_match;
1630
1631 case EOB_ACT_LAST_MATCH:
1632 (yy_c_buf_p) =
1633 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1634
1635 yy_current_state = yy_get_previous_state( );
1636
1637 yy_cp = (yy_c_buf_p);
1638 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1639 goto yy_find_action;
1640 }
1641 break;
1642 }
1643
1644 default:
1645 YY_FATAL_ERROR(
1646 "fatal flex scanner internal error--no action found" );
1647 } /* end of action switch */
1648 } /* end of scanning one token */
1649 } /* end of scope_optimizer_lex */
1650
1651 /* yy_get_next_buffer - try to read in a new buffer
1652 *
1653 * Returns a code representing an action:
1654 * EOB_ACT_LAST_MATCH -
1655 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1656 * EOB_ACT_END_OF_FILE - end of file
1657 */
1658 static int yy_get_next_buffer (void)
1659 {
1660 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1661 register char *source = (yytext_ptr);
1662 register int number_to_move, i;
1663 int ret_val;
1664
1665 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1666 YY_FATAL_ERROR(
1667 "fatal flex scanner internal error--end of buffer missed" );
1668
1669 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1670 { /* Don't try to fill the buffer, so this is an EOF. */
1671 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1672 {
1673 /* We matched a single character, the EOB, so
1674 * treat this as a final EOF.
1675 */
1676 return EOB_ACT_END_OF_FILE;
1677 }
1678
1679 else
1680 {
1681 /* We matched some text prior to the EOB, first
1682 * process it.
1683 */
1684 return EOB_ACT_LAST_MATCH;
1685 }
1686 }
1687
1688 /* Try to read more data. */
1689
1690 /* First move last chars to start of buffer. */
1691 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1692
1693 for ( i = 0; i < number_to_move; ++i )
1694 *(dest++) = *(source++);
1695
1696 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1697 /* don't do the read, it's not guaranteed to return an EOF,
1698 * just force an EOF
1699 */
1700 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1701
1702 else
1703 {
1704 yy_size_t num_to_read =
1705 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1706
1707 while ( num_to_read <= 0 )
1708 { /* Not enough room in the buffer - grow it. */
1709
1710 /* just a shorter name for the current buffer */
1711 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1712
1713 int yy_c_buf_p_offset =
1714 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1715
1716 if ( b->yy_is_our_buffer )
1717 {
1718 yy_size_t new_size = b->yy_buf_size * 2;
1719
1720 if ( new_size <= 0 )
1721 b->yy_buf_size += b->yy_buf_size / 8;
1722 else
1723 b->yy_buf_size *= 2;
1724
1725 b->yy_ch_buf = (char *)
1726 /* Include room in for 2 EOB chars. */
1727 scope_optimizer_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1728 }
1729 else
1730 /* Can't grow it, we don't own it. */
1731 b->yy_ch_buf = 0;
1732
1733 if ( ! b->yy_ch_buf )
1734 YY_FATAL_ERROR(
1735 "fatal error - scanner input buffer overflow" );
1736
1737 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1738
1739 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1740 number_to_move - 1;
1741
1742 }
1743
1744 if ( num_to_read > YY_READ_BUF_SIZE )
1745 num_to_read = YY_READ_BUF_SIZE;
1746
1747 /* Read in more data. */
1748 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1749 (yy_n_chars), num_to_read );
1750
1751 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1752 }
1753
1754 if ( (yy_n_chars) == 0 )
1755 {
1756 if ( number_to_move == YY_MORE_ADJ )
1757 {
1758 ret_val = EOB_ACT_END_OF_FILE;
1759 scope_optimizer_restart(scope_optimizer_in );
1760 }
1761
1762 else
1763 {
1764 ret_val = EOB_ACT_LAST_MATCH;
1765 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1766 YY_BUFFER_EOF_PENDING;
1767 }
1768 }
1769
1770 else
1771 ret_val = EOB_ACT_CONTINUE_SCAN;
1772
1773 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1774 /* Extend the array by 50%, plus the number we really need. */
1775 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1776 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) scope_optimizer_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1777 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1778 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1779 }
1780
1781 (yy_n_chars) += number_to_move;
1782 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1783 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1784
1785 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1786
1787 return ret_val;
1788 }
1789
1790 /* yy_get_previous_state - get the state just before the EOB char was reached */
1791
1792 static yy_state_type yy_get_previous_state (void)
1793 {
1794 register yy_state_type yy_current_state;
1795 register char *yy_cp;
1796
1797 yy_current_state = (yy_start);
1798
1799 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1800 {
1801 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1802 if ( yy_accept[yy_current_state] )
1803 {
1804 (yy_last_accepting_state) = yy_current_state;
1805 (yy_last_accepting_cpos) = yy_cp;
1806 }
1807 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1808 {
1809 yy_current_state = (int) yy_def[yy_current_state];
1810 if ( yy_current_state >= 352 )
1811 yy_c = yy_meta[(unsigned int) yy_c];
1812 }
1813 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1814 }
1815
1816 return yy_current_state;
1817 }
1818
1819 /* yy_try_NUL_trans - try to make a transition on the NUL character
1820 *
1821 * synopsis
1822 * next_state = yy_try_NUL_trans( current_state );
1823 */
1824 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1825 {
1826 register int yy_is_jam;
1827 register char *yy_cp = (yy_c_buf_p);
1828
1829 register YY_CHAR yy_c = 1;
1830 if ( yy_accept[yy_current_state] )
1831 {
1832 (yy_last_accepting_state) = yy_current_state;
1833 (yy_last_accepting_cpos) = yy_cp;
1834 }
1835 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1836 {
1837 yy_current_state = (int) yy_def[yy_current_state];
1838 if ( yy_current_state >= 352 )
1839 yy_c = yy_meta[(unsigned int) yy_c];
1840 }
1841 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1842 yy_is_jam = (yy_current_state == 351);
1843
1844 return yy_is_jam ? 0 : yy_current_state;
1845 }
1846
1847 static void yyunput (int c, register char * yy_bp )
1848 {
1849 register char *yy_cp;
1850
1851 yy_cp = (yy_c_buf_p);
1852
1853 /* undo effects of setting up scope_optimizer_text */
1854 *yy_cp = (yy_hold_char);
1855
1856 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1857 { /* need to shift things up to make room */
1858 /* +2 for EOB chars. */
1859 register yy_size_t number_to_move = (yy_n_chars) + 2;
1860 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1861 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1862 register char *source =
1863 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1864
1865 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1866 *--dest = *--source;
1867
1868 yy_cp += (int) (dest - source);
1869 yy_bp += (int) (dest - source);
1870 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1871 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1872
1873 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1874 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1875 }
1876
1877 *--yy_cp = (char) c;
1878
1879 if ( c == '\n' ){
1880 --scope_optimizer_lineno;
1881 }
1882
1883 (yytext_ptr) = yy_bp;
1884 (yy_hold_char) = *yy_cp;
1885 (yy_c_buf_p) = yy_cp;
1886 }
1887
1888 #ifndef YY_NO_INPUT
1889 #ifdef __cplusplus
1890 static int yyinput (void)
1891 #else
1892 static int input (void)
1893 #endif
1894
1895 {
1896 int c;
1897
1898 *(yy_c_buf_p) = (yy_hold_char);
1899
1900 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1901 {
1902 /* yy_c_buf_p now points to the character we want to return.
1903 * If this occurs *before* the EOB characters, then it's a
1904 * valid NUL; if not, then we've hit the end of the buffer.
1905 */
1906 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1907 /* This was really a NUL. */
1908 *(yy_c_buf_p) = '\0';
1909
1910 else
1911 { /* need more input */
1912 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1913 ++(yy_c_buf_p);
1914
1915 switch ( yy_get_next_buffer( ) )
1916 {
1917 case EOB_ACT_LAST_MATCH:
1918 /* This happens because yy_g_n_b()
1919 * sees that we've accumulated a
1920 * token and flags that we need to
1921 * try matching the token before
1922 * proceeding. But for input(),
1923 * there's no matching to consider.
1924 * So convert the EOB_ACT_LAST_MATCH
1925 * to EOB_ACT_END_OF_FILE.
1926 */
1927
1928 /* Reset buffer status. */
1929 scope_optimizer_restart(scope_optimizer_in );
1930
1931 /*FALLTHROUGH*/
1932
1933 case EOB_ACT_END_OF_FILE:
1934 {
1935 if ( scope_optimizer_wrap( ) )
1936 return EOF;
1937
1938 if ( ! (yy_did_buffer_switch_on_eof) )
1939 YY_NEW_FILE;
1940 #ifdef __cplusplus
1941 return yyinput();
1942 #else
1943 return input();
1944 #endif
1945 }
1946
1947 case EOB_ACT_CONTINUE_SCAN:
1948 (yy_c_buf_p) = (yytext_ptr) + offset;
1949 break;
1950 }
1951 }
1952 }
1953
1954 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1955 *(yy_c_buf_p) = '\0'; /* preserve scope_optimizer_text */
1956 (yy_hold_char) = *++(yy_c_buf_p);
1957
1958 if ( c == '\n' )
1959
1960 scope_optimizer_lineno++;
1961 ;
1962
1963 return c;
1964 }
1965 #endif /* ifndef YY_NO_INPUT */
1966
1967 /** Immediately switch to a different input stream.
1968 * @param input_file A readable stream.
1969 *
1970 * @note This function does not reset the start condition to @c INITIAL .
1971 */
1972 void scope_optimizer_restart (FILE * input_file )
1973 {
1974
1975 if ( ! YY_CURRENT_BUFFER ){
1976 scope_optimizer_ensure_buffer_stack ();
1977 YY_CURRENT_BUFFER_LVALUE =
1978 scope_optimizer__create_buffer(scope_optimizer_in,YY_BUF_SIZE );
1979 }
1980
1981 scope_optimizer__init_buffer(YY_CURRENT_BUFFER,input_file );
1982 scope_optimizer__load_buffer_state( );
1983 }
1984
1985 /** Switch to a different input buffer.
1986 * @param new_buffer The new input buffer.
1987 *
1988 */
1989 void scope_optimizer__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1990 {
1991
1992 /* TODO. We should be able to replace this entire function body
1993 * with
1994 * scope_optimizer_pop_buffer_state();
1995 * scope_optimizer_push_buffer_state(new_buffer);
1996 */
1997 scope_optimizer_ensure_buffer_stack ();
1998 if ( YY_CURRENT_BUFFER == new_buffer )
1999 return;
2000
2001 if ( YY_CURRENT_BUFFER )
2002 {
2003 /* Flush out information for old buffer. */
2004 *(yy_c_buf_p) = (yy_hold_char);
2005 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2006 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2007 }
2008
2009 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2010 scope_optimizer__load_buffer_state( );
2011
2012 /* We don't actually know whether we did this switch during
2013 * EOF (scope_optimizer_wrap()) processing, but the only time this flag
2014 * is looked at is after scope_optimizer_wrap() is called, so it's safe
2015 * to go ahead and always set it.
2016 */
2017 (yy_did_buffer_switch_on_eof) = 1;
2018 }
2019
2020 static void scope_optimizer__load_buffer_state (void)
2021 {
2022 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2023 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2024 scope_optimizer_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2025 (yy_hold_char) = *(yy_c_buf_p);
2026 }
2027
2028 /** Allocate and initialize an input buffer state.
2029 * @param file A readable stream.
2030 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2031 *
2032 * @return the allocated buffer state.
2033 */
2034 YY_BUFFER_STATE scope_optimizer__create_buffer (FILE * file, int size )
2035 {
2036 YY_BUFFER_STATE b;
2037
2038 b = (YY_BUFFER_STATE) scope_optimizer_alloc(sizeof( struct yy_buffer_state ) );
2039 if ( ! b )
2040 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer__create_buffer()" );
2041
2042 b->yy_buf_size = size;
2043
2044 /* yy_ch_buf has to be 2 characters longer than the size given because
2045 * we need to put in 2 end-of-buffer characters.
2046 */
2047 b->yy_ch_buf = (char *) scope_optimizer_alloc(b->yy_buf_size + 2 );
2048 if ( ! b->yy_ch_buf )
2049 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer__create_buffer()" );
2050
2051 b->yy_is_our_buffer = 1;
2052
2053 scope_optimizer__init_buffer(b,file );
2054
2055 return b;
2056 }
2057
2058 /** Destroy the buffer.
2059 * @param b a buffer created with scope_optimizer__create_buffer()
2060 *
2061 */
2062 void scope_optimizer__delete_buffer (YY_BUFFER_STATE b )
2063 {
2064
2065 if ( ! b )
2066 return;
2067
2068 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2069 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2070
2071 if ( b->yy_is_our_buffer )
2072 scope_optimizer_free((void *) b->yy_ch_buf );
2073
2074 scope_optimizer_free((void *) b );
2075 }
2076
2077 /* Initializes or reinitializes a buffer.
2078 * This function is sometimes called more than once on the same buffer,
2079 * such as during a scope_optimizer_restart() or at EOF.
2080 */
2081 static void scope_optimizer__init_buffer (YY_BUFFER_STATE b, FILE * file )
2082
2083 {
2084 int oerrno = errno;
2085
2086 scope_optimizer__flush_buffer(b );
2087
2088 b->yy_input_file = file;
2089 b->yy_fill_buffer = 1;
2090
2091 /* If b is the current buffer, then scope_optimizer__init_buffer was _probably_
2092 * called from scope_optimizer_restart() or through yy_get_next_buffer.
2093 * In that case, we don't want to reset the lineno or column.
2094 */
2095 if (b != YY_CURRENT_BUFFER){
2096 b->yy_bs_lineno = 1;
2097 b->yy_bs_column = 0;
2098 }
2099
2100 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2101
2102 errno = oerrno;
2103 }
2104
2105 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2106 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2107 *
2108 */
2109 void scope_optimizer__flush_buffer (YY_BUFFER_STATE b )
2110 {
2111 if ( ! b )
2112 return;
2113
2114 b->yy_n_chars = 0;
2115
2116 /* We always need two end-of-buffer characters. The first causes
2117 * a transition to the end-of-buffer state. The second causes
2118 * a jam in that state.
2119 */
2120 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2121 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2122
2123 b->yy_buf_pos = &b->yy_ch_buf[0];
2124
2125 b->yy_at_bol = 1;
2126 b->yy_buffer_status = YY_BUFFER_NEW;
2127
2128 if ( b == YY_CURRENT_BUFFER )
2129 scope_optimizer__load_buffer_state( );
2130 }
2131
2132 /** Pushes the new state onto the stack. The new state becomes
2133 * the current state. This function will allocate the stack
2134 * if necessary.
2135 * @param new_buffer The new state.
2136 *
2137 */
2138 void scope_optimizer_push_buffer_state (YY_BUFFER_STATE new_buffer )
2139 {
2140 if (new_buffer == NULL)
2141 return;
2142
2143 scope_optimizer_ensure_buffer_stack();
2144
2145 /* This block is copied from scope_optimizer__switch_to_buffer. */
2146 if ( YY_CURRENT_BUFFER )
2147 {
2148 /* Flush out information for old buffer. */
2149 *(yy_c_buf_p) = (yy_hold_char);
2150 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2151 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2152 }
2153
2154 /* Only push if top exists. Otherwise, replace top. */
2155 if (YY_CURRENT_BUFFER)
2156 (yy_buffer_stack_top)++;
2157 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2158
2159 /* copied from scope_optimizer__switch_to_buffer. */
2160 scope_optimizer__load_buffer_state( );
2161 (yy_did_buffer_switch_on_eof) = 1;
2162 }
2163
2164 /** Removes and deletes the top of the stack, if present.
2165 * The next element becomes the new top.
2166 *
2167 */
2168 void scope_optimizer_pop_buffer_state (void)
2169 {
2170 if (!YY_CURRENT_BUFFER)
2171 return;
2172
2173 scope_optimizer__delete_buffer(YY_CURRENT_BUFFER );
2174 YY_CURRENT_BUFFER_LVALUE = NULL;
2175 if ((yy_buffer_stack_top) > 0)
2176 --(yy_buffer_stack_top);
2177
2178 if (YY_CURRENT_BUFFER) {
2179 scope_optimizer__load_buffer_state( );
2180 (yy_did_buffer_switch_on_eof) = 1;
2181 }
2182 }
2183
2184 /* Allocates the stack if it does not exist.
2185 * Guarantees space for at least one push.
2186 */
2187 static void scope_optimizer_ensure_buffer_stack (void)
2188 {
2189 yy_size_t num_to_alloc;
2190
2191 if (!(yy_buffer_stack)) {
2192
2193 /* First allocation is just for 2 elements, since we don't know if this
2194 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2195 * immediate realloc on the next call.
2196 */
2197 num_to_alloc = 1;
2198 (yy_buffer_stack) = (struct yy_buffer_state**)scope_optimizer_alloc
2199 (num_to_alloc * sizeof(struct yy_buffer_state*)
2200 );
2201 if ( ! (yy_buffer_stack) )
2202 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer_ensure_buffer_stack()" );
2203
2204 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2205
2206 (yy_buffer_stack_max) = num_to_alloc;
2207 (yy_buffer_stack_top) = 0;
2208 return;
2209 }
2210
2211 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2212
2213 /* Increase the buffer to prepare for a possible push. */
2214 int grow_size = 8 /* arbitrary grow size */;
2215
2216 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2217 (yy_buffer_stack) = (struct yy_buffer_state**)scope_optimizer_realloc
2218 ((yy_buffer_stack),
2219 num_to_alloc * sizeof(struct yy_buffer_state*)
2220 );
2221 if ( ! (yy_buffer_stack) )
2222 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer_ensure_buffer_stack()" );
2223
2224 /* zero only the new slots.*/
2225 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2226 (yy_buffer_stack_max) = num_to_alloc;
2227 }
2228 }
2229
2230 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2231 * @param base the character buffer
2232 * @param size the size in bytes of the character buffer
2233 *
2234 * @return the newly allocated buffer state object.
2235 */
2236 YY_BUFFER_STATE scope_optimizer__scan_buffer (char * base, yy_size_t size )
2237 {
2238 YY_BUFFER_STATE b;
2239
2240 if ( size < 2 ||
2241 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2242 base[size-1] != YY_END_OF_BUFFER_CHAR )
2243 /* They forgot to leave room for the EOB's. */
2244 return 0;
2245
2246 b = (YY_BUFFER_STATE) scope_optimizer_alloc(sizeof( struct yy_buffer_state ) );
2247 if ( ! b )
2248 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer__scan_buffer()" );
2249
2250 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2251 b->yy_buf_pos = b->yy_ch_buf = base;
2252 b->yy_is_our_buffer = 0;
2253 b->yy_input_file = 0;
2254 b->yy_n_chars = b->yy_buf_size;
2255 b->yy_is_interactive = 0;
2256 b->yy_at_bol = 1;
2257 b->yy_fill_buffer = 0;
2258 b->yy_buffer_status = YY_BUFFER_NEW;
2259
2260 scope_optimizer__switch_to_buffer(b );
2261
2262 return b;
2263 }
2264
2265 /** Setup the input buffer state to scan a string. The next call to scope_optimizer_lex() will
2266 * scan from a @e copy of @a str.
2267 * @param yystr a NUL-terminated string to scan
2268 *
2269 * @return the newly allocated buffer state object.
2270 * @note If you want to scan bytes that may contain NUL values, then use
2271 * scope_optimizer__scan_bytes() instead.
2272 */
2273 YY_BUFFER_STATE scope_optimizer__scan_string (yyconst char * yystr )
2274 {
2275
2276 return scope_optimizer__scan_bytes(yystr,strlen(yystr) );
2277 }
2278
2279 /** Setup the input buffer state to scan the given bytes. The next call to scope_optimizer_lex() will
2280 * scan from a @e copy of @a bytes.
2281 * @param yybytes the byte buffer to scan
2282 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2283 *
2284 * @return the newly allocated buffer state object.
2285 */
2286 YY_BUFFER_STATE scope_optimizer__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
2287 {
2288 YY_BUFFER_STATE b;
2289 char *buf;
2290 yy_size_t n;
2291 yy_size_t i;
2292
2293 /* Get memory for full buffer, including space for trailing EOB's. */
2294 n = _yybytes_len + 2;
2295 buf = (char *) scope_optimizer_alloc(n );
2296 if ( ! buf )
2297 YY_FATAL_ERROR( "out of dynamic memory in scope_optimizer__scan_bytes()" );
2298
2299 for ( i = 0; i < _yybytes_len; ++i )
2300 buf[i] = yybytes[i];
2301
2302 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2303
2304 b = scope_optimizer__scan_buffer(buf,n );
2305 if ( ! b )
2306 YY_FATAL_ERROR( "bad buffer in scope_optimizer__scan_bytes()" );
2307
2308 /* It's okay to grow etc. this buffer, and we should throw it
2309 * away when we're done.
2310 */
2311 b->yy_is_our_buffer = 1;
2312
2313 return b;
2314 }
2315
2316 #ifndef YY_EXIT_FAILURE
2317 #define YY_EXIT_FAILURE 2
2318 #endif
2319
2320 static void yy_fatal_error (yyconst char* msg )
2321 {
2322 (void) fprintf( stderr, "%s\n", msg );
2323
2324 }
2325
2326 /* Redefine yyless() so it works in section 3 code. */
2327
2328 #undef yyless
2329 #define yyless(n) \
2330 do \
2331 { \
2332 /* Undo effects of setting up scope_optimizer_text. */ \
2333 int yyless_macro_arg = (n); \
2334 YY_LESS_LINENO(yyless_macro_arg);\
2335 scope_optimizer_text[scope_optimizer_leng] = (yy_hold_char); \
2336 (yy_c_buf_p) = scope_optimizer_text + yyless_macro_arg; \
2337 (yy_hold_char) = *(yy_c_buf_p); \
2338 *(yy_c_buf_p) = '\0'; \
2339 scope_optimizer_leng = yyless_macro_arg; \
2340 } \
2341 while ( 0 )
2342
2343 /* Accessor methods (get/set functions) to struct members. */
2344
2345 /** Get the current line number.
2346 *
2347 */
2348 int scope_optimizer_get_lineno (void)
2349 {
2350
2351 return scope_optimizer_lineno;
2352 }
2353
2354 /** Get the input stream.
2355 *
2356 */
2357 FILE *scope_optimizer_get_in (void)
2358 {
2359 return scope_optimizer_in;
2360 }
2361
2362 /** Get the output stream.
2363 *
2364 */
2365 FILE *scope_optimizer_get_out (void)
2366 {
2367 return scope_optimizer_out;
2368 }
2369
2370 /** Get the length of the current token.
2371 *
2372 */
2373 yy_size_t scope_optimizer_get_leng (void)
2374 {
2375 return scope_optimizer_leng;
2376 }
2377
2378 /** Get the current token.
2379 *
2380 */
2381
2382 char *scope_optimizer_get_text (void)
2383 {
2384 return scope_optimizer_text;
2385 }
2386
2387 /** Set the current line number.
2388 * @param line_number
2389 *
2390 */
2391 void scope_optimizer_set_lineno (int line_number )
2392 {
2393
2394 scope_optimizer_lineno = line_number;
2395 }
2396
2397 /** Set the input stream. This does not discard the current
2398 * input buffer.
2399 * @param in_str A readable stream.
2400 *
2401 * @see scope_optimizer__switch_to_buffer
2402 */
2403 void scope_optimizer_set_in (FILE * in_str )
2404 {
2405 scope_optimizer_in = in_str ;
2406 }
2407
2408 void scope_optimizer_set_out (FILE * out_str )
2409 {
2410 scope_optimizer_out = out_str ;
2411 }
2412
2413 int scope_optimizer_get_debug (void)
2414 {
2415 return scope_optimizer__flex_debug;
2416 }
2417
2418 void scope_optimizer_set_debug (int bdebug )
2419 {
2420 scope_optimizer__flex_debug = bdebug ;
2421 }
2422
2423 static int yy_init_globals (void)
2424 {
2425 /* Initialization is the same as for the non-reentrant scanner.
2426 * This function is called from scope_optimizer_lex_destroy(), so don't allocate here.
2427 */
2428
2429 /* We do not touch scope_optimizer_lineno unless the option is enabled. */
2430 scope_optimizer_lineno = 1;
2431
2432 (yy_buffer_stack) = 0;
2433 (yy_buffer_stack_top) = 0;
2434 (yy_buffer_stack_max) = 0;
2435 (yy_c_buf_p) = (char *) 0;
2436 (yy_init) = 0;
2437 (yy_start) = 0;
2438
2439 /* Defined in main.c */
2440 #ifdef YY_STDINIT
2441 scope_optimizer_in = stdin;
2442 scope_optimizer_out = stdout;
2443 #else
2444 scope_optimizer_in = (FILE *) 0;
2445 scope_optimizer_out = (FILE *) 0;
2446 #endif
2447
2448 /* For future reference: Set errno on error, since we are called by
2449 * scope_optimizer_lex_init()
2450 */
2451 return 0;
2452 }
2453
2454 /* scope_optimizer_lex_destroy is for both reentrant and non-reentrant scanners. */
2455 int scope_optimizer_lex_destroy (void)
2456 {
2457
2458 /* Pop the buffer stack, destroying each element. */
2459 while(YY_CURRENT_BUFFER){
2460 scope_optimizer__delete_buffer(YY_CURRENT_BUFFER );
2461 YY_CURRENT_BUFFER_LVALUE = NULL;
2462 scope_optimizer_pop_buffer_state();
2463 }
2464
2465 /* Destroy the stack itself. */
2466 scope_optimizer_free((yy_buffer_stack) );
2467 (yy_buffer_stack) = NULL;
2468
2469 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2470 * scope_optimizer_lex() is called, initialization will occur. */
2471 yy_init_globals( );
2472
2473 return 0;
2474 }
2475
2476 /*
2477 * Internal utility routines.
2478 */
2479
2480 #ifndef yytext_ptr
2481 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2482 {
2483 register int i;
2484 for ( i = 0; i < n; ++i )
2485 s1[i] = s2[i];
2486 }
2487 #endif
2488
2489 #ifdef YY_NEED_STRLEN
2490 static int yy_flex_strlen (yyconst char * s )
2491 {
2492 register int n;
2493 for ( n = 0; s[n]; ++n )
2494 ;
2495
2496 return n;
2497 }
2498 #endif
2499
2500 void *scope_optimizer_alloc (yy_size_t size )
2501 {
2502 return (void *) malloc( size );
2503 }
2504
2505 void *scope_optimizer_realloc (void * ptr, yy_size_t size )
2506 {
2507 /* The cast to (char *) in the following accommodates both
2508 * implementations that use char* generic pointers, and those
2509 * that use void* generic pointers. It works with the latter
2510 * because both ANSI C and C++ allow castless assignment from
2511 * any pointer type to void*, and deal with argument conversions
2512 * as though doing an assignment.
2513 */
2514 return (void *) realloc( (char *) ptr, size );
2515 }
2516
2517 void scope_optimizer_free (void * ptr )
2518 {
2519 free( (char *) ptr ); /* see scope_optimizer_realloc() for (char *) cast */
2520 }
2521
2522 #define YYTABLES_NAME "yytables"
2523
2524 int scope_optimizer_wrap() {
2525 return 1;
2526 }
2527
2528 static void consume_lambda_signature() {
2529 int depth = 1;
2530 catch_for_scope += ";";
2531 std::string curarg;
2532 while(true) {
2533 int rc = scope_optimizer_lex();
2534 if(rc == 0) break;
2535 switch(rc) {
2536 case '<':
2537 ++depth;
2538 curarg += "< ";
2539 break;
2540 case '>':
2541 --depth;
2542 curarg += "> ";
2543 break;
2544 case '(':
2545 ++depth;
2546 curarg += ")";
2547 break;
2548 case ')':
2549 --depth;
2550 if(depth == 0) {
2551 if(!curarg.empty()) {
2552 curarg += ";";
2553 catch_for_scope += curarg;
2554 }
2555 return;
2556 } else {
2557 curarg += ")";
2558 }
2559 break;
2560 case ',':
2561 if(depth == 1) {
2562 curarg += ";";
2563 catch_for_scope += curarg;
2564 curarg.clear();
2565 } else {
2566 curarg += ",";
2567 }
2568 break;
2569 default:
2570 curarg += scope_optimizer_text;
2571 break;
2572 }
2573 }
2574 }
2575
2576 void scope_optimizer_clean()
2577 {
2578 scope_optimizer__flush_buffer(YY_CURRENT_BUFFER);
2579 scope_optimizer__delete_buffer(YY_CURRENT_BUFFER);
2580
2581 scope_stack.clear();
2582 current_scope.clear();
2583 current_state = INITIAL;
2584 current_brace_depth = 1;
2585 catch_for_scope.clear();
2586 }
2587
2588 int OptimizeScope(const std::string &inputScope, std::string &optimizedScope, int localsLine, std::string &localsScope)
2589 {
2590 BEGIN 0;
2591 scope_optimizer__scan_string(inputScope.c_str());
2592
2593 int rc = scope_optimizer_lex();
2594 if (scope_stack.empty()) {
2595 optimizedScope = inputScope;
2596 scope_optimizer_clean();
2597 return rc;
2598 }
2599
2600 std::string tmp_scope;
2601 for (size_t i = 0; i < scope_stack.size(); i++) {
2602 tmp_scope += scope_stack.at(i).str;
2603 if(scope_stack.at(i).line >= localsLine) {
2604 localsScope += scope_stack.at(i).str;
2605 }
2606 }
2607
2608 // if the current scope is not empty, terminate it with ';' and return
2609 if ( tmp_scope.empty() == false ) {
2610 tmp_scope += ";";
2611 optimizedScope = tmp_scope;
2612 }
2613 scope_optimizer_clean();
2614 return rc;
2615 }
2616