source: trunk/orbital/generated/gun-scanner.cpp @ 1425

Last change on this file since 1425 was 1425, checked in by sam, 10 years ago

orbital: make sure to include "config.h" in all compiled files.

  • Property svn:keywords set to Id
File size: 43.0 KB
Line 
1#line 2 "generated/gun-scanner.cpp"
2
3#line 4 "generated/gun-scanner.cpp"
4
5#define  YY_INT_ALIGNED short int
6
7/* A lexical scanner generated by flex */
8
9#define FLEX_SCANNER
10#define YY_FLEX_MAJOR_VERSION 2
11#define YY_FLEX_MINOR_VERSION 5
12#define YY_FLEX_SUBMINOR_VERSION 35
13#if YY_FLEX_SUBMINOR_VERSION > 0
14#define FLEX_BETA
15#endif
16
17    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
18     * following macro. This is required in order to pass the c++-multiple-scanners
19     * test in the regression suite. We get reports that it breaks inheritance.
20     * We will address this in a future release of flex, or omit the C++ scanner
21     * altogether.
22     */
23    #define yyFlexLexer GunFlexLexer
24
25/* First, we deal with  platform-specific or compiler-specific issues. */
26
27/* begin standard C headers. */
28
29/* end standard C headers. */
30
31/* flex integer type definitions */
32
33#ifndef FLEXINT_H
34#define FLEXINT_H
35
36/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
37
38#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
39
40/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41 * if you want the limit (max/min) macros for int types.
42 */
43#ifndef __STDC_LIMIT_MACROS
44#define __STDC_LIMIT_MACROS 1
45#endif
46
47#include <inttypes.h>
48typedef int8_t flex_int8_t;
49typedef uint8_t flex_uint8_t;
50typedef int16_t flex_int16_t;
51typedef uint16_t flex_uint16_t;
52typedef int32_t flex_int32_t;
53typedef uint32_t flex_uint32_t;
54#else
55typedef signed char flex_int8_t;
56typedef short int flex_int16_t;
57typedef int flex_int32_t;
58typedef unsigned char flex_uint8_t;
59typedef unsigned short int flex_uint16_t;
60typedef unsigned int flex_uint32_t;
61
62/* Limits of integral types. */
63#ifndef INT8_MIN
64#define INT8_MIN               (-128)
65#endif
66#ifndef INT16_MIN
67#define INT16_MIN              (-32767-1)
68#endif
69#ifndef INT32_MIN
70#define INT32_MIN              (-2147483647-1)
71#endif
72#ifndef INT8_MAX
73#define INT8_MAX               (127)
74#endif
75#ifndef INT16_MAX
76#define INT16_MAX              (32767)
77#endif
78#ifndef INT32_MAX
79#define INT32_MAX              (2147483647)
80#endif
81#ifndef UINT8_MAX
82#define UINT8_MAX              (255U)
83#endif
84#ifndef UINT16_MAX
85#define UINT16_MAX             (65535U)
86#endif
87#ifndef UINT32_MAX
88#define UINT32_MAX             (4294967295U)
89#endif
90
91#endif /* ! C99 */
92
93#endif /* ! FLEXINT_H */
94
95/* begin standard C++ headers. */
96#include <iostream>
97#include <errno.h>
98#include <cstdlib>
99#include <cstdio>
100#include <cstring>
101/* end standard C++ headers. */
102
103#ifdef __cplusplus
104
105/* The "const" storage-class-modifier is valid. */
106#define YY_USE_CONST
107
108#else   /* ! __cplusplus */
109
110/* C99 requires __STDC__ to be defined as 1. */
111#if defined (__STDC__)
112
113#define YY_USE_CONST
114
115#endif  /* defined (__STDC__) */
116#endif  /* ! __cplusplus */
117
118#ifdef YY_USE_CONST
119#define yyconst const
120#else
121#define yyconst
122#endif
123
124/* Returned upon end-of-file. */
125#define YY_NULL 0
126
127/* Promotes a possibly negative, possibly signed char to an unsigned
128 * integer for use as an array index.  If the signed char is negative,
129 * we want to instead treat it as an 8-bit unsigned char, hence the
130 * double cast.
131 */
132#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
133
134/* Enter a start condition.  This macro really ought to take a parameter,
135 * but we do it the disgusting crufty way forced on us by the ()-less
136 * definition of BEGIN.
137 */
138#define BEGIN (yy_start) = 1 + 2 *
139
140/* Translate the current start state into a value that can be later handed
141 * to BEGIN to return to the state.  The YYSTATE alias is for lex
142 * compatibility.
143 */
144#define YY_START (((yy_start) - 1) / 2)
145#define YYSTATE YY_START
146
147/* Action number for EOF rule of a given start state. */
148#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
149
150/* Special action meaning "start processing a new file". */
151#define YY_NEW_FILE yyrestart( yyin  )
152
153#define YY_END_OF_BUFFER_CHAR 0
154
155/* Size of default input buffer. */
156#ifndef YY_BUF_SIZE
157#ifdef __ia64__
158/* On IA-64, the buffer size is 16k, not 8k.
159 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
160 * Ditto for the __ia64__ case accordingly.
161 */
162#define YY_BUF_SIZE 32768
163#else
164#define YY_BUF_SIZE 16384
165#endif /* __ia64__ */
166#endif
167
168/* The state buf must be large enough to hold one state per character in the main buffer.
169 */
170#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
171
172#ifndef YY_TYPEDEF_YY_BUFFER_STATE
173#define YY_TYPEDEF_YY_BUFFER_STATE
174typedef struct yy_buffer_state *YY_BUFFER_STATE;
175#endif
176
177extern int yyleng;
178
179#define EOB_ACT_CONTINUE_SCAN 0
180#define EOB_ACT_END_OF_FILE 1
181#define EOB_ACT_LAST_MATCH 2
182
183    #define YY_LESS_LINENO(n)
184   
185/* Return all but the first "n" matched characters back to the input stream. */
186#define yyless(n) \
187        do \
188                { \
189                /* Undo effects of setting up yytext. */ \
190        int yyless_macro_arg = (n); \
191        YY_LESS_LINENO(yyless_macro_arg);\
192                *yy_cp = (yy_hold_char); \
193                YY_RESTORE_YY_MORE_OFFSET \
194                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
195                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
196                } \
197        while ( 0 )
198
199#define unput(c) yyunput( c, (yytext_ptr)  )
200
201#ifndef YY_TYPEDEF_YY_SIZE_T
202#define YY_TYPEDEF_YY_SIZE_T
203typedef size_t yy_size_t;
204#endif
205
206#ifndef YY_STRUCT_YY_BUFFER_STATE
207#define YY_STRUCT_YY_BUFFER_STATE
208struct yy_buffer_state
209        {
210
211        std::istream* yy_input_file;
212
213        char *yy_ch_buf;                /* input buffer */
214        char *yy_buf_pos;               /* current position in input buffer */
215
216        /* Size of input buffer in bytes, not including room for EOB
217         * characters.
218         */
219        yy_size_t yy_buf_size;
220
221        /* Number of characters read into yy_ch_buf, not including EOB
222         * characters.
223         */
224        int yy_n_chars;
225
226        /* Whether we "own" the buffer - i.e., we know we created it,
227         * and can realloc() it to grow it, and should free() it to
228         * delete it.
229         */
230        int yy_is_our_buffer;
231
232        /* Whether this is an "interactive" input source; if so, and
233         * if we're using stdio for input, then we want to use getc()
234         * instead of fread(), to make sure we stop fetching input after
235         * each newline.
236         */
237        int yy_is_interactive;
238
239        /* Whether we're considered to be at the beginning of a line.
240         * If so, '^' rules will be active on the next match, otherwise
241         * not.
242         */
243        int yy_at_bol;
244
245    int yy_bs_lineno; /**< The line count. */
246    int yy_bs_column; /**< The column count. */
247   
248        /* Whether to try to fill the input buffer when we reach the
249         * end of it.
250         */
251        int yy_fill_buffer;
252
253        int yy_buffer_status;
254
255#define YY_BUFFER_NEW 0
256#define YY_BUFFER_NORMAL 1
257        /* When an EOF's been seen but there's still some text to process
258         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
259         * shouldn't try reading from the input source any more.  We might
260         * still have a bunch of tokens to match, though, because of
261         * possible backing-up.
262         *
263         * When we actually see the EOF, we change the status to "new"
264         * (via yyrestart()), so that the user can continue scanning by
265         * just pointing yyin at a new input file.
266         */
267#define YY_BUFFER_EOF_PENDING 2
268
269        };
270#endif /* !YY_STRUCT_YY_BUFFER_STATE */
271
272/* We provide macros for accessing buffer states in case in the
273 * future we want to put the buffer states in a more general
274 * "scanner state".
275 *
276 * Returns the top of the stack, or NULL.
277 */
278#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
279                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
280                          : NULL)
281
282/* Same as previous macro, but useful when we know that the buffer stack is not
283 * NULL or when we need an lvalue. For internal use only.
284 */
285#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
286
287void *Gunalloc (yy_size_t  );
288void *Gunrealloc (void *,yy_size_t  );
289void Gunfree (void *  );
290
291#define yy_new_buffer yy_create_buffer
292
293#define yy_set_interactive(is_interactive) \
294        { \
295        if ( ! YY_CURRENT_BUFFER ){ \
296        yyensure_buffer_stack (); \
297                YY_CURRENT_BUFFER_LVALUE =    \
298            yy_create_buffer( yyin, YY_BUF_SIZE ); \
299        } \
300        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
301        }
302
303#define yy_set_bol(at_bol) \
304        { \
305        if ( ! YY_CURRENT_BUFFER ){\
306        yyensure_buffer_stack (); \
307                YY_CURRENT_BUFFER_LVALUE =    \
308            yy_create_buffer( yyin, YY_BUF_SIZE ); \
309        } \
310        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
311        }
312
313#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
314
315/* Begin user sect3 */
316
317typedef unsigned char YY_CHAR;
318
319#define yytext_ptr yytext
320
321#include <FlexLexer.h>
322
323/* Done after the current pattern has been matched and before the
324 * corresponding action - sets up yytext.
325 */
326#define YY_DO_BEFORE_ACTION \
327        (yytext_ptr) = yy_bp; \
328        yyleng = (size_t) (yy_cp - yy_bp); \
329        (yy_hold_char) = *yy_cp; \
330        *yy_cp = '\0'; \
331        (yy_c_buf_p) = yy_cp;
332
333#define YY_NUM_RULES 21
334#define YY_END_OF_BUFFER 22
335/* This struct is not used in this scanner,
336   but its presence is necessary. */
337struct yy_trans_info
338        {
339        flex_int32_t yy_verify;
340        flex_int32_t yy_nxt;
341        };
342static yyconst flex_int16_t yy_accept[51] =
343    {   0,
344        0,    0,   22,   21,   20,   21,   19,   18,   20,   17,
345       21,   21,   21,   21,   21,   21,   21,   21,   21,    0,
346       17,   17,    0,    1,    3,   13,    0,   14,    0,    0,
347        0,    7,    4,   15,    6,    0,    0,    0,   17,   11,
348       12,    0,    0,    2,    8,    5,   16,    9,   10,    0
349    } ;
350
351static yyconst flex_int32_t yy_ec[256] =
352    {   0,
353        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
354        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
355        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
356        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
357        1,    1,    3,    4,    5,    6,    1,    7,    7,    7,
358        7,    7,    7,    7,    7,    7,    7,    1,    1,    1,
359        1,    1,    1,    1,    1,    1,    1,    1,    8,    1,
360        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
361        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
362        1,    1,    1,    1,    1,    1,    9,   10,   11,   12,
363
364        8,   13,    1,    1,   14,    1,   15,   16,   17,    1,
365       18,   19,    1,   20,   21,   22,    1,    1,    1,    1,
366        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
367        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
368        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
369        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
370        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
371        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
372        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
373        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
374
375        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
376        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
377        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
378        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
379        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
380        1,    1,    1,    1,    1
381    } ;
382
383static yyconst flex_int32_t yy_meta[23] =
384    {   0,
385        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
386        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
387        1,    1
388    } ;
389
390static yyconst flex_int16_t yy_base[51] =
391    {   0,
392        0,    0,   66,   67,   67,   17,   67,   19,   58,   21,
393       50,   54,   20,   44,   43,   51,   47,   31,   44,   50,
394       28,   24,   38,   67,   67,   67,   28,   67,   38,   43,
395       40,   67,   67,   67,   67,   41,   31,   37,   35,   67,
396       67,   18,   42,   67,   67,   67,   67,   67,   67,   67
397    } ;
398
399static yyconst flex_int16_t yy_def[51] =
400    {   0,
401       50,    1,   50,   50,   50,   50,   50,   50,   50,   50,
402       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
403       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
404       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
405       50,   50,   50,   50,   50,   50,   50,   50,   50,    0
406    } ;
407
408static yyconst flex_int16_t yy_nxt[90] =
409    {   0,
410        4,    5,    6,    7,    8,    9,   10,    4,   11,    4,
411       12,    4,   13,    4,    4,   14,   15,    4,   16,   17,
412       18,   19,   20,   21,   20,   21,   20,   21,   23,   26,
413       22,   23,   27,   20,   21,   23,   47,   40,   28,   33,
414       38,   39,   38,   39,   39,   34,   41,   46,   35,   36,
415       48,   49,   45,   44,   43,   42,   22,   37,   32,   31,
416       30,   29,   25,   24,   22,   50,    3,   50,   50,   50,
417       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
418       50,   50,   50,   50,   50,   50,   50,   50,   50
419    } ;
420
421static yyconst flex_int16_t yy_chk[90] =
422    {   0,
423        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
424        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
425        1,    1,    6,    6,    8,    8,   10,   10,   10,   13,
426       22,   22,   13,   21,   21,   21,   42,   27,   13,   18,
427       23,   39,   23,   38,   23,   18,   27,   37,   18,   18,
428       43,   43,   36,   31,   30,   29,   20,   19,   17,   16,
429       15,   14,   12,   11,    9,    3,   50,   50,   50,   50,
430       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
431       50,   50,   50,   50,   50,   50,   50,   50,   50
432    } ;
433
434/* The intent behind this definition is that it'll catch
435 * any uses of REJECT which flex missed.
436 */
437#define REJECT reject_used_but_not_detected
438#define yymore() yymore_used_but_not_detected
439#define YY_MORE_ADJ 0
440#define YY_RESTORE_YY_MORE_OFFSET
441#line 1 "gun-scanner.l"
442#line 2 "gun-scanner.l"
443//
444// Orbital
445//
446// Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
447//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
448//            (c) 2012 Sam Hocevar <sam@hocevar.net>
449//
450
451#if defined HAVE_CONFIG_H
452#   include "config.h"
453#endif
454
455#include "core.h"
456#include "loldebug.h"
457
458using namespace lol;
459
460#include "../gun-compiler.h"
461
462typedef orbital::GunParser::token token;
463typedef orbital::GunParser::token_type token_type;
464
465#ifndef YY_DECL
466#   define YY_DECL orbital::GunParser::token_type \
467        orbital::GunScanner::lex(orbital::GunParser::semantic_type* yylval, \
468                                 orbital::GunParser::location_type* yylloc)
469#endif
470
471#define yyterminate() return token::T_END
472#define YY_NO_UNISTD_H
473#define YY_USER_ACTION yylloc->columns(yyleng);
474#line 475 "generated/gun-scanner.cpp"
475
476#define INITIAL 0
477
478#ifndef YY_NO_UNISTD_H
479/* Special case for "unistd.h", since it is non-ANSI. We include it way
480 * down here because we want the user's section 1 to have been scanned first.
481 * The user has a chance to override it with an option.
482 */
483#include <unistd.h>
484#endif
485
486#ifndef YY_EXTRA_TYPE
487#define YY_EXTRA_TYPE void *
488#endif
489
490#ifndef yytext_ptr
491static void yy_flex_strncpy (char *,yyconst char *,int );
492#endif
493
494#ifdef YY_NEED_STRLEN
495static int yy_flex_strlen (yyconst char * );
496#endif
497
498#ifndef YY_NO_INPUT
499
500#endif
501
502/* Amount of stuff to slurp up with each read. */
503#ifndef YY_READ_BUF_SIZE
504#ifdef __ia64__
505/* On IA-64, the buffer size is 16k, not 8k */
506#define YY_READ_BUF_SIZE 16384
507#else
508#define YY_READ_BUF_SIZE 8192
509#endif /* __ia64__ */
510#endif
511
512/* Copy whatever the last rule matched to the standard output. */
513#ifndef ECHO
514#define ECHO LexerOutput( yytext, yyleng )
515#endif
516
517/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
518 * is returned in "result".
519 */
520#ifndef YY_INPUT
521#define YY_INPUT(buf,result,max_size) \
522\
523        if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
524                YY_FATAL_ERROR( "input in flex scanner failed" );
525
526#endif
527
528/* No semi-colon after return; correct usage is to write "yyterminate();" -
529 * we don't want an extra ';' after the "return" because that will cause
530 * some compilers to complain about unreachable statements.
531 */
532#ifndef yyterminate
533#define yyterminate() return YY_NULL
534#endif
535
536/* Number of entries by which start-condition stack grows. */
537#ifndef YY_START_STACK_INCR
538#define YY_START_STACK_INCR 25
539#endif
540
541/* Report a fatal error. */
542#ifndef YY_FATAL_ERROR
543#define YY_FATAL_ERROR(msg) LexerError( msg )
544#endif
545
546/* end tables serialization structures and prototypes */
547
548/* Default declaration of generated scanner - a define so the user can
549 * easily add parameters.
550 */
551#ifndef YY_DECL
552#define YY_DECL_IS_OURS 1
553#define YY_DECL int yyFlexLexer::yylex()
554#endif /* !YY_DECL */
555
556/* Code executed at the beginning of each rule, after yytext and yyleng
557 * have been set up.
558 */
559#ifndef YY_USER_ACTION
560#define YY_USER_ACTION
561#endif
562
563/* Code executed at the end of each rule. */
564#ifndef YY_BREAK
565#define YY_BREAK break;
566#endif
567
568#define YY_RULE_SETUP \
569        YY_USER_ACTION
570
571/** The main scanner function which does all the work.
572 */
573YY_DECL
574{
575        register yy_state_type yy_current_state;
576        register char *yy_cp, *yy_bp;
577        register int yy_act;
578   
579#line 38 "gun-scanner.l"
580
581
582
583    /* reset location at the beginning of yylex() */
584    yylloc->step();
585
586
587#line 588 "generated/gun-scanner.cpp"
588
589        if ( !(yy_init) )
590                {
591                (yy_init) = 1;
592
593#ifdef YY_USER_INIT
594                YY_USER_INIT;
595#endif
596
597                if ( ! (yy_start) )
598                        (yy_start) = 1; /* first start state */
599
600                if ( ! yyin )
601                        yyin = & std::cin;
602
603                if ( ! yyout )
604                        yyout = & std::cout;
605
606                if ( ! YY_CURRENT_BUFFER ) {
607                        yyensure_buffer_stack ();
608                        YY_CURRENT_BUFFER_LVALUE =
609                                yy_create_buffer( yyin, YY_BUF_SIZE );
610                }
611
612                yy_load_buffer_state(  );
613                }
614
615        while ( 1 )             /* loops until end-of-file is reached */
616                {
617                yy_cp = (yy_c_buf_p);
618
619                /* Support of yytext. */
620                *yy_cp = (yy_hold_char);
621
622                /* yy_bp points to the position in yy_ch_buf of the start of
623                 * the current run.
624                 */
625                yy_bp = yy_cp;
626
627                yy_current_state = (yy_start);
628yy_match:
629                do
630                        {
631                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
632                        if ( yy_accept[yy_current_state] )
633                                {
634                                (yy_last_accepting_state) = yy_current_state;
635                                (yy_last_accepting_cpos) = yy_cp;
636                                }
637                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
638                                {
639                                yy_current_state = (int) yy_def[yy_current_state];
640                                if ( yy_current_state >= 51 )
641                                        yy_c = yy_meta[(unsigned int) yy_c];
642                                }
643                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
644                        ++yy_cp;
645                        }
646                while ( yy_current_state != 50 );
647                yy_cp = (yy_last_accepting_cpos);
648                yy_current_state = (yy_last_accepting_state);
649
650yy_find_action:
651                yy_act = yy_accept[yy_current_state];
652
653                YY_DO_BEFORE_ACTION;
654
655do_action:      /* This label is used only to access EOF actions. */
656
657                switch ( yy_act )
658        { /* beginning of action switch */
659                        case 0: /* must back up */
660                        /* undo the effects of YY_DO_BEFORE_ACTION */
661                        *yy_cp = (yy_hold_char);
662                        yy_cp = (yy_last_accepting_cpos);
663                        yy_current_state = (yy_last_accepting_state);
664                        goto yy_find_action;
665
666case 1:
667YY_RULE_SETUP
668#line 45 "gun-scanner.l"
669{ return token::T_AI; }
670        YY_BREAK
671case 2:
672YY_RULE_SETUP
673#line 46 "gun-scanner.l"
674{ return token::T_PAI; }
675        YY_BREAK
676case 3:
677YY_RULE_SETUP
678#line 47 "gun-scanner.l"
679{ return token::T_CA; }
680        YY_BREAK
681case 4:
682YY_RULE_SETUP
683#line 48 "gun-scanner.l"
684{ return token::T_SA; }
685        YY_BREAK
686case 5:
687YY_RULE_SETUP
688#line 49 "gun-scanner.l"
689{ return token::T_TIM; }
690        YY_BREAK
691case 6:
692YY_RULE_SETUP
693#line 50 "gun-scanner.l"
694{ return token::T_SO; }
695        YY_BREAK
696case 7:
697YY_RULE_SETUP
698#line 51 "gun-scanner.l"
699{ return token::T_RD; }
700        YY_BREAK
701case 8:
702YY_RULE_SETUP
703#line 52 "gun-scanner.l"
704{ return token::T_SPD; }
705        YY_BREAK
706case 9:
707YY_RULE_SETUP
708#line 53 "gun-scanner.l"
709{ return token::T_MODA; }
710        YY_BREAK
711case 10:
712YY_RULE_SETUP
713#line 54 "gun-scanner.l"
714{ return token::T_MODB; }
715        YY_BREAK
716case 11:
717YY_RULE_SETUP
718#line 55 "gun-scanner.l"
719{ return token::T_FFB; }
720        YY_BREAK
721case 12:
722YY_RULE_SETUP
723#line 56 "gun-scanner.l"
724{ return token::T_FFP; }
725        YY_BREAK
726case 13:
727YY_RULE_SETUP
728#line 57 "gun-scanner.l"
729{ return token::T_FB; }
730        YY_BREAK
731case 14:
732YY_RULE_SETUP
733#line 58 "gun-scanner.l"
734{ return token::T_FP; }
735        YY_BREAK
736case 15:
737YY_RULE_SETUP
738#line 59 "gun-scanner.l"
739{ return token::T_SK; }
740        YY_BREAK
741case 16:
742YY_RULE_SETUP
743#line 60 "gun-scanner.l"
744{ return token::T_LOOP; }
745        YY_BREAK
746case 17:
747YY_RULE_SETUP
748#line 62 "gun-scanner.l"
749{
750        yylval->fval = atof(yytext); return token::NUMBER; }
751        YY_BREAK
752case 18:
753YY_RULE_SETUP
754#line 64 "gun-scanner.l"
755{ return token_type('-'); }
756        YY_BREAK
757case 19:
758YY_RULE_SETUP
759#line 65 "gun-scanner.l"
760{ return token_type(','); }
761        YY_BREAK
762case 20:
763/* rule 20 can match eol */
764YY_RULE_SETUP
765#line 66 "gun-scanner.l"
766{ /* ignore everything else */ }
767        YY_BREAK
768case 21:
769YY_RULE_SETUP
770#line 68 "gun-scanner.l"
771ECHO;
772        YY_BREAK
773#line 774 "generated/gun-scanner.cpp"
774case YY_STATE_EOF(INITIAL):
775        yyterminate();
776
777        case YY_END_OF_BUFFER:
778                {
779                /* Amount of text matched not including the EOB char. */
780                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
781
782                /* Undo the effects of YY_DO_BEFORE_ACTION. */
783                *yy_cp = (yy_hold_char);
784                YY_RESTORE_YY_MORE_OFFSET
785
786                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
787                        {
788                        /* We're scanning a new file or input source.  It's
789                         * possible that this happened because the user
790                         * just pointed yyin at a new source and called
791                         * yylex().  If so, then we have to assure
792                         * consistency between YY_CURRENT_BUFFER and our
793                         * globals.  Here is the right place to do so, because
794                         * this is the first action (other than possibly a
795                         * back-up) that will match for the new input source.
796                         */
797                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
798                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
799                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
800                        }
801
802                /* Note that here we test for yy_c_buf_p "<=" to the position
803                 * of the first EOB in the buffer, since yy_c_buf_p will
804                 * already have been incremented past the NUL character
805                 * (since all states make transitions on EOB to the
806                 * end-of-buffer state).  Contrast this with the test
807                 * in input().
808                 */
809                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
810                        { /* This was really a NUL. */
811                        yy_state_type yy_next_state;
812
813                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
814
815                        yy_current_state = yy_get_previous_state(  );
816
817                        /* Okay, we're now positioned to make the NUL
818                         * transition.  We couldn't have
819                         * yy_get_previous_state() go ahead and do it
820                         * for us because it doesn't know how to deal
821                         * with the possibility of jamming (and we don't
822                         * want to build jamming into it because then it
823                         * will run more slowly).
824                         */
825
826                        yy_next_state = yy_try_NUL_trans( yy_current_state );
827
828                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
829
830                        if ( yy_next_state )
831                                {
832                                /* Consume the NUL. */
833                                yy_cp = ++(yy_c_buf_p);
834                                yy_current_state = yy_next_state;
835                                goto yy_match;
836                                }
837
838                        else
839                                {
840                                yy_cp = (yy_last_accepting_cpos);
841                                yy_current_state = (yy_last_accepting_state);
842                                goto yy_find_action;
843                                }
844                        }
845
846                else switch ( yy_get_next_buffer(  ) )
847                        {
848                        case EOB_ACT_END_OF_FILE:
849                                {
850                                (yy_did_buffer_switch_on_eof) = 0;
851
852                                if ( yywrap(  ) )
853                                        {
854                                        /* Note: because we've taken care in
855                                         * yy_get_next_buffer() to have set up
856                                         * yytext, we can now set up
857                                         * yy_c_buf_p so that if some total
858                                         * hoser (like flex itself) wants to
859                                         * call the scanner after we return the
860                                         * YY_NULL, it'll still work - another
861                                         * YY_NULL will get returned.
862                                         */
863                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
864
865                                        yy_act = YY_STATE_EOF(YY_START);
866                                        goto do_action;
867                                        }
868
869                                else
870                                        {
871                                        if ( ! (yy_did_buffer_switch_on_eof) )
872                                                YY_NEW_FILE;
873                                        }
874                                break;
875                                }
876
877                        case EOB_ACT_CONTINUE_SCAN:
878                                (yy_c_buf_p) =
879                                        (yytext_ptr) + yy_amount_of_matched_text;
880
881                                yy_current_state = yy_get_previous_state(  );
882
883                                yy_cp = (yy_c_buf_p);
884                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
885                                goto yy_match;
886
887                        case EOB_ACT_LAST_MATCH:
888                                (yy_c_buf_p) =
889                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
890
891                                yy_current_state = yy_get_previous_state(  );
892
893                                yy_cp = (yy_c_buf_p);
894                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
895                                goto yy_find_action;
896                        }
897                break;
898                }
899
900        default:
901                YY_FATAL_ERROR(
902                        "fatal flex scanner internal error--no action found" );
903        } /* end of action switch */
904                } /* end of scanning one token */
905} /* end of yylex */
906
907/* The contents of this function are C++ specific, so the () macro is not used.
908 */
909yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
910{
911        yyin = arg_yyin;
912        yyout = arg_yyout;
913        yy_c_buf_p = 0;
914        yy_init = 0;
915        yy_start = 0;
916        yy_flex_debug = 0;
917        yylineno = 1;   // this will only get updated if %option yylineno
918
919        yy_did_buffer_switch_on_eof = 0;
920
921        yy_looking_for_trail_begin = 0;
922        yy_more_flag = 0;
923        yy_more_len = 0;
924        yy_more_offset = yy_prev_more_offset = 0;
925
926        yy_start_stack_ptr = yy_start_stack_depth = 0;
927        yy_start_stack = NULL;
928
929        yy_buffer_stack = 0;
930        yy_buffer_stack_top = 0;
931        yy_buffer_stack_max = 0;
932
933        yy_state_buf = 0;
934
935}
936
937/* The contents of this function are C++ specific, so the () macro is not used.
938 */
939yyFlexLexer::~yyFlexLexer()
940{
941        delete [] yy_state_buf;
942        Gunfree(yy_start_stack  );
943        yy_delete_buffer( YY_CURRENT_BUFFER );
944        Gunfree(yy_buffer_stack  );
945}
946
947/* The contents of this function are C++ specific, so the () macro is not used.
948 */
949void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
950{
951        if ( new_in )
952                {
953                yy_delete_buffer( YY_CURRENT_BUFFER );
954                yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
955                }
956
957        if ( new_out )
958                yyout = new_out;
959}
960
961#ifdef YY_INTERACTIVE
962int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
963#else
964int yyFlexLexer::LexerInput( char* buf, int max_size )
965#endif
966{
967        if ( yyin->eof() || yyin->fail() )
968                return 0;
969
970#ifdef YY_INTERACTIVE
971        yyin->get( buf[0] );
972
973        if ( yyin->eof() )
974                return 0;
975
976        if ( yyin->bad() )
977                return -1;
978
979        return 1;
980
981#else
982        (void) yyin->read( buf, max_size );
983
984        if ( yyin->bad() )
985                return -1;
986        else
987                return yyin->gcount();
988#endif
989}
990
991void yyFlexLexer::LexerOutput( const char* buf, int size )
992{
993        (void) yyout->write( buf, size );
994}
995
996/* yy_get_next_buffer - try to read in a new buffer
997 *
998 * Returns a code representing an action:
999 *      EOB_ACT_LAST_MATCH -
1000 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1001 *      EOB_ACT_END_OF_FILE - end of file
1002 */
1003int yyFlexLexer::yy_get_next_buffer()
1004{
1005        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1006        register char *source = (yytext_ptr);
1007        register int number_to_move, i;
1008        int ret_val;
1009
1010        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1011                YY_FATAL_ERROR(
1012                "fatal flex scanner internal error--end of buffer missed" );
1013
1014        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1015                { /* Don't try to fill the buffer, so this is an EOF. */
1016                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1017                        {
1018                        /* We matched a single character, the EOB, so
1019                         * treat this as a final EOF.
1020                         */
1021                        return EOB_ACT_END_OF_FILE;
1022                        }
1023
1024                else
1025                        {
1026                        /* We matched some text prior to the EOB, first
1027                         * process it.
1028                         */
1029                        return EOB_ACT_LAST_MATCH;
1030                        }
1031                }
1032
1033        /* Try to read more data. */
1034
1035        /* First move last chars to start of buffer. */
1036        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1037
1038        for ( i = 0; i < number_to_move; ++i )
1039                *(dest++) = *(source++);
1040
1041        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1042                /* don't do the read, it's not guaranteed to return an EOF,
1043                 * just force an EOF
1044                 */
1045                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1046
1047        else
1048                {
1049                        int num_to_read =
1050                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1051
1052                while ( num_to_read <= 0 )
1053                        { /* Not enough room in the buffer - grow it. */
1054
1055                        /* just a shorter name for the current buffer */
1056                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1057
1058                        int yy_c_buf_p_offset =
1059                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
1060
1061                        if ( b->yy_is_our_buffer )
1062                                {
1063                                int new_size = b->yy_buf_size * 2;
1064
1065                                if ( new_size <= 0 )
1066                                        b->yy_buf_size += b->yy_buf_size / 8;
1067                                else
1068                                        b->yy_buf_size *= 2;
1069
1070                                b->yy_ch_buf = (char *)
1071                                        /* Include room in for 2 EOB chars. */
1072                                        Gunrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1073                                }
1074                        else
1075                                /* Can't grow it, we don't own it. */
1076                                b->yy_ch_buf = 0;
1077
1078                        if ( ! b->yy_ch_buf )
1079                                YY_FATAL_ERROR(
1080                                "fatal error - scanner input buffer overflow" );
1081
1082                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1083
1084                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1085                                                number_to_move - 1;
1086
1087                        }
1088
1089                if ( num_to_read > YY_READ_BUF_SIZE )
1090                        num_to_read = YY_READ_BUF_SIZE;
1091
1092                /* Read in more data. */
1093                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1094                        (yy_n_chars), (size_t) num_to_read );
1095
1096                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1097                }
1098
1099        if ( (yy_n_chars) == 0 )
1100                {
1101                if ( number_to_move == YY_MORE_ADJ )
1102                        {
1103                        ret_val = EOB_ACT_END_OF_FILE;
1104                        yyrestart( yyin  );
1105                        }
1106
1107                else
1108                        {
1109                        ret_val = EOB_ACT_LAST_MATCH;
1110                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1111                                YY_BUFFER_EOF_PENDING;
1112                        }
1113                }
1114
1115        else
1116                ret_val = EOB_ACT_CONTINUE_SCAN;
1117
1118        if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1119                /* Extend the array by 50%, plus the number we really need. */
1120                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1121                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Gunrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1122                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1123                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1124        }
1125
1126        (yy_n_chars) += number_to_move;
1127        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1128        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1129
1130        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1131
1132        return ret_val;
1133}
1134
1135/* yy_get_previous_state - get the state just before the EOB char was reached */
1136
1137    yy_state_type yyFlexLexer::yy_get_previous_state()
1138{
1139        register yy_state_type yy_current_state;
1140        register char *yy_cp;
1141   
1142        yy_current_state = (yy_start);
1143
1144        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1145                {
1146                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1147                if ( yy_accept[yy_current_state] )
1148                        {
1149                        (yy_last_accepting_state) = yy_current_state;
1150                        (yy_last_accepting_cpos) = yy_cp;
1151                        }
1152                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1153                        {
1154                        yy_current_state = (int) yy_def[yy_current_state];
1155                        if ( yy_current_state >= 51 )
1156                                yy_c = yy_meta[(unsigned int) yy_c];
1157                        }
1158                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1159                }
1160
1161        return yy_current_state;
1162}
1163
1164/* yy_try_NUL_trans - try to make a transition on the NUL character
1165 *
1166 * synopsis
1167 *      next_state = yy_try_NUL_trans( current_state );
1168 */
1169    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1170{
1171        register int yy_is_jam;
1172        register char *yy_cp = (yy_c_buf_p);
1173
1174        register YY_CHAR yy_c = 1;
1175        if ( yy_accept[yy_current_state] )
1176                {
1177                (yy_last_accepting_state) = yy_current_state;
1178                (yy_last_accepting_cpos) = yy_cp;
1179                }
1180        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1181                {
1182                yy_current_state = (int) yy_def[yy_current_state];
1183                if ( yy_current_state >= 51 )
1184                        yy_c = yy_meta[(unsigned int) yy_c];
1185                }
1186        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1187        yy_is_jam = (yy_current_state == 50);
1188
1189        return yy_is_jam ? 0 : yy_current_state;
1190}
1191
1192    void yyFlexLexer::yyunput( int c, register char* yy_bp)
1193{
1194        register char *yy_cp;
1195   
1196    yy_cp = (yy_c_buf_p);
1197
1198        /* undo effects of setting up yytext */
1199        *yy_cp = (yy_hold_char);
1200
1201        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1202                { /* need to shift things up to make room */
1203                /* +2 for EOB chars. */
1204                register int number_to_move = (yy_n_chars) + 2;
1205                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1206                                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1207                register char *source =
1208                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1209
1210                while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1211                        *--dest = *--source;
1212
1213                yy_cp += (int) (dest - source);
1214                yy_bp += (int) (dest - source);
1215                YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1216                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1217
1218                if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1219                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
1220                }
1221
1222        *--yy_cp = (char) c;
1223
1224        (yytext_ptr) = yy_bp;
1225        (yy_hold_char) = *yy_cp;
1226        (yy_c_buf_p) = yy_cp;
1227}
1228
1229    int yyFlexLexer::yyinput()
1230{
1231        int c;
1232   
1233        *(yy_c_buf_p) = (yy_hold_char);
1234
1235        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1236                {
1237                /* yy_c_buf_p now points to the character we want to return.
1238                 * If this occurs *before* the EOB characters, then it's a
1239                 * valid NUL; if not, then we've hit the end of the buffer.
1240                 */
1241                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1242                        /* This was really a NUL. */
1243                        *(yy_c_buf_p) = '\0';
1244
1245                else
1246                        { /* need more input */
1247                        int offset = (yy_c_buf_p) - (yytext_ptr);
1248                        ++(yy_c_buf_p);
1249
1250                        switch ( yy_get_next_buffer(  ) )
1251                                {
1252                                case EOB_ACT_LAST_MATCH:
1253                                        /* This happens because yy_g_n_b()
1254                                         * sees that we've accumulated a
1255                                         * token and flags that we need to
1256                                         * try matching the token before
1257                                         * proceeding.  But for input(),
1258                                         * there's no matching to consider.
1259                                         * So convert the EOB_ACT_LAST_MATCH
1260                                         * to EOB_ACT_END_OF_FILE.
1261                                         */
1262
1263                                        /* Reset buffer status. */
1264                                        yyrestart( yyin );
1265
1266                                        /*FALLTHROUGH*/
1267
1268                                case EOB_ACT_END_OF_FILE:
1269                                        {
1270                                        if ( yywrap(  ) )
1271                                                return EOF;
1272
1273                                        if ( ! (yy_did_buffer_switch_on_eof) )
1274                                                YY_NEW_FILE;
1275#ifdef __cplusplus
1276                                        return yyinput();
1277#else
1278                                        return input();
1279#endif
1280                                        }
1281
1282                                case EOB_ACT_CONTINUE_SCAN:
1283                                        (yy_c_buf_p) = (yytext_ptr) + offset;
1284                                        break;
1285                                }
1286                        }
1287                }
1288
1289        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
1290        *(yy_c_buf_p) = '\0';   /* preserve yytext */
1291        (yy_hold_char) = *++(yy_c_buf_p);
1292
1293        return c;
1294}
1295
1296/** Immediately switch to a different input stream.
1297 * @param input_file A readable stream.
1298 *
1299 * @note This function does not reset the start condition to @c INITIAL .
1300 */
1301    void yyFlexLexer::yyrestart( std::istream* input_file )
1302{
1303   
1304        if ( ! YY_CURRENT_BUFFER ){
1305        yyensure_buffer_stack ();
1306                YY_CURRENT_BUFFER_LVALUE =
1307            yy_create_buffer( yyin, YY_BUF_SIZE );
1308        }
1309
1310        yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1311        yy_load_buffer_state(  );
1312}
1313
1314/** Switch to a different input buffer.
1315 * @param new_buffer The new input buffer.
1316 *
1317 */
1318    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1319{
1320   
1321        /* TODO. We should be able to replace this entire function body
1322         * with
1323         *              yypop_buffer_state();
1324         *              yypush_buffer_state(new_buffer);
1325     */
1326        yyensure_buffer_stack ();
1327        if ( YY_CURRENT_BUFFER == new_buffer )
1328                return;
1329
1330        if ( YY_CURRENT_BUFFER )
1331                {
1332                /* Flush out information for old buffer. */
1333                *(yy_c_buf_p) = (yy_hold_char);
1334                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1335                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1336                }
1337
1338        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1339        yy_load_buffer_state(  );
1340
1341        /* We don't actually know whether we did this switch during
1342         * EOF (yywrap()) processing, but the only time this flag
1343         * is looked at is after yywrap() is called, so it's safe
1344         * to go ahead and always set it.
1345         */
1346        (yy_did_buffer_switch_on_eof) = 1;
1347}
1348
1349    void yyFlexLexer::yy_load_buffer_state()
1350{
1351        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1352        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1353        yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1354        (yy_hold_char) = *(yy_c_buf_p);
1355}
1356
1357/** Allocate and initialize an input buffer state.
1358 * @param file A readable stream.
1359 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1360 *
1361 * @return the allocated buffer state.
1362 */
1363    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1364{
1365        YY_BUFFER_STATE b;
1366   
1367        b = (YY_BUFFER_STATE) Gunalloc(sizeof( struct yy_buffer_state )  );
1368        if ( ! b )
1369                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1370
1371        b->yy_buf_size = size;
1372
1373        /* yy_ch_buf has to be 2 characters longer than the size given because
1374         * we need to put in 2 end-of-buffer characters.
1375         */
1376        b->yy_ch_buf = (char *) Gunalloc(b->yy_buf_size + 2  );
1377        if ( ! b->yy_ch_buf )
1378                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1379
1380        b->yy_is_our_buffer = 1;
1381
1382        yy_init_buffer( b, file );
1383
1384        return b;
1385}
1386
1387/** Destroy the buffer.
1388 * @param b a buffer created with yy_create_buffer()
1389 *
1390 */
1391    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1392{
1393   
1394        if ( ! b )
1395                return;
1396
1397        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1398                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1399
1400        if ( b->yy_is_our_buffer )
1401                Gunfree((void *) b->yy_ch_buf  );
1402
1403        Gunfree((void *) b  );
1404}
1405
1406extern "C" int isatty (int );
1407
1408/* Initializes or reinitializes a buffer.
1409 * This function is sometimes called more than once on the same buffer,
1410 * such as during a yyrestart() or at EOF.
1411 */
1412    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1413
1414{
1415        int oerrno = errno;
1416   
1417        yy_flush_buffer( b );
1418
1419        b->yy_input_file = file;
1420        b->yy_fill_buffer = 1;
1421
1422    /* If b is the current buffer, then yy_init_buffer was _probably_
1423     * called from yyrestart() or through yy_get_next_buffer.
1424     * In that case, we don't want to reset the lineno or column.
1425     */
1426    if (b != YY_CURRENT_BUFFER){
1427        b->yy_bs_lineno = 1;
1428        b->yy_bs_column = 0;
1429    }
1430
1431        b->yy_is_interactive = 0;
1432        errno = oerrno;
1433}
1434
1435/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1436 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1437 *
1438 */
1439    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1440{
1441        if ( ! b )
1442                return;
1443
1444        b->yy_n_chars = 0;
1445
1446        /* We always need two end-of-buffer characters.  The first causes
1447         * a transition to the end-of-buffer state.  The second causes
1448         * a jam in that state.
1449         */
1450        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1451        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1452
1453        b->yy_buf_pos = &b->yy_ch_buf[0];
1454
1455        b->yy_at_bol = 1;
1456        b->yy_buffer_status = YY_BUFFER_NEW;
1457
1458        if ( b == YY_CURRENT_BUFFER )
1459                yy_load_buffer_state(  );
1460}
1461
1462/** Pushes the new state onto the stack. The new state becomes
1463 *  the current state. This function will allocate the stack
1464 *  if necessary.
1465 *  @param new_buffer The new state.
1466 * 
1467 */
1468void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1469{
1470        if (new_buffer == NULL)
1471                return;
1472
1473        yyensure_buffer_stack();
1474
1475        /* This block is copied from yy_switch_to_buffer. */
1476        if ( YY_CURRENT_BUFFER )
1477                {
1478                /* Flush out information for old buffer. */
1479                *(yy_c_buf_p) = (yy_hold_char);
1480                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1481                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1482                }
1483
1484        /* Only push if top exists. Otherwise, replace top. */
1485        if (YY_CURRENT_BUFFER)
1486                (yy_buffer_stack_top)++;
1487        YY_CURRENT_BUFFER_LVALUE = new_buffer;
1488
1489        /* copied from yy_switch_to_buffer. */
1490        yy_load_buffer_state(  );
1491        (yy_did_buffer_switch_on_eof) = 1;
1492}
1493
1494/** Removes and deletes the top of the stack, if present.
1495 *  The next element becomes the new top.
1496 * 
1497 */
1498void yyFlexLexer::yypop_buffer_state (void)
1499{
1500        if (!YY_CURRENT_BUFFER)
1501                return;
1502
1503        yy_delete_buffer(YY_CURRENT_BUFFER );
1504        YY_CURRENT_BUFFER_LVALUE = NULL;
1505        if ((yy_buffer_stack_top) > 0)
1506                --(yy_buffer_stack_top);
1507
1508        if (YY_CURRENT_BUFFER) {
1509                yy_load_buffer_state(  );
1510                (yy_did_buffer_switch_on_eof) = 1;
1511        }
1512}
1513
1514/* Allocates the stack if it does not exist.
1515 *  Guarantees space for at least one push.
1516 */
1517void yyFlexLexer::yyensure_buffer_stack(void)
1518{
1519        int num_to_alloc;
1520   
1521        if (!(yy_buffer_stack)) {
1522
1523                /* First allocation is just for 2 elements, since we don't know if this
1524                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1525                 * immediate realloc on the next call.
1526         */
1527                num_to_alloc = 1;
1528                (yy_buffer_stack) = (struct yy_buffer_state**)Gunalloc
1529                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
1530                                                                );
1531                if ( ! (yy_buffer_stack) )
1532                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1533                                                                 
1534                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1535                               
1536                (yy_buffer_stack_max) = num_to_alloc;
1537                (yy_buffer_stack_top) = 0;
1538                return;
1539        }
1540
1541        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1542
1543                /* Increase the buffer to prepare for a possible push. */
1544                int grow_size = 8 /* arbitrary grow size */;
1545
1546                num_to_alloc = (yy_buffer_stack_max) + grow_size;
1547                (yy_buffer_stack) = (struct yy_buffer_state**)Gunrealloc
1548                                                                ((yy_buffer_stack),
1549                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
1550                                                                );
1551                if ( ! (yy_buffer_stack) )
1552                        YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1553
1554                /* zero only the new slots.*/
1555                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1556                (yy_buffer_stack_max) = num_to_alloc;
1557        }
1558}
1559
1560    void yyFlexLexer::yy_push_state( int new_state )
1561{
1562        if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1563                {
1564                yy_size_t new_size;
1565
1566                (yy_start_stack_depth) += YY_START_STACK_INCR;
1567                new_size = (yy_start_stack_depth) * sizeof( int );
1568
1569                if ( ! (yy_start_stack) )
1570                        (yy_start_stack) = (int *) Gunalloc(new_size  );
1571
1572                else
1573                        (yy_start_stack) = (int *) Gunrealloc((void *) (yy_start_stack),new_size  );
1574
1575                if ( ! (yy_start_stack) )
1576                        YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
1577                }
1578
1579        (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1580
1581        BEGIN(new_state);
1582}
1583
1584    void yyFlexLexer::yy_pop_state()
1585{
1586        if ( --(yy_start_stack_ptr) < 0 )
1587                YY_FATAL_ERROR( "start-condition stack underflow" );
1588
1589        BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1590}
1591
1592    int yyFlexLexer::yy_top_state()
1593{
1594        return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1595}
1596
1597#ifndef YY_EXIT_FAILURE
1598#define YY_EXIT_FAILURE 2
1599#endif
1600
1601void yyFlexLexer::LexerError( yyconst char msg[] )
1602{
1603        std::cerr << msg << std::endl;
1604        exit( YY_EXIT_FAILURE );
1605}
1606
1607/* Redefine yyless() so it works in section 3 code. */
1608
1609#undef yyless
1610#define yyless(n) \
1611        do \
1612                { \
1613                /* Undo effects of setting up yytext. */ \
1614        int yyless_macro_arg = (n); \
1615        YY_LESS_LINENO(yyless_macro_arg);\
1616                yytext[yyleng] = (yy_hold_char); \
1617                (yy_c_buf_p) = yytext + yyless_macro_arg; \
1618                (yy_hold_char) = *(yy_c_buf_p); \
1619                *(yy_c_buf_p) = '\0'; \
1620                yyleng = yyless_macro_arg; \
1621                } \
1622        while ( 0 )
1623
1624/* Accessor  methods (get/set functions) to struct members. */
1625
1626/*
1627 * Internal utility routines.
1628 */
1629
1630#ifndef yytext_ptr
1631static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1632{
1633        register int i;
1634        for ( i = 0; i < n; ++i )
1635                s1[i] = s2[i];
1636}
1637#endif
1638
1639#ifdef YY_NEED_STRLEN
1640static int yy_flex_strlen (yyconst char * s )
1641{
1642        register int n;
1643        for ( n = 0; s[n]; ++n )
1644                ;
1645
1646        return n;
1647}
1648#endif
1649
1650void *Gunalloc (yy_size_t  size )
1651{
1652        return (void *) malloc( size );
1653}
1654
1655void *Gunrealloc  (void * ptr, yy_size_t  size )
1656{
1657        /* The cast to (char *) in the following accommodates both
1658         * implementations that use char* generic pointers, and those
1659         * that use void* generic pointers.  It works with the latter
1660         * because both ANSI C and C++ allow castless assignment from
1661         * any pointer type to void*, and deal with argument conversions
1662         * as though doing an assignment.
1663         */
1664        return (void *) realloc( (char *) ptr, size );
1665}
1666
1667void Gunfree (void * ptr )
1668{
1669        free( (char *) ptr );   /* see Gunrealloc() for (char *) cast */
1670}
1671
1672#define YYTABLES_NAME "yytables"
1673
1674#line 68 "gun-scanner.l"
1675
1676
1677
1678orbital::GunScanner::GunScanner(char const *command)
1679    : GunFlexLexer(0, 0),
1680      m_input(command)
1681{
1682}
1683
1684orbital::GunScanner::~GunScanner()
1685{
1686}
1687
1688int orbital::GunScanner::LexerInput(char* buf, int max_size)
1689{
1690    buf[0] = m_input[0];
1691    if (buf[0])
1692        ++m_input;
1693    return buf[0] ? 1 : 0;
1694}
1695
1696#ifdef yylex
1697#undef yylex
1698#endif
1699int GunFlexLexer::yylex()
1700{
1701    std::cerr << "in GunFlexLexer::yylex() !" << std::endl;
1702    return 0;
1703}
1704
1705int GunFlexLexer::yywrap()
1706{
1707    return 1;
1708}
1709
1710
Note: See TracBrowser for help on using the repository browser.