LoIniFileLexer.C

00001 #line 2 "src/Robots/LoBot/config/LoIniFileLexer.C"
00002 
00003 #line 4 "src/Robots/LoBot/config/LoIniFileLexer.C"
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 35
00013 #if YY_FLEX_SUBMINOR_VERSION > 0
00014 #define FLEX_BETA
00015 #endif
00016 
00017 /* First, we deal with  platform-specific or compiler-specific issues. */
00018 
00019 /* begin standard C headers. */
00020 #include <stdio.h>
00021 #include <string.h>
00022 #include <errno.h>
00023 #include <stdlib.h>
00024 
00025 /* end standard C headers. */
00026 
00027 /* flex integer type definitions */
00028 
00029 #ifndef FLEXINT_H
00030 #define FLEXINT_H
00031 
00032 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
00033 
00034 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
00035 
00036 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
00037  * if you want the limit (max/min) macros for int types. 
00038  */
00039 #ifndef __STDC_LIMIT_MACROS
00040 #define __STDC_LIMIT_MACROS 1
00041 #endif
00042 
00043 #include <inttypes.h>
00044 typedef int8_t flex_int8_t;
00045 typedef uint8_t flex_uint8_t;
00046 typedef int16_t flex_int16_t;
00047 typedef uint16_t flex_uint16_t;
00048 typedef int32_t flex_int32_t;
00049 typedef uint32_t flex_uint32_t;
00050 #else
00051 typedef signed char flex_int8_t;
00052 typedef short int flex_int16_t;
00053 typedef int flex_int32_t;
00054 typedef unsigned char flex_uint8_t; 
00055 typedef unsigned short int flex_uint16_t;
00056 typedef unsigned int flex_uint32_t;
00057 
00058 /* Limits of integral types. */
00059 #ifndef INT8_MIN
00060 #define INT8_MIN               (-128)
00061 #endif
00062 #ifndef INT16_MIN
00063 #define INT16_MIN              (-32767-1)
00064 #endif
00065 #ifndef INT32_MIN
00066 #define INT32_MIN              (-2147483647-1)
00067 #endif
00068 #ifndef INT8_MAX
00069 #define INT8_MAX               (127)
00070 #endif
00071 #ifndef INT16_MAX
00072 #define INT16_MAX              (32767)
00073 #endif
00074 #ifndef INT32_MAX
00075 #define INT32_MAX              (2147483647)
00076 #endif
00077 #ifndef UINT8_MAX
00078 #define UINT8_MAX              (255U)
00079 #endif
00080 #ifndef UINT16_MAX
00081 #define UINT16_MAX             (65535U)
00082 #endif
00083 #ifndef UINT32_MAX
00084 #define UINT32_MAX             (4294967295U)
00085 #endif
00086 
00087 #endif /* ! C99 */
00088 
00089 #endif /* ! FLEXINT_H */
00090 
00091 #ifdef __cplusplus
00092 
00093 /* The "const" storage-class-modifier is valid. */
00094 #define YY_USE_CONST
00095 
00096 #else   /* ! __cplusplus */
00097 
00098 /* C99 requires __STDC__ to be defined as 1. */
00099 #if defined (__STDC__)
00100 
00101 #define YY_USE_CONST
00102 
00103 #endif  /* defined (__STDC__) */
00104 #endif  /* ! __cplusplus */
00105 
00106 #ifdef YY_USE_CONST
00107 #define yyconst const
00108 #else
00109 #define yyconst
00110 #endif
00111 
00112 /* Returned upon end-of-file. */
00113 #define YY_NULL 0
00114 
00115 /* Promotes a possibly negative, possibly signed char to an unsigned
00116  * integer for use as an array index.  If the signed char is negative,
00117  * we want to instead treat it as an 8-bit unsigned char, hence the
00118  * double cast.
00119  */
00120 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00121 
00122 /* Enter a start condition.  This macro really ought to take a parameter,
00123  * but we do it the disgusting crufty way forced on us by the ()-less
00124  * definition of BEGIN.
00125  */
00126 #define BEGIN (yy_start) = 1 + 2 *
00127 
00128 /* Translate the current start state into a value that can be later handed
00129  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00130  * compatibility.
00131  */
00132 #define YY_START (((yy_start) - 1) / 2)
00133 #define YYSTATE YY_START
00134 
00135 /* Action number for EOF rule of a given start state. */
00136 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00137 
00138 /* Special action meaning "start processing a new file". */
00139 #define YY_NEW_FILE yyrestart(yyin  )
00140 
00141 #define YY_END_OF_BUFFER_CHAR 0
00142 
00143 /* Size of default input buffer. */
00144 #ifndef YY_BUF_SIZE
00145 #ifdef __ia64__
00146 /* On IA-64, the buffer size is 16k, not 8k.
00147  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
00148  * Ditto for the __ia64__ case accordingly.
00149  */
00150 #define YY_BUF_SIZE 32768
00151 #else
00152 #define YY_BUF_SIZE 16384
00153 #endif /* __ia64__ */
00154 #endif
00155 
00156 /* The state buf must be large enough to hold one state per character in the main buffer.
00157  */
00158 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00159 
00160 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00161 #define YY_TYPEDEF_YY_BUFFER_STATE
00162 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00163 #endif
00164 
00165 extern int yyleng;
00166 
00167 extern FILE *yyin, *yyout;
00168 
00169 #define EOB_ACT_CONTINUE_SCAN 0
00170 #define EOB_ACT_END_OF_FILE 1
00171 #define EOB_ACT_LAST_MATCH 2
00172 
00173     #define YY_LESS_LINENO(n)
00174     
00175 /* Return all but the first "n" matched characters back to the input stream. */
00176 #define yyless(n) \
00177         do \
00178                 { \
00179                 /* Undo effects of setting up yytext. */ \
00180         int yyless_macro_arg = (n); \
00181         YY_LESS_LINENO(yyless_macro_arg);\
00182                 *yy_cp = (yy_hold_char); \
00183                 YY_RESTORE_YY_MORE_OFFSET \
00184                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00185                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00186                 } \
00187         while ( 0 )
00188 
00189 #define unput(c) yyunput( c, (yytext_ptr)  )
00190 
00191 #ifndef YY_TYPEDEF_YY_SIZE_T
00192 #define YY_TYPEDEF_YY_SIZE_T
00193 typedef size_t yy_size_t;
00194 #endif
00195 
00196 #ifndef YY_STRUCT_YY_BUFFER_STATE
00197 #define YY_STRUCT_YY_BUFFER_STATE
00198 struct yy_buffer_state
00199         {
00200         FILE *yy_input_file;
00201 
00202         char *yy_ch_buf;                /* input buffer */
00203         char *yy_buf_pos;               /* current position in input buffer */
00204 
00205         /* Size of input buffer in bytes, not including room for EOB
00206          * characters.
00207          */
00208         yy_size_t yy_buf_size;
00209 
00210         /* Number of characters read into yy_ch_buf, not including EOB
00211          * characters.
00212          */
00213         int yy_n_chars;
00214 
00215         /* Whether we "own" the buffer - i.e., we know we created it,
00216          * and can realloc() it to grow it, and should free() it to
00217          * delete it.
00218          */
00219         int yy_is_our_buffer;
00220 
00221         /* Whether this is an "interactive" input source; if so, and
00222          * if we're using stdio for input, then we want to use getc()
00223          * instead of fread(), to make sure we stop fetching input after
00224          * each newline.
00225          */
00226         int yy_is_interactive;
00227 
00228         /* Whether we're considered to be at the beginning of a line.
00229          * If so, '^' rules will be active on the next match, otherwise
00230          * not.
00231          */
00232         int yy_at_bol;
00233 
00234     int yy_bs_lineno; /**< The line count. */
00235     int yy_bs_column; /**< The column count. */
00236     
00237         /* Whether to try to fill the input buffer when we reach the
00238          * end of it.
00239          */
00240         int yy_fill_buffer;
00241 
00242         int yy_buffer_status;
00243 
00244 #define YY_BUFFER_NEW 0
00245 #define YY_BUFFER_NORMAL 1
00246         /* When an EOF's been seen but there's still some text to process
00247          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00248          * shouldn't try reading from the input source any more.  We might
00249          * still have a bunch of tokens to match, though, because of
00250          * possible backing-up.
00251          *
00252          * When we actually see the EOF, we change the status to "new"
00253          * (via yyrestart()), so that the user can continue scanning by
00254          * just pointing yyin at a new input file.
00255          */
00256 #define YY_BUFFER_EOF_PENDING 2
00257 
00258         };
00259 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00260 
00261 /* Stack of input buffers. */
00262 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
00263 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
00264 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
00265 
00266 /* We provide macros for accessing buffer states in case in the
00267  * future we want to put the buffer states in a more general
00268  * "scanner state".
00269  *
00270  * Returns the top of the stack, or NULL.
00271  */
00272 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00273                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00274                           : NULL)
00275 
00276 /* Same as previous macro, but useful when we know that the buffer stack is not
00277  * NULL or when we need an lvalue. For internal use only.
00278  */
00279 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00280 
00281 /* yy_hold_char holds the character lost when yytext is formed. */
00282 static char yy_hold_char;
00283 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
00284 int yyleng;
00285 
00286 /* Points to current character in buffer. */
00287 static char *yy_c_buf_p = (char *) 0;
00288 static int yy_init = 0;         /* whether we need to initialize */
00289 static int yy_start = 0;        /* start state number */
00290 
00291 /* Flag which is used to allow yywrap()'s to do buffer switches
00292  * instead of setting up a fresh yyin.  A bit of a hack ...
00293  */
00294 static int yy_did_buffer_switch_on_eof;
00295 
00296 void yyrestart (FILE *input_file  );
00297 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
00298 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
00299 void yy_delete_buffer (YY_BUFFER_STATE b  );
00300 void yy_flush_buffer (YY_BUFFER_STATE b  );
00301 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
00302 void yypop_buffer_state (void );
00303 
00304 static void yyensure_buffer_stack (void );
00305 static void yy_load_buffer_state (void );
00306 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
00307 
00308 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
00309 
00310 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
00311 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
00312 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
00313 
00314 void *yyalloc (yy_size_t  );
00315 void *yyrealloc (void *,yy_size_t  );
00316 void yyfree (void *  );
00317 
00318 #define yy_new_buffer yy_create_buffer
00319 
00320 #define yy_set_interactive(is_interactive) \
00321         { \
00322         if ( ! YY_CURRENT_BUFFER ){ \
00323         yyensure_buffer_stack (); \
00324                 YY_CURRENT_BUFFER_LVALUE =    \
00325             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00326         } \
00327         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00328         }
00329 
00330 #define yy_set_bol(at_bol) \
00331         { \
00332         if ( ! YY_CURRENT_BUFFER ){\
00333         yyensure_buffer_stack (); \
00334                 YY_CURRENT_BUFFER_LVALUE =    \
00335             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00336         } \
00337         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00338         }
00339 
00340 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00341 
00342 #define yywrap(n) 1
00343 #define YY_SKIP_YYWRAP
00344 
00345 typedef unsigned char YY_CHAR;
00346 
00347 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
00348 
00349 typedef int yy_state_type;
00350 
00351 extern int yylineno;
00352 
00353 int yylineno = 1;
00354 
00355 extern char *yytext;
00356 #define yytext_ptr yytext
00357 
00358 static yy_state_type yy_get_previous_state (void );
00359 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
00360 static int yy_get_next_buffer (void );
00361 static void yy_fatal_error (yyconst char msg[]  );
00362 
00363 /* Done after the current pattern has been matched and before the
00364  * corresponding action - sets up yytext.
00365  */
00366 #define YY_DO_BEFORE_ACTION \
00367         (yytext_ptr) = yy_bp; \
00368         (yytext_ptr) -= (yy_more_len); \
00369         yyleng = (size_t) (yy_cp - (yytext_ptr)); \
00370         (yy_hold_char) = *yy_cp; \
00371         *yy_cp = '\0'; \
00372         (yy_c_buf_p) = yy_cp;
00373 
00374 #define YY_NUM_RULES 11
00375 #define YY_END_OF_BUFFER 12
00376 /* This struct is not used in this scanner,
00377    but its presence is necessary. */
00378 struct yy_trans_info
00379         {
00380         flex_int32_t yy_verify;
00381         flex_int32_t yy_nxt;
00382         };
00383 static yyconst flex_int16_t yy_accept[37] =
00384     {   0,
00385         0,    0,    0,    0,   12,    9,    9,   10,    6,    5,
00386         3,    4,    9,    1,    9,   11,    8,   11,    0,    6,
00387         3,    4,    6,    5,    3,    4,    0,    1,    0,    0,
00388         2,    0,    8,    0,    7,    0
00389     } ;
00390 
00391 static yyconst flex_int32_t yy_ec[256] =
00392     {   0,
00393         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00394         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00395         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00396         1,    2,    1,    1,    4,    1,    1,    1,    1,    1,
00397         1,    1,    1,    1,    1,    1,    1,    5,    5,    5,
00398         5,    5,    5,    5,    5,    5,    5,    1,    4,    1,
00399         6,    1,    1,    1,    7,    7,    7,    7,    7,    7,
00400         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00401         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00402         8,    9,   10,    1,    5,    1,    7,    7,    7,    7,
00403 
00404         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00405         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
00406         7,    7,    1,    1,    1,    1,    1,    1,    1,    1,
00407         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00408         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00409         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00410         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00411         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00412         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00413         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00414 
00415         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00416         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00418         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00420         1,    1,    1,    1,    1
00421     } ;
00422 
00423 static yyconst flex_int32_t yy_meta[11] =
00424     {   0,
00425         1,    1,    1,    1,    2,    1,    2,    1,    1,    1
00426     } ;
00427 
00428 static yyconst flex_int16_t yy_base[41] =
00429     {   0,
00430         0,    9,   11,   18,   35,   60,   26,   60,   31,    0,
00431        29,   28,   35,   60,   26,   37,   60,   44,    0,   24,
00432        23,   22,   21,    0,   20,   17,    0,   60,   15,   14,
00433        60,   13,   60,    0,   60,   60,   53,   13,   55,   57
00434     } ;
00435 
00436 static yyconst flex_int16_t yy_def[41] =
00437     {   0,
00438        36,    1,   37,   37,   36,   36,   36,   36,   36,   38,
00439        36,   36,    7,   36,   39,   40,   36,   40,    7,   36,
00440        36,   36,   36,   38,   36,   36,   13,   36,   39,   39,
00441        36,   18,   36,   18,   36,    0,   36,   36,   36,   36
00442     } ;
00443 
00444 static yyconst flex_int16_t yy_nxt[71] =
00445     {   0,
00446         6,    7,    8,    6,    6,    9,   10,   11,    6,   12,
00447        13,   14,   15,   17,   24,   33,   31,   31,   26,   18,
00448        17,   25,   23,   26,   25,   23,   18,   19,   31,   26,
00449        25,   20,   23,   21,   36,   22,   27,   28,   29,   33,
00450        36,   36,   36,   36,   36,   34,   35,   36,   36,   36,
00451        36,   36,   34,   16,   16,   30,   30,   32,   32,    5,
00452        36,   36,   36,   36,   36,   36,   36,   36,   36,   36
00453     } ;
00454 
00455 static yyconst flex_int16_t yy_chk[71] =
00456     {   0,
00457         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00458         2,    2,    2,    3,   38,   32,   30,   29,   26,    3,
00459         4,   25,   23,   22,   21,   20,    4,    7,   15,   12,
00460        11,    7,    9,    7,    5,    7,   13,   13,   13,   16,
00461         0,    0,    0,    0,    0,   16,   18,    0,    0,    0,
00462         0,    0,   18,   37,   37,   39,   39,   40,   40,   36,
00463        36,   36,   36,   36,   36,   36,   36,   36,   36,   36
00464     } ;
00465 
00466 static yy_state_type yy_last_accepting_state;
00467 static char *yy_last_accepting_cpos;
00468 
00469 extern int yy_flex_debug;
00470 int yy_flex_debug = 0;
00471 
00472 /* The intent behind this definition is that it'll catch
00473  * any uses of REJECT which flex missed.
00474  */
00475 #define REJECT reject_used_but_not_detected
00476 static int yy_more_flag = 0;
00477 static int yy_more_len = 0;
00478 #define yymore() ((yy_more_flag) = 1)
00479 #define YY_MORE_ADJ (yy_more_len)
00480 #define YY_RESTORE_YY_MORE_OFFSET
00481 char *yytext;
00482 #line 1 "src/Robots/LoBot/config/LoIniFileLexer.l"
00483 /* -*- mode: C;-*- */
00484 #line 3 "src/Robots/LoBot/config/LoIniFileLexer.l"
00485 /*
00486    LoIniFileLexer.l -- lex source for Robolocust/Lobot config files
00487 
00488    This file implements the pattern-action pairs used by flex to spit out
00489    a C/C++ lexical analyzer that tokenizes the config files for the
00490    Robolocust/Lobot program. These config files are simplified INI files
00491    whose syntax rules are as follows:
00492 
00493        1. Blank lines and comments are ignored.
00494 
00495        2. Only single-line comments are supported.
00496 
00497        3. Comments are started with either a '#' or ';' character.
00498 
00499        4. Comments must appear on lines by themselves (i.e., config lines
00500           cannot have comments embedded in them).
00501 
00502        5. Config lines can be either section names or key-value
00503           assignments.
00504 
00505        6. Section names must start with a letter and may be followed by
00506           letters, numbers or the underscore character.
00507 
00508        7. Section names have to be enclosed in square brackets, i.e., '['
00509           and ']'.
00510 
00511        8. The key name in a key-value assignment follows the same rules as
00512           section names (except that they should not be enclosed in square
00513           brackets).
00514 
00515        9. The key name must be followed by an equals sign (which may be
00516           surrounded by optional whitespace).
00517 
00518       10. The value must follow the equals sign in a key-value assignment
00519           statement.
00520 
00521       11. All tokens following the equals sign (disregarding optional
00522           trailing whitespace after the equals sign) comprise the value
00523           portion of the key-value statement.
00524 
00525       12. Long key-value statements may be broken up across multiple
00526           lines and continued from one line to the next by ending each
00527           line with a '\' character. Note that the '\' must be the last
00528           character on the line, i.e., it should be immediately followed
00529           by a newline and no other trailing whitespace between the '\'
00530           and the newline.
00531 
00532           All initial whitespace on the following line will be discarded.
00533           Thus, to break up a really long string across multiple lines,
00534           don't have any whitespace between the '\' at the end of lines
00535           and the immediately preceding character. However, to ensure
00536           that tokens on the following lines are considered separate, put
00537           some intervening whitespace between the '\' and the previous
00538           character.
00539 
00540           The '\' line continuation characters themselves are not part of
00541           the value portion of key-value statements.
00542 
00543       13. The value portion of a key-value statement is taken verbatim,
00544           i.e., there is no notion of quoting strings and/or escape
00545           sequences; the whitespace following the equals sign is ignored
00546           and then all characters up to the end of the line are taken as
00547           the value corresponding to the specified key
00548 
00549    The following example illustrates what such an INI file looks like:
00550 
00551       # This is a comment and will be ignored as will all the blank lines
00552       # in this example.
00553 
00554       ; Comments can also be introduced by a semicolon
00555 
00556       # These entries do not belong to any section and are part of the
00557       # anonymous/unnamed "global" section:
00558       foo = 123
00559       bar = look Ma, no quotes!
00560 
00561       # Here is some random section
00562       [some_section]
00563 
00564       # It is okay to repeat key names in different sections/scope:
00565       foo = ping
00566       bar = pong
00567 
00568       # A section ends when another starts
00569       [another_section]
00570       some_key = some_value
00571 
00572       # It is okay to repeat sections. Key-value assignments will simply
00573       # "resume" under the previously defined section's scope.
00574       [some_section]
00575       quoted_string = "no such thing! quotes are part of the value"
00576 
00577       # Repeating keys in a section is also okay. The newly assigned
00578       # value will override the previous one. This feature should be
00579       # exercised with extreme care!
00580       foo = oops! already defined, but not a problem
00581       bar = # this is not a comment; it is the value for the bar key
00582 
00583       # Here is an example of a long statement continued across multiple
00584       # lines.
00585       baz = this is a very very very long key-value statement that \
00586             continues on and on across several consecutive lines simply \
00587             to illustrate how such long statements may be broken up for \
00588             the sake of readability by using the backslash at the end \
00589             of each line as a line continuation character
00590 
00591       boo = this is another long key-value statement conti\
00592             nued on the next line but broken in the middle of words to ill\
00593             ustrate how this strange feature works
00594 
00595    Straying from the above rules and the syntax illustrated above will
00596    probably lead to errors (usually of the worst kind, i.e., silent
00597    assumptions of weird intent). This code is mostly just a
00598    quick-and-dirty hack and has not been tested extensively to iron out
00599    all possible bugs. So try not to push the envelope here; the basic
00600    config file syntax rules are more than adequate for most purposes.
00601 */
00602 
00603 // Primary maintainer for this file: mviswana usc edu
00604 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/config/LoIniFileLexer.C $ */
00605 // $Id: LoIniFileLexer.C 14390 2011-01-13 20:17:22Z pez $
00606 
00607 // yacc headers
00608 #include "Robots/LoBot/config/LoLexYaccDefs.H"   // for various declarations
00609 #include "Robots/LoBot/config/LoIniFileLexer.H"  // dummy hdr for dep. calc.
00610 #include "Robots/LoBot/config/LoIniFileParser.H" // for the parser tokens
00611 
00612 // Standard C++ headers
00613 #include <algorithm>
00614 #include <string>
00615 
00616 // In the code generated by flex, the yy_get_next_buffer() function
00617 // performs a comparison between a signed and unsigned variable. This
00618 // produces a compiler warning, which results in an error because, by
00619 // default, INVT builds are setup to treat all warnings as errors.
00620 // Since we really can't fix the code generated by flex, we resort to
00621 // turning off this warning so that the .C file generated from this
00622 // Lex source builds without any hassles.
00623 //
00624 // DEVNOTE: On Debian etch, which has GCC 4.1.2, this works fine
00625 // because, apparently, the compiler does not care for the signed-
00626 // unsigned match in yy_get_next_buffer().
00627 //
00628 // On Debian lenny, which comes with GCC 4.3.2, and on Ubuntu 10.04LTS
00629 // (Lucid Lynx), which comes with GCC 4.4.3, the diagnostic pragma is
00630 // supported. Thus, we test for at least version 4.3 of GCC.
00631 //
00632 // This may not work on other systems with other versions of GCC. An
00633 // alternative workaround is not known for this particular problem.
00634 #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
00635 #pragma GCC diagnostic ignored "-Wsign-compare"
00636 #endif
00637 
00638 /*
00639    This state is used after the assignment operator is encountered on a
00640    key-value statement to be able to read everything up to the end of the
00641    line without stumbling on identifiers, comments, and so on.
00642 */
00643 
00644 /*
00645    Instruct flex to suppress unnecessary functions so that we don't get
00646    any warnings (which can be show stoppers no thanks to INVT's use of
00647    -Werror in its build system).
00648 */
00649 /*----------------------------- LEX RULES -----------------------------*/
00650 #line 651 "src/Robots/LoBot/config/LoIniFileLexer.C"
00651 
00652 #define INITIAL 0
00653 #define LOCD_IFL_READVAL 1
00654 
00655 #ifndef YY_NO_UNISTD_H
00656 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00657  * down here because we want the user's section 1 to have been scanned first.
00658  * The user has a chance to override it with an option.
00659  */
00660 #include <unistd.h>
00661 #endif
00662 
00663 #ifndef YY_EXTRA_TYPE
00664 #define YY_EXTRA_TYPE void *
00665 #endif
00666 
00667 static int yy_init_globals (void );
00668 
00669 /* Accessor methods to globals.
00670    These are made visible to non-reentrant scanners for convenience. */
00671 
00672 int yylex_destroy (void );
00673 
00674 int yyget_debug (void );
00675 
00676 void yyset_debug (int debug_flag  );
00677 
00678 YY_EXTRA_TYPE yyget_extra (void );
00679 
00680 void yyset_extra (YY_EXTRA_TYPE user_defined  );
00681 
00682 FILE *yyget_in (void );
00683 
00684 void yyset_in  (FILE * in_str  );
00685 
00686 FILE *yyget_out (void );
00687 
00688 void yyset_out  (FILE * out_str  );
00689 
00690 int yyget_leng (void );
00691 
00692 char *yyget_text (void );
00693 
00694 int yyget_lineno (void );
00695 
00696 void yyset_lineno (int line_number  );
00697 
00698 /* Macros after this point can all be overridden by user definitions in
00699  * section 1.
00700  */
00701 
00702 #ifndef YY_SKIP_YYWRAP
00703 #ifdef __cplusplus
00704 extern "C" int yywrap (void );
00705 #else
00706 extern int yywrap (void );
00707 #endif
00708 #endif
00709 
00710 #ifndef yytext_ptr
00711 static void yy_flex_strncpy (char *,yyconst char *,int );
00712 #endif
00713 
00714 #ifdef YY_NEED_STRLEN
00715 static int yy_flex_strlen (yyconst char * );
00716 #endif
00717 
00718 #ifndef YY_NO_INPUT
00719 
00720 #ifdef __cplusplus
00721 static int yyinput (void );
00722 #else
00723 static int input (void );
00724 #endif
00725 
00726 #endif
00727 
00728 /* Amount of stuff to slurp up with each read. */
00729 #ifndef YY_READ_BUF_SIZE
00730 #ifdef __ia64__
00731 /* On IA-64, the buffer size is 16k, not 8k */
00732 #define YY_READ_BUF_SIZE 16384
00733 #else
00734 #define YY_READ_BUF_SIZE 8192
00735 #endif /* __ia64__ */
00736 #endif
00737 
00738 /* Copy whatever the last rule matched to the standard output. */
00739 #ifndef ECHO
00740 /* This used to be an fputs(), but since the string might contain NUL's,
00741  * we now use fwrite().
00742  */
00743 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00744 #endif
00745 
00746 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00747  * is returned in "result".
00748  */
00749 #ifndef YY_INPUT
00750 #define YY_INPUT(buf,result,max_size) \
00751         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00752                 { \
00753                 int c = '*'; \
00754                 size_t n; \
00755                 for ( n = 0; n < max_size && \
00756                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00757                         buf[n] = (char) c; \
00758                 if ( c == '\n' ) \
00759                         buf[n++] = (char) c; \
00760                 if ( c == EOF && ferror( yyin ) ) \
00761                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
00762                 result = n; \
00763                 } \
00764         else \
00765                 { \
00766                 errno=0; \
00767                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00768                         { \
00769                         if( errno != EINTR) \
00770                                 { \
00771                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00772                                 break; \
00773                                 } \
00774                         errno=0; \
00775                         clearerr(yyin); \
00776                         } \
00777                 }\
00778 \
00779 
00780 #endif
00781 
00782 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00783  * we don't want an extra ';' after the "return" because that will cause
00784  * some compilers to complain about unreachable statements.
00785  */
00786 #ifndef yyterminate
00787 #define yyterminate() return YY_NULL
00788 #endif
00789 
00790 /* Number of entries by which start-condition stack grows. */
00791 #ifndef YY_START_STACK_INCR
00792 #define YY_START_STACK_INCR 25
00793 #endif
00794 
00795 /* Report a fatal error. */
00796 #ifndef YY_FATAL_ERROR
00797 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00798 #endif
00799 
00800 /* end tables serialization structures and prototypes */
00801 
00802 /* Default declaration of generated scanner - a define so the user can
00803  * easily add parameters.
00804  */
00805 #ifndef YY_DECL
00806 #define YY_DECL_IS_OURS 1
00807 
00808 extern int yylex (void);
00809 
00810 #define YY_DECL int yylex (void)
00811 #endif /* !YY_DECL */
00812 
00813 /* Code executed at the beginning of each rule, after yytext and yyleng
00814  * have been set up.
00815  */
00816 #ifndef YY_USER_ACTION
00817 #define YY_USER_ACTION
00818 #endif
00819 
00820 /* Code executed at the end of each rule. */
00821 #ifndef YY_BREAK
00822 #define YY_BREAK break;
00823 #endif
00824 
00825 #define YY_RULE_SETUP \
00826         if ( yyleng > 0 ) \
00827                 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
00828                                 (yytext[yyleng - 1] == '\n'); \
00829         YY_USER_ACTION
00830 
00831 /** The main scanner function which does all the work.
00832  */
00833 YY_DECL
00834 {
00835         register yy_state_type yy_current_state;
00836         register char *yy_cp, *yy_bp;
00837         register int yy_act;
00838     
00839 #line 174 "src/Robots/LoBot/config/LoIniFileLexer.l"
00840 
00841 
00842 #line 843 "src/Robots/LoBot/config/LoIniFileLexer.C"
00843 
00844         if ( !(yy_init) )
00845                 {
00846                 (yy_init) = 1;
00847 
00848 #ifdef YY_USER_INIT
00849                 YY_USER_INIT;
00850 #endif
00851 
00852                 if ( ! (yy_start) )
00853                         (yy_start) = 1; /* first start state */
00854 
00855                 if ( ! yyin )
00856                         yyin = stdin;
00857 
00858                 if ( ! yyout )
00859                         yyout = stdout;
00860 
00861                 if ( ! YY_CURRENT_BUFFER ) {
00862                         yyensure_buffer_stack ();
00863                         YY_CURRENT_BUFFER_LVALUE =
00864                                 yy_create_buffer(yyin,YY_BUF_SIZE );
00865                 }
00866 
00867                 yy_load_buffer_state( );
00868                 }
00869 
00870         while ( 1 )             /* loops until end-of-file is reached */
00871                 {
00872                 (yy_more_len) = 0;
00873                 if ( (yy_more_flag) )
00874                         {
00875                         (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
00876                         (yy_more_flag) = 0;
00877                         }
00878                 yy_cp = (yy_c_buf_p);
00879 
00880                 /* Support of yytext. */
00881                 *yy_cp = (yy_hold_char);
00882 
00883                 /* yy_bp points to the position in yy_ch_buf of the start of
00884                  * the current run.
00885                  */
00886                 yy_bp = yy_cp;
00887 
00888                 yy_current_state = (yy_start);
00889                 yy_current_state += YY_AT_BOL();
00890 yy_match:
00891                 do
00892                         {
00893                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00894                         if ( yy_accept[yy_current_state] )
00895                                 {
00896                                 (yy_last_accepting_state) = yy_current_state;
00897                                 (yy_last_accepting_cpos) = yy_cp;
00898                                 }
00899                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00900                                 {
00901                                 yy_current_state = (int) yy_def[yy_current_state];
00902                                 if ( yy_current_state >= 37 )
00903                                         yy_c = yy_meta[(unsigned int) yy_c];
00904                                 }
00905                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00906                         ++yy_cp;
00907                         }
00908                 while ( yy_base[yy_current_state] != 60 );
00909 
00910 yy_find_action:
00911                 yy_act = yy_accept[yy_current_state];
00912                 if ( yy_act == 0 )
00913                         { /* have to back up */
00914                         yy_cp = (yy_last_accepting_cpos);
00915                         yy_current_state = (yy_last_accepting_state);
00916                         yy_act = yy_accept[yy_current_state];
00917                         }
00918 
00919                 YY_DO_BEFORE_ACTION;
00920 
00921 do_action:      /* This label is used only to access EOF actions. */
00922 
00923                 switch ( yy_act )
00924         { /* beginning of action switch */
00925                         case 0: /* must back up */
00926                         /* undo the effects of YY_DO_BEFORE_ACTION */
00927                         *yy_cp = (yy_hold_char);
00928                         yy_cp = (yy_last_accepting_cpos);
00929                         yy_current_state = (yy_last_accepting_state);
00930                         goto yy_find_action;
00931 
00932 case 1:
00933 /* rule 1 can match eol */
00934 YY_RULE_SETUP
00935 #line 176 "src/Robots/LoBot/config/LoIniFileLexer.l"
00936 {/* ignore blank lines */}
00937         YY_BREAK
00938 case 2:
00939 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
00940 (yy_c_buf_p) = yy_cp -= 1;
00941 YY_DO_BEFORE_ACTION; /* set up yytext again */
00942 YY_RULE_SETUP
00943 #line 177 "src/Robots/LoBot/config/LoIniFileLexer.l"
00944 {/* ignore comments */}
00945         YY_BREAK
00946 /*
00947       These two rules look for '[' and ']' respectively. These tokens
00948       indicate the start of a section in the config file. Whitespace
00949       surrounding the tokens are acceptable.
00950    */
00951 case 3:
00952 YY_RULE_SETUP
00953 #line 184 "src/Robots/LoBot/config/LoIniFileLexer.l"
00954 {return LOCD_IFP_OPENSEC  ;}
00955         YY_BREAK
00956 case 4:
00957 YY_RULE_SETUP
00958 #line 185 "src/Robots/LoBot/config/LoIniFileLexer.l"
00959 {return LOCD_IFP_CLOSESEC ;}
00960         YY_BREAK
00961 /*
00962       This rule looks for identifiers. Identifiers are the names of keys
00963       that make up the key-value pairs of the Robolocust configuration
00964       database.
00965    */
00966 case 5:
00967 YY_RULE_SETUP
00968 #line 192 "src/Robots/LoBot/config/LoIniFileLexer.l"
00969 {
00970       locd_ifp_set_current_identifier(yytext) ;
00971       return LOCD_IFP_IDENTIFIER ;
00972    }
00973         YY_BREAK
00974 /*
00975       This rule looks for equals signs. The config file consists of
00976       "[section]" definitions and "key = value" assignment statements.
00977       Therefore, this rule recognizes a part of the assignment
00978       statements. Whitespace around equals signs are acceptable.
00979 
00980       To recognize the value part of an assignment statement we need to
00981       enter a new state after the equals sign has been read. This is why
00982       this rule initiates the switch to the LOCD_IFL_READVAL state. This
00983       state allows us to read every- thing up to the end of the
00984       assignment statement without stumbling on identifiers, comments,
00985       etc.
00986    */
00987 case 6:
00988 YY_RULE_SETUP
00989 #line 210 "src/Robots/LoBot/config/LoIniFileLexer.l"
00990 {
00991       BEGIN(LOCD_IFL_READVAL) ;
00992       return LOCD_IFP_ASSOP ;
00993    }
00994         YY_BREAK
00995 /*
00996       This rule reads the value part of a key-value assignment statement.
00997       It recognizes '\' at the end of a line as a line continuation
00998       character. When it comes across a '\' at the end of a line, it
00999       simply continues reading the input file and adding the characters
01000       to the current token until it hits a line that does not end with a
01001       '\'.
01002    */
01003 case 7:
01004 /* rule 7 can match eol */
01005 YY_RULE_SETUP
01006 #line 223 "src/Robots/LoBot/config/LoIniFileLexer.l"
01007 {yymore() ;}
01008         YY_BREAK
01009 /*
01010       This rule is also for the value part of a key-value assignment
01011       statement. It deals with the case wherein the value is all on one
01012       line, i.e., not continued across multiple lines with the '\'
01013       character. This rule will also apply for the last line of a
01014       multi-line value specification.
01015 
01016       In the case of multi-line value specs, we want to clean-up the
01017       token by removing all the backslashes at the ends of preceding
01018       lines and swallowing any initial whitespace on following lines.
01019       That's what all the string manipulation code in this rule's action
01020       block is for.
01021    */
01022 case 8:
01023 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
01024 (yy_c_buf_p) = yy_cp -= 1;
01025 YY_DO_BEFORE_ACTION; /* set up yytext again */
01026 YY_RULE_SETUP
01027 #line 238 "src/Robots/LoBot/config/LoIniFileLexer.l"
01028 {
01029       BEGIN(INITIAL) ;
01030 
01031          // Clean-up the value token
01032       char* token = new char[yyleng + 1] ;
01033       std::fill_n(token, yyleng + 1, '\0') ;
01034 
01035       char* dst = token ;
01036       char* src = yytext ;
01037       while (*src)
01038       {
01039          char* bs = strchr(src, '\\') ;
01040          if (! bs) {           // no more backslashes left in source string
01041             strcpy(dst, src) ; // copy remaining src string into destination
01042             break ;
01043          }
01044          std::copy(src, bs, dst) ; // copy from curr pt in src up to bkslash
01045          dst += bs - src ;
01046          src = bs + 1 ;    // skip over backslash in source string
01047          if (*src != '\n') // but only if it's immediately followed by newline
01048             *dst++ = '\\' ;// otherwise, leave backslash in token
01049          while (isspace(*src)) // eat initial whitespace on following line
01050             ++src ;
01051       }
01052       locd_ifp_set_current_value(token) ;
01053       delete[] token ;
01054       return LOCD_IFP_VALUE ;
01055    }
01056         YY_BREAK
01057 /* Some fallback and boilerplate rules when above don't apply. */
01058 case 9:
01059 YY_RULE_SETUP
01060 #line 268 "src/Robots/LoBot/config/LoIniFileLexer.l"
01061 {return yytext[0] ; /* unknown token */}
01062         YY_BREAK
01063 case 10:
01064 /* rule 10 can match eol */
01065 YY_RULE_SETUP
01066 #line 269 "src/Robots/LoBot/config/LoIniFileLexer.l"
01067 {/* to prevent default ECHO action   */}
01068         YY_BREAK
01069 case 11:
01070 YY_RULE_SETUP
01071 #line 270 "src/Robots/LoBot/config/LoIniFileLexer.l"
01072 ECHO;
01073         YY_BREAK
01074 #line 1075 "src/Robots/LoBot/config/LoIniFileLexer.C"
01075 case YY_STATE_EOF(INITIAL):
01076 case YY_STATE_EOF(LOCD_IFL_READVAL):
01077         yyterminate();
01078 
01079         case YY_END_OF_BUFFER:
01080                 {
01081                 /* Amount of text matched not including the EOB char. */
01082                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
01083 
01084                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
01085                 *yy_cp = (yy_hold_char);
01086                 YY_RESTORE_YY_MORE_OFFSET
01087 
01088                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01089                         {
01090                         /* We're scanning a new file or input source.  It's
01091                          * possible that this happened because the user
01092                          * just pointed yyin at a new source and called
01093                          * yylex().  If so, then we have to assure
01094                          * consistency between YY_CURRENT_BUFFER and our
01095                          * globals.  Here is the right place to do so, because
01096                          * this is the first action (other than possibly a
01097                          * back-up) that will match for the new input source.
01098                          */
01099                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01100                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01101                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01102                         }
01103 
01104                 /* Note that here we test for yy_c_buf_p "<=" to the position
01105                  * of the first EOB in the buffer, since yy_c_buf_p will
01106                  * already have been incremented past the NUL character
01107                  * (since all states make transitions on EOB to the
01108                  * end-of-buffer state).  Contrast this with the test
01109                  * in input().
01110                  */
01111                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01112                         { /* This was really a NUL. */
01113                         yy_state_type yy_next_state;
01114 
01115                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
01116 
01117                         yy_current_state = yy_get_previous_state(  );
01118 
01119                         /* Okay, we're now positioned to make the NUL
01120                          * transition.  We couldn't have
01121                          * yy_get_previous_state() go ahead and do it
01122                          * for us because it doesn't know how to deal
01123                          * with the possibility of jamming (and we don't
01124                          * want to build jamming into it because then it
01125                          * will run more slowly).
01126                          */
01127 
01128                         yy_next_state = yy_try_NUL_trans( yy_current_state );
01129 
01130                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01131 
01132                         if ( yy_next_state )
01133                                 {
01134                                 /* Consume the NUL. */
01135                                 yy_cp = ++(yy_c_buf_p);
01136                                 yy_current_state = yy_next_state;
01137                                 goto yy_match;
01138                                 }
01139 
01140                         else
01141                                 {
01142                                 yy_cp = (yy_c_buf_p);
01143                                 goto yy_find_action;
01144                                 }
01145                         }
01146 
01147                 else switch ( yy_get_next_buffer(  ) )
01148                         {
01149                         case EOB_ACT_END_OF_FILE:
01150                                 {
01151                                 (yy_did_buffer_switch_on_eof) = 0;
01152 
01153                                 if ( yywrap( ) )
01154                                         {
01155                                         /* Note: because we've taken care in
01156                                          * yy_get_next_buffer() to have set up
01157                                          * yytext, we can now set up
01158                                          * yy_c_buf_p so that if some total
01159                                          * hoser (like flex itself) wants to
01160                                          * call the scanner after we return the
01161                                          * YY_NULL, it'll still work - another
01162                                          * YY_NULL will get returned.
01163                                          */
01164                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
01165 
01166                                         yy_act = YY_STATE_EOF(YY_START);
01167                                         goto do_action;
01168                                         }
01169 
01170                                 else
01171                                         {
01172                                         if ( ! (yy_did_buffer_switch_on_eof) )
01173                                                 YY_NEW_FILE;
01174                                         }
01175                                 break;
01176                                 }
01177 
01178                         case EOB_ACT_CONTINUE_SCAN:
01179                                 (yy_c_buf_p) =
01180                                         (yytext_ptr) + yy_amount_of_matched_text;
01181 
01182                                 yy_current_state = yy_get_previous_state(  );
01183 
01184                                 yy_cp = (yy_c_buf_p);
01185                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01186                                 goto yy_match;
01187 
01188                         case EOB_ACT_LAST_MATCH:
01189                                 (yy_c_buf_p) =
01190                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
01191 
01192                                 yy_current_state = yy_get_previous_state(  );
01193 
01194                                 yy_cp = (yy_c_buf_p);
01195                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01196                                 goto yy_find_action;
01197                         }
01198                 break;
01199                 }
01200 
01201         default:
01202                 YY_FATAL_ERROR(
01203                         "fatal flex scanner internal error--no action found" );
01204         } /* end of action switch */
01205                 } /* end of scanning one token */
01206 } /* end of yylex */
01207 
01208 /* yy_get_next_buffer - try to read in a new buffer
01209  *
01210  * Returns a code representing an action:
01211  *      EOB_ACT_LAST_MATCH -
01212  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01213  *      EOB_ACT_END_OF_FILE - end of file
01214  */
01215 static int yy_get_next_buffer (void)
01216 {
01217         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01218         register char *source = (yytext_ptr);
01219         register int number_to_move, i;
01220         int ret_val;
01221 
01222         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
01223                 YY_FATAL_ERROR(
01224                 "fatal flex scanner internal error--end of buffer missed" );
01225 
01226         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01227                 { /* Don't try to fill the buffer, so this is an EOF. */
01228                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
01229                         {
01230                         /* We matched a single character, the EOB, so
01231                          * treat this as a final EOF.
01232                          */
01233                         return EOB_ACT_END_OF_FILE;
01234                         }
01235 
01236                 else
01237                         {
01238                         /* We matched some text prior to the EOB, first
01239                          * process it.
01240                          */
01241                         return EOB_ACT_LAST_MATCH;
01242                         }
01243                 }
01244 
01245         /* Try to read more data. */
01246 
01247         /* First move last chars to start of buffer. */
01248         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
01249 
01250         for ( i = 0; i < number_to_move; ++i )
01251                 *(dest++) = *(source++);
01252 
01253         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01254                 /* don't do the read, it's not guaranteed to return an EOF,
01255                  * just force an EOF
01256                  */
01257                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
01258 
01259         else
01260                 {
01261                         int num_to_read =
01262                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01263 
01264                 while ( num_to_read <= 0 )
01265                         { /* Not enough room in the buffer - grow it. */
01266 
01267                         /* just a shorter name for the current buffer */
01268                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01269 
01270                         int yy_c_buf_p_offset =
01271                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
01272 
01273                         if ( b->yy_is_our_buffer )
01274                                 {
01275                                 int new_size = b->yy_buf_size * 2;
01276 
01277                                 if ( new_size <= 0 )
01278                                         b->yy_buf_size += b->yy_buf_size / 8;
01279                                 else
01280                                         b->yy_buf_size *= 2;
01281 
01282                                 b->yy_ch_buf = (char *)
01283                                         /* Include room in for 2 EOB chars. */
01284                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
01285                                 }
01286                         else
01287                                 /* Can't grow it, we don't own it. */
01288                                 b->yy_ch_buf = 0;
01289 
01290                         if ( ! b->yy_ch_buf )
01291                                 YY_FATAL_ERROR(
01292                                 "fatal error - scanner input buffer overflow" );
01293 
01294                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
01295 
01296                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01297                                                 number_to_move - 1;
01298 
01299                         }
01300 
01301                 if ( num_to_read > YY_READ_BUF_SIZE )
01302                         num_to_read = YY_READ_BUF_SIZE;
01303 
01304                 /* Read in more data. */
01305                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01306                         (yy_n_chars), (size_t) num_to_read );
01307 
01308                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01309                 }
01310 
01311         if ( (yy_n_chars) == 0 )
01312                 {
01313                 if ( number_to_move == YY_MORE_ADJ )
01314                         {
01315                         ret_val = EOB_ACT_END_OF_FILE;
01316                         yyrestart(yyin  );
01317                         }
01318 
01319                 else
01320                         {
01321                         ret_val = EOB_ACT_LAST_MATCH;
01322                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01323                                 YY_BUFFER_EOF_PENDING;
01324                         }
01325                 }
01326 
01327         else
01328                 ret_val = EOB_ACT_CONTINUE_SCAN;
01329 
01330         if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01331                 /* Extend the array by 50%, plus the number we really need. */
01332                 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
01333                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
01334                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01335                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01336         }
01337 
01338         (yy_n_chars) += number_to_move;
01339         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01340         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01341 
01342         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01343 
01344         return ret_val;
01345 }
01346 
01347 /* yy_get_previous_state - get the state just before the EOB char was reached */
01348 
01349     static yy_state_type yy_get_previous_state (void)
01350 {
01351         register yy_state_type yy_current_state;
01352         register char *yy_cp;
01353     
01354         yy_current_state = (yy_start);
01355         yy_current_state += YY_AT_BOL();
01356 
01357         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01358                 {
01359                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01360                 if ( yy_accept[yy_current_state] )
01361                         {
01362                         (yy_last_accepting_state) = yy_current_state;
01363                         (yy_last_accepting_cpos) = yy_cp;
01364                         }
01365                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01366                         {
01367                         yy_current_state = (int) yy_def[yy_current_state];
01368                         if ( yy_current_state >= 37 )
01369                                 yy_c = yy_meta[(unsigned int) yy_c];
01370                         }
01371                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01372                 }
01373 
01374         return yy_current_state;
01375 }
01376 
01377 /* yy_try_NUL_trans - try to make a transition on the NUL character
01378  *
01379  * synopsis
01380  *      next_state = yy_try_NUL_trans( current_state );
01381  */
01382     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
01383 {
01384         register int yy_is_jam;
01385         register char *yy_cp = (yy_c_buf_p);
01386 
01387         register YY_CHAR yy_c = 1;
01388         if ( yy_accept[yy_current_state] )
01389                 {
01390                 (yy_last_accepting_state) = yy_current_state;
01391                 (yy_last_accepting_cpos) = yy_cp;
01392                 }
01393         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01394                 {
01395                 yy_current_state = (int) yy_def[yy_current_state];
01396                 if ( yy_current_state >= 37 )
01397                         yy_c = yy_meta[(unsigned int) yy_c];
01398                 }
01399         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01400         yy_is_jam = (yy_current_state == 36);
01401 
01402         return yy_is_jam ? 0 : yy_current_state;
01403 }
01404 
01405 #ifndef YY_NO_INPUT
01406 #ifdef __cplusplus
01407     static int yyinput (void)
01408 #else
01409     static int input  (void)
01410 #endif
01411 
01412 {
01413         int c;
01414     
01415         *(yy_c_buf_p) = (yy_hold_char);
01416 
01417         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01418                 {
01419                 /* yy_c_buf_p now points to the character we want to return.
01420                  * If this occurs *before* the EOB characters, then it's a
01421                  * valid NUL; if not, then we've hit the end of the buffer.
01422                  */
01423                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01424                         /* This was really a NUL. */
01425                         *(yy_c_buf_p) = '\0';
01426 
01427                 else
01428                         { /* need more input */
01429                         int offset = (yy_c_buf_p) - (yytext_ptr);
01430                         ++(yy_c_buf_p);
01431 
01432                         switch ( yy_get_next_buffer(  ) )
01433                                 {
01434                                 case EOB_ACT_LAST_MATCH:
01435                                         /* This happens because yy_g_n_b()
01436                                          * sees that we've accumulated a
01437                                          * token and flags that we need to
01438                                          * try matching the token before
01439                                          * proceeding.  But for input(),
01440                                          * there's no matching to consider.
01441                                          * So convert the EOB_ACT_LAST_MATCH
01442                                          * to EOB_ACT_END_OF_FILE.
01443                                          */
01444 
01445                                         /* Reset buffer status. */
01446                                         yyrestart(yyin );
01447 
01448                                         /*FALLTHROUGH*/
01449 
01450                                 case EOB_ACT_END_OF_FILE:
01451                                         {
01452                                         if ( yywrap( ) )
01453                                                 return EOF;
01454 
01455                                         if ( ! (yy_did_buffer_switch_on_eof) )
01456                                                 YY_NEW_FILE;
01457 #ifdef __cplusplus
01458                                         return yyinput();
01459 #else
01460                                         return input();
01461 #endif
01462                                         }
01463 
01464                                 case EOB_ACT_CONTINUE_SCAN:
01465                                         (yy_c_buf_p) = (yytext_ptr) + offset;
01466                                         break;
01467                                 }
01468                         }
01469                 }
01470 
01471         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01472         *(yy_c_buf_p) = '\0';   /* preserve yytext */
01473         (yy_hold_char) = *++(yy_c_buf_p);
01474 
01475         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
01476 
01477         return c;
01478 }
01479 #endif  /* ifndef YY_NO_INPUT */
01480 
01481 /** Immediately switch to a different input stream.
01482  * @param input_file A readable stream.
01483  * 
01484  * @note This function does not reset the start condition to @c INITIAL .
01485  */
01486     void yyrestart  (FILE * input_file )
01487 {
01488     
01489         if ( ! YY_CURRENT_BUFFER ){
01490         yyensure_buffer_stack ();
01491                 YY_CURRENT_BUFFER_LVALUE =
01492             yy_create_buffer(yyin,YY_BUF_SIZE );
01493         }
01494 
01495         yy_init_buffer(YY_CURRENT_BUFFER,input_file );
01496         yy_load_buffer_state( );
01497 }
01498 
01499 /** Switch to a different input buffer.
01500  * @param new_buffer The new input buffer.
01501  * 
01502  */
01503     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
01504 {
01505     
01506         /* TODO. We should be able to replace this entire function body
01507          * with
01508          *              yypop_buffer_state();
01509          *              yypush_buffer_state(new_buffer);
01510      */
01511         yyensure_buffer_stack ();
01512         if ( YY_CURRENT_BUFFER == new_buffer )
01513                 return;
01514 
01515         if ( YY_CURRENT_BUFFER )
01516                 {
01517                 /* Flush out information for old buffer. */
01518                 *(yy_c_buf_p) = (yy_hold_char);
01519                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01520                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01521                 }
01522 
01523         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01524         yy_load_buffer_state( );
01525 
01526         /* We don't actually know whether we did this switch during
01527          * EOF (yywrap()) processing, but the only time this flag
01528          * is looked at is after yywrap() is called, so it's safe
01529          * to go ahead and always set it.
01530          */
01531         (yy_did_buffer_switch_on_eof) = 1;
01532 }
01533 
01534 static void yy_load_buffer_state  (void)
01535 {
01536         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01537         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01538         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01539         (yy_hold_char) = *(yy_c_buf_p);
01540 }
01541 
01542 /** Allocate and initialize an input buffer state.
01543  * @param file A readable stream.
01544  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
01545  * 
01546  * @return the allocated buffer state.
01547  */
01548     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
01549 {
01550         YY_BUFFER_STATE b;
01551     
01552         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
01553         if ( ! b )
01554                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01555 
01556         b->yy_buf_size = size;
01557 
01558         /* yy_ch_buf has to be 2 characters longer than the size given because
01559          * we need to put in 2 end-of-buffer characters.
01560          */
01561         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
01562         if ( ! b->yy_ch_buf )
01563                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01564 
01565         b->yy_is_our_buffer = 1;
01566 
01567         yy_init_buffer(b,file );
01568 
01569         return b;
01570 }
01571 
01572 /** Destroy the buffer.
01573  * @param b a buffer created with yy_create_buffer()
01574  * 
01575  */
01576     void yy_delete_buffer (YY_BUFFER_STATE  b )
01577 {
01578     
01579         if ( ! b )
01580                 return;
01581 
01582         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01583                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01584 
01585         if ( b->yy_is_our_buffer )
01586                 yyfree((void *) b->yy_ch_buf  );
01587 
01588         yyfree((void *) b  );
01589 }
01590 
01591 #ifndef __cplusplus
01592 extern int isatty (int );
01593 #endif /* __cplusplus */
01594     
01595 /* Initializes or reinitializes a buffer.
01596  * This function is sometimes called more than once on the same buffer,
01597  * such as during a yyrestart() or at EOF.
01598  */
01599     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
01600 
01601 {
01602         int oerrno = errno;
01603     
01604         yy_flush_buffer(b );
01605 
01606         b->yy_input_file = file;
01607         b->yy_fill_buffer = 1;
01608 
01609     /* If b is the current buffer, then yy_init_buffer was _probably_
01610      * called from yyrestart() or through yy_get_next_buffer.
01611      * In that case, we don't want to reset the lineno or column.
01612      */
01613     if (b != YY_CURRENT_BUFFER){
01614         b->yy_bs_lineno = 1;
01615         b->yy_bs_column = 0;
01616     }
01617 
01618         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01619     
01620         errno = oerrno;
01621 }
01622 
01623 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
01624  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
01625  * 
01626  */
01627     void yy_flush_buffer (YY_BUFFER_STATE  b )
01628 {
01629         if ( ! b )
01630                 return;
01631 
01632         b->yy_n_chars = 0;
01633 
01634         /* We always need two end-of-buffer characters.  The first causes
01635          * a transition to the end-of-buffer state.  The second causes
01636          * a jam in that state.
01637          */
01638         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01639         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01640 
01641         b->yy_buf_pos = &b->yy_ch_buf[0];
01642 
01643         b->yy_at_bol = 1;
01644         b->yy_buffer_status = YY_BUFFER_NEW;
01645 
01646         if ( b == YY_CURRENT_BUFFER )
01647                 yy_load_buffer_state( );
01648 }
01649 
01650 /** Pushes the new state onto the stack. The new state becomes
01651  *  the current state. This function will allocate the stack
01652  *  if necessary.
01653  *  @param new_buffer The new state.
01654  *  
01655  */
01656 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
01657 {
01658         if (new_buffer == NULL)
01659                 return;
01660 
01661         yyensure_buffer_stack();
01662 
01663         /* This block is copied from yy_switch_to_buffer. */
01664         if ( YY_CURRENT_BUFFER )
01665                 {
01666                 /* Flush out information for old buffer. */
01667                 *(yy_c_buf_p) = (yy_hold_char);
01668                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01669                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01670                 }
01671 
01672         /* Only push if top exists. Otherwise, replace top. */
01673         if (YY_CURRENT_BUFFER)
01674                 (yy_buffer_stack_top)++;
01675         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01676 
01677         /* copied from yy_switch_to_buffer. */
01678         yy_load_buffer_state( );
01679         (yy_did_buffer_switch_on_eof) = 1;
01680 }
01681 
01682 /** Removes and deletes the top of the stack, if present.
01683  *  The next element becomes the new top.
01684  *  
01685  */
01686 void yypop_buffer_state (void)
01687 {
01688         if (!YY_CURRENT_BUFFER)
01689                 return;
01690 
01691         yy_delete_buffer(YY_CURRENT_BUFFER );
01692         YY_CURRENT_BUFFER_LVALUE = NULL;
01693         if ((yy_buffer_stack_top) > 0)
01694                 --(yy_buffer_stack_top);
01695 
01696         if (YY_CURRENT_BUFFER) {
01697                 yy_load_buffer_state( );
01698                 (yy_did_buffer_switch_on_eof) = 1;
01699         }
01700 }
01701 
01702 /* Allocates the stack if it does not exist.
01703  *  Guarantees space for at least one push.
01704  */
01705 static void yyensure_buffer_stack (void)
01706 {
01707         int num_to_alloc;
01708     
01709         if (!(yy_buffer_stack)) {
01710 
01711                 /* First allocation is just for 2 elements, since we don't know if this
01712                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
01713                  * immediate realloc on the next call.
01714          */
01715                 num_to_alloc = 1;
01716                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
01717                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01718                                                                 );
01719                 if ( ! (yy_buffer_stack) )
01720                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
01721                                                                   
01722                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01723                                 
01724                 (yy_buffer_stack_max) = num_to_alloc;
01725                 (yy_buffer_stack_top) = 0;
01726                 return;
01727         }
01728 
01729         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
01730 
01731                 /* Increase the buffer to prepare for a possible push. */
01732                 int grow_size = 8 /* arbitrary grow size */;
01733 
01734                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
01735                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
01736                                                                 ((yy_buffer_stack),
01737                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01738                                                                 );
01739                 if ( ! (yy_buffer_stack) )
01740                         YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
01741 
01742                 /* zero only the new slots.*/
01743                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
01744                 (yy_buffer_stack_max) = num_to_alloc;
01745         }
01746 }
01747 
01748 /** Setup the input buffer state to scan directly from a user-specified character buffer.
01749  * @param base the character buffer
01750  * @param size the size in bytes of the character buffer
01751  * 
01752  * @return the newly allocated buffer state object. 
01753  */
01754 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
01755 {
01756         YY_BUFFER_STATE b;
01757     
01758         if ( size < 2 ||
01759              base[size-2] != YY_END_OF_BUFFER_CHAR ||
01760              base[size-1] != YY_END_OF_BUFFER_CHAR )
01761                 /* They forgot to leave room for the EOB's. */
01762                 return 0;
01763 
01764         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
01765         if ( ! b )
01766                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01767 
01768         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
01769         b->yy_buf_pos = b->yy_ch_buf = base;
01770         b->yy_is_our_buffer = 0;
01771         b->yy_input_file = 0;
01772         b->yy_n_chars = b->yy_buf_size;
01773         b->yy_is_interactive = 0;
01774         b->yy_at_bol = 1;
01775         b->yy_fill_buffer = 0;
01776         b->yy_buffer_status = YY_BUFFER_NEW;
01777 
01778         yy_switch_to_buffer(b  );
01779 
01780         return b;
01781 }
01782 
01783 /** Setup the input buffer state to scan a string. The next call to yylex() will
01784  * scan from a @e copy of @a str.
01785  * @param yystr a NUL-terminated string to scan
01786  * 
01787  * @return the newly allocated buffer state object.
01788  * @note If you want to scan bytes that may contain NUL values, then use
01789  *       yy_scan_bytes() instead.
01790  */
01791 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
01792 {
01793     
01794         return yy_scan_bytes(yystr,strlen(yystr) );
01795 }
01796 
01797 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
01798  * scan from a @e copy of @a bytes.
01799  * @param yybytes the byte buffer to scan
01800  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
01801  * 
01802  * @return the newly allocated buffer state object.
01803  */
01804 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
01805 {
01806         YY_BUFFER_STATE b;
01807         char *buf;
01808         yy_size_t n;
01809         int i;
01810     
01811         /* Get memory for full buffer, including space for trailing EOB's. */
01812         n = _yybytes_len + 2;
01813         buf = (char *) yyalloc(n  );
01814         if ( ! buf )
01815                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01816 
01817         for ( i = 0; i < _yybytes_len; ++i )
01818                 buf[i] = yybytes[i];
01819 
01820         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01821 
01822         b = yy_scan_buffer(buf,n );
01823         if ( ! b )
01824                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01825 
01826         /* It's okay to grow etc. this buffer, and we should throw it
01827          * away when we're done.
01828          */
01829         b->yy_is_our_buffer = 1;
01830 
01831         return b;
01832 }
01833 
01834 #ifndef YY_EXIT_FAILURE
01835 #define YY_EXIT_FAILURE 2
01836 #endif
01837 
01838 static void yy_fatal_error (yyconst char* msg )
01839 {
01840         (void) fprintf( stderr, "%s\n", msg );
01841         exit( YY_EXIT_FAILURE );
01842 }
01843 
01844 /* Redefine yyless() so it works in section 3 code. */
01845 
01846 #undef yyless
01847 #define yyless(n) \
01848         do \
01849                 { \
01850                 /* Undo effects of setting up yytext. */ \
01851         int yyless_macro_arg = (n); \
01852         YY_LESS_LINENO(yyless_macro_arg);\
01853                 yytext[yyleng] = (yy_hold_char); \
01854                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
01855                 (yy_hold_char) = *(yy_c_buf_p); \
01856                 *(yy_c_buf_p) = '\0'; \
01857                 yyleng = yyless_macro_arg; \
01858                 } \
01859         while ( 0 )
01860 
01861 /* Accessor  methods (get/set functions) to struct members. */
01862 
01863 /** Get the current line number.
01864  * 
01865  */
01866 int yyget_lineno  (void)
01867 {
01868         
01869     return yylineno;
01870 }
01871 
01872 /** Get the input stream.
01873  * 
01874  */
01875 FILE *yyget_in  (void)
01876 {
01877         return yyin;
01878 }
01879 
01880 /** Get the output stream.
01881  * 
01882  */
01883 FILE *yyget_out  (void)
01884 {
01885         return yyout;
01886 }
01887 
01888 /** Get the length of the current token.
01889  * 
01890  */
01891 int yyget_leng  (void)
01892 {
01893         return yyleng;
01894 }
01895 
01896 /** Get the current token.
01897  * 
01898  */
01899 
01900 char *yyget_text  (void)
01901 {
01902         return yytext;
01903 }
01904 
01905 /** Set the current line number.
01906  * @param line_number
01907  * 
01908  */
01909 void yyset_lineno (int  line_number )
01910 {
01911     
01912     yylineno = line_number;
01913 }
01914 
01915 /** Set the input stream. This does not discard the current
01916  * input buffer.
01917  * @param in_str A readable stream.
01918  * 
01919  * @see yy_switch_to_buffer
01920  */
01921 void yyset_in (FILE *  in_str )
01922 {
01923         yyin = in_str ;
01924 }
01925 
01926 void yyset_out (FILE *  out_str )
01927 {
01928         yyout = out_str ;
01929 }
01930 
01931 int yyget_debug  (void)
01932 {
01933         return yy_flex_debug;
01934 }
01935 
01936 void yyset_debug (int  bdebug )
01937 {
01938         yy_flex_debug = bdebug ;
01939 }
01940 
01941 static int yy_init_globals (void)
01942 {
01943         /* Initialization is the same as for the non-reentrant scanner.
01944      * This function is called from yylex_destroy(), so don't allocate here.
01945      */
01946 
01947     (yy_buffer_stack) = 0;
01948     (yy_buffer_stack_top) = 0;
01949     (yy_buffer_stack_max) = 0;
01950     (yy_c_buf_p) = (char *) 0;
01951     (yy_init) = 0;
01952     (yy_start) = 0;
01953 
01954 /* Defined in main.c */
01955 #ifdef YY_STDINIT
01956     yyin = stdin;
01957     yyout = stdout;
01958 #else
01959     yyin = (FILE *) 0;
01960     yyout = (FILE *) 0;
01961 #endif
01962 
01963     /* For future reference: Set errno on error, since we are called by
01964      * yylex_init()
01965      */
01966     return 0;
01967 }
01968 
01969 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
01970 int yylex_destroy  (void)
01971 {
01972     
01973     /* Pop the buffer stack, destroying each element. */
01974         while(YY_CURRENT_BUFFER){
01975                 yy_delete_buffer(YY_CURRENT_BUFFER  );
01976                 YY_CURRENT_BUFFER_LVALUE = NULL;
01977                 yypop_buffer_state();
01978         }
01979 
01980         /* Destroy the stack itself. */
01981         yyfree((yy_buffer_stack) );
01982         (yy_buffer_stack) = NULL;
01983 
01984     /* Reset the globals. This is important in a non-reentrant scanner so the next time
01985      * yylex() is called, initialization will occur. */
01986     yy_init_globals( );
01987 
01988     return 0;
01989 }
01990 
01991 /*
01992  * Internal utility routines.
01993  */
01994 
01995 #ifndef yytext_ptr
01996 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
01997 {
01998         register int i;
01999         for ( i = 0; i < n; ++i )
02000                 s1[i] = s2[i];
02001 }
02002 #endif
02003 
02004 #ifdef YY_NEED_STRLEN
02005 static int yy_flex_strlen (yyconst char * s )
02006 {
02007         register int n;
02008         for ( n = 0; s[n]; ++n )
02009                 ;
02010 
02011         return n;
02012 }
02013 #endif
02014 
02015 void *yyalloc (yy_size_t  size )
02016 {
02017         return (void *) malloc( size );
02018 }
02019 
02020 void *yyrealloc  (void * ptr, yy_size_t  size )
02021 {
02022         /* The cast to (char *) in the following accommodates both
02023          * implementations that use char* generic pointers, and those
02024          * that use void* generic pointers.  It works with the latter
02025          * because both ANSI C and C++ allow castless assignment from
02026          * any pointer type to void*, and deal with argument conversions
02027          * as though doing an assignment.
02028          */
02029         return (void *) realloc( (char *) ptr, size );
02030 }
02031 
02032 void yyfree (void * ptr )
02033 {
02034         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
02035 }
02036 
02037 #define YYTABLES_NAME "yytables"
02038 
02039 #line 270 "src/Robots/LoBot/config/LoIniFileLexer.l"
Generated on Sun May 8 08:05:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3