Scanner.cpp
Go to the documentation of this file.
1#include <IceUtil/ScannerConfig.h>
2#line 2 "src/IceStorm/Scanner.cpp"
3
4#line 4 "src/IceStorm/Scanner.cpp"
5
6#define YY_INT_ALIGNED short int
7
8/* A lexical scanner generated by flex */
9
10#define FLEX_SCANNER
11#define YY_FLEX_MAJOR_VERSION 2
12#define YY_FLEX_MINOR_VERSION 5
13#define YY_FLEX_SUBMINOR_VERSION 37
14#if YY_FLEX_SUBMINOR_VERSION > 0
15#define FLEX_BETA
16#endif
17
18/* First, we deal with platform-specific or compiler-specific issues. */
19
20/* begin standard C headers. */
21#include <errno.h>
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25
26/* end standard C headers. */
27
28/* flex integer type definitions */
29
30#ifndef FLEXINT_H
31#define FLEXINT_H
32
33/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34
35#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36
37/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
38 * if you want the limit (max/min) macros for int types.
39 */
40#ifndef __STDC_LIMIT_MACROS
41#define __STDC_LIMIT_MACROS 1
42#endif
43
44#include <inttypes.h>
45typedef int8_t flex_int8_t;
46typedef uint8_t flex_uint8_t;
47typedef int16_t flex_int16_t;
48typedef uint16_t flex_uint16_t;
49typedef int32_t flex_int32_t;
50typedef uint32_t flex_uint32_t;
51#else
52typedef signed char flex_int8_t;
53typedef short int flex_int16_t;
54typedef int flex_int32_t;
55typedef unsigned char flex_uint8_t;
56typedef unsigned short int flex_uint16_t;
57typedef unsigned int flex_uint32_t;
58
59/* Limits of integral types. */
60#ifndef INT8_MIN
61#define INT8_MIN (-128)
62#endif
63#ifndef INT16_MIN
64#define INT16_MIN (-32767 - 1)
65#endif
66#ifndef INT32_MIN
67#define INT32_MIN (-2147483647 - 1)
68#endif
69#ifndef INT8_MAX
70#define INT8_MAX (127)
71#endif
72#ifndef INT16_MAX
73#define INT16_MAX (32767)
74#endif
75#ifndef INT32_MAX
76#define INT32_MAX (2147483647)
77#endif
78#ifndef UINT8_MAX
79#define UINT8_MAX (255U)
80#endif
81#ifndef UINT16_MAX
82#define UINT16_MAX (65535U)
83#endif
84#ifndef UINT32_MAX
85#define UINT32_MAX (4294967295U)
86#endif
87
88#endif /* ! C99 */
89
90#endif /* ! FLEXINT_H */
91
92#ifdef __cplusplus
93
94/* The "const" storage-class-modifier is valid. */
95#define YY_USE_CONST
96
97#else /* ! __cplusplus */
98
99/* C99 requires __STDC__ to be defined as 1. */
100#if defined(__STDC__)
101
102#define YY_USE_CONST
103
104#endif /* defined (__STDC__) */
105#endif /* ! __cplusplus */
106
107#ifdef YY_USE_CONST
108#define yyconst const
109#else
110#define yyconst
111#endif
112
113/* Returned upon end-of-file. */
114#define YY_NULL 0
115
116/* Promotes a possibly negative, possibly signed char to an unsigned
117 * integer for use as an array index. If the signed char is negative,
118 * we want to instead treat it as an 8-bit unsigned char, hence the
119 * double cast.
120 */
121#define YY_SC_TO_UI(c) ((unsigned int)(unsigned char)c)
122
123/* Enter a start condition. This macro really ought to take a parameter,
124 * but we do it the disgusting crufty way forced on us by the ()-less
125 * definition of BEGIN.
126 */
127#define BEGIN (yy_start) = 1 + 2 *
128
129/* Translate the current start state into a value that can be later handed
130 * to BEGIN to return to the state. The YYSTATE alias is for lex
131 * compatibility.
132 */
133#define YY_START (((yy_start)-1) / 2)
134#define YYSTATE YY_START
135
136/* Action number for EOF rule of a given start state. */
137#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
138
139/* Special action meaning "start processing a new file". */
140#define YY_NEW_FILE yyrestart(yyin)
141
142#define YY_END_OF_BUFFER_CHAR 0
143
144/* Size of default input buffer. */
145#ifndef YY_BUF_SIZE
146#define YY_BUF_SIZE 16384
147#endif
148
149/* The state buf must be large enough to hold one state per character in the main buffer.
150 */
151#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
152
153#ifndef YY_TYPEDEF_YY_BUFFER_STATE
154#define YY_TYPEDEF_YY_BUFFER_STATE
156#endif
157
158#ifndef YY_TYPEDEF_YY_SIZE_T
159#define YY_TYPEDEF_YY_SIZE_T
160typedef size_t yy_size_t;
161#endif
162
163extern yy_size_t yyleng;
164
165extern FILE *yyin, *yyout;
166
167#define EOB_ACT_CONTINUE_SCAN 0
168#define EOB_ACT_END_OF_FILE 1
169#define EOB_ACT_LAST_MATCH 2
170
171#define YY_LESS_LINENO(n)
172
173/* Return all but the first "n" matched characters back to the input stream. */
174#define yyless(n) \
175 do \
176 { \
177 /* Undo effects of setting up yytext. */ \
178 int yyless_macro_arg = (n); \
179 YY_LESS_LINENO(yyless_macro_arg); \
180 *yy_cp = (yy_hold_char); \
181 YY_RESTORE_YY_MORE_OFFSET(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
182 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
183 } while (0)
184
185#define unput(c) yyunput(c, (yytext_ptr))
186
187#ifndef YY_STRUCT_YY_BUFFER_STATE
188#define YY_STRUCT_YY_BUFFER_STATE
189
191{
193
194 char* yy_ch_buf; /* input buffer */
195 char* yy_buf_pos; /* current position in input buffer */
196
197 /* Size of input buffer in bytes, not including room for EOB
198 * characters.
199 */
201
202 /* Number of characters read into yy_ch_buf, not including EOB
203 * characters.
204 */
206
207 /* Whether we "own" the buffer - i.e., we know we created it,
208 * and can realloc() it to grow it, and should free() it to
209 * delete it.
210 */
212
213 /* Whether this is an "interactive" input source; if so, and
214 * if we're using stdio for input, then we want to use getc()
215 * instead of fread(), to make sure we stop fetching input after
216 * each newline.
217 */
219
220 /* Whether we're considered to be at the beginning of a line.
221 * If so, '^' rules will be active on the next match, otherwise
222 * not.
223 */
225
226 int yy_bs_lineno; /**< The line count. */
227 int yy_bs_column; /**< The column count. */
228
229 /* Whether to try to fill the input buffer when we reach the
230 * end of it.
231 */
233
235
236#define YY_BUFFER_NEW 0
237#define YY_BUFFER_NORMAL 1
238 /* When an EOF's been seen but there's still some text to process
239 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
240 * shouldn't try reading from the input source any more. We might
241 * still have a bunch of tokens to match, though, because of
242 * possible backing-up.
243 *
244 * When we actually see the EOF, we change the status to "new"
245 * (via yyrestart()), so that the user can continue scanning by
246 * just pointing yyin at a new input file.
247 */
248#define YY_BUFFER_EOF_PENDING 2
249};
250#endif /* !YY_STRUCT_YY_BUFFER_STATE */
251
252/* Stack of input buffers. */
253static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
254static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
255static YY_BUFFER_STATE* yy_buffer_stack = 0; /**< Stack as an array. */
256
257/* We provide macros for accessing buffer states in case in the
258 * future we want to put the buffer states in a more general
259 * "scanner state".
260 *
261 * Returns the top of the stack, or NULL.
262 */
263#define YY_CURRENT_BUFFER ((yy_buffer_stack) ? (yy_buffer_stack)[(yy_buffer_stack_top)] : NULL)
264
265/* Same as previous macro, but useful when we know that the buffer stack is not
266 * NULL or when we need an lvalue. For internal use only.
267 */
268#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
269
270/* yy_hold_char holds the character lost when yytext is formed. */
271static char yy_hold_char;
272static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
274
275/* Points to current character in buffer. */
276static char* yy_c_buf_p = (char*)0;
277static int yy_init = 0; /* whether we need to initialize */
278static int yy_start = 0; /* start state number */
279
280/* Flag which is used to allow yywrap()'s to do buffer switches
281 * instead of setting up a fresh yyin. A bit of a hack ...
282 */
283static int yy_did_buffer_switch_on_eof;
284
285void yyrestart(FILE* input_file);
286void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer);
287YY_BUFFER_STATE yy_create_buffer(FILE* file, int size);
290void yypush_buffer_state(YY_BUFFER_STATE new_buffer);
291void yypop_buffer_state(void);
292
293static void yyensure_buffer_stack(void);
294static void yy_load_buffer_state(void);
295static void yy_init_buffer(YY_BUFFER_STATE b, FILE* file);
296
297#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER)
298
302
303void* yyalloc(yy_size_t);
304void* yyrealloc(void*, yy_size_t);
305void yyfree(void*);
306
307#define yy_new_buffer yy_create_buffer
308
309#define yy_set_interactive(is_interactive) \
310 { \
311 if (!YY_CURRENT_BUFFER) \
312 { \
313 yyensure_buffer_stack(); \
314 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
315 } \
316 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
317 }
318
319#define yy_set_bol(at_bol) \
320 { \
321 if (!YY_CURRENT_BUFFER) \
322 { \
323 yyensure_buffer_stack(); \
324 YY_CURRENT_BUFFER_LVALUE = yy_create_buffer(yyin, YY_BUF_SIZE); \
325 } \
326 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
327 }
328
329#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
330
331/* Begin user sect3 */
332
333#define yywrap() 1
334#define YY_SKIP_YYWRAP
335
336typedef unsigned char YY_CHAR;
337
338FILE *yyin = (FILE*)0, *yyout = (FILE*)0;
339
340typedef int yy_state_type;
341
342extern int yylineno;
343
344int yylineno = 1;
345
346extern char* yytext;
347#define yytext_ptr yytext
348
349static yy_state_type yy_get_previous_state(void);
350static yy_state_type yy_try_NUL_trans(yy_state_type current_state);
351static int yy_get_next_buffer(void);
352static void yy_fatal_error(yyconst char msg[]);
353
354/* Done after the current pattern has been matched and before the
355 * corresponding action - sets up yytext.
356 */
357#define YY_DO_BEFORE_ACTION \
358 (yytext_ptr) = yy_bp; \
359 yyleng = (size_t)(yy_cp - yy_bp); \
360 (yy_hold_char) = *yy_cp; \
361 *yy_cp = '\0'; \
362 (yy_c_buf_p) = yy_cp;
363
364#define YY_NUM_RULES 8
365#define YY_END_OF_BUFFER 9
366
367/* This struct is not used in this scanner,
368 but its presence is necessary. */
374
376 yy_accept[19] = {0, 3, 3, 9, 7, 3, 4, 5, 6, 7, 4, 7, 3, 0, 2, 1, 0, 3, 0};
377
378static yyconst flex_int32_t yy_ec[256] = {
379 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 1, 1, 1, 1, 2, 1, 4, 1, 1, 1, 1, 5, 1, 1, 6, 1, 1, 1, 1, 7, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 1, 1, 1, 1, 1, 9, 1, 1, 1, 1, 1, 1, 1, 1,
383
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
391
392static yyconst flex_int32_t yy_meta[10] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1};
393
395 yy_base[19] = {0, 0, 0, 11, 22, 8, 22, 22, 22, 12, 22, 18, 0, 0, 22, 22, 0, 22, 22};
396
398 yy_def[19] = {0, 18, 1, 18, 18, 18, 18, 18, 18, 18, 18, 18, 5, 11, 18, 18, 11, 18, 0};
399
400static yyconst flex_int16_t yy_nxt[32] = {0, 4, 5, 6, 7, 8, 4, 9, 10, 11, 12,
401 18, 18, 18, 18, 18, 18, 13, 14, 15, 16, 17,
402 3, 18, 18, 18, 18, 18, 18, 18, 18, 18};
403
404static yyconst flex_int16_t yy_chk[32] = {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
405 3, 0, 0, 0, 0, 0, 5, 9, 9, 11, 11,
406 18, 18, 18, 18, 18, 18, 18, 18, 18, 18};
407
408static yy_state_type yy_last_accepting_state;
409static char* yy_last_accepting_cpos;
410
411extern int yy_flex_debug;
413
414/* The intent behind this definition is that it'll catch
415 * any uses of REJECT which flex missed.
416 */
417#define REJECT reject_used_but_not_detected
418#define yymore() yymore_used_but_not_detected
419#define YY_MORE_ADJ 0
420#define YY_RESTORE_YY_MORE_OFFSET
421char* yytext;
422#line 1 "src/IceStorm/Scanner.l"
423#line 2 "src/IceStorm/Scanner.l"
424
425// **********************************************************************
426//
427// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
428//
429// This copy of Ice is licensed to you under the terms described in the
430// ICE_LICENSE file included in this distribution.
431//
432// **********************************************************************
433
434#include <Ice/Ice.h>
435#include <IceStorm/Grammar.h>
436#include <IceStorm/Parser.h>
437
438#if defined(_MSC_VER) && defined(ICE_64)
439//
440// '=' : conversion from 'size_t' to 'int', possible loss of data
441// The result of fread() is a size_t and gets inserted into an int
442//
443#pragma warning(4 : 4267)
444//
445// 'initializing' : conversion from '__int64' to 'int', possible loss of data
446// Puts a pointer-difference into an int
447//
448#pragma warning(4 : 4244)
449#endif
450
451#if defined(_MSC_VER) && defined(ICE_32)
452//
453// '<' : signed/unsigned mismatch
454//
455#pragma warning(4 : 4018)
456#endif
457
458#if defined(__GNUC__)
459#pragma GCC diagnostic ignored "-Wsign-compare"
460#endif
461
462using namespace std;
463using namespace Ice;
464using namespace IceStorm;
465
466#ifdef _MSC_VER
467#ifdef yywrap
468#undef yywrap
469#define yywrap() 1
470#endif
471#define YY_NO_UNISTD_H
472#endif
473
474#ifdef __SUNPRO_CC
475#ifdef yywrap
476#undef yywrap
477#define yywrap() 1
478#endif
479#ifdef ICE_64
480#pragma error_messages(off, truncwarn)
481#endif
482#endif
483
484#define YY_INPUT(buf, result, maxSize) parser->getInput(buf, result, maxSize)
485
486namespace IceStorm
487{
488
489 typedef std::map<std::string, int> StringTokenMap;
490 static StringTokenMap keywordMap;
491
492 void initScanner();
493
494} // namespace IceStorm
495
496#define YY_USER_INIT initScanner();
497
498#line 537 "src/IceStorm/Scanner.cpp"
499
500#define INITIAL 0
501
502#ifndef YY_NO_UNISTD_H
503/* Special case for "unistd.h", since it is non-ANSI. We include it way
504 * down here because we want the user's section 1 to have been scanned first.
505 * The user has a chance to override it with an option.
506 */
507#include <unistd.h>
508#endif
509
510#ifndef YY_EXTRA_TYPE
511#define YY_EXTRA_TYPE void*
512#endif
513
514static int yy_init_globals(void);
515
516/* Accessor methods to globals.
517 These are made visible to non-reentrant scanners for convenience. */
518
519int yylex_destroy(void);
520
521int yyget_debug(void);
522
523void yyset_debug(int debug_flag);
524
526
527void yyset_extra(YY_EXTRA_TYPE user_defined);
528
529FILE* yyget_in(void);
530
531void yyset_in(FILE* in_str);
532
533FILE* yyget_out(void);
534
535void yyset_out(FILE* out_str);
536
538
539char* yyget_text(void);
540
541int yyget_lineno(void);
542
543void yyset_lineno(int line_number);
544
545/* Macros after this point can all be overridden by user definitions in
546 * section 1.
547 */
548
549#ifndef YY_SKIP_YYWRAP
550#ifdef __cplusplus
551extern "C" int yywrap(void);
552#else
553extern int yywrap(void);
554#endif
555#endif
556
557static void yyunput(int c, char* buf_ptr);
558
559#ifndef yytext_ptr
560static void yy_flex_strncpy(char*, yyconst char*, int);
561#endif
562
563#ifdef YY_NEED_STRLEN
564static int yy_flex_strlen(yyconst char*);
565#endif
566
567#ifndef YY_NO_INPUT
568
569#ifdef __cplusplus
570static int yyinput(void);
571#else
572static int input(void);
573#endif
574
575#endif
576
577/* Amount of stuff to slurp up with each read. */
578#ifndef YY_READ_BUF_SIZE
579#define YY_READ_BUF_SIZE 8192
580#endif
581
582/* Copy whatever the last rule matched to the standard output. */
583#ifndef ECHO
584/* This used to be an fputs(), but since the string might contain NUL's,
585 * we now use fwrite().
586 */
587#define ECHO \
588 do \
589 { \
590 if (fwrite(yytext, yyleng, 1, yyout)) \
591 { \
592 } \
593 } while (0)
594#endif
595
596/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
597 * is returned in "result".
598 */
599#ifndef YY_INPUT
600#define YY_INPUT(buf, result, max_size) \
601 if (YY_CURRENT_BUFFER_LVALUE->yy_is_interactive) \
602 { \
603 int c = '*'; \
604 size_t n; \
605 for (n = 0; n < max_size && (c = getc(yyin)) != EOF && c != '\n'; ++n) \
606 buf[n] = (char)c; \
607 if (c == '\n') \
608 buf[n++] = (char)c; \
609 if (c == EOF && ferror(yyin)) \
610 YY_FATAL_ERROR("input in flex scanner failed"); \
611 result = n; \
612 } \
613 else \
614 { \
615 errno = 0; \
616 while ((result = fread(buf, 1, max_size, yyin)) == 0 && ferror(yyin)) \
617 { \
618 if (errno != EINTR) \
619 { \
620 YY_FATAL_ERROR("input in flex scanner failed"); \
621 break; \
622 } \
623 errno = 0; \
624 clearerr(yyin); \
625 } \
626 }
627
628
629#endif
630
631/* No semi-colon after return; correct usage is to write "yyterminate();" -
632 * we don't want an extra ';' after the "return" because that will cause
633 * some compilers to complain about unreachable statements.
634 */
635#ifndef yyterminate
636#define yyterminate() return YY_NULL
637#endif
638
639/* Number of entries by which start-condition stack grows. */
640#ifndef YY_START_STACK_INCR
641#define YY_START_STACK_INCR 25
642#endif
643
644/* Report a fatal error. */
645#ifndef YY_FATAL_ERROR
646#define YY_FATAL_ERROR(msg) yy_fatal_error(msg)
647#endif
648
649/* end tables serialization structures and prototypes */
650
651/* Default declaration of generated scanner - a define so the user can
652 * easily add parameters.
653 */
654#ifndef YY_DECL
655#define YY_DECL_IS_OURS 1
656
657extern int yylex(void);
658
659#define YY_DECL int yylex(void)
660#endif /* !YY_DECL */
661
662/* Code executed at the beginning of each rule, after yytext and yyleng
663 * have been set up.
664 */
665#ifndef YY_USER_ACTION
666#define YY_USER_ACTION
667#endif
668
669/* Code executed at the end of each rule. */
670#ifndef YY_BREAK
671#define YY_BREAK break;
672#endif
673
674#define YY_RULE_SETUP YY_USER_ACTION
675
676/** The main scanner function which does all the work.
677 */
679{
680 /*register*/ yy_state_type yy_current_state;
681 /*register*/ char *yy_cp, *yy_bp;
682 /*register*/ int yy_act;
683
684#line 84 "src/IceStorm/Scanner.l"
685
686
687#line 722 "src/IceStorm/Scanner.cpp"
688
689 if (!(yy_init))
690 {
691 (yy_init) = 1;
692
693#ifdef YY_USER_INIT
695#endif
696
697 if (!(yy_start))
698 {
699 (yy_start) = 1; /* first start state */
700 }
701
702 if (!yyin)
703 {
704 yyin = stdin;
705 }
706
707 if (!yyout)
708 {
709 yyout = stdout;
710 }
711
713 {
714 yyensure_buffer_stack();
716 }
717
718 yy_load_buffer_state();
719 }
720
721 while (1) /* loops until end-of-file is reached */
722 {
723 yy_cp = (yy_c_buf_p);
724
725 /* Support of yytext. */
726 *yy_cp = (yy_hold_char);
727
728 /* yy_bp points to the position in yy_ch_buf of the start of
729 * the current run.
730 */
731 yy_bp = yy_cp;
732
733 yy_current_state = (yy_start);
734 yy_match:
735 do
736 {
737 /*register*/ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
738 if (yy_accept[yy_current_state])
739 {
740 (yy_last_accepting_state) = yy_current_state;
741 (yy_last_accepting_cpos) = yy_cp;
742 }
743 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
744 {
745 yy_current_state = (int)yy_def[yy_current_state];
746 if (yy_current_state >= 19)
747 {
748 yy_c = yy_meta[(unsigned int)yy_c];
749 }
750 }
751 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
752 ++yy_cp;
753 } while (yy_base[yy_current_state] != 22);
754
755 yy_find_action:
756 yy_act = yy_accept[yy_current_state];
757 if (yy_act == 0)
758 {
759 /* have to back up */
760 yy_cp = (yy_last_accepting_cpos);
761 yy_current_state = (yy_last_accepting_state);
762 yy_act = yy_accept[yy_current_state];
763 }
764
766
767 do_action: /* This label is used only to access EOF actions. */
768
769 switch (yy_act)
770 {
771 /* beginning of action switch */
772 case 0: /* must back up */
773 /* undo the effects of YY_DO_BEFORE_ACTION */
774 *yy_cp = (yy_hold_char);
775 yy_cp = (yy_last_accepting_cpos);
776 yy_current_state = (yy_last_accepting_state);
777 goto yy_find_action;
778
779 case 1:
781#line 86 "src/IceStorm/Scanner.l"
782 {
783 // C++-style comment
784 int c;
785 do
786 {
787 c = yyinput();
788 } while (c != '\n' && c != EOF);
789 }
791 case 2:
793#line 96 "src/IceStorm/Scanner.l"
794 {
795 // C-style comment
796 while (true)
797 {
798 int c = yyinput();
799 if (c == '*')
800 {
801 int next = yyinput();
802 if (next == '/')
803 {
804 break;
805 }
806 else
807 {
808 unput(next);
809 }
810 }
811 else if (c == EOF)
812 {
813 parser->warning("EOF in comment");
814 break;
815 }
816 }
817 }
819 case 3:
820 /* rule 3 can match eol */
822#line 121 "src/IceStorm/Scanner.l"
823 {
824 size_t len = strlen(yytext);
825 for (size_t i = 0; i < len; ++i)
826 {
827 if (yytext[i] == '\\')
828 {
829 parser->continueLine();
830 }
831 }
832 }
834 case 4:
835 /* rule 4 can match eol */
837#line 132 "src/IceStorm/Scanner.l"
838 {
839 return ';';
840 }
842 case 5:
844#line 136 "src/IceStorm/Scanner.l"
845 {
846 // "..."-type strings
847 string s;
848 while (true)
849 {
850 char c = static_cast<char>(yyinput());
851 if (c == '"')
852 {
853 break;
854 }
855 else if (c == static_cast<char>(EOF))
856 {
857 parser->warning("EOF in string");
858 break;
859 }
860 else if (c == '\\')
861 {
862 char next = static_cast<char>(yyinput());
863 switch (next)
864 {
865 case '\\':
866 case '"':
867 {
868 s += next;
869 break;
870 }
871
872 default:
873 {
874 s += c;
875 unput(next);
876 }
877 }
878 }
879 else
880 {
881 s += c;
882 }
883 }
884 yylvalp->clear();
885 yylvalp->push_back(s);
886 return ICE_STORM_STRING;
887 }
889 case 6:
891#line 180 "src/IceStorm/Scanner.l"
892 {
893 // '...'-type strings
894 string s;
895 while (true)
896 {
897 char c = static_cast<char>(yyinput());
898 if (c == '\'')
899 {
900 break;
901 }
902 else if (c == static_cast<char>(EOF))
903 {
904 parser->warning("EOF in string");
905 break;
906 }
907 else
908 {
909 s += c;
910 }
911 }
912 yylvalp->clear();
913 yylvalp->push_back(s);
914 return ICE_STORM_STRING;
915 }
917 case 7:
919#line 205 "src/IceStorm/Scanner.l"
920 {
921 // Simple strings
922 string s;
923 s += yytext[0];
924 while (true)
925 {
926 char c = static_cast<char>(yyinput());
927 if (c == static_cast<char>(EOF))
928 {
929 break;
930 }
931 else if (isspace(static_cast<unsigned char>(c)) || c == ';')
932 {
933 unput(c);
934 break;
935 }
936
937 s += c;
938 }
939
940 yylvalp->clear();
941 yylvalp->push_back(s);
942
943 StringTokenMap::const_iterator pos = keywordMap.find(s);
944 return pos != keywordMap.end() ? pos->second : ICE_STORM_STRING;
945 }
947 case 8:
949#line 232 "src/IceStorm/Scanner.l"
950 ECHO;
952#line 979 "src/IceStorm/Scanner.cpp"
953 case YY_STATE_EOF(INITIAL):
954 yyterminate();
955
956 case YY_END_OF_BUFFER:
957 {
958 /* Amount of text matched not including the EOB char. */
959 int yy_amount_of_matched_text = (int)(yy_cp - (yytext_ptr)) - 1;
960
961 /* Undo the effects of YY_DO_BEFORE_ACTION. */
962 *yy_cp = (yy_hold_char);
964
965 if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW)
966 {
967 /* We're scanning a new file or input source. It's
968 * possible that this happened because the user
969 * just pointed yyin at a new source and called
970 * yylex(). If so, then we have to assure
971 * consistency between YY_CURRENT_BUFFER and our
972 * globals. Here is the right place to do so, because
973 * this is the first action (other than possibly a
974 * back-up) that will match for the new input source.
975 */
976 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
977 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
978 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
979 }
980
981 /* Note that here we test for yy_c_buf_p "<=" to the position
982 * of the first EOB in the buffer, since yy_c_buf_p will
983 * already have been incremented past the NUL character
984 * (since all states make transitions on EOB to the
985 * end-of-buffer state). Contrast this with the test
986 * in input().
987 */
988 if ((yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
989 {
990 /* This was really a NUL. */
991 yy_state_type yy_next_state;
992
993 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
994
995 yy_current_state = yy_get_previous_state();
996
997 /* Okay, we're now positioned to make the NUL
998 * transition. We couldn't have
999 * yy_get_previous_state() go ahead and do it
1000 * for us because it doesn't know how to deal
1001 * with the possibility of jamming (and we don't
1002 * want to build jamming into it because then it
1003 * will run more slowly).
1004 */
1005
1006 yy_next_state = yy_try_NUL_trans(yy_current_state);
1007
1009
1010 if (yy_next_state)
1011 {
1012 /* Consume the NUL. */
1013 yy_cp = ++(yy_c_buf_p);
1014 yy_current_state = yy_next_state;
1015 goto yy_match;
1016 }
1017
1018 else
1019 {
1020 yy_cp = (yy_c_buf_p);
1021 goto yy_find_action;
1022 }
1023 }
1024
1025 else
1026 switch (yy_get_next_buffer())
1027 {
1029 {
1030 (yy_did_buffer_switch_on_eof) = 0;
1031
1032 if (yywrap())
1033 {
1034 /* Note: because we've taken care in
1035 * yy_get_next_buffer() to have set up
1036 * yytext, we can now set up
1037 * yy_c_buf_p so that if some total
1038 * hoser (like flex itself) wants to
1039 * call the scanner after we return the
1040 * YY_NULL, it'll still work - another
1041 * YY_NULL will get returned.
1042 */
1043 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1044
1046 goto do_action;
1047 }
1048
1049 else
1050 {
1051 if (!(yy_did_buffer_switch_on_eof))
1052 {
1054 }
1055 }
1056 break;
1057 }
1058
1060 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1061
1062 yy_current_state = yy_get_previous_state();
1063
1064 yy_cp = (yy_c_buf_p);
1066 goto yy_match;
1067
1068 case EOB_ACT_LAST_MATCH:
1069 (yy_c_buf_p) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1070
1071 yy_current_state = yy_get_previous_state();
1072
1073 yy_cp = (yy_c_buf_p);
1075 goto yy_find_action;
1076 }
1077 break;
1078 }
1079
1080 default:
1081 YY_FATAL_ERROR("fatal flex scanner internal error--no action found");
1082 } /* end of action switch */
1083 } /* end of scanning one token */
1084} /* end of yylex */
1085
1086/* yy_get_next_buffer - try to read in a new buffer
1087 *
1088 * Returns a code representing an action:
1089 * EOB_ACT_LAST_MATCH -
1090 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1091 * EOB_ACT_END_OF_FILE - end of file
1092 */
1093static int
1094yy_get_next_buffer(void)
1095{
1096 /*register*/ char* dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1097 /*register*/ char* source = (yytext_ptr);
1098 /*register*/ int number_to_move, i;
1099 int ret_val;
1100
1101 if ((yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1])
1102 YY_FATAL_ERROR("fatal flex scanner internal error--end of buffer missed");
1103
1104 if (YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0)
1105 {
1106 /* Don't try to fill the buffer, so this is an EOF. */
1107 if ((yy_c_buf_p) - (yytext_ptr)-YY_MORE_ADJ == 1)
1108 {
1109 /* We matched a single character, the EOB, so
1110 * treat this as a final EOF.
1111 */
1112 return EOB_ACT_END_OF_FILE;
1113 }
1114
1115 else
1116 {
1117 /* We matched some text prior to the EOB, first
1118 * process it.
1119 */
1120 return EOB_ACT_LAST_MATCH;
1121 }
1122 }
1123
1124 /* Try to read more data. */
1125
1126 /* First move last chars to start of buffer. */
1127 number_to_move = (int)((yy_c_buf_p) - (yytext_ptr)) - 1;
1128
1129 for (i = 0; i < number_to_move; ++i)
1130 {
1131 *(dest++) = *(source++);
1132 }
1133
1134 if (YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING)
1135 /* don't do the read, it's not guaranteed to return an EOF,
1136 * just force an EOF
1137 */
1138 {
1139 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1140 }
1141
1142 else
1143 {
1144 yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1145
1146 while (num_to_read <= 0)
1147 {
1148 /* Not enough room in the buffer - grow it. */
1149
1150 /* just a shorter name for the current buffer */
1152
1153 int yy_c_buf_p_offset = (int)((yy_c_buf_p)-b->yy_ch_buf);
1154
1155 if (b->yy_is_our_buffer)
1156 {
1157 yy_size_t new_size = b->yy_buf_size * 2;
1158
1159 if (new_size <= 0)
1160 {
1161 b->yy_buf_size += b->yy_buf_size / 8;
1162 }
1163 else
1164 {
1165 b->yy_buf_size *= 2;
1166 }
1167
1168 b->yy_ch_buf = (char*)
1169 /* Include room in for 2 EOB chars. */
1170 yyrealloc((void*)b->yy_ch_buf, b->yy_buf_size + 2);
1171 }
1172 else
1173 /* Can't grow it, we don't own it. */
1174 {
1175 b->yy_ch_buf = 0;
1176 }
1177
1178 if (!b->yy_ch_buf)
1179 YY_FATAL_ERROR("fatal error - scanner input buffer overflow");
1180
1181 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1182
1183 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1184 }
1185
1186 if (num_to_read > YY_READ_BUF_SIZE)
1187 {
1188 num_to_read = YY_READ_BUF_SIZE;
1189 }
1190
1191 /* Read in more data. */
1192 YY_INPUT((&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), (yy_n_chars), num_to_read);
1193
1194 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1195 }
1196
1197 if ((yy_n_chars) == 0)
1198 {
1199 if (number_to_move == YY_MORE_ADJ)
1200 {
1201 ret_val = EOB_ACT_END_OF_FILE;
1202 yyrestart(yyin);
1203 }
1204
1205 else
1206 {
1207 ret_val = EOB_ACT_LAST_MATCH;
1209 }
1210 }
1211
1212 else
1213 {
1214 ret_val = EOB_ACT_CONTINUE_SCAN;
1215 }
1216
1217 if ((yy_size_t)((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size)
1218 {
1219 /* Extend the array by 50%, plus the number we really need. */
1220 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1221 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf =
1222 (char*)yyrealloc((void*)YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size);
1223 if (!YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
1224 {
1225 YY_FATAL_ERROR("out of dynamic memory in yy_get_next_buffer()");
1226 }
1227 }
1228
1229 (yy_n_chars) += number_to_move;
1230 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1231 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1232
1233 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1234
1235 return ret_val;
1236}
1237
1238/* yy_get_previous_state - get the state just before the EOB char was reached */
1239
1240static yy_state_type
1241yy_get_previous_state(void)
1242{
1243 /*register*/ yy_state_type yy_current_state;
1244 /*register*/ char* yy_cp;
1245
1246 yy_current_state = (yy_start);
1247
1248 for (yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp)
1249 {
1250 /*register*/ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1251 if (yy_accept[yy_current_state])
1252 {
1253 (yy_last_accepting_state) = yy_current_state;
1254 (yy_last_accepting_cpos) = yy_cp;
1255 }
1256 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1257 {
1258 yy_current_state = (int)yy_def[yy_current_state];
1259 if (yy_current_state >= 19)
1260 {
1261 yy_c = yy_meta[(unsigned int)yy_c];
1262 }
1263 }
1264 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
1265 }
1266
1267 return yy_current_state;
1268}
1269
1270/* yy_try_NUL_trans - try to make a transition on the NUL character
1271 *
1272 * synopsis
1273 * next_state = yy_try_NUL_trans( current_state );
1274 */
1275static yy_state_type
1276yy_try_NUL_trans(yy_state_type yy_current_state)
1277{
1278 /*register*/ int yy_is_jam;
1279 /*register*/ char* yy_cp = (yy_c_buf_p);
1280
1281 /*register*/ YY_CHAR yy_c = 1;
1282 if (yy_accept[yy_current_state])
1283 {
1284 (yy_last_accepting_state) = yy_current_state;
1285 (yy_last_accepting_cpos) = yy_cp;
1286 }
1287 while (yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state)
1288 {
1289 yy_current_state = (int)yy_def[yy_current_state];
1290 if (yy_current_state >= 19)
1291 {
1292 yy_c = yy_meta[(unsigned int)yy_c];
1293 }
1294 }
1295 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int)yy_c];
1296 yy_is_jam = (yy_current_state == 18);
1297
1298 return yy_is_jam ? 0 : yy_current_state;
1299}
1300
1301static void
1302yyunput(int c, /*register*/ char* yy_bp)
1303{
1304 /*register*/ char* yy_cp;
1305
1306 yy_cp = (yy_c_buf_p);
1307
1308 /* undo effects of setting up yytext */
1309 *yy_cp = (yy_hold_char);
1310
1311 if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
1312 {
1313 /* need to shift things up to make room */
1314 /* +2 for EOB chars. */
1315 /*register*/ yy_size_t number_to_move = (yy_n_chars) + 2;
1316 /*register*/ char* dest =
1317 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1318 /*register*/ char* source = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1319
1320 while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf)
1321 {
1322 *--dest = *--source;
1323 }
1324
1325 yy_cp += (int)(dest - source);
1326 yy_bp += (int)(dest - source);
1327 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1328
1329 if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2)
1330 {
1331 YY_FATAL_ERROR("flex scanner push-back overflow");
1332 }
1333 }
1334
1335 *--yy_cp = (char)c;
1336
1337 (yytext_ptr) = yy_bp;
1338 (yy_hold_char) = *yy_cp;
1339 (yy_c_buf_p) = yy_cp;
1340}
1341
1342#ifndef YY_NO_INPUT
1343#ifdef __cplusplus
1344static int
1345yyinput(void)
1346#else
1347static int
1348input(void)
1349#endif
1350
1351{
1352 int c;
1353
1354 *(yy_c_buf_p) = (yy_hold_char);
1355
1356 if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR)
1357 {
1358 /* yy_c_buf_p now points to the character we want to return.
1359 * If this occurs *before* the EOB characters, then it's a
1360 * valid NUL; if not, then we've hit the end of the buffer.
1361 */
1362 if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)])
1363 /* This was really a NUL. */
1364 {
1365 *(yy_c_buf_p) = '\0';
1366 }
1367
1368 else
1369 {
1370 /* need more input */
1371 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1372 ++(yy_c_buf_p);
1373
1374 switch (yy_get_next_buffer())
1375 {
1376 case EOB_ACT_LAST_MATCH:
1377 /* This happens because yy_g_n_b()
1378 * sees that we've accumulated a
1379 * token and flags that we need to
1380 * try matching the token before
1381 * proceeding. But for input(),
1382 * there's no matching to consider.
1383 * So convert the EOB_ACT_LAST_MATCH
1384 * to EOB_ACT_END_OF_FILE.
1385 */
1386
1387 /* Reset buffer status. */
1388 yyrestart(yyin);
1389
1390 /*FALLTHROUGH*/
1391
1393 {
1394 if (yywrap())
1395 {
1396 return EOF;
1397 }
1398
1399 if (!(yy_did_buffer_switch_on_eof))
1400 {
1402 }
1403#ifdef __cplusplus
1404 return yyinput();
1405#else
1406 return input();
1407#endif
1408 }
1409
1411 (yy_c_buf_p) = (yytext_ptr) + offset;
1412 break;
1413 }
1414 }
1415 }
1416
1417 c = *(unsigned char*)(yy_c_buf_p); /* cast for 8-bit char's */
1418 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1419 (yy_hold_char) = *++(yy_c_buf_p);
1420
1421 return c;
1422}
1423#endif /* ifndef YY_NO_INPUT */
1424
1425/** Immediately switch to a different input stream.
1426 * @param input_file A readable stream.
1427 *
1428 * @note This function does not reset the start condition to @c INITIAL .
1429 */
1430void
1431yyrestart(FILE* input_file)
1432{
1433
1434 if (!YY_CURRENT_BUFFER)
1435 {
1436 yyensure_buffer_stack();
1438 }
1439
1440 yy_init_buffer(YY_CURRENT_BUFFER, input_file);
1441 yy_load_buffer_state();
1442}
1443
1444/** Switch to a different input buffer.
1445 * @param new_buffer The new input buffer.
1446 *
1447 */
1448void
1450{
1451
1452 /* TODO. We should be able to replace this entire function body
1453 * with
1454 * yypop_buffer_state();
1455 * yypush_buffer_state(new_buffer);
1456 */
1457 yyensure_buffer_stack();
1458 if (YY_CURRENT_BUFFER == new_buffer)
1459 {
1460 return;
1461 }
1462
1464 {
1465 /* Flush out information for old buffer. */
1466 *(yy_c_buf_p) = (yy_hold_char);
1467 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1468 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1469 }
1470
1471 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1472 yy_load_buffer_state();
1473
1474 /* We don't actually know whether we did this switch during
1475 * EOF (yywrap()) processing, but the only time this flag
1476 * is looked at is after yywrap() is called, so it's safe
1477 * to go ahead and always set it.
1478 */
1479 (yy_did_buffer_switch_on_eof) = 1;
1480}
1481
1482static void
1483yy_load_buffer_state(void)
1484{
1485 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1486 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1487 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1488 (yy_hold_char) = *(yy_c_buf_p);
1489}
1490
1491/** Allocate and initialize an input buffer state.
1492 * @param file A readable stream.
1493 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1494 *
1495 * @return the allocated buffer state.
1496 */
1498yy_create_buffer(FILE* file, int size)
1499{
1501
1502 b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
1503 if (!b)
1504 {
1505 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1506 }
1507
1508 b->yy_buf_size = size;
1509
1510 /* yy_ch_buf has to be 2 characters longer than the size given because
1511 * we need to put in 2 end-of-buffer characters.
1512 */
1513 b->yy_ch_buf = (char*)yyalloc(b->yy_buf_size + 2);
1514 if (!b->yy_ch_buf)
1515 {
1516 YY_FATAL_ERROR("out of dynamic memory in yy_create_buffer()");
1517 }
1518
1519 b->yy_is_our_buffer = 1;
1520
1521 yy_init_buffer(b, file);
1522
1523 return b;
1524}
1525
1526/** Destroy the buffer.
1527 * @param b a buffer created with yy_create_buffer()
1528 *
1529 */
1530void
1532{
1533
1534 if (!b)
1535 {
1536 return;
1537 }
1538
1539 if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */
1540 {
1542 }
1543
1544 if (b->yy_is_our_buffer)
1545 {
1546 yyfree((void*)b->yy_ch_buf);
1547 }
1548
1549 yyfree((void*)b);
1550}
1551
1552/* Initializes or reinitializes a buffer.
1553 * This function is sometimes called more than once on the same buffer,
1554 * such as during a yyrestart() or at EOF.
1555 */
1556static void
1557yy_init_buffer(YY_BUFFER_STATE b, FILE* file)
1558
1559{
1560 int oerrno = errno;
1561
1562 yy_flush_buffer(b);
1563
1564 b->yy_input_file = file;
1565 b->yy_fill_buffer = 1;
1566
1567 /* If b is the current buffer, then yy_init_buffer was _probably_
1568 * called from yyrestart() or through yy_get_next_buffer.
1569 * In that case, we don't want to reset the lineno or column.
1570 */
1571 if (b != YY_CURRENT_BUFFER)
1572 {
1573 b->yy_bs_lineno = 1;
1574 b->yy_bs_column = 0;
1575 }
1576
1577 b->yy_is_interactive = 1;
1578
1579 errno = oerrno;
1580}
1581
1582/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1583 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1584 *
1585 */
1586void
1588{
1589 if (!b)
1590 {
1591 return;
1592 }
1593
1594 b->yy_n_chars = 0;
1595
1596 /* We always need two end-of-buffer characters. The first causes
1597 * a transition to the end-of-buffer state. The second causes
1598 * a jam in that state.
1599 */
1602
1603 b->yy_buf_pos = &b->yy_ch_buf[0];
1604
1605 b->yy_at_bol = 1;
1607
1608 if (b == YY_CURRENT_BUFFER)
1609 {
1610 yy_load_buffer_state();
1611 }
1612}
1613
1614/** Pushes the new state onto the stack. The new state becomes
1615 * the current state. This function will allocate the stack
1616 * if necessary.
1617 * @param new_buffer The new state.
1618 *
1619 */
1620void
1622{
1623 if (new_buffer == NULL)
1624 {
1625 return;
1626 }
1627
1628 yyensure_buffer_stack();
1629
1630 /* This block is copied from yy_switch_to_buffer. */
1632 {
1633 /* Flush out information for old buffer. */
1634 *(yy_c_buf_p) = (yy_hold_char);
1635 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1636 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1637 }
1638
1639 /* Only push if top exists. Otherwise, replace top. */
1641 {
1642 (yy_buffer_stack_top)++;
1643 }
1644 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1645
1646 /* copied from yy_switch_to_buffer. */
1647 yy_load_buffer_state();
1648 (yy_did_buffer_switch_on_eof) = 1;
1649}
1650
1651/** Removes and deletes the top of the stack, if present.
1652 * The next element becomes the new top.
1653 *
1654 */
1655void
1657{
1658 if (!YY_CURRENT_BUFFER)
1659 {
1660 return;
1661 }
1662
1665 if ((yy_buffer_stack_top) > 0)
1666 {
1667 --(yy_buffer_stack_top);
1668 }
1669
1671 {
1672 yy_load_buffer_state();
1673 (yy_did_buffer_switch_on_eof) = 1;
1674 }
1675}
1676
1677/* Allocates the stack if it does not exist.
1678 * Guarantees space for at least one push.
1679 */
1680static void
1681yyensure_buffer_stack(void)
1682{
1683 yy_size_t num_to_alloc;
1684
1685 if (!(yy_buffer_stack))
1686 {
1687
1688 /* First allocation is just for 2 elements, since we don't know if this
1689 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1690 * immediate realloc on the next call.
1691 */
1692 num_to_alloc = 1;
1693 (yy_buffer_stack) =
1694 (struct yy_buffer_state**)yyalloc(num_to_alloc * sizeof(struct yy_buffer_state*));
1695 if (!(yy_buffer_stack))
1696 {
1697 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1698 }
1699
1700 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1701
1702 (yy_buffer_stack_max) = num_to_alloc;
1703 (yy_buffer_stack_top) = 0;
1704 return;
1705 }
1706
1707 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1)
1708 {
1709
1710 /* Increase the buffer to prepare for a possible push. */
1711 int grow_size = 8 /* arbitrary grow size */;
1712
1713 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1714 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc(
1715 (yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*));
1716 if (!(yy_buffer_stack))
1717 {
1718 YY_FATAL_ERROR("out of dynamic memory in yyensure_buffer_stack()");
1719 }
1720
1721 /* zero only the new slots.*/
1722 memset((yy_buffer_stack) + (yy_buffer_stack_max),
1723 0,
1724 grow_size * sizeof(struct yy_buffer_state*));
1725 (yy_buffer_stack_max) = num_to_alloc;
1726 }
1727}
1728
1729/** Setup the input buffer state to scan directly from a user-specified character buffer.
1730 * @param base the character buffer
1731 * @param size the size in bytes of the character buffer
1732 *
1733 * @return the newly allocated buffer state object.
1734 */
1736yy_scan_buffer(char* base, yy_size_t size)
1737{
1739
1740 if (size < 2 || base[size - 2] != YY_END_OF_BUFFER_CHAR ||
1741 base[size - 1] != YY_END_OF_BUFFER_CHAR)
1742 /* They forgot to leave room for the EOB's. */
1743 {
1744 return 0;
1745 }
1746
1747 b = (YY_BUFFER_STATE)yyalloc(sizeof(struct yy_buffer_state));
1748 if (!b)
1749 {
1750 YY_FATAL_ERROR("out of dynamic memory in yy_scan_buffer()");
1751 }
1752
1753 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1754 b->yy_buf_pos = b->yy_ch_buf = base;
1755 b->yy_is_our_buffer = 0;
1756 b->yy_input_file = 0;
1757 b->yy_n_chars = b->yy_buf_size;
1758 b->yy_is_interactive = 0;
1759 b->yy_at_bol = 1;
1760 b->yy_fill_buffer = 0;
1762
1764
1765 return b;
1766}
1767
1768/** Setup the input buffer state to scan a string. The next call to yylex() will
1769 * scan from a @e copy of @a str.
1770 * @param yystr a NUL-terminated string to scan
1771 *
1772 * @return the newly allocated buffer state object.
1773 * @note If you want to scan bytes that may contain NUL values, then use
1774 * yy_scan_bytes() instead.
1775 */
1778{
1779
1780 return yy_scan_bytes(yystr, strlen(yystr));
1781}
1782
1783/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1784 * scan from a @e copy of @a bytes.
1785 * @param yybytes the byte buffer to scan
1786 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1787 *
1788 * @return the newly allocated buffer state object.
1789 */
1791yy_scan_bytes(yyconst char* yybytes, yy_size_t _yybytes_len)
1792{
1794 char* buf;
1795 yy_size_t n;
1796 int i;
1797
1798 /* Get memory for full buffer, including space for trailing EOB's. */
1799 n = _yybytes_len + 2;
1800 buf = (char*)yyalloc(n);
1801 if (!buf)
1802 {
1803 YY_FATAL_ERROR("out of dynamic memory in yy_scan_bytes()");
1804 }
1805
1806 for (i = 0; i < _yybytes_len; ++i)
1807 {
1808 buf[i] = yybytes[i];
1809 }
1810
1811 buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR;
1812
1813 b = yy_scan_buffer(buf, n);
1814 if (!b)
1815 {
1816 YY_FATAL_ERROR("bad buffer in yy_scan_bytes()");
1817 }
1818
1819 /* It's okay to grow etc. this buffer, and we should throw it
1820 * away when we're done.
1821 */
1822 b->yy_is_our_buffer = 1;
1823
1824 return b;
1825}
1826
1827#ifndef YY_EXIT_FAILURE
1828#define YY_EXIT_FAILURE 2
1829#endif
1830
1831static void
1832yy_fatal_error(yyconst char* msg)
1833{
1834 (void)fprintf(stderr, "%s\n", msg);
1835 exit(YY_EXIT_FAILURE);
1836}
1837
1838/* Redefine yyless() so it works in section 3 code. */
1839
1840#undef yyless
1841#define yyless(n) \
1842 do \
1843 { \
1844 /* Undo effects of setting up yytext. */ \
1845 int yyless_macro_arg = (n); \
1846 YY_LESS_LINENO(yyless_macro_arg); \
1847 yytext[yyleng] = (yy_hold_char); \
1848 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1849 (yy_hold_char) = *(yy_c_buf_p); \
1850 *(yy_c_buf_p) = '\0'; \
1851 yyleng = yyless_macro_arg; \
1852 } while (0)
1853
1854/* Accessor methods (get/set functions) to struct members. */
1855
1856/** Get the current line number.
1857 *
1858 */
1859int
1861{
1862
1863 return yylineno;
1864}
1865
1866/** Get the input stream.
1867 *
1868 */
1869FILE*
1871{
1872 return yyin;
1873}
1874
1875/** Get the output stream.
1876 *
1877 */
1878FILE*
1880{
1881 return yyout;
1882}
1883
1884/** Get the length of the current token.
1885 *
1886 */
1889{
1890 return yyleng;
1891}
1892
1893/** Get the current token.
1894 *
1895 */
1896
1897char*
1899{
1900 return yytext;
1901}
1902
1903/** Set the current line number.
1904 * @param line_number
1905 *
1906 */
1907void
1908yyset_lineno(int line_number)
1909{
1910
1911 yylineno = line_number;
1912}
1913
1914/** Set the input stream. This does not discard the current
1915 * input buffer.
1916 * @param in_str A readable stream.
1917 *
1918 * @see yy_switch_to_buffer
1919 */
1920void
1921yyset_in(FILE* in_str)
1922{
1923 yyin = in_str;
1924}
1925
1926void
1927yyset_out(FILE* out_str)
1928{
1929 yyout = out_str;
1930}
1931
1932int
1934{
1935 return yy_flex_debug;
1936}
1937
1938void
1939yyset_debug(int bdebug)
1940{
1941 yy_flex_debug = bdebug;
1942}
1943
1944static int
1945yy_init_globals(void)
1946{
1947 /* Initialization is the same as for the non-reentrant scanner.
1948 * This function is called from yylex_destroy(), so don't allocate here.
1949 */
1950
1951 (yy_buffer_stack) = 0;
1952 (yy_buffer_stack_top) = 0;
1953 (yy_buffer_stack_max) = 0;
1954 (yy_c_buf_p) = (char*)0;
1955 (yy_init) = 0;
1956 (yy_start) = 0;
1957
1958 /* Defined in main.c */
1959#ifdef YY_STDINIT
1960 yyin = stdin;
1961 yyout = stdout;
1962#else
1963 yyin = (FILE*)0;
1964 yyout = (FILE*)0;
1965#endif
1966
1967 /* For future reference: Set errno on error, since we are called by
1968 * yylex_init()
1969 */
1970 return 0;
1971}
1972
1973/* yylex_destroy is for both reentrant and non-reentrant scanners. */
1974int
1976{
1977
1978 /* Pop the buffer stack, destroying each element. */
1979 while (YY_CURRENT_BUFFER)
1980 {
1984 }
1985
1986 /* Destroy the stack itself. */
1987 yyfree((yy_buffer_stack));
1988 (yy_buffer_stack) = NULL;
1989
1990 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1991 * yylex() is called, initialization will occur. */
1992 yy_init_globals();
1993
1994 return 0;
1995}
1996
1997/*
1998 * Internal utility routines.
1999 */
2000
2001#ifndef yytext_ptr
2002static void
2003yy_flex_strncpy(char* s1, yyconst char* s2, int n)
2004{
2005 /*register*/ int i;
2006 for (i = 0; i < n; ++i)
2007 {
2008 s1[i] = s2[i];
2009 }
2010}
2011#endif
2012
2013#ifdef YY_NEED_STRLEN
2014static int
2015yy_flex_strlen(yyconst char* s)
2016{
2017 /*register*/ int n;
2018 for (n = 0; s[n]; ++n)
2019 ;
2020
2021 return n;
2022}
2023#endif
2024
2025void*
2027{
2028 return (void*)malloc(size);
2029}
2030
2031void*
2032yyrealloc(void* ptr, yy_size_t size)
2033{
2034 /* The cast to (char *) in the following accommodates both
2035 * implementations that use char* generic pointers, and those
2036 * that use void* generic pointers. It works with the latter
2037 * because both ANSI C and C++ allow castless assignment from
2038 * any pointer type to void*, and deal with argument conversions
2039 * as though doing an assignment.
2040 */
2041 return (void*)realloc((char*)ptr, size);
2042}
2043
2044void
2045yyfree(void* ptr)
2046{
2047 free((char*)ptr); /* see yyrealloc() for (char *) cast */
2048}
2049
2050#define YYTABLES_NAME "yytables"
2051
2052#line 232 "src/IceStorm/Scanner.l"
2053
2054namespace IceStorm
2055{
2056
2057 //
2058 // initScanner() fills the keyword map with all keyword-token pairs.
2059 //
2060
2061 void
2063 {
2064 keywordMap["help"] = ICE_STORM_HELP;
2065 keywordMap["quit"] = ICE_STORM_EXIT;
2066 keywordMap["exit"] = ICE_STORM_EXIT;
2067 keywordMap["current"] = ICE_STORM_CURRENT;
2068 keywordMap["create"] = ICE_STORM_CREATE;
2069 keywordMap["destroy"] = ICE_STORM_DESTROY;
2070 keywordMap["link"] = ICE_STORM_LINK;
2071 keywordMap["unlink"] = ICE_STORM_UNLINK;
2072 keywordMap["links"] = ICE_STORM_LINKS;
2073 keywordMap["topics"] = ICE_STORM_TOPICS;
2074 keywordMap["replica"] = ICE_STORM_REPLICA;
2075 keywordMap["subscribers"] = ICE_STORM_SUBSCRIBERS;
2076 }
2077
2078} // namespace IceStorm
@ ICE_STORM_SUBSCRIBERS
Definition Grammar.cpp:153
@ ICE_STORM_TOPICS
Definition Grammar.cpp:151
@ ICE_STORM_LINK
Definition Grammar.cpp:148
@ ICE_STORM_REPLICA
Definition Grammar.cpp:152
@ ICE_STORM_CURRENT
Definition Grammar.cpp:145
@ ICE_STORM_UNLINK
Definition Grammar.cpp:149
@ ICE_STORM_LINKS
Definition Grammar.cpp:150
@ ICE_STORM_EXIT
Definition Grammar.cpp:144
@ ICE_STORM_HELP
Definition Grammar.cpp:143
@ ICE_STORM_STRING
Definition Grammar.cpp:154
@ ICE_STORM_DESTROY
Definition Grammar.cpp:147
@ ICE_STORM_CREATE
Definition Grammar.cpp:146
FILE * yyin
Definition Scanner.cpp:338
#define YY_DECL
Definition Parser.h:25
#define YY_NEW_FILE
Definition Scanner.cpp:140
FILE * yyget_in(void)
Get the input stream.
Definition Scanner.cpp:1870
unsigned char flex_uint8_t
Definition Scanner.cpp:55
yy_size_t yyleng
Definition Scanner.cpp:273
YY_BUFFER_STATE yy_scan_string(yyconst char *yy_str)
Setup the input buffer state to scan a string.
Definition Scanner.cpp:1777
void yyset_lineno(int line_number)
Set the current line number.
Definition Scanner.cpp:1908
unsigned char YY_CHAR
Definition Scanner.cpp:336
#define YY_USER_INIT
Definition Scanner.cpp:496
#define YY_EXTRA_TYPE
Definition Scanner.cpp:511
FILE * yyout
Definition Scanner.cpp:165
void yyset_extra(YY_EXTRA_TYPE user_defined)
short int flex_int16_t
Definition Scanner.cpp:53
void yy_flush_buffer(YY_BUFFER_STATE b)
Discard all buffered characters.
Definition Scanner.cpp:1587
void yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)
Switch to a different input buffer.
Definition Scanner.cpp:1449
yy_size_t yyget_leng(void)
Get the length of the current token.
Definition Scanner.cpp:1888
char * yytext
Definition Scanner.cpp:421
unsigned int flex_uint32_t
Definition Scanner.cpp:57
int yyget_lineno(void)
Get the current line number.
Definition Scanner.cpp:1860
#define YY_BREAK
Definition Scanner.cpp:671
#define unput(c)
Definition Scanner.cpp:185
int yy_act
Definition Scanner.cpp:682
void yypush_buffer_state(YY_BUFFER_STATE new_buffer)
Pushes the new state onto the stack.
Definition Scanner.cpp:1621
int yyget_debug(void)
Definition Scanner.cpp:1933
struct yy_buffer_state * YY_BUFFER_STATE
Definition Scanner.cpp:155
#define YY_BUFFER_NEW
Definition Scanner.cpp:236
FILE * yyget_out(void)
Get the output stream.
Definition Scanner.cpp:1879
#define YY_RESTORE_YY_MORE_OFFSET
Definition Scanner.cpp:420
YY_BUFFER_STATE yy_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
Definition Scanner.cpp:1498
int yylineno
Definition Scanner.cpp:344
#define YY_BUFFER_NORMAL
Definition Scanner.cpp:237
char * yy_cp
Definition Scanner.cpp:681
void yypop_buffer_state(void)
Removes and deletes the top of the stack, if present.
Definition Scanner.cpp:1656
#define YY_MORE_ADJ
Definition Scanner.cpp:419
#define YY_RULE_SETUP
Definition Scanner.cpp:674
void yyfree(void *)
Definition Scanner.cpp:2045
int yy_flex_debug
Definition Scanner.cpp:412
#define yytext_ptr
Definition Scanner.cpp:347
signed char flex_int8_t
Definition Scanner.cpp:52
void * yyalloc(yy_size_t)
Definition Scanner.cpp:2026
#define EOB_ACT_END_OF_FILE
Definition Scanner.cpp:168
#define YY_CURRENT_BUFFER_LVALUE
Definition Scanner.cpp:268
int flex_int32_t
Definition Scanner.cpp:54
void yyset_out(FILE *out_str)
Definition Scanner.cpp:1927
YY_BUFFER_STATE yy_scan_bytes(yyconst char *bytes, yy_size_t len)
Setup the input buffer state to scan the given bytes.
Definition Scanner.cpp:1791
#define YY_START
Definition Scanner.cpp:133
int yylex(void)
Definition Scanner.l:84
int yy_state_type
Definition Scanner.cpp:340
#define YY_CURRENT_BUFFER
Definition Scanner.cpp:263
#define yyconst
Definition Scanner.cpp:110
#define INITIAL
Definition Scanner.cpp:500
char * yy_bp
Definition Scanner.cpp:681
#define YY_READ_BUF_SIZE
Definition Scanner.cpp:579
#define ECHO
Definition Scanner.cpp:587
#define YY_INPUT(buf, result, maxSize)
Definition Scanner.cpp:484
#define YY_END_OF_BUFFER
Definition Scanner.cpp:365
#define YY_STATE_EOF(state)
Definition Scanner.cpp:137
int yylex_destroy(void)
Definition Scanner.cpp:1975
void yyrestart(FILE *input_file)
Immediately switch to a different input stream.
Definition Scanner.cpp:1431
#define YY_END_OF_BUFFER_CHAR
Definition Scanner.cpp:142
void * yyrealloc(void *, yy_size_t)
Definition Scanner.cpp:2032
#define YY_FATAL_ERROR(msg)
Definition Scanner.cpp:646
#define yyterminate()
Definition Scanner.cpp:636
unsigned short int flex_uint16_t
Definition Scanner.cpp:56
void yyset_debug(int debug_flag)
Definition Scanner.cpp:1939
void yyset_in(FILE *in_str)
Set the input stream.
Definition Scanner.cpp:1921
#define YY_DO_BEFORE_ACTION
Definition Scanner.cpp:357
char * yyget_text(void)
Get the current token.
Definition Scanner.cpp:1898
#define EOB_ACT_LAST_MATCH
Definition Scanner.cpp:169
size_t yy_size_t
Definition Scanner.cpp:160
#define YY_BUFFER_EOF_PENDING
Definition Scanner.cpp:248
YY_EXTRA_TYPE yyget_extra(void)
#define yywrap()
Definition Scanner.cpp:333
#define EOB_ACT_CONTINUE_SCAN
Definition Scanner.cpp:167
void yy_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
Definition Scanner.cpp:1531
#define YY_BUF_SIZE
Definition Scanner.cpp:146
#define YY_EXIT_FAILURE
Definition Scanner.cpp:1828
#define YY_SC_TO_UI(c)
Definition Scanner.cpp:121
YY_BUFFER_STATE yy_scan_buffer(char *base, yy_size_t size)
Setup the input buffer state to scan directly from a user-specified character buffer.
Definition Scanner.cpp:1736
constexpr T c
std::map< std::string, int > StringTokenMap
Definition Scanner.cpp:489
void initScanner()
Definition Scanner.cpp:2062
Parser * parser
Definition Parser.cpp:34
double s(double t, double s0, double v0, double a0, double j)
Definition CtrlUtil.h:33
Vertex source(const detail::edge_base< Directed, Vertex > &e, const PCG &)
constexpr auto n() noexcept
yy_size_t yy_n_chars
Definition Scanner.cpp:205
int yy_bs_lineno
The line count.
Definition Scanner.cpp:226
yy_size_t yy_buf_size
Definition Scanner.cpp:200
int yy_bs_column
The column count.
Definition Scanner.cpp:227
char * yy_buf_pos
Definition Scanner.cpp:195
FILE * yy_input_file
Definition Scanner.cpp:192
flex_int32_t yy_nxt
Definition Scanner.cpp:372
flex_int32_t yy_verify
Definition Scanner.cpp:371