src/scanner.cc

Go to the documentation of this file.
00001 #line 2 "scanner.cc"
00002 
00003 #line 4 "scanner.cc"
00004 
00005 #define  YY_INT_ALIGNED short int
00006 
00007 /* A lexical scanner generated by flex */
00008 
00009 #define FLEX_SCANNER
00010 #define YY_FLEX_MAJOR_VERSION 2
00011 #define YY_FLEX_MINOR_VERSION 5
00012 #define YY_FLEX_SUBMINOR_VERSION 33
00013 #if YY_FLEX_SUBMINOR_VERSION > 0
00014 #define FLEX_BETA
00015 #endif
00016 
00017 /* %if-c++-only */
00018     /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
00019      * following macro. This is required in order to pass the c++-multiple-scanners
00020      * test in the regression suite. We get reports that it breaks inheritance.
00021      * We will address this in a future release of flex, or omit the C++ scanner
00022      * altogether.
00023      */
00024     #define yyFlexLexer ExampleFlexLexer
00025 /* %endif */
00026 
00027 /* %if-c-only */
00028 /* %endif */
00029 
00030 /* %if-c-only */
00031 /* %endif */
00032 
00033 /* First, we deal with  platform-specific or compiler-specific issues. */
00034 
00035 /* begin standard C headers. */
00036 /* %if-c-only */
00037 /* %endif */
00038 
00039 /* %if-tables-serialization */
00040 /* %endif */
00041 /* end standard C headers. */
00042 
00043 /* %if-c-or-c++ */
00044 /* flex integer type definitions */
00045 
00046 #ifndef FLEXINT_H
00047 #define FLEXINT_H
00048 
00049 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00050 
00051 #if __STDC_VERSION__ >= 199901L
00052 
00053 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00054  * if you want the limit (max/min) macros for int types. 
00055  */
00056 #ifndef __STDC_LIMIT_MACROS
00057 #define __STDC_LIMIT_MACROS 1
00058 #endif
00059 
00060 #include <inttypes.h>
00061 typedef int8_t flex_int8_t;
00062 typedef uint8_t flex_uint8_t;
00063 typedef int16_t flex_int16_t;
00064 typedef uint16_t flex_uint16_t;
00065 typedef int32_t flex_int32_t;
00066 typedef uint32_t flex_uint32_t;
00067 #else
00068 typedef signed char flex_int8_t;
00069 typedef short int flex_int16_t;
00070 typedef int flex_int32_t;
00071 typedef unsigned char flex_uint8_t; 
00072 typedef unsigned short int flex_uint16_t;
00073 typedef unsigned int flex_uint32_t;
00074 #endif /* ! C99 */
00075 
00076 /* Limits of integral types. */
00077 #ifndef INT8_MIN
00078 #define INT8_MIN               (-128)
00079 #endif
00080 #ifndef INT16_MIN
00081 #define INT16_MIN              (-32767-1)
00082 #endif
00083 #ifndef INT32_MIN
00084 #define INT32_MIN              (-2147483647-1)
00085 #endif
00086 #ifndef INT8_MAX
00087 #define INT8_MAX               (127)
00088 #endif
00089 #ifndef INT16_MAX
00090 #define INT16_MAX              (32767)
00091 #endif
00092 #ifndef INT32_MAX
00093 #define INT32_MAX              (2147483647)
00094 #endif
00095 #ifndef UINT8_MAX
00096 #define UINT8_MAX              (255U)
00097 #endif
00098 #ifndef UINT16_MAX
00099 #define UINT16_MAX             (65535U)
00100 #endif
00101 #ifndef UINT32_MAX
00102 #define UINT32_MAX             (4294967295U)
00103 #endif
00104 
00105 #endif /* ! FLEXINT_H */
00106 
00107 /* %endif */
00108 
00109 /* %if-c++-only */
00110 /* begin standard C++ headers. */
00111 #include <iostream> 
00112 #include <errno.h>
00113 #include <cstdlib>
00114 #include <cstring>
00115 /* end standard C++ headers. */
00116 /* %endif */
00117 
00118 #ifdef __cplusplus
00119 
00120 /* The "const" storage-class-modifier is valid. */
00121 #define YY_USE_CONST
00122 
00123 #else   /* ! __cplusplus */
00124 
00125 #if __STDC__
00126 
00127 #define YY_USE_CONST
00128 
00129 #endif  /* __STDC__ */
00130 #endif  /* ! __cplusplus */
00131 
00132 #ifdef YY_USE_CONST
00133 #define yyconst const
00134 #else
00135 #define yyconst
00136 #endif
00137 
00138 /* %not-for-header */
00139 
00140 /* Returned upon end-of-file. */
00141 #define YY_NULL 0
00142 /* %ok-for-header */
00143 
00144 /* %not-for-header */
00145 
00146 /* Promotes a possibly negative, possibly signed char to an unsigned
00147  * integer for use as an array index.  If the signed char is negative,
00148  * we want to instead treat it as an 8-bit unsigned char, hence the
00149  * double cast.
00150  */
00151 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00152 /* %ok-for-header */
00153 
00154 /* %if-reentrant */
00155 /* %endif */
00156 
00157 /* %if-not-reentrant */
00158 
00159 /* %endif */
00160 
00161 /* Enter a start condition.  This macro really ought to take a parameter,
00162  * but we do it the disgusting crufty way forced on us by the ()-less
00163  * definition of BEGIN.
00164  */
00165 #define BEGIN (yy_start) = 1 + 2 *
00166 
00167 /* Translate the current start state into a value that can be later handed
00168  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00169  * compatibility.
00170  */
00171 #define YY_START (((yy_start) - 1) / 2)
00172 #define YYSTATE YY_START
00173 
00174 /* Action number for EOF rule of a given start state. */
00175 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00176 
00177 /* Special action meaning "start processing a new file". */
00178 #define YY_NEW_FILE yyrestart( yyin  )
00179 
00180 #define YY_END_OF_BUFFER_CHAR 0
00181 
00182 /* Size of default input buffer. */
00183 #ifndef YY_BUF_SIZE
00184 #define YY_BUF_SIZE 16384
00185 #endif
00186 
00187 /* The state buf must be large enough to hold one state per character in the main buffer.
00188  */
00189 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00190 
00191 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00192 #define YY_TYPEDEF_YY_BUFFER_STATE
00193 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00194 #endif
00195 
00196 /* %if-not-reentrant */
00197 extern int yyleng;
00198 /* %endif */
00199 
00200 /* %if-c-only */
00201 /* %if-not-reentrant */
00202 /* %endif */
00203 /* %endif */
00204 
00205 #define EOB_ACT_CONTINUE_SCAN 0
00206 #define EOB_ACT_END_OF_FILE 1
00207 #define EOB_ACT_LAST_MATCH 2
00208 
00209     #define YY_LESS_LINENO(n)
00210     
00211 /* Return all but the first "n" matched characters back to the input stream. */
00212 #define yyless(n) \
00213         do \
00214                 { \
00215                 /* Undo effects of setting up yytext. */ \
00216         int yyless_macro_arg = (n); \
00217         YY_LESS_LINENO(yyless_macro_arg);\
00218                 *yy_cp = (yy_hold_char); \
00219                 YY_RESTORE_YY_MORE_OFFSET \
00220                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00221                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00222                 } \
00223         while ( 0 )
00224 
00225 #define unput(c) yyunput( c, (yytext_ptr)  )
00226 
00227 /* The following is because we cannot portably get our hands on size_t
00228  * (without autoconf's help, which isn't available because we want
00229  * flex-generated scanners to compile on their own).
00230  */
00231 
00232 #ifndef YY_TYPEDEF_YY_SIZE_T
00233 #define YY_TYPEDEF_YY_SIZE_T
00234 typedef unsigned int yy_size_t;
00235 #endif
00236 
00237 #ifndef YY_STRUCT_YY_BUFFER_STATE
00238 #define YY_STRUCT_YY_BUFFER_STATE
00239 struct yy_buffer_state
00240         {
00241 /* %if-c-only */
00242 /* %endif */
00243 
00244 /* %if-c++-only */
00245         std::istream* yy_input_file;
00246 /* %endif */
00247 
00248         char *yy_ch_buf;                /* input buffer */
00249         char *yy_buf_pos;               /* current position in input buffer */
00250 
00251         /* Size of input buffer in bytes, not including room for EOB
00252          * characters.
00253          */
00254         yy_size_t yy_buf_size;
00255 
00256         /* Number of characters read into yy_ch_buf, not including EOB
00257          * characters.
00258          */
00259         int yy_n_chars;
00260 
00261         /* Whether we "own" the buffer - i.e., we know we created it,
00262          * and can realloc() it to grow it, and should free() it to
00263          * delete it.
00264          */
00265         int yy_is_our_buffer;
00266 
00267         /* Whether this is an "interactive" input source; if so, and
00268          * if we're using stdio for input, then we want to use getc()
00269          * instead of fread(), to make sure we stop fetching input after
00270          * each newline.
00271          */
00272         int yy_is_interactive;
00273 
00274         /* Whether we're considered to be at the beginning of a line.
00275          * If so, '^' rules will be active on the next match, otherwise
00276          * not.
00277          */
00278         int yy_at_bol;
00279 
00280     int yy_bs_lineno; 
00281     int yy_bs_column; 
00283         /* Whether to try to fill the input buffer when we reach the
00284          * end of it.
00285          */
00286         int yy_fill_buffer;
00287 
00288         int yy_buffer_status;
00289 
00290 #define YY_BUFFER_NEW 0
00291 #define YY_BUFFER_NORMAL 1
00292         /* When an EOF's been seen but there's still some text to process
00293          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00294          * shouldn't try reading from the input source any more.  We might
00295          * still have a bunch of tokens to match, though, because of
00296          * possible backing-up.
00297          *
00298          * When we actually see the EOF, we change the status to "new"
00299          * (via yyrestart()), so that the user can continue scanning by
00300          * just pointing yyin at a new input file.
00301          */
00302 #define YY_BUFFER_EOF_PENDING 2
00303 
00304         };
00305 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00306 
00307 /* %if-c-only Standard (non-C++) definition */
00308 /* %not-for-header */
00309 
00310 /* %if-not-reentrant */
00311 /* %endif */
00312 /* %ok-for-header */
00313 
00314 /* %endif */
00315 
00316 /* We provide macros for accessing buffer states in case in the
00317  * future we want to put the buffer states in a more general
00318  * "scanner state".
00319  *
00320  * Returns the top of the stack, or NULL.
00321  */
00322 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00323                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00324                           : NULL)
00325 
00326 /* Same as previous macro, but useful when we know that the buffer stack is not
00327  * NULL or when we need an lvalue. For internal use only.
00328  */
00329 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00330 
00331 /* %if-c-only Standard (non-C++) definition */
00332 /* %if-not-reentrant */
00333 /* %not-for-header */
00334 
00335 /* %ok-for-header */
00336 
00337 /* %endif */
00338 /* %endif */
00339 
00340 void *Examplealloc (yy_size_t  );
00341 void *Examplerealloc (void *,yy_size_t  );
00342 void Examplefree (void *  );
00343 
00344 #define yy_new_buffer yy_create_buffer
00345 
00346 #define yy_set_interactive(is_interactive) \
00347         { \
00348         if ( ! YY_CURRENT_BUFFER ){ \
00349         yyensure_buffer_stack (); \
00350                 YY_CURRENT_BUFFER_LVALUE =    \
00351             yy_create_buffer( yyin, YY_BUF_SIZE ); \
00352         } \
00353         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00354         }
00355 
00356 #define yy_set_bol(at_bol) \
00357         { \
00358         if ( ! YY_CURRENT_BUFFER ){\
00359         yyensure_buffer_stack (); \
00360                 YY_CURRENT_BUFFER_LVALUE =    \
00361             yy_create_buffer( yyin, YY_BUF_SIZE ); \
00362         } \
00363         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00364         }
00365 
00366 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00367 
00368 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
00369 /* Begin user sect3 */
00370 
00371 #define yywrap(n) 1
00372 #define YY_SKIP_YYWRAP
00373 
00374 #define FLEX_DEBUG
00375 
00376 typedef unsigned char YY_CHAR;
00377 
00378 #define yytext_ptr yytext
00379 
00380 #include <FlexLexer.h>
00381 
00382 /* %if-c-only Standard (non-C++) definition */
00383 /* %endif */
00384 
00385 /* Done after the current pattern has been matched and before the
00386  * corresponding action - sets up yytext.
00387  */
00388 #define YY_DO_BEFORE_ACTION \
00389         (yytext_ptr) = yy_bp; \
00390 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
00391         yyleng = (size_t) (yy_cp - yy_bp); \
00392         (yy_hold_char) = *yy_cp; \
00393         *yy_cp = '\0'; \
00394 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
00395         (yy_c_buf_p) = yy_cp;
00396 
00397 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
00398 #define YY_NUM_RULES 7
00399 #define YY_END_OF_BUFFER 8
00400 /* This struct is not used in this scanner,
00401    but its presence is necessary. */
00402 struct yy_trans_info
00403         {
00404         flex_int32_t yy_verify;
00405         flex_int32_t yy_nxt;
00406         };
00407 static yyconst flex_int16_t yy_accept[15] =
00408     {   0,
00409         0,    0,    8,    6,    4,    5,    1,    3,    4,    2,
00410         1,    3,    2,    0
00411     } ;
00412 
00413 static yyconst flex_int32_t yy_ec[256] =
00414     {   0,
00415         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00416         1,    1,    2,    1,    1,    1,    1,    1,    1,    1,
00417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00418         1,    2,    1,    1,    1,    1,    1,    1,    1,    1,
00419         1,    1,    1,    4,    4,    5,    1,    6,    6,    6,
00420         6,    6,    6,    6,    6,    6,    6,    1,    1,    1,
00421         1,    1,    1,    1,    7,    7,    7,    7,    7,    7,
00422         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00423         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00424         1,    1,    1,    1,    4,    1,    7,    7,    7,    7,
00425 
00426         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00427         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00428         7,    7,    1,    1,    1,    1,    1,    1,    1,    1,
00429         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00430         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00431         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00432         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00433         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00434         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00435         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00436 
00437         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00438         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00439         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00440         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00441         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00442         1,    1,    1,    1,    1
00443     } ;
00444 
00445 static yyconst flex_int32_t yy_meta[8] =
00446     {   0,
00447         1,    1,    1,    2,    2,    2,    2
00448     } ;
00449 
00450 static yyconst flex_int16_t yy_base[16] =
00451     {   0,
00452         0,    0,   15,   16,   12,   16,    3,    0,   11,    6,
00453         0,    0,    5,   16,    8
00454     } ;
00455 
00456 static yyconst flex_int16_t yy_def[16] =
00457     {   0,
00458        14,    1,   14,   14,   14,   14,   14,   15,   14,   14,
00459         7,   15,   14,    0,   14
00460     } ;
00461 
00462 static yyconst flex_int16_t yy_nxt[24] =
00463     {   0,
00464         4,    5,    6,    4,    4,    7,    8,   10,   11,   12,
00465        13,   13,    9,    9,   14,    3,   14,   14,   14,   14,
00466        14,   14,   14
00467     } ;
00468 
00469 static yyconst flex_int16_t yy_chk[24] =
00470     {   0,
00471         1,    1,    1,    1,    1,    1,    1,    7,    7,   15,
00472        13,   10,    9,    5,    3,   14,   14,   14,   14,   14,
00473        14,   14,   14
00474     } ;
00475 
00476 static yyconst flex_int16_t yy_rule_linenum[7] =
00477     {   0,
00478        71,   76,   81,   87,   92,   98
00479     } ;
00480 
00481 /* The intent behind this definition is that it'll catch
00482  * any uses of REJECT which flex missed.
00483  */
00484 #define REJECT reject_used_but_not_detected
00485 #define yymore() yymore_used_but_not_detected
00486 #define YY_MORE_ADJ 0
00487 #define YY_RESTORE_YY_MORE_OFFSET
00488 #line 1 "scanner.ll"
00489 /* $Id: scanner.cc 30 2007-08-20 11:15:18Z tb $ -*- mode: c++ -*- */
00491 #line 5 "scanner.ll"
00492 
00493 #include <string>
00494 
00495 #include "parser.h"
00496 #include "scanner.h"
00497 
00498 /* import the parser's token type into a local typedef */
00499 typedef example::Parser::token token;
00500 typedef example::Parser::token_type token_type;
00501 
00502 /* Work around an incompatibility in flex (at least versions 2.5.31 through
00503  * 2.5.33): it generates code that does not conform to C89.  See Debian bug
00504  * 333231 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.  */
00505 #undef yywrap
00506 #define yywrap()        1
00507 
00508 /* By default yylex returns int, we use token_type. Unfortunately yyterminate
00509  * by default returns 0, which is not of token_type. */
00510 #define yyterminate() return token::END
00511 
00512 /* This disables inclusion of unistd.h, which is not available under Visual C++
00513  * on Win32. The C++ scanner uses STL streams instead. */
00514 #define YY_NO_UNISTD_H
00515 
00516 /*** Flex Declarations and Options ***/
00517 /* enable c++ scanner class generation */
00518 /* change the name of the scanner class. results in "ExampleFlexLexer" */
00519 /* the manual says "somewhat more optimized" */
00520 /* enable scanner to generate debug output. disable this for release
00521  * versions. */
00522 /* no support for include files is planned */
00523 /* enables the use of start condition stacks */
00524 /* The following paragraph suffices to track locations accurately. Each time
00525  * yylex is invoked, the begin position is moved onto the end position. */
00526 #line 55 "scanner.ll"
00527 #define YY_USER_ACTION  yylloc->columns(yyleng);
00528 #line 529 "scanner.cc"
00529 
00530 #define INITIAL 0
00531 
00532 #ifndef YY_NO_UNISTD_H
00533 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00534  * down here because we want the user's section 1 to have been scanned first.
00535  * The user has a chance to override it with an option.
00536  */
00537 /* %if-c-only */
00538 /* %endif */
00539 /* %if-c++-only */
00540 #include <unistd.h>
00541 /* %endif */
00542 #endif
00543 
00544 #ifndef YY_EXTRA_TYPE
00545 #define YY_EXTRA_TYPE void *
00546 #endif
00547 
00548 /* %if-c-only Reentrant structure and macros (non-C++). */
00549 /* %if-reentrant */
00550 /* %if-c-only */
00551 /* %endif */
00552 /* %if-reentrant */
00553 /* %endif */
00554 /* %if-bison-bridge */
00555 /* %endif */
00556 /* %endif End reentrant structures and macros. */
00557 /* %not-for-header */
00558 
00559 /* %ok-for-header */
00560 
00561 /* %endif */
00562 
00563 #ifndef yytext_ptr
00564 static void yy_flex_strncpy (char *,yyconst char *,int );
00565 #endif
00566 
00567 #ifdef YY_NEED_STRLEN
00568 static int yy_flex_strlen (yyconst char * );
00569 #endif
00570 
00571 #ifndef YY_NO_INPUT
00572 /* %if-c-only Standard (non-C++) definition */
00573 /* %not-for-header */
00574 
00575 /* %ok-for-header */
00576 
00577 /* %endif */
00578 #endif
00579 
00580 /* %if-c-only */
00581 /* %endif */
00582 
00583 /* Amount of stuff to slurp up with each read. */
00584 #ifndef YY_READ_BUF_SIZE
00585 #define YY_READ_BUF_SIZE 8192
00586 #endif
00587 
00588 /* Copy whatever the last rule matched to the standard output. */
00589 #ifndef ECHO
00590 /* %if-c-only Standard (non-C++) definition */
00591 /* %endif */
00592 /* %if-c++-only C++ definition */
00593 #define ECHO LexerOutput( yytext, yyleng )
00594 /* %endif */
00595 #endif
00596 
00597 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00598  * is returned in "result".
00599  */
00600 #ifndef YY_INPUT
00601 #define YY_INPUT(buf,result,max_size) \
00602 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
00603 \
00604 /* %if-c++-only C++ definition \ */\
00605         if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
00606                 YY_FATAL_ERROR( "input in flex scanner failed" );
00607 /* %endif */
00608 
00609 #endif
00610 
00611 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00612  * we don't want an extra ';' after the "return" because that will cause
00613  * some compilers to complain about unreachable statements.
00614  */
00615 #ifndef yyterminate
00616 #define yyterminate() return YY_NULL
00617 #endif
00618 
00619 /* Number of entries by which start-condition stack grows. */
00620 #ifndef YY_START_STACK_INCR
00621 #define YY_START_STACK_INCR 25
00622 #endif
00623 
00624 /* Report a fatal error. */
00625 #ifndef YY_FATAL_ERROR
00626 /* %if-c-only */
00627 /* %endif */
00628 /* %if-c++-only */
00629 #define YY_FATAL_ERROR(msg) LexerError( msg )
00630 /* %endif */
00631 #endif
00632 
00633 /* %if-tables-serialization structures and prototypes */
00634 /* %not-for-header */
00635 
00636 /* %ok-for-header */
00637 
00638 /* %not-for-header */
00639 
00640 /* %tables-yydmap generated elements */
00641 /* %endif */
00642 /* end tables serialization structures and prototypes */
00643 
00644 /* %ok-for-header */
00645 
00646 /* Default declaration of generated scanner - a define so the user can
00647  * easily add parameters.
00648  */
00649 #ifndef YY_DECL
00650 #define YY_DECL_IS_OURS 1
00651 /* %if-c-only Standard (non-C++) definition */
00652 /* %endif */
00653 /* %if-c++-only C++ definition */
00654 #define YY_DECL int yyFlexLexer::yylex()
00655 /* %endif */
00656 #endif /* !YY_DECL */
00657 
00658 /* Code executed at the beginning of each rule, after yytext and yyleng
00659  * have been set up.
00660  */
00661 #ifndef YY_USER_ACTION
00662 #define YY_USER_ACTION
00663 #endif
00664 
00665 /* Code executed at the end of each rule. */
00666 #ifndef YY_BREAK
00667 #define YY_BREAK break;
00668 #endif
00669 
00670 /* %% [6.0] YY_RULE_SETUP definition goes here */
00671 #define YY_RULE_SETUP \
00672         YY_USER_ACTION
00673 
00674 /* %not-for-header */
00675 
00678 YY_DECL
00679 {
00680         register yy_state_type yy_current_state;
00681         register char *yy_cp, *yy_bp;
00682         register int yy_act;
00683     
00684 /* %% [7.0] user's declarations go here */
00685 #line 58 "scanner.ll"
00686 
00687 
00688  /* code to place at the beginning of yylex() */
00689 
00690     // reset location
00691     yylloc->step();
00692 
00693     // variable for quoted strings
00694     std::string quotedstring;
00695 
00696 
00697  /*** BEGIN EXAMPLE - Change the example lexer rules below ***/
00698 
00699 #line 700 "scanner.cc"
00700 
00701         if ( !(yy_init) )
00702                 {
00703                 (yy_init) = 1;
00704 
00705 #ifdef YY_USER_INIT
00706                 YY_USER_INIT;
00707 #endif
00708 
00709                 if ( ! (yy_start) )
00710                         (yy_start) = 1; /* first start state */
00711 
00712                 if ( ! yyin )
00713 /* %if-c-only */
00714 /* %endif */
00715 /* %if-c++-only */
00716                         yyin = & std::cin;
00717 /* %endif */
00718 
00719                 if ( ! yyout )
00720 /* %if-c-only */
00721 /* %endif */
00722 /* %if-c++-only */
00723                         yyout = & std::cout;
00724 /* %endif */
00725 
00726                 if ( ! YY_CURRENT_BUFFER ) {
00727                         yyensure_buffer_stack ();
00728                         YY_CURRENT_BUFFER_LVALUE =
00729                                 yy_create_buffer( yyin, YY_BUF_SIZE );
00730                 }
00731 
00732                 yy_load_buffer_state(  );
00733                 }
00734 
00735         while ( 1 )             /* loops until end-of-file is reached */
00736                 {
00737 /* %% [8.0] yymore()-related code goes here */
00738                 yy_cp = (yy_c_buf_p);
00739 
00740                 /* Support of yytext. */
00741                 *yy_cp = (yy_hold_char);
00742 
00743                 /* yy_bp points to the position in yy_ch_buf of the start of
00744                  * the current run.
00745                  */
00746                 yy_bp = yy_cp;
00747 
00748 /* %% [9.0] code to set up and find next match goes here */
00749                 yy_current_state = (yy_start);
00750 yy_match:
00751                 do
00752                         {
00753                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00754                         if ( yy_accept[yy_current_state] )
00755                                 {
00756                                 (yy_last_accepting_state) = yy_current_state;
00757                                 (yy_last_accepting_cpos) = yy_cp;
00758                                 }
00759                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00760                                 {
00761                                 yy_current_state = (int) yy_def[yy_current_state];
00762                                 if ( yy_current_state >= 15 )
00763                                         yy_c = yy_meta[(unsigned int) yy_c];
00764                                 }
00765                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00766                         ++yy_cp;
00767                         }
00768                 while ( yy_current_state != 14 );
00769                 yy_cp = (yy_last_accepting_cpos);
00770                 yy_current_state = (yy_last_accepting_state);
00771 
00772 yy_find_action:
00773 /* %% [10.0] code to find the action number goes here */
00774                 yy_act = yy_accept[yy_current_state];
00775 
00776                 YY_DO_BEFORE_ACTION;
00777 
00778 /* %% [11.0] code for yylineno update goes here */
00779 
00780 do_action:      /* This label is used only to access EOF actions. */
00781 
00782 /* %% [12.0] debug code goes here */
00783                 if ( yy_flex_debug )
00784                         {
00785                         if ( yy_act == 0 )
00786                                 std::cerr << "--scanner backing up\n";
00787                         else if ( yy_act < 7 )
00788                                 std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
00789                                          "(\"" << yytext << "\")\n";
00790                         else if ( yy_act == 7 )
00791                                 std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
00792                         else if ( yy_act == 8 )
00793                                 std::cerr << "--(end of buffer or a NUL)\n";
00794                         else
00795                                 std::cerr << "--EOF (start condition " << YY_START << ")\n";
00796                         }
00797 
00798                 switch ( yy_act )
00799         { /* beginning of action switch */
00800 /* %% [13.0] actions go here */
00801                         case 0: /* must back up */
00802                         /* undo the effects of YY_DO_BEFORE_ACTION */
00803                         *yy_cp = (yy_hold_char);
00804                         yy_cp = (yy_last_accepting_cpos);
00805                         yy_current_state = (yy_last_accepting_state);
00806                         goto yy_find_action;
00807 
00808 case 1:
00809 YY_RULE_SETUP
00810 #line 71 "scanner.ll"
00811 {
00812     yylval->integerVal = atoi(yytext);
00813     return token::INTEGER;
00814 }
00815         YY_BREAK
00816 case 2:
00817 YY_RULE_SETUP
00818 #line 76 "scanner.ll"
00819 {
00820     yylval->doubleVal = atof(yytext);
00821     return token::DOUBLE;
00822 }
00823         YY_BREAK
00824 case 3:
00825 YY_RULE_SETUP
00826 #line 81 "scanner.ll"
00827 {
00828     yylval->stringVal = new std::string(yytext, yyleng);
00829     return token::STRING;
00830 }
00831         YY_BREAK
00832 /* gobble up white-spaces */
00833 case 4:
00834 YY_RULE_SETUP
00835 #line 87 "scanner.ll"
00836 {
00837     yylloc->step();
00838 }
00839         YY_BREAK
00840 /* gobble up end-of-lines */
00841 case 5:
00842 /* rule 5 can match eol */
00843 YY_RULE_SETUP
00844 #line 92 "scanner.ll"
00845 {
00846     yylloc->lines(yyleng); yylloc->step();
00847     return token::EOL;
00848 }
00849         YY_BREAK
00850 /* pass all other characters up to bison */
00851 case 6:
00852 YY_RULE_SETUP
00853 #line 98 "scanner.ll"
00854 {
00855     return static_cast<token_type>(*yytext);
00856 }
00857         YY_BREAK
00858 /*** END EXAMPLE - Change the example lexer rules above ***/
00859 case 7:
00860 YY_RULE_SETUP
00861 #line 104 "scanner.ll"
00862 ECHO;
00863         YY_BREAK
00864 #line 865 "scanner.cc"
00865 case YY_STATE_EOF(INITIAL):
00866         yyterminate();
00867 
00868         case YY_END_OF_BUFFER:
00869                 {
00870                 /* Amount of text matched not including the EOB char. */
00871                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
00872 
00873                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
00874                 *yy_cp = (yy_hold_char);
00875                 YY_RESTORE_YY_MORE_OFFSET
00876 
00877                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
00878                         {
00879                         /* We're scanning a new file or input source.  It's
00880                          * possible that this happened because the user
00881                          * just pointed yyin at a new source and called
00882                          * yylex().  If so, then we have to assure
00883                          * consistency between YY_CURRENT_BUFFER and our
00884                          * globals.  Here is the right place to do so, because
00885                          * this is the first action (other than possibly a
00886                          * back-up) that will match for the new input source.
00887                          */
00888                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
00889                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
00890                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
00891                         }
00892 
00893                 /* Note that here we test for yy_c_buf_p "<=" to the position
00894                  * of the first EOB in the buffer, since yy_c_buf_p will
00895                  * already have been incremented past the NUL character
00896                  * (since all states make transitions on EOB to the
00897                  * end-of-buffer state).  Contrast this with the test
00898                  * in input().
00899                  */
00900                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
00901                         { /* This was really a NUL. */
00902                         yy_state_type yy_next_state;
00903 
00904                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
00905 
00906                         yy_current_state = yy_get_previous_state(  );
00907 
00908                         /* Okay, we're now positioned to make the NUL
00909                          * transition.  We couldn't have
00910                          * yy_get_previous_state() go ahead and do it
00911                          * for us because it doesn't know how to deal
00912                          * with the possibility of jamming (and we don't
00913                          * want to build jamming into it because then it
00914                          * will run more slowly).
00915                          */
00916 
00917                         yy_next_state = yy_try_NUL_trans( yy_current_state );
00918 
00919                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00920 
00921                         if ( yy_next_state )
00922                                 {
00923                                 /* Consume the NUL. */
00924                                 yy_cp = ++(yy_c_buf_p);
00925                                 yy_current_state = yy_next_state;
00926                                 goto yy_match;
00927                                 }
00928 
00929                         else
00930                                 {
00931 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
00932                                 yy_cp = (yy_last_accepting_cpos);
00933                                 yy_current_state = (yy_last_accepting_state);
00934                                 goto yy_find_action;
00935                                 }
00936                         }
00937 
00938                 else switch ( yy_get_next_buffer(  ) )
00939                         {
00940                         case EOB_ACT_END_OF_FILE:
00941                                 {
00942                                 (yy_did_buffer_switch_on_eof) = 0;
00943 
00944                                 if ( yywrap(  ) )
00945                                         {
00946                                         /* Note: because we've taken care in
00947                                          * yy_get_next_buffer() to have set up
00948                                          * yytext, we can now set up
00949                                          * yy_c_buf_p so that if some total
00950                                          * hoser (like flex itself) wants to
00951                                          * call the scanner after we return the
00952                                          * YY_NULL, it'll still work - another
00953                                          * YY_NULL will get returned.
00954                                          */
00955                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
00956 
00957                                         yy_act = YY_STATE_EOF(YY_START);
00958                                         goto do_action;
00959                                         }
00960 
00961                                 else
00962                                         {
00963                                         if ( ! (yy_did_buffer_switch_on_eof) )
00964                                                 YY_NEW_FILE;
00965                                         }
00966                                 break;
00967                                 }
00968 
00969                         case EOB_ACT_CONTINUE_SCAN:
00970                                 (yy_c_buf_p) =
00971                                         (yytext_ptr) + yy_amount_of_matched_text;
00972 
00973                                 yy_current_state = yy_get_previous_state(  );
00974 
00975                                 yy_cp = (yy_c_buf_p);
00976                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00977                                 goto yy_match;
00978 
00979                         case EOB_ACT_LAST_MATCH:
00980                                 (yy_c_buf_p) =
00981                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
00982 
00983                                 yy_current_state = yy_get_previous_state(  );
00984 
00985                                 yy_cp = (yy_c_buf_p);
00986                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00987                                 goto yy_find_action;
00988                         }
00989                 break;
00990                 }
00991 
00992         default:
00993                 YY_FATAL_ERROR(
00994                         "fatal flex scanner internal error--no action found" );
00995         } /* end of action switch */
00996                 } /* end of scanning one token */
00997 } /* end of yylex */
00998 /* %ok-for-header */
00999 
01000 /* %if-c++-only */
01001 /* %not-for-header */
01002 
01003 yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
01004 {
01005         yyin = arg_yyin;
01006         yyout = arg_yyout;
01007         yy_c_buf_p = 0;
01008         yy_init = 0;
01009         yy_start = 0;
01010         yy_flex_debug = 0;
01011         yylineno = 1;   // this will only get updated if %option yylineno
01012 
01013         yy_did_buffer_switch_on_eof = 0;
01014 
01015         yy_looking_for_trail_begin = 0;
01016         yy_more_flag = 0;
01017         yy_more_len = 0;
01018         yy_more_offset = yy_prev_more_offset = 0;
01019 
01020         yy_start_stack_ptr = yy_start_stack_depth = 0;
01021         yy_start_stack = NULL;
01022 
01023     (yy_buffer_stack) = 0;
01024     (yy_buffer_stack_top) = 0;
01025     (yy_buffer_stack_max) = 0;
01026 
01027         yy_state_buf = 0;
01028 
01029 }
01030 
01031 yyFlexLexer::~yyFlexLexer()
01032 {
01033         delete [] yy_state_buf;
01034         Examplefree(yy_start_stack  );
01035         yy_delete_buffer( YY_CURRENT_BUFFER );
01036 }
01037 
01038 void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
01039 {
01040         if ( new_in )
01041                 {
01042                 yy_delete_buffer( YY_CURRENT_BUFFER );
01043                 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  ) );
01044                 }
01045 
01046         if ( new_out )
01047                 yyout = new_out;
01048 }
01049 
01050 #ifdef YY_INTERACTIVE
01051 int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
01052 #else
01053 int yyFlexLexer::LexerInput( char* buf, int max_size )
01054 #endif
01055 {
01056         if ( yyin->eof() || yyin->fail() )
01057                 return 0;
01058 
01059 #ifdef YY_INTERACTIVE
01060         yyin->get( buf[0] );
01061 
01062         if ( yyin->eof() )
01063                 return 0;
01064 
01065         if ( yyin->bad() )
01066                 return -1;
01067 
01068         return 1;
01069 
01070 #else
01071         (void) yyin->read( buf, max_size );
01072 
01073         if ( yyin->bad() )
01074                 return -1;
01075         else
01076                 return yyin->gcount();
01077 #endif
01078 }
01079 
01080 void yyFlexLexer::LexerOutput( const char* buf, int size )
01081 {
01082         (void) yyout->write( buf, size );
01083 }
01084 /* %ok-for-header */
01085 
01086 /* %endif */
01087 
01088 /* yy_get_next_buffer - try to read in a new buffer
01089  *
01090  * Returns a code representing an action:
01091  *      EOB_ACT_LAST_MATCH -
01092  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01093  *      EOB_ACT_END_OF_FILE - end of file
01094  */
01095 /* %if-c-only */
01096 /* %endif */
01097 /* %if-c++-only */
01098 int yyFlexLexer::yy_get_next_buffer()
01099 /* %endif */
01100 {
01101         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01102         register char *source = (yytext_ptr);
01103         register int number_to_move, i;
01104         int ret_val;
01105 
01106         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
01107                 YY_FATAL_ERROR(
01108                 "fatal flex scanner internal error--end of buffer missed" );
01109 
01110         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01111                 { /* Don't try to fill the buffer, so this is an EOF. */
01112                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
01113                         {
01114                         /* We matched a single character, the EOB, so
01115                          * treat this as a final EOF.
01116                          */
01117                         return EOB_ACT_END_OF_FILE;
01118                         }
01119 
01120                 else
01121                         {
01122                         /* We matched some text prior to the EOB, first
01123                          * process it.
01124                          */
01125                         return EOB_ACT_LAST_MATCH;
01126                         }
01127                 }
01128 
01129         /* Try to read more data. */
01130 
01131         /* First move last chars to start of buffer. */
01132         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
01133 
01134         for ( i = 0; i < number_to_move; ++i )
01135                 *(dest++) = *(source++);
01136 
01137         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01138                 /* don't do the read, it's not guaranteed to return an EOF,
01139                  * just force an EOF
01140                  */
01141                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
01142 
01143         else
01144                 {
01145                         int num_to_read =
01146                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01147 
01148                 while ( num_to_read <= 0 )
01149                         { /* Not enough room in the buffer - grow it. */
01150 
01151                         /* just a shorter name for the current buffer */
01152                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01153 
01154                         int yy_c_buf_p_offset =
01155                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
01156 
01157                         if ( b->yy_is_our_buffer )
01158                                 {
01159                                 int new_size = b->yy_buf_size * 2;
01160 
01161                                 if ( new_size <= 0 )
01162                                         b->yy_buf_size += b->yy_buf_size / 8;
01163                                 else
01164                                         b->yy_buf_size *= 2;
01165 
01166                                 b->yy_ch_buf = (char *)
01167                                         /* Include room in for 2 EOB chars. */
01168                                         Examplerealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
01169                                 }
01170                         else
01171                                 /* Can't grow it, we don't own it. */
01172                                 b->yy_ch_buf = 0;
01173 
01174                         if ( ! b->yy_ch_buf )
01175                                 YY_FATAL_ERROR(
01176                                 "fatal error - scanner input buffer overflow" );
01177 
01178                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
01179 
01180                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01181                                                 number_to_move - 1;
01182 
01183                         }
01184 
01185                 if ( num_to_read > YY_READ_BUF_SIZE )
01186                         num_to_read = YY_READ_BUF_SIZE;
01187 
01188                 /* Read in more data. */
01189                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01190                         (yy_n_chars), num_to_read );
01191 
01192                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01193                 }
01194 
01195         if ( (yy_n_chars) == 0 )
01196                 {
01197                 if ( number_to_move == YY_MORE_ADJ )
01198                         {
01199                         ret_val = EOB_ACT_END_OF_FILE;
01200                         yyrestart( yyin  );
01201                         }
01202 
01203                 else
01204                         {
01205                         ret_val = EOB_ACT_LAST_MATCH;
01206                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01207                                 YY_BUFFER_EOF_PENDING;
01208                         }
01209                 }
01210 
01211         else
01212                 ret_val = EOB_ACT_CONTINUE_SCAN;
01213 
01214         (yy_n_chars) += number_to_move;
01215         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01216         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01217 
01218         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01219 
01220         return ret_val;
01221 }
01222 
01223 /* yy_get_previous_state - get the state just before the EOB char was reached */
01224 
01225 /* %if-c-only */
01226 /* %not-for-header */
01227 
01228 /* %endif */
01229 /* %if-c++-only */
01230     yy_state_type yyFlexLexer::yy_get_previous_state()
01231 /* %endif */
01232 {
01233         register yy_state_type yy_current_state;
01234         register char *yy_cp;
01235     
01236 /* %% [15.0] code to get the start state into yy_current_state goes here */
01237         yy_current_state = (yy_start);
01238 
01239         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01240                 {
01241 /* %% [16.0] code to find the next state goes here */
01242                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01243                 if ( yy_accept[yy_current_state] )
01244                         {
01245                         (yy_last_accepting_state) = yy_current_state;
01246                         (yy_last_accepting_cpos) = yy_cp;
01247                         }
01248                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01249                         {
01250                         yy_current_state = (int) yy_def[yy_current_state];
01251                         if ( yy_current_state >= 15 )
01252                                 yy_c = yy_meta[(unsigned int) yy_c];
01253                         }
01254                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01255                 }
01256 
01257         return yy_current_state;
01258 }
01259 
01260 /* yy_try_NUL_trans - try to make a transition on the NUL character
01261  *
01262  * synopsis
01263  *      next_state = yy_try_NUL_trans( current_state );
01264  */
01265 /* %if-c-only */
01266 /* %endif */
01267 /* %if-c++-only */
01268     yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
01269 /* %endif */
01270 {
01271         register int yy_is_jam;
01272     /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
01273         register char *yy_cp = (yy_c_buf_p);
01274 
01275         register YY_CHAR yy_c = 1;
01276         if ( yy_accept[yy_current_state] )
01277                 {
01278                 (yy_last_accepting_state) = yy_current_state;
01279                 (yy_last_accepting_cpos) = yy_cp;
01280                 }
01281         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01282                 {
01283                 yy_current_state = (int) yy_def[yy_current_state];
01284                 if ( yy_current_state >= 15 )
01285                         yy_c = yy_meta[(unsigned int) yy_c];
01286                 }
01287         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01288         yy_is_jam = (yy_current_state == 14);
01289 
01290         return yy_is_jam ? 0 : yy_current_state;
01291 }
01292 
01293 /* %if-c-only */
01294 /* %endif */
01295 /* %if-c++-only */
01296     void yyFlexLexer::yyunput( int c, register char* yy_bp)
01297 /* %endif */
01298 {
01299         register char *yy_cp;
01300     
01301     yy_cp = (yy_c_buf_p);
01302 
01303         /* undo effects of setting up yytext */
01304         *yy_cp = (yy_hold_char);
01305 
01306         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01307                 { /* need to shift things up to make room */
01308                 /* +2 for EOB chars. */
01309                 register int number_to_move = (yy_n_chars) + 2;
01310                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01311                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01312                 register char *source =
01313                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01314 
01315                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01316                         *--dest = *--source;
01317 
01318                 yy_cp += (int) (dest - source);
01319                 yy_bp += (int) (dest - source);
01320                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01321                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01322 
01323                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01324                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
01325                 }
01326 
01327         *--yy_cp = (char) c;
01328 
01329 /* %% [18.0] update yylineno here */
01330 
01331         (yytext_ptr) = yy_bp;
01332         (yy_hold_char) = *yy_cp;
01333         (yy_c_buf_p) = yy_cp;
01334 }
01335 /* %if-c-only */
01336 /* %endif */
01337 
01338 /* %if-c-only */
01339 /* %endif */
01340 /* %if-c++-only */
01341     int yyFlexLexer::yyinput()
01342 /* %endif */
01343 {
01344         int c;
01345     
01346         *(yy_c_buf_p) = (yy_hold_char);
01347 
01348         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01349                 {
01350                 /* yy_c_buf_p now points to the character we want to return.
01351                  * If this occurs *before* the EOB characters, then it's a
01352                  * valid NUL; if not, then we've hit the end of the buffer.
01353                  */
01354                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01355                         /* This was really a NUL. */
01356                         *(yy_c_buf_p) = '\0';
01357 
01358                 else
01359                         { /* need more input */
01360                         int offset = (yy_c_buf_p) - (yytext_ptr);
01361                         ++(yy_c_buf_p);
01362 
01363                         switch ( yy_get_next_buffer(  ) )
01364                                 {
01365                                 case EOB_ACT_LAST_MATCH:
01366                                         /* This happens because yy_g_n_b()
01367                                          * sees that we've accumulated a
01368                                          * token and flags that we need to
01369                                          * try matching the token before
01370                                          * proceeding.  But for input(),
01371                                          * there's no matching to consider.
01372                                          * So convert the EOB_ACT_LAST_MATCH
01373                                          * to EOB_ACT_END_OF_FILE.
01374                                          */
01375 
01376                                         /* Reset buffer status. */
01377                                         yyrestart( yyin );
01378 
01379                                         /*FALLTHROUGH*/
01380 
01381                                 case EOB_ACT_END_OF_FILE:
01382                                         {
01383                                         if ( yywrap(  ) )
01384                                                 return EOF;
01385 
01386                                         if ( ! (yy_did_buffer_switch_on_eof) )
01387                                                 YY_NEW_FILE;
01388 #ifdef __cplusplus
01389                                         return yyinput();
01390 #else
01391                                         return input();
01392 #endif
01393                                         }
01394 
01395                                 case EOB_ACT_CONTINUE_SCAN:
01396                                         (yy_c_buf_p) = (yytext_ptr) + offset;
01397                                         break;
01398                                 }
01399                         }
01400                 }
01401 
01402         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01403         *(yy_c_buf_p) = '\0';   /* preserve yytext */
01404         (yy_hold_char) = *++(yy_c_buf_p);
01405 
01406 /* %% [19.0] update BOL and yylineno */
01407 
01408         return c;
01409 }
01410 /* %if-c-only */
01411 /* %endif */
01412 
01418 /* %if-c-only */
01419 /* %endif */
01420 /* %if-c++-only */
01421     void yyFlexLexer::yyrestart( std::istream* input_file )
01422 /* %endif */
01423 {
01424     
01425         if ( ! YY_CURRENT_BUFFER ){
01426         yyensure_buffer_stack ();
01427                 YY_CURRENT_BUFFER_LVALUE =
01428             yy_create_buffer( yyin, YY_BUF_SIZE );
01429         }
01430 
01431         yy_init_buffer( YY_CURRENT_BUFFER, input_file );
01432         yy_load_buffer_state(  );
01433 }
01434 
01439 /* %if-c-only */
01440 /* %endif */
01441 /* %if-c++-only */
01442     void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
01443 /* %endif */
01444 {
01445     
01446         /* TODO. We should be able to replace this entire function body
01447          * with
01448          *              yypop_buffer_state();
01449          *              yypush_buffer_state(new_buffer);
01450      */
01451         yyensure_buffer_stack ();
01452         if ( YY_CURRENT_BUFFER == new_buffer )
01453                 return;
01454 
01455         if ( YY_CURRENT_BUFFER )
01456                 {
01457                 /* Flush out information for old buffer. */
01458                 *(yy_c_buf_p) = (yy_hold_char);
01459                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01460                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01461                 }
01462 
01463         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01464         yy_load_buffer_state(  );
01465 
01466         /* We don't actually know whether we did this switch during
01467          * EOF (yywrap()) processing, but the only time this flag
01468          * is looked at is after yywrap() is called, so it's safe
01469          * to go ahead and always set it.
01470          */
01471         (yy_did_buffer_switch_on_eof) = 1;
01472 }
01473 
01474 /* %if-c-only */
01475 /* %endif */
01476 /* %if-c++-only */
01477     void yyFlexLexer::yy_load_buffer_state()
01478 /* %endif */
01479 {
01480         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01481         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01482         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01483         (yy_hold_char) = *(yy_c_buf_p);
01484 }
01485 
01492 /* %if-c-only */
01493 /* %endif */
01494 /* %if-c++-only */
01495     YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
01496 /* %endif */
01497 {
01498         YY_BUFFER_STATE b;
01499     
01500         b = (YY_BUFFER_STATE) Examplealloc(sizeof( struct yy_buffer_state )  );
01501         if ( ! b )
01502                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01503 
01504         b->yy_buf_size = size;
01505 
01506         /* yy_ch_buf has to be 2 characters longer than the size given because
01507          * we need to put in 2 end-of-buffer characters.
01508          */
01509         b->yy_ch_buf = (char *) Examplealloc(b->yy_buf_size + 2  );
01510         if ( ! b->yy_ch_buf )
01511                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01512 
01513         b->yy_is_our_buffer = 1;
01514 
01515         yy_init_buffer( b, file );
01516 
01517         return b;
01518 }
01519 
01524 /* %if-c-only */
01525 /* %endif */
01526 /* %if-c++-only */
01527     void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
01528 /* %endif */
01529 {
01530     
01531         if ( ! b )
01532                 return;
01533 
01534         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01535                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01536 
01537         if ( b->yy_is_our_buffer )
01538                 Examplefree((void *) b->yy_ch_buf  );
01539 
01540         Examplefree((void *) b  );
01541 }
01542 
01543 /* %if-c-only */
01544 /* %endif */
01545 
01546 /* %if-c++-only */
01547 
01548 extern "C" int isatty (int );
01549 
01550 /* %endif */
01551 
01552 /* Initializes or reinitializes a buffer.
01553  * This function is sometimes called more than once on the same buffer,
01554  * such as during a yyrestart() or at EOF.
01555  */
01556 /* %if-c-only */
01557 /* %endif */
01558 /* %if-c++-only */
01559     void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
01560 /* %endif */
01561 
01562 {
01563         int oerrno = errno;
01564     
01565         yy_flush_buffer( b );
01566 
01567         b->yy_input_file = file;
01568         b->yy_fill_buffer = 1;
01569 
01570     /* If b is the current buffer, then yy_init_buffer was _probably_
01571      * called from yyrestart() or through yy_get_next_buffer.
01572      * In that case, we don't want to reset the lineno or column.
01573      */
01574     if (b != YY_CURRENT_BUFFER){
01575         b->yy_bs_lineno = 1;
01576         b->yy_bs_column = 0;
01577     }
01578 
01579 /* %if-c-only */
01580 /* %endif */
01581 /* %if-c++-only */
01582         b->yy_is_interactive = 0;
01583 /* %endif */
01584         errno = oerrno;
01585 }
01586 
01591 /* %if-c-only */
01592 /* %endif */
01593 /* %if-c++-only */
01594     void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
01595 /* %endif */
01596 {
01597         if ( ! b )
01598                 return;
01599 
01600         b->yy_n_chars = 0;
01601 
01602         /* We always need two end-of-buffer characters.  The first causes
01603          * a transition to the end-of-buffer state.  The second causes
01604          * a jam in that state.
01605          */
01606         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01607         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01608 
01609         b->yy_buf_pos = &b->yy_ch_buf[0];
01610 
01611         b->yy_at_bol = 1;
01612         b->yy_buffer_status = YY_BUFFER_NEW;
01613 
01614         if ( b == YY_CURRENT_BUFFER )
01615                 yy_load_buffer_state(  );
01616 }
01617 
01618 /* %if-c-or-c++ */
01625 /* %if-c-only */
01626 /* %endif */
01627 /* %if-c++-only */
01628 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
01629 /* %endif */
01630 {
01631         if (new_buffer == NULL)
01632                 return;
01633 
01634         yyensure_buffer_stack();
01635 
01636         /* This block is copied from yy_switch_to_buffer. */
01637         if ( YY_CURRENT_BUFFER )
01638                 {
01639                 /* Flush out information for old buffer. */
01640                 *(yy_c_buf_p) = (yy_hold_char);
01641                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01642                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01643                 }
01644 
01645         /* Only push if top exists. Otherwise, replace top. */
01646         if (YY_CURRENT_BUFFER)
01647                 (yy_buffer_stack_top)++;
01648         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01649 
01650         /* copied from yy_switch_to_buffer. */
01651         yy_load_buffer_state(  );
01652         (yy_did_buffer_switch_on_eof) = 1;
01653 }
01654 /* %endif */
01655 
01656 /* %if-c-or-c++ */
01661 /* %if-c-only */
01662 /* %endif */
01663 /* %if-c++-only */
01664 void yyFlexLexer::yypop_buffer_state (void)
01665 /* %endif */
01666 {
01667         if (!YY_CURRENT_BUFFER)
01668                 return;
01669 
01670         yy_delete_buffer(YY_CURRENT_BUFFER );
01671         YY_CURRENT_BUFFER_LVALUE = NULL;
01672         if ((yy_buffer_stack_top) > 0)
01673                 --(yy_buffer_stack_top);
01674 
01675         if (YY_CURRENT_BUFFER) {
01676                 yy_load_buffer_state(  );
01677                 (yy_did_buffer_switch_on_eof) = 1;
01678         }
01679 }
01680 /* %endif */
01681 
01682 /* %if-c-or-c++ */
01683 /* Allocates the stack if it does not exist.
01684  *  Guarantees space for at least one push.
01685  */
01686 /* %if-c-only */
01687 /* %endif */
01688 /* %if-c++-only */
01689 void yyFlexLexer::yyensure_buffer_stack(void)
01690 /* %endif */
01691 {
01692         int num_to_alloc;
01693     
01694         if (!(yy_buffer_stack)) {
01695 
01696                 /* First allocation is just for 2 elements, since we don't know if this
01697                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
01698                  * immediate realloc on the next call.
01699          */
01700                 num_to_alloc = 1;
01701                 (yy_buffer_stack) = (struct yy_buffer_state**)Examplealloc
01702                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01703                                                                 );
01704                 
01705                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01706                                 
01707                 (yy_buffer_stack_max) = num_to_alloc;
01708                 (yy_buffer_stack_top) = 0;
01709                 return;
01710         }
01711 
01712         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
01713 
01714                 /* Increase the buffer to prepare for a possible push. */
01715                 int grow_size = 8 /* arbitrary grow size */;
01716 
01717                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
01718                 (yy_buffer_stack) = (struct yy_buffer_state**)Examplerealloc
01719                                                                 ((yy_buffer_stack),
01720                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01721                                                                 );
01722 
01723                 /* zero only the new slots.*/
01724                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
01725                 (yy_buffer_stack_max) = num_to_alloc;
01726         }
01727 }
01728 /* %endif */
01729 
01730 /* %if-c-only */
01731 /* %endif */
01732 
01733 /* %if-c-only */
01734 /* %endif */
01735 
01736 /* %if-c-only */
01737 /* %endif */
01738 
01739 /* %if-c-only */
01740 /* %endif */
01741 /* %if-c++-only */
01742     void yyFlexLexer::yy_push_state( int new_state )
01743 /* %endif */
01744 {
01745         if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
01746                 {
01747                 yy_size_t new_size;
01748 
01749                 (yy_start_stack_depth) += YY_START_STACK_INCR;
01750                 new_size = (yy_start_stack_depth) * sizeof( int );
01751 
01752                 if ( ! (yy_start_stack) )
01753                         (yy_start_stack) = (int *) Examplealloc(new_size  );
01754 
01755                 else
01756                         (yy_start_stack) = (int *) Examplerealloc((void *) (yy_start_stack),new_size  );
01757 
01758                 if ( ! (yy_start_stack) )
01759                         YY_FATAL_ERROR(
01760                         "out of memory expanding start-condition stack" );
01761                 }
01762 
01763         (yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
01764 
01765         BEGIN(new_state);
01766 }
01767 
01768 /* %if-c-only */
01769 /* %endif */
01770 /* %if-c++-only */
01771     void yyFlexLexer::yy_pop_state()
01772 /* %endif */
01773 {
01774         if ( --(yy_start_stack_ptr) < 0 )
01775                 YY_FATAL_ERROR( "start-condition stack underflow" );
01776 
01777         BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
01778 }
01779 
01780 /* %if-c-only */
01781 /* %endif */
01782 /* %if-c++-only */
01783     int yyFlexLexer::yy_top_state()
01784 /* %endif */
01785 {
01786         return (yy_start_stack)[(yy_start_stack_ptr) - 1];
01787 }
01788 
01789 #ifndef YY_EXIT_FAILURE
01790 #define YY_EXIT_FAILURE 2
01791 #endif
01792 
01793 /* %if-c-only */
01794 /* %endif */
01795 /* %if-c++-only */
01796 void yyFlexLexer::LexerError( yyconst char msg[] )
01797 {
01798         std::cerr << msg << std::endl;
01799         exit( YY_EXIT_FAILURE );
01800 }
01801 /* %endif */
01802 
01803 /* Redefine yyless() so it works in section 3 code. */
01804 
01805 #undef yyless
01806 #define yyless(n) \
01807         do \
01808                 { \
01809                 /* Undo effects of setting up yytext. */ \
01810         int yyless_macro_arg = (n); \
01811         YY_LESS_LINENO(yyless_macro_arg);\
01812                 yytext[yyleng] = (yy_hold_char); \
01813                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
01814                 (yy_hold_char) = *(yy_c_buf_p); \
01815                 *(yy_c_buf_p) = '\0'; \
01816                 yyleng = yyless_macro_arg; \
01817                 } \
01818         while ( 0 )
01819 
01820 /* Accessor  methods (get/set functions) to struct members. */
01821 
01822 /* %if-c-only */
01823 /* %if-reentrant */
01824 /* %endif */
01825 /* %if-reentrant */
01826 /* %endif */
01827 /* %endif */
01828 
01829 /* %if-reentrant */
01830 /* %if-bison-bridge */
01831 /* %endif */
01832 /* %endif */
01833 
01834 /* %if-c-only */
01835 /* %endif */
01836 
01837 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
01838 /* %if-reentrant */
01839 /* %endif */
01840 /* %endif */
01841 
01842 /*
01843  * Internal utility routines.
01844  */
01845 
01846 #ifndef yytext_ptr
01847 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
01848 {
01849         register int i;
01850         for ( i = 0; i < n; ++i )
01851                 s1[i] = s2[i];
01852 }
01853 #endif
01854 
01855 #ifdef YY_NEED_STRLEN
01856 static int yy_flex_strlen (yyconst char * s )
01857 {
01858         register int n;
01859         for ( n = 0; s[n]; ++n )
01860                 ;
01861 
01862         return n;
01863 }
01864 #endif
01865 
01866 void *Examplealloc (yy_size_t  size )
01867 {
01868         return (void *) malloc( size );
01869 }
01870 
01871 void *Examplerealloc  (void * ptr, yy_size_t  size )
01872 {
01873         /* The cast to (char *) in the following accommodates both
01874          * implementations that use char* generic pointers, and those
01875          * that use void* generic pointers.  It works with the latter
01876          * because both ANSI C and C++ allow castless assignment from
01877          * any pointer type to void*, and deal with argument conversions
01878          * as though doing an assignment.
01879          */
01880         return (void *) realloc( (char *) ptr, size );
01881 }
01882 
01883 void Examplefree (void * ptr )
01884 {
01885         free( (char *) ptr );   /* see Examplerealloc() for (char *) cast */
01886 }
01887 
01888 /* %if-tables-serialization definitions */
01889 /* %define-yytables   The name for this specific scanner's tables. */
01890 #define YYTABLES_NAME "yytables"
01891 /* %endif */
01892 
01893 /* %ok-for-header */
01894 
01895 #line 104 "scanner.ll"
01896 
01897 
01898 
01899 namespace example {
01900 
01901 Scanner::Scanner(std::istream* in,
01902                  std::ostream* out)
01903     : ExampleFlexLexer(in, out)
01904 {
01905 }
01906 
01907 Scanner::~Scanner()
01908 {
01909 }
01910 
01911 void Scanner::set_debug(bool b)
01912 {
01913     yy_flex_debug = b;
01914 }
01915 
01916 }
01917 
01918 /* This implementation of ExampleFlexLexer::yylex() is required to fill the
01919  * vtable of the class ExampleFlexLexer. We define the scanner's main yylex
01920  * function via YY_DECL to reside in the Scanner class instead. */
01921 
01922 #ifdef yylex
01923 #undef yylex
01924 #endif
01925 
01926 int ExampleFlexLexer::yylex()
01927 {
01928     std::cerr << "in ExampleFlexLexer::yylex() !" << std::endl;
01929     return 0;
01930 }
01931 

Generated on Mon Aug 20 13:34:21 2007 for Flex Bison C++ Example by  doxygen 1.5.2