LoMetlogParser.C

00001 #line 2 "src/Robots/LoBot/metlog/LoMetlogParser.C"
00002 
00003 #line 4 "src/Robots/LoBot/metlog/LoMetlogParser.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 /* An opaque pointer. */
00123 #ifndef YY_TYPEDEF_YY_SCANNER_T
00124 #define YY_TYPEDEF_YY_SCANNER_T
00125 typedef void* yyscan_t;
00126 #endif
00127 
00128 /* For convenience, these vars (plus the bison vars far below)
00129    are macros in the reentrant scanner. */
00130 #define yyin yyg->yyin_r
00131 #define yyout yyg->yyout_r
00132 #define yyextra yyg->yyextra_r
00133 #define yyleng yyg->yyleng_r
00134 #define yytext yyg->yytext_r
00135 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
00136 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
00137 #define yy_flex_debug yyg->yy_flex_debug_r
00138 
00139 /* Enter a start condition.  This macro really ought to take a parameter,
00140  * but we do it the disgusting crufty way forced on us by the ()-less
00141  * definition of BEGIN.
00142  */
00143 #define BEGIN yyg->yy_start = 1 + 2 *
00144 
00145 /* Translate the current start state into a value that can be later handed
00146  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00147  * compatibility.
00148  */
00149 #define YY_START ((yyg->yy_start - 1) / 2)
00150 #define YYSTATE YY_START
00151 
00152 /* Action number for EOF rule of a given start state. */
00153 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00154 
00155 /* Special action meaning "start processing a new file". */
00156 #define YY_NEW_FILE lomet_parser_restart(yyin ,yyscanner )
00157 
00158 #define YY_END_OF_BUFFER_CHAR 0
00159 
00160 /* Size of default input buffer. */
00161 #ifndef YY_BUF_SIZE
00162 #ifdef __ia64__
00163 /* On IA-64, the buffer size is 16k, not 8k.
00164  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
00165  * Ditto for the __ia64__ case accordingly.
00166  */
00167 #define YY_BUF_SIZE 32768
00168 #else
00169 #define YY_BUF_SIZE 16384
00170 #endif /* __ia64__ */
00171 #endif
00172 
00173 /* The state buf must be large enough to hold one state per character in the main buffer.
00174  */
00175 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00176 
00177 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00178 #define YY_TYPEDEF_YY_BUFFER_STATE
00179 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00180 #endif
00181 
00182 #define EOB_ACT_CONTINUE_SCAN 0
00183 #define EOB_ACT_END_OF_FILE 1
00184 #define EOB_ACT_LAST_MATCH 2
00185 
00186     #define YY_LESS_LINENO(n)
00187     
00188 /* Return all but the first "n" matched characters back to the input stream. */
00189 #define yyless(n) \
00190         do \
00191                 { \
00192                 /* Undo effects of setting up yytext. */ \
00193         int yyless_macro_arg = (n); \
00194         YY_LESS_LINENO(yyless_macro_arg);\
00195                 *yy_cp = yyg->yy_hold_char; \
00196                 YY_RESTORE_YY_MORE_OFFSET \
00197                 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00198                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00199                 } \
00200         while ( 0 )
00201 
00202 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
00203 
00204 #ifndef YY_TYPEDEF_YY_SIZE_T
00205 #define YY_TYPEDEF_YY_SIZE_T
00206 typedef size_t yy_size_t;
00207 #endif
00208 
00209 #ifndef YY_STRUCT_YY_BUFFER_STATE
00210 #define YY_STRUCT_YY_BUFFER_STATE
00211 struct yy_buffer_state
00212         {
00213         FILE *yy_input_file;
00214 
00215         char *yy_ch_buf;                /* input buffer */
00216         char *yy_buf_pos;               /* current position in input buffer */
00217 
00218         /* Size of input buffer in bytes, not including room for EOB
00219          * characters.
00220          */
00221         yy_size_t yy_buf_size;
00222 
00223         /* Number of characters read into yy_ch_buf, not including EOB
00224          * characters.
00225          */
00226         int yy_n_chars;
00227 
00228         /* Whether we "own" the buffer - i.e., we know we created it,
00229          * and can realloc() it to grow it, and should free() it to
00230          * delete it.
00231          */
00232         int yy_is_our_buffer;
00233 
00234         /* Whether this is an "interactive" input source; if so, and
00235          * if we're using stdio for input, then we want to use getc()
00236          * instead of fread(), to make sure we stop fetching input after
00237          * each newline.
00238          */
00239         int yy_is_interactive;
00240 
00241         /* Whether we're considered to be at the beginning of a line.
00242          * If so, '^' rules will be active on the next match, otherwise
00243          * not.
00244          */
00245         int yy_at_bol;
00246 
00247     int yy_bs_lineno; /**< The line count. */
00248     int yy_bs_column; /**< The column count. */
00249     
00250         /* Whether to try to fill the input buffer when we reach the
00251          * end of it.
00252          */
00253         int yy_fill_buffer;
00254 
00255         int yy_buffer_status;
00256 
00257 #define YY_BUFFER_NEW 0
00258 #define YY_BUFFER_NORMAL 1
00259         /* When an EOF's been seen but there's still some text to process
00260          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00261          * shouldn't try reading from the input source any more.  We might
00262          * still have a bunch of tokens to match, though, because of
00263          * possible backing-up.
00264          *
00265          * When we actually see the EOF, we change the status to "new"
00266          * (via lomet_parser_restart()), so that the user can continue scanning by
00267          * just pointing yyin at a new input file.
00268          */
00269 #define YY_BUFFER_EOF_PENDING 2
00270 
00271         };
00272 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00273 
00274 /* We provide macros for accessing buffer states in case in the
00275  * future we want to put the buffer states in a more general
00276  * "scanner state".
00277  *
00278  * Returns the top of the stack, or NULL.
00279  */
00280 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
00281                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
00282                           : NULL)
00283 
00284 /* Same as previous macro, but useful when we know that the buffer stack is not
00285  * NULL or when we need an lvalue. For internal use only.
00286  */
00287 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
00288 
00289 void lomet_parser_restart (FILE *input_file ,yyscan_t yyscanner );
00290 void lomet_parser__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00291 YY_BUFFER_STATE lomet_parser__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
00292 void lomet_parser__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00293 void lomet_parser__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
00294 void lomet_parser_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
00295 void lomet_parser_pop_buffer_state (yyscan_t yyscanner );
00296 
00297 static void lomet_parser_ensure_buffer_stack (yyscan_t yyscanner );
00298 static void lomet_parser__load_buffer_state (yyscan_t yyscanner );
00299 static void lomet_parser__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
00300 
00301 #define YY_FLUSH_BUFFER lomet_parser__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
00302 
00303 YY_BUFFER_STATE lomet_parser__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
00304 YY_BUFFER_STATE lomet_parser__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
00305 YY_BUFFER_STATE lomet_parser__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
00306 
00307 void *lomet_parser_alloc (yy_size_t ,yyscan_t yyscanner );
00308 void *lomet_parser_realloc (void *,yy_size_t ,yyscan_t yyscanner );
00309 void lomet_parser_free (void * ,yyscan_t yyscanner );
00310 
00311 #define yy_new_buffer lomet_parser__create_buffer
00312 
00313 #define yy_set_interactive(is_interactive) \
00314         { \
00315         if ( ! YY_CURRENT_BUFFER ){ \
00316         lomet_parser_ensure_buffer_stack (yyscanner); \
00317                 YY_CURRENT_BUFFER_LVALUE =    \
00318             lomet_parser__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00319         } \
00320         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00321         }
00322 
00323 #define yy_set_bol(at_bol) \
00324         { \
00325         if ( ! YY_CURRENT_BUFFER ){\
00326         lomet_parser_ensure_buffer_stack (yyscanner); \
00327                 YY_CURRENT_BUFFER_LVALUE =    \
00328             lomet_parser__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
00329         } \
00330         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00331         }
00332 
00333 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00334 
00335 #define lomet_parser_wrap(n) 1
00336 #define YY_SKIP_YYWRAP
00337 
00338 typedef unsigned char YY_CHAR;
00339 
00340 typedef int yy_state_type;
00341 
00342 #define yytext_ptr yytext_r
00343 
00344 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
00345 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
00346 static int yy_get_next_buffer (yyscan_t yyscanner );
00347 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
00348 
00349 /* Done after the current pattern has been matched and before the
00350  * corresponding action - sets up yytext.
00351  */
00352 #define YY_DO_BEFORE_ACTION \
00353         yyg->yytext_ptr = yy_bp; \
00354         yyleng = (size_t) (yy_cp - yy_bp); \
00355         yyg->yy_hold_char = *yy_cp; \
00356         *yy_cp = '\0'; \
00357         yyg->yy_c_buf_p = yy_cp;
00358 
00359 #define YY_NUM_RULES 17
00360 #define YY_END_OF_BUFFER 18
00361 /* This struct is not used in this scanner,
00362    but its presence is necessary. */
00363 struct yy_trans_info
00364         {
00365         flex_int32_t yy_verify;
00366         flex_int32_t yy_nxt;
00367         };
00368 static yyconst flex_int16_t yy_accept[116] =
00369     {   0,
00370         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00371        18,   17,   17,   17,   17,   17,   17,   17,    1,   17,
00372         4,   11,   11,   10,   13,   13,   12,   16,   16,   15,
00373         0,    0,    0,    0,    0,    0,    0,    1,    0,    4,
00374        10,   12,   15,   15,    0,    0,    0,    0,    0,    0,
00375         0,   15,    9,    0,    0,    0,    0,    0,    0,    0,
00376         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00377         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00378         0,    0,    0,    0,    8,    0,    0,    0,    0,    0,
00379         0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
00380 
00381         0,    0,    0,    3,    2,    0,    0,    0,    0,    5,
00382         0,    6,    7,   14,    0
00383     } ;
00384 
00385 static yyconst flex_int32_t yy_ec[256] =
00386     {   0,
00387         1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
00388         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00389         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00390         1,    3,    1,    1,    1,    1,    1,    1,    1,    1,
00391         1,    1,    4,    1,    4,    5,    1,    6,    6,    6,
00392         6,    6,    6,    6,    6,    6,    6,    1,    1,    1,
00393         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00394         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00395         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00396         1,    1,    1,    1,    7,    1,    8,    9,   10,   11,
00397 
00398        12,    1,   13,   14,   15,    1,   16,   17,   18,   19,
00399        20,   21,    1,   22,   23,   24,   25,    1,    1,   26,
00400        27,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00401         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00402         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00403         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00404         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00405         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00406         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00407         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00408 
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         1,    1,    1,    1,    1
00415     } ;
00416 
00417 static yyconst flex_int32_t yy_meta[28] =
00418     {   0,
00419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00420         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00421         1,    1,    1,    1,    1,    1,    1
00422     } ;
00423 
00424 static yyconst flex_int16_t yy_base[122] =
00425     {   0,
00426         0,   19,  131,  130,    0,    1,    9,   12,   28,   31,
00427       131,  134,  105,    1,  116,  116,  115,  104,  119,  122,
00428       134,  134,  117,  116,  134,  115,  114,  134,  113,   15,
00429       100,  105,   92,   97,  106,  101,  104,  105,  108,  134,
00430       103,  102,   33,  101,   85,   83,   82,   92,   92,   85,
00431        90,   93,  134,   85,   82,   89,   81,   79,   77,   80,
00432        81,   78,   77,   69,   72,   67,   77,   58,   72,   69,
00433        62,   70,   55,   54,   74,   73,   62,   47,   61,   50,
00434        58,   57,   66,   65,  134,   52,   46,   45,   23,   41,
00435        53,   54,   53,   40,   38,   34,   49,   39,   38,   31,
00436 
00437        41,   32,   27,  134,  134,   38,   37,   27,   35,  134,
00438        34,  134,  134,  134,  134,   39,   28,   25,    9,    7,
00439         0
00440     } ;
00441 
00442 static yyconst flex_int16_t yy_def[122] =
00443     {   0,
00444       116,  116,  117,  117,  118,  118,  119,  119,  120,  120,
00445       115,  115,  115,  115,  115,  115,  115,  115,  115,  121,
00446       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00447       115,  115,  115,  115,  115,  115,  115,  115,  121,  115,
00448       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00449       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00450       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00451       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00452       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00453       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00454 
00455       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00456       115,  115,  115,  115,    0,  115,  115,  115,  115,  115,
00457       115
00458     } ;
00459 
00460 static yyconst flex_int16_t yy_nxt[162] =
00461     {   0,
00462        39,   12,   12,   23,   23,   24,   24,   28,   13,   25,
00463        12,   14,   26,   12,   27,   26,   15,   27,   32,   44,
00464        43,   16,   17,   18,   19,   22,   33,   13,   20,   12,
00465        14,   29,   12,   30,   29,   15,   30,   44,   43,   12,
00466        16,   17,   18,   94,  114,   95,  113,  112,  111,  110,
00467       109,  108,  107,  106,  105,  104,  103,  102,  101,  100,
00468        99,   98,   97,   96,   93,   92,   91,   90,   89,   88,
00469        87,   86,   85,   84,   83,   82,   81,   80,   79,   78,
00470        77,   76,   75,   74,   73,   72,   71,   70,   69,   68,
00471        67,   66,   65,   64,   63,   62,   61,   60,   52,   59,
00472 
00473        58,   57,   56,   55,   54,   53,   52,   42,   41,   40,
00474        38,   51,   50,   49,   48,   47,   46,   45,   43,   42,
00475        42,   41,   41,   40,   38,   37,   36,   35,   34,   31,
00476       115,   21,   21,   11,  115,  115,  115,  115,  115,  115,
00477       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00478       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00479       115
00480     } ;
00481 
00482 static yyconst flex_int16_t yy_chk[162] =
00483     {   0,
00484       121,    5,    6,    5,    6,    5,    6,  120,    1,  119,
00485         7,    1,    7,    8,    7,    8,    1,    8,   14,   30,
00486        30,    1,    1,    1,    2,  118,   14,    2,  117,    9,
00487         2,    9,   10,    9,   10,    2,   10,   43,   43,  116,
00488         2,    2,    2,   89,  111,   89,  109,  108,  107,  106,
00489       103,  102,  101,  100,   99,   98,   97,   96,   95,   94,
00490        93,   92,   91,   90,   88,   87,   86,   84,   83,   82,
00491        81,   80,   79,   78,   77,   76,   75,   74,   73,   72,
00492        71,   70,   69,   68,   67,   66,   65,   64,   63,   62,
00493        61,   60,   59,   58,   57,   56,   55,   54,   52,   51,
00494 
00495        50,   49,   48,   47,   46,   45,   44,   42,   41,   39,
00496        38,   37,   36,   35,   34,   33,   32,   31,   29,   27,
00497        26,   24,   23,   20,   19,   18,   17,   16,   15,   13,
00498        11,    4,    3,  115,  115,  115,  115,  115,  115,  115,
00499       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00500       115,  115,  115,  115,  115,  115,  115,  115,  115,  115,
00501       115
00502     } ;
00503 
00504 /* The intent behind this definition is that it'll catch
00505  * any uses of REJECT which flex missed.
00506  */
00507 #define REJECT reject_used_but_not_detected
00508 #define yymore() yymore_used_but_not_detected
00509 #define YY_MORE_ADJ 0
00510 #define YY_RESTORE_YY_MORE_OFFSET
00511 #line 1 "src/Robots/LoBot/metlog/LoMetlogParser.l"
00512 /* -*- mode: C;-*- */
00513 #line 3 "src/Robots/LoBot/metlog/LoMetlogParser.l"
00514 /*
00515    LoMetlogParser.l -- lex source for parsing Robolocust metrics log files
00516 
00517    This file defines various rules for parsing Robolocust metrics log
00518    files. We don't really need a grammar for that; therefore, we don't
00519    need yacc/bison; lex alone will do a fine job. That's why this
00520    "lexical analyzer" is referred to as a "parser." In fact, this lexer
00521    really is a parser because it isn't concerned with tokenization;
00522    instead, it simply looks for certain patterns in the input and
00523    immediately takes appropriate action to parse that input.
00524 
00525    NOTE: This parser is designed specifically for the metlog files spit
00526    out by the trajectory related experiments concerned with measuring the
00527    performance of LGMD-based obstacle avoidance algorithms in a local
00528    navigation task involving a slalom course. It won't work with
00529    arbitrary metlog files.
00530 */
00531 
00532 // Primary maintainer for this file: mviswana usc edu
00533 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/metlog/LoMetlogParser.C $
00534 // $Id: LoMetlogParser.C 14285 2010-12-01 17:33:15Z mviswana $
00535 
00536 // lobot headers
00537 #include "Robots/LoBot/metlog/LoExperiment.H"
00538 #include "Robots/LoBot/metlog/LoPointTypes.H"
00539 #include "Robots/LoBot/util/LoString.H"
00540 
00541 // In the code generated by flex, the yy_get_next_buffer() function
00542 // performs a comparison between a signed and unsigned variable. This
00543 // produces a compiler warning, which results in an error because, by
00544 // default, INVT builds are setup to treat all warnings as errors. Since
00545 // we really can't fix the code generated by flex, we resort to turning
00546 // off this warning so that the .C file generated from this Lex source
00547 // builds without any hassles.
00548 //
00549 // DEVNOTE: On Debian etch, which has GCC 4.1.2, this works fine because,
00550 // apparently, the compiler does not care for the signed-unsigned match
00551 // in yy_get_next_buffer().
00552 //
00553 // On Debian lenny, which comes with GCC 4.3.2, and on Ubuntu 10.04LTS
00554 // (Lucid Lynx), which comes with GCC 4.4.3, the diagnostic pragma is
00555 // supported. Thus, we test for at least version 4.3 of GCC.
00556 //
00557 // This may not work on other systems with other versions of GCC. An
00558 // alternative workaround is not known for this particular problem.
00559 #if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
00560 #pragma GCC diagnostic ignored "-Wsign-compare"
00561 #endif
00562 
00563 // The metlog loader object, which is responsible for loading and parsing
00564 // Robolocust metrics logs, uses this lex-generated scanner for the
00565 // desired parsing functionality. The parsed results are stored in an
00566 // instance of the lobot::Experiment class. The loader object has to
00567 // create the Experiment that will receive the parsing results and pass
00568 // it to this scanner module using flex's extra data mechanism.
00569 //
00570 // By default, flex considers extra data to be a void* that should be
00571 // casted as required. However, we can use this macro to redefine the
00572 // extra data's type so as to avoid unnecessary casting.
00573 #define YY_EXTRA_TYPE lobot::Experiment*
00574 
00575 // When no rules match, flex's default action is to echo the input to
00576 // stdout. This can be quite annoying when we would like our program to
00577 // go about its work with minimal chatter.
00578 //
00579 // One way to suppress the echo action is to define a fallback rule at
00580 // the end of the rules section that applies when none of the others
00581 // match and have an empty action. However, for some strange reason,
00582 // this does not always work.
00583 //
00584 // As a workaround, we define the ECHO macro used by flex to be empty.
00585 // This seems to work fine.
00586 #define ECHO
00587 
00588 /*
00589    These states are used by the scanner for extracting robot position and
00590    speed information from the metlogs.
00591 */
00592 
00593 /*
00594    Since this scanner will be used to parse multiple log files in
00595    parallel, we need it to be reentrant to ensure that it works properly
00596    in a multithreaded environment.
00597 */
00598 /*
00599    The scanner is used to parse metrics logs stored on disk. It will
00600    never be used interactively by end users.
00601 */
00602 /*
00603    The lomet program uses another lex-based scanner for tokenizing the
00604    config file. To ensure this one doesn't clash with that, we change the
00605    default function prefixes from "yy" to the following.
00606 */
00607 /*
00608    Even though lex generates C code, this scanner is actually part of a
00609    C++ program. Therefore, we might as well have it generate the code in
00610    a file that the compiler and build system will readily recognize as
00611    C++. Furthermore, because of the way the INVT automatic dependency
00612    calculator works, we also need a corresponding header file that we can
00613    include in the client module's C++ source file to get the final link
00614    step to work properly.
00615 
00616    DEVNOTE: The build takes place in the saliency root directory.
00617    Consequently, we must specify the full pathname relative to that
00618    directory to get flex to send the C source and header files to the
00619    proper location under the Robolocust root. If we were to use only the
00620    base file names, e.g., LoMetlogParser.C, the output would end up in
00621    the saliency root directory and would not be found by the other
00622    Robolocust modules that depend on this parser.
00623 */
00624 /*
00625    Instruct flex to suppress unnecessary functions so that we don't get
00626    any warnings (which can be show stoppers no thanks to INVT's use of
00627    -Werror in its build system).
00628 */
00629 /*----------------------------- LEX RULES -----------------------------*/
00630 #line 631 "src/Robots/LoBot/metlog/LoMetlogParser.C"
00631 
00632 #define INITIAL 0
00633 #define LOMP_GOAL_POSE 1
00634 #define LOMP_POSE_X 2
00635 #define LOMP_POSE_Y 3
00636 #define LOMP_SPEED 4
00637 
00638 #ifndef YY_NO_UNISTD_H
00639 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00640  * down here because we want the user's section 1 to have been scanned first.
00641  * The user has a chance to override it with an option.
00642  */
00643 #include <unistd.h>
00644 #endif
00645 
00646 #ifndef YY_EXTRA_TYPE
00647 #define YY_EXTRA_TYPE void *
00648 #endif
00649 
00650 /* Holds the entire state of the reentrant scanner. */
00651 struct yyguts_t
00652     {
00653 
00654     /* User-defined. Not touched by flex. */
00655     YY_EXTRA_TYPE yyextra_r;
00656 
00657     /* The rest are the same as the globals declared in the non-reentrant scanner. */
00658     FILE *yyin_r, *yyout_r;
00659     size_t yy_buffer_stack_top; /**< index of top of stack. */
00660     size_t yy_buffer_stack_max; /**< capacity of stack. */
00661     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
00662     char yy_hold_char;
00663     int yy_n_chars;
00664     int yyleng_r;
00665     char *yy_c_buf_p;
00666     int yy_init;
00667     int yy_start;
00668     int yy_did_buffer_switch_on_eof;
00669     int yy_start_stack_ptr;
00670     int yy_start_stack_depth;
00671     int *yy_start_stack;
00672     yy_state_type yy_last_accepting_state;
00673     char* yy_last_accepting_cpos;
00674 
00675     int yylineno_r;
00676     int yy_flex_debug_r;
00677 
00678     char *yytext_r;
00679     int yy_more_flag;
00680     int yy_more_len;
00681 
00682     }; /* end struct yyguts_t */
00683 
00684 static int yy_init_globals (yyscan_t yyscanner );
00685 
00686 int lomet_parser_lex_init (yyscan_t* scanner);
00687 
00688 int lomet_parser_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
00689 
00690 /* Accessor methods to globals.
00691    These are made visible to non-reentrant scanners for convenience. */
00692 
00693 int lomet_parser_lex_destroy (yyscan_t yyscanner );
00694 
00695 int lomet_parser_get_debug (yyscan_t yyscanner );
00696 
00697 void lomet_parser_set_debug (int debug_flag ,yyscan_t yyscanner );
00698 
00699 YY_EXTRA_TYPE lomet_parser_get_extra (yyscan_t yyscanner );
00700 
00701 void lomet_parser_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
00702 
00703 FILE *lomet_parser_get_in (yyscan_t yyscanner );
00704 
00705 void lomet_parser_set_in  (FILE * in_str ,yyscan_t yyscanner );
00706 
00707 FILE *lomet_parser_get_out (yyscan_t yyscanner );
00708 
00709 void lomet_parser_set_out  (FILE * out_str ,yyscan_t yyscanner );
00710 
00711 int lomet_parser_get_leng (yyscan_t yyscanner );
00712 
00713 char *lomet_parser_get_text (yyscan_t yyscanner );
00714 
00715 int lomet_parser_get_lineno (yyscan_t yyscanner );
00716 
00717 void lomet_parser_set_lineno (int line_number ,yyscan_t yyscanner );
00718 
00719 /* Macros after this point can all be overridden by user definitions in
00720  * section 1.
00721  */
00722 
00723 #ifndef YY_SKIP_YYWRAP
00724 #ifdef __cplusplus
00725 extern "C" int lomet_parser_wrap (yyscan_t yyscanner );
00726 #else
00727 extern int lomet_parser_wrap (yyscan_t yyscanner );
00728 #endif
00729 #endif
00730 
00731 #ifndef yytext_ptr
00732 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
00733 #endif
00734 
00735 #ifdef YY_NEED_STRLEN
00736 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
00737 #endif
00738 
00739 #ifndef YY_NO_INPUT
00740 
00741 #ifdef __cplusplus
00742 static int yyinput (yyscan_t yyscanner );
00743 #else
00744 static int input (yyscan_t yyscanner );
00745 #endif
00746 
00747 #endif
00748 
00749 /* Amount of stuff to slurp up with each read. */
00750 #ifndef YY_READ_BUF_SIZE
00751 #ifdef __ia64__
00752 /* On IA-64, the buffer size is 16k, not 8k */
00753 #define YY_READ_BUF_SIZE 16384
00754 #else
00755 #define YY_READ_BUF_SIZE 8192
00756 #endif /* __ia64__ */
00757 #endif
00758 
00759 /* Copy whatever the last rule matched to the standard output. */
00760 #ifndef ECHO
00761 /* This used to be an fputs(), but since the string might contain NUL's,
00762  * we now use fwrite().
00763  */
00764 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
00765 #endif
00766 
00767 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00768  * is returned in "result".
00769  */
00770 #ifndef YY_INPUT
00771 #define YY_INPUT(buf,result,max_size) \
00772         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00773                 { \
00774                 int c = '*'; \
00775                 size_t n; \
00776                 for ( n = 0; n < max_size && \
00777                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00778                         buf[n] = (char) c; \
00779                 if ( c == '\n' ) \
00780                         buf[n++] = (char) c; \
00781                 if ( c == EOF && ferror( yyin ) ) \
00782                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
00783                 result = n; \
00784                 } \
00785         else \
00786                 { \
00787                 errno=0; \
00788                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00789                         { \
00790                         if( errno != EINTR) \
00791                                 { \
00792                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00793                                 break; \
00794                                 } \
00795                         errno=0; \
00796                         clearerr(yyin); \
00797                         } \
00798                 }\
00799 \
00800 
00801 #endif
00802 
00803 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00804  * we don't want an extra ';' after the "return" because that will cause
00805  * some compilers to complain about unreachable statements.
00806  */
00807 #ifndef yyterminate
00808 #define yyterminate() return YY_NULL
00809 #endif
00810 
00811 /* Number of entries by which start-condition stack grows. */
00812 #ifndef YY_START_STACK_INCR
00813 #define YY_START_STACK_INCR 25
00814 #endif
00815 
00816 /* Report a fatal error. */
00817 #ifndef YY_FATAL_ERROR
00818 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
00819 #endif
00820 
00821 /* end tables serialization structures and prototypes */
00822 
00823 /* Default declaration of generated scanner - a define so the user can
00824  * easily add parameters.
00825  */
00826 #ifndef YY_DECL
00827 #define YY_DECL_IS_OURS 1
00828 
00829 extern int lomet_parser_lex (yyscan_t yyscanner);
00830 
00831 #define YY_DECL int lomet_parser_lex (yyscan_t yyscanner)
00832 #endif /* !YY_DECL */
00833 
00834 /* Code executed at the beginning of each rule, after yytext and yyleng
00835  * have been set up.
00836  */
00837 #ifndef YY_USER_ACTION
00838 #define YY_USER_ACTION
00839 #endif
00840 
00841 /* Code executed at the end of each rule. */
00842 #ifndef YY_BREAK
00843 #define YY_BREAK break;
00844 #endif
00845 
00846 #define YY_RULE_SETUP \
00847         if ( yyleng > 0 ) \
00848                 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
00849                                 (yytext[yyleng - 1] == '\n'); \
00850         YY_USER_ACTION
00851 
00852 /** The main scanner function which does all the work.
00853  */
00854 YY_DECL
00855 {
00856         register yy_state_type yy_current_state;
00857         register char *yy_cp, *yy_bp;
00858         register int yy_act;
00859     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
00860 
00861 #line 134 "src/Robots/LoBot/metlog/LoMetlogParser.l"
00862 
00863 
00864 
00865 // Each entry in a Robolocust metrics log begins with a time stamp
00866 // expressed as the number of milliseconds elapsed since the Unix epoch.
00867 // For the most part, we don't care about these time stamps; however, for
00868 // some metlog entries, we do want to record them.
00869 //
00870 // To avoid the hassle of trying to backtrack our way to the start of the
00871 // line on lines that require the time stamps recorded, we simply record
00872 // the time stamp on each line in a temporary, local variable as we
00873 // encounter these stamps. Then, when we come across an entry where we
00874 // require the time stamp, all we need to do is use the above-mentioned
00875 // local variable, which is defined below.
00876 long long int lomp_time_stamp = 0 ;
00877 
00878 // This variable keeps track of the proper lobot::Experiment position
00879 // list into which we should insert the next piece of position
00880 // information that we come across in the metlog.
00881 lobot::PointListName lomp_pose_target = lobot::TRAJECTORY ;
00882 
00883 // These two variables keep track of the latest position coordinates
00884 // retrieved from the metlog.
00885 int lomp_pose_x = 0, lomp_pose_y = 0 ;
00886 
00887 
00888    /*
00889       This rule "captures" the time stamps that start off all log entries
00890       in a local variable within the lomet_parser_lex() function. Other rules that
00891       are interested in the time stamp can simply use the value stored in
00892       this variable.
00893    */
00894 #line 895 "src/Robots/LoBot/metlog/LoMetlogParser.C"
00895 
00896         if ( !yyg->yy_init )
00897                 {
00898                 yyg->yy_init = 1;
00899 
00900 #ifdef YY_USER_INIT
00901                 YY_USER_INIT;
00902 #endif
00903 
00904                 if ( ! yyg->yy_start )
00905                         yyg->yy_start = 1;      /* first start state */
00906 
00907                 if ( ! yyin )
00908                         yyin = stdin;
00909 
00910                 if ( ! yyout )
00911                         yyout = stdout;
00912 
00913                 if ( ! YY_CURRENT_BUFFER ) {
00914                         lomet_parser_ensure_buffer_stack (yyscanner);
00915                         YY_CURRENT_BUFFER_LVALUE =
00916                                 lomet_parser__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
00917                 }
00918 
00919                 lomet_parser__load_buffer_state(yyscanner );
00920                 }
00921 
00922         while ( 1 )             /* loops until end-of-file is reached */
00923                 {
00924                 yy_cp = yyg->yy_c_buf_p;
00925 
00926                 /* Support of yytext. */
00927                 *yy_cp = yyg->yy_hold_char;
00928 
00929                 /* yy_bp points to the position in yy_ch_buf of the start of
00930                  * the current run.
00931                  */
00932                 yy_bp = yy_cp;
00933 
00934                 yy_current_state = yyg->yy_start;
00935                 yy_current_state += YY_AT_BOL();
00936 yy_match:
00937                 do
00938                         {
00939                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00940                         if ( yy_accept[yy_current_state] )
00941                                 {
00942                                 yyg->yy_last_accepting_state = yy_current_state;
00943                                 yyg->yy_last_accepting_cpos = yy_cp;
00944                                 }
00945                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00946                                 {
00947                                 yy_current_state = (int) yy_def[yy_current_state];
00948                                 if ( yy_current_state >= 116 )
00949                                         yy_c = yy_meta[(unsigned int) yy_c];
00950                                 }
00951                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00952                         ++yy_cp;
00953                         }
00954                 while ( yy_current_state != 115 );
00955                 yy_cp = yyg->yy_last_accepting_cpos;
00956                 yy_current_state = yyg->yy_last_accepting_state;
00957 
00958 yy_find_action:
00959                 yy_act = yy_accept[yy_current_state];
00960 
00961                 YY_DO_BEFORE_ACTION;
00962 
00963 do_action:      /* This label is used only to access EOF actions. */
00964 
00965                 switch ( yy_act )
00966         { /* beginning of action switch */
00967                         case 0: /* must back up */
00968                         /* undo the effects of YY_DO_BEFORE_ACTION */
00969                         *yy_cp = yyg->yy_hold_char;
00970                         yy_cp = yyg->yy_last_accepting_cpos;
00971                         yy_current_state = yyg->yy_last_accepting_state;
00972                         goto yy_find_action;
00973 
00974 case 1:
00975 YY_RULE_SETUP
00976 #line 166 "src/Robots/LoBot/metlog/LoMetlogParser.l"
00977 {
00978       lomp_time_stamp = lobot::from_string<long long int>(yytext) ;
00979    }
00980         YY_BREAK
00981 /*
00982       Robolocust's goal behaviour spits out a fairly long metlog entry
00983       that spans two lines. When we're parsing these lines, we don't
00984       really care for most of the info they contain save for the time
00985       stamp and the robot's position within the map.
00986 
00987       The next three rules take care of the details of recording this
00988       information properly.
00989    */
00990 case 2:
00991 YY_RULE_SETUP
00992 #line 179 "src/Robots/LoBot/metlog/LoMetlogParser.l"
00993 {
00994       yyextra->start_time(lomp_time_stamp) ;
00995       BEGIN(LOMP_GOAL_POSE) ;
00996    }
00997         YY_BREAK
00998 case 3:
00999 YY_RULE_SETUP
01000 #line 184 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01001 {
01002       yyextra->finis_time(lomp_time_stamp) ;
01003       BEGIN(LOMP_GOAL_POSE) ;
01004    }
01005         YY_BREAK
01006 case 4:
01007 /* rule 4 can match eol */
01008 YY_RULE_SETUP
01009 #line 189 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01010 {
01011       /*
01012          Discard everything on the first line of the goal behaviour's
01013          metlog entry and then enter the LOMP_POSE_X state to read the
01014          robot's position's x-coordinate.
01015       */
01016       lomp_pose_target = lobot::TRAJECTORY ;
01017       BEGIN(LOMP_POSE_X) ;
01018    }
01019         YY_BREAK
01020 /*
01021       Rules for extracting the robot position reported by various other
01022       behaviours.
01023    */
01024 case 5:
01025 YY_RULE_SETUP
01026 #line 203 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01027 {
01028       lomp_pose_target = lobot::TRAJECTORY ;
01029       BEGIN(LOMP_POSE_X) ;
01030    }
01031         YY_BREAK
01032 case 6:
01033 YY_RULE_SETUP
01034 #line 208 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01035 {
01036       lomp_pose_target = lobot::EMERGENCY_STOP ;
01037       BEGIN(LOMP_POSE_X) ;
01038    }
01039         YY_BREAK
01040 case 7:
01041 YY_RULE_SETUP
01042 #line 213 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01043 {
01044       lomp_pose_target = lobot::LGMD_EXTRICATE ;
01045       BEGIN(LOMP_POSE_X) ;
01046    }
01047         YY_BREAK
01048 case 8:
01049 YY_RULE_SETUP
01050 #line 218 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01051 {
01052       lomp_pose_target = lobot::EXTRICATE ;
01053       BEGIN(LOMP_POSE_X) ;
01054    }
01055         YY_BREAK
01056 case 9:
01057 YY_RULE_SETUP
01058 #line 223 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01059 {
01060       lomp_pose_target = lobot::BUMP ;
01061       BEGIN(LOMP_POSE_X) ;
01062    }
01063         YY_BREAK
01064 /*
01065       When we want to read the robot's x-coordinate within the map, we
01066       discard everything that doesn't look like a number. Then, after we
01067       do find a number, we go into the LOMP_POSE_Y state to read the
01068       y-coordinate.
01069    */
01070 case 10:
01071 YY_RULE_SETUP
01072 #line 234 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01073 {
01074       lomp_pose_x = lobot::from_string<int>(yytext) ;
01075       BEGIN(LOMP_POSE_Y) ;
01076    }
01077         YY_BREAK
01078 case 11:
01079 YY_RULE_SETUP
01080 #line 239 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01081 {/* ignore everything that doesn't look like a number */}
01082         YY_BREAK
01083 /*
01084       Just as we did when we read the x-coordinate of the robot's
01085       position, we ignore everything that doesn't look like a number.
01086       When we finally do come across a valid number, we read it and then
01087       pass the x and y coordinates to the output lobot::Experiment
01088       object. Since the lobot::Experiment object contains several
01089       different lists of positions, we have to take care that we record
01090       the most recent position info parsed from the metlog in the
01091       appropriate list.
01092    */
01093 case 12:
01094 YY_RULE_SETUP
01095 #line 251 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01096 {
01097       lomp_pose_y = lobot::from_string<int>(yytext) ;
01098       yyextra->add_point(lomp_pose_target, lomp_pose_x, lomp_pose_y) ;
01099       BEGIN(INITIAL) ;
01100    }
01101         YY_BREAK
01102 case 13:
01103 YY_RULE_SETUP
01104 #line 257 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01105 {/* ignore everything that doesn't look like a number */}
01106         YY_BREAK
01107 /*
01108       The final metlog entry of interest to us is the one that records
01109       the robot's speed. The next three rules take care of the details of
01110       extracting this info from the log.
01111    */
01112 case 14:
01113 YY_RULE_SETUP
01114 #line 264 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01115 {
01116       BEGIN(LOMP_SPEED) ;
01117    }
01118         YY_BREAK
01119 case 15:
01120 YY_RULE_SETUP
01121 #line 268 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01122 {
01123       yyextra->add_speed(lobot::from_string<float>(yytext)) ;
01124       BEGIN(INITIAL) ;
01125    }
01126         YY_BREAK
01127 case 16:
01128 YY_RULE_SETUP
01129 #line 273 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01130 {/* ignore everything that doesn't look like a number */}
01131         YY_BREAK
01132 case 17:
01133 YY_RULE_SETUP
01134 #line 274 "src/Robots/LoBot/metlog/LoMetlogParser.l"
01135 ECHO;
01136         YY_BREAK
01137 #line 1138 "src/Robots/LoBot/metlog/LoMetlogParser.C"
01138 case YY_STATE_EOF(INITIAL):
01139 case YY_STATE_EOF(LOMP_GOAL_POSE):
01140 case YY_STATE_EOF(LOMP_POSE_X):
01141 case YY_STATE_EOF(LOMP_POSE_Y):
01142 case YY_STATE_EOF(LOMP_SPEED):
01143         yyterminate();
01144 
01145         case YY_END_OF_BUFFER:
01146                 {
01147                 /* Amount of text matched not including the EOB char. */
01148                 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
01149 
01150                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
01151                 *yy_cp = yyg->yy_hold_char;
01152                 YY_RESTORE_YY_MORE_OFFSET
01153 
01154                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01155                         {
01156                         /* We're scanning a new file or input source.  It's
01157                          * possible that this happened because the user
01158                          * just pointed yyin at a new source and called
01159                          * lomet_parser_lex().  If so, then we have to assure
01160                          * consistency between YY_CURRENT_BUFFER and our
01161                          * globals.  Here is the right place to do so, because
01162                          * this is the first action (other than possibly a
01163                          * back-up) that will match for the new input source.
01164                          */
01165                         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01166                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01167                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01168                         }
01169 
01170                 /* Note that here we test for yy_c_buf_p "<=" to the position
01171                  * of the first EOB in the buffer, since yy_c_buf_p will
01172                  * already have been incremented past the NUL character
01173                  * (since all states make transitions on EOB to the
01174                  * end-of-buffer state).  Contrast this with the test
01175                  * in input().
01176                  */
01177                 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01178                         { /* This was really a NUL. */
01179                         yy_state_type yy_next_state;
01180 
01181                         yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
01182 
01183                         yy_current_state = yy_get_previous_state( yyscanner );
01184 
01185                         /* Okay, we're now positioned to make the NUL
01186                          * transition.  We couldn't have
01187                          * yy_get_previous_state() go ahead and do it
01188                          * for us because it doesn't know how to deal
01189                          * with the possibility of jamming (and we don't
01190                          * want to build jamming into it because then it
01191                          * will run more slowly).
01192                          */
01193 
01194                         yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
01195 
01196                         yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01197 
01198                         if ( yy_next_state )
01199                                 {
01200                                 /* Consume the NUL. */
01201                                 yy_cp = ++yyg->yy_c_buf_p;
01202                                 yy_current_state = yy_next_state;
01203                                 goto yy_match;
01204                                 }
01205 
01206                         else
01207                                 {
01208                                 yy_cp = yyg->yy_last_accepting_cpos;
01209                                 yy_current_state = yyg->yy_last_accepting_state;
01210                                 goto yy_find_action;
01211                                 }
01212                         }
01213 
01214                 else switch ( yy_get_next_buffer( yyscanner ) )
01215                         {
01216                         case EOB_ACT_END_OF_FILE:
01217                                 {
01218                                 yyg->yy_did_buffer_switch_on_eof = 0;
01219 
01220                                 if ( lomet_parser_wrap(yyscanner ) )
01221                                         {
01222                                         /* Note: because we've taken care in
01223                                          * yy_get_next_buffer() to have set up
01224                                          * yytext, we can now set up
01225                                          * yy_c_buf_p so that if some total
01226                                          * hoser (like flex itself) wants to
01227                                          * call the scanner after we return the
01228                                          * YY_NULL, it'll still work - another
01229                                          * YY_NULL will get returned.
01230                                          */
01231                                         yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
01232 
01233                                         yy_act = YY_STATE_EOF(YY_START);
01234                                         goto do_action;
01235                                         }
01236 
01237                                 else
01238                                         {
01239                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
01240                                                 YY_NEW_FILE;
01241                                         }
01242                                 break;
01243                                 }
01244 
01245                         case EOB_ACT_CONTINUE_SCAN:
01246                                 yyg->yy_c_buf_p =
01247                                         yyg->yytext_ptr + yy_amount_of_matched_text;
01248 
01249                                 yy_current_state = yy_get_previous_state( yyscanner );
01250 
01251                                 yy_cp = yyg->yy_c_buf_p;
01252                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01253                                 goto yy_match;
01254 
01255                         case EOB_ACT_LAST_MATCH:
01256                                 yyg->yy_c_buf_p =
01257                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
01258 
01259                                 yy_current_state = yy_get_previous_state( yyscanner );
01260 
01261                                 yy_cp = yyg->yy_c_buf_p;
01262                                 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
01263                                 goto yy_find_action;
01264                         }
01265                 break;
01266                 }
01267 
01268         default:
01269                 YY_FATAL_ERROR(
01270                         "fatal flex scanner internal error--no action found" );
01271         } /* end of action switch */
01272                 } /* end of scanning one token */
01273 } /* end of lomet_parser_lex */
01274 
01275 /* yy_get_next_buffer - try to read in a new buffer
01276  *
01277  * Returns a code representing an action:
01278  *      EOB_ACT_LAST_MATCH -
01279  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01280  *      EOB_ACT_END_OF_FILE - end of file
01281  */
01282 static int yy_get_next_buffer (yyscan_t yyscanner)
01283 {
01284     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01285         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01286         register char *source = yyg->yytext_ptr;
01287         register int number_to_move, i;
01288         int ret_val;
01289 
01290         if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
01291                 YY_FATAL_ERROR(
01292                 "fatal flex scanner internal error--end of buffer missed" );
01293 
01294         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01295                 { /* Don't try to fill the buffer, so this is an EOF. */
01296                 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
01297                         {
01298                         /* We matched a single character, the EOB, so
01299                          * treat this as a final EOF.
01300                          */
01301                         return EOB_ACT_END_OF_FILE;
01302                         }
01303 
01304                 else
01305                         {
01306                         /* We matched some text prior to the EOB, first
01307                          * process it.
01308                          */
01309                         return EOB_ACT_LAST_MATCH;
01310                         }
01311                 }
01312 
01313         /* Try to read more data. */
01314 
01315         /* First move last chars to start of buffer. */
01316         number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
01317 
01318         for ( i = 0; i < number_to_move; ++i )
01319                 *(dest++) = *(source++);
01320 
01321         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01322                 /* don't do the read, it's not guaranteed to return an EOF,
01323                  * just force an EOF
01324                  */
01325                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
01326 
01327         else
01328                 {
01329                         int num_to_read =
01330                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01331 
01332                 while ( num_to_read <= 0 )
01333                         { /* Not enough room in the buffer - grow it. */
01334 
01335                         /* just a shorter name for the current buffer */
01336                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01337 
01338                         int yy_c_buf_p_offset =
01339                                 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
01340 
01341                         if ( b->yy_is_our_buffer )
01342                                 {
01343                                 int new_size = b->yy_buf_size * 2;
01344 
01345                                 if ( new_size <= 0 )
01346                                         b->yy_buf_size += b->yy_buf_size / 8;
01347                                 else
01348                                         b->yy_buf_size *= 2;
01349 
01350                                 b->yy_ch_buf = (char *)
01351                                         /* Include room in for 2 EOB chars. */
01352                                         lomet_parser_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
01353                                 }
01354                         else
01355                                 /* Can't grow it, we don't own it. */
01356                                 b->yy_ch_buf = 0;
01357 
01358                         if ( ! b->yy_ch_buf )
01359                                 YY_FATAL_ERROR(
01360                                 "fatal error - scanner input buffer overflow" );
01361 
01362                         yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
01363 
01364                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01365                                                 number_to_move - 1;
01366 
01367                         }
01368 
01369                 if ( num_to_read > YY_READ_BUF_SIZE )
01370                         num_to_read = YY_READ_BUF_SIZE;
01371 
01372                 /* Read in more data. */
01373                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01374                         yyg->yy_n_chars, (size_t) num_to_read );
01375 
01376                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01377                 }
01378 
01379         if ( yyg->yy_n_chars == 0 )
01380                 {
01381                 if ( number_to_move == YY_MORE_ADJ )
01382                         {
01383                         ret_val = EOB_ACT_END_OF_FILE;
01384                         lomet_parser_restart(yyin  ,yyscanner);
01385                         }
01386 
01387                 else
01388                         {
01389                         ret_val = EOB_ACT_LAST_MATCH;
01390                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01391                                 YY_BUFFER_EOF_PENDING;
01392                         }
01393                 }
01394 
01395         else
01396                 ret_val = EOB_ACT_CONTINUE_SCAN;
01397 
01398         if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
01399                 /* Extend the array by 50%, plus the number we really need. */
01400                 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
01401                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) lomet_parser_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
01402                 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01403                         YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
01404         }
01405 
01406         yyg->yy_n_chars += number_to_move;
01407         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
01408         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
01409 
01410         yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01411 
01412         return ret_val;
01413 }
01414 
01415 /* yy_get_previous_state - get the state just before the EOB char was reached */
01416 
01417     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
01418 {
01419         register yy_state_type yy_current_state;
01420         register char *yy_cp;
01421     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01422 
01423         yy_current_state = yyg->yy_start;
01424         yy_current_state += YY_AT_BOL();
01425 
01426         for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
01427                 {
01428                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01429                 if ( yy_accept[yy_current_state] )
01430                         {
01431                         yyg->yy_last_accepting_state = yy_current_state;
01432                         yyg->yy_last_accepting_cpos = yy_cp;
01433                         }
01434                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01435                         {
01436                         yy_current_state = (int) yy_def[yy_current_state];
01437                         if ( yy_current_state >= 116 )
01438                                 yy_c = yy_meta[(unsigned int) yy_c];
01439                         }
01440                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01441                 }
01442 
01443         return yy_current_state;
01444 }
01445 
01446 /* yy_try_NUL_trans - try to make a transition on the NUL character
01447  *
01448  * synopsis
01449  *      next_state = yy_try_NUL_trans( current_state );
01450  */
01451     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
01452 {
01453         register int yy_is_jam;
01454     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
01455         register char *yy_cp = yyg->yy_c_buf_p;
01456 
01457         register YY_CHAR yy_c = 1;
01458         if ( yy_accept[yy_current_state] )
01459                 {
01460                 yyg->yy_last_accepting_state = yy_current_state;
01461                 yyg->yy_last_accepting_cpos = yy_cp;
01462                 }
01463         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01464                 {
01465                 yy_current_state = (int) yy_def[yy_current_state];
01466                 if ( yy_current_state >= 116 )
01467                         yy_c = yy_meta[(unsigned int) yy_c];
01468                 }
01469         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01470         yy_is_jam = (yy_current_state == 115);
01471 
01472         return yy_is_jam ? 0 : yy_current_state;
01473 }
01474 
01475 #ifndef YY_NO_INPUT
01476 #ifdef __cplusplus
01477     static int yyinput (yyscan_t yyscanner)
01478 #else
01479     static int input  (yyscan_t yyscanner)
01480 #endif
01481 
01482 {
01483         int c;
01484     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01485 
01486         *yyg->yy_c_buf_p = yyg->yy_hold_char;
01487 
01488         if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
01489                 {
01490                 /* yy_c_buf_p now points to the character we want to return.
01491                  * If this occurs *before* the EOB characters, then it's a
01492                  * valid NUL; if not, then we've hit the end of the buffer.
01493                  */
01494                 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
01495                         /* This was really a NUL. */
01496                         *yyg->yy_c_buf_p = '\0';
01497 
01498                 else
01499                         { /* need more input */
01500                         int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
01501                         ++yyg->yy_c_buf_p;
01502 
01503                         switch ( yy_get_next_buffer( yyscanner ) )
01504                                 {
01505                                 case EOB_ACT_LAST_MATCH:
01506                                         /* This happens because yy_g_n_b()
01507                                          * sees that we've accumulated a
01508                                          * token and flags that we need to
01509                                          * try matching the token before
01510                                          * proceeding.  But for input(),
01511                                          * there's no matching to consider.
01512                                          * So convert the EOB_ACT_LAST_MATCH
01513                                          * to EOB_ACT_END_OF_FILE.
01514                                          */
01515 
01516                                         /* Reset buffer status. */
01517                                         lomet_parser_restart(yyin ,yyscanner);
01518 
01519                                         /*FALLTHROUGH*/
01520 
01521                                 case EOB_ACT_END_OF_FILE:
01522                                         {
01523                                         if ( lomet_parser_wrap(yyscanner ) )
01524                                                 return EOF;
01525 
01526                                         if ( ! yyg->yy_did_buffer_switch_on_eof )
01527                                                 YY_NEW_FILE;
01528 #ifdef __cplusplus
01529                                         return yyinput(yyscanner);
01530 #else
01531                                         return input(yyscanner);
01532 #endif
01533                                         }
01534 
01535                                 case EOB_ACT_CONTINUE_SCAN:
01536                                         yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
01537                                         break;
01538                                 }
01539                         }
01540                 }
01541 
01542         c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
01543         *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
01544         yyg->yy_hold_char = *++yyg->yy_c_buf_p;
01545 
01546         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
01547 
01548         return c;
01549 }
01550 #endif  /* ifndef YY_NO_INPUT */
01551 
01552 /** Immediately switch to a different input stream.
01553  * @param input_file A readable stream.
01554  * @param yyscanner The scanner object.
01555  * @note This function does not reset the start condition to @c INITIAL .
01556  */
01557     void lomet_parser_restart  (FILE * input_file , yyscan_t yyscanner)
01558 {
01559     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01560 
01561         if ( ! YY_CURRENT_BUFFER ){
01562         lomet_parser_ensure_buffer_stack (yyscanner);
01563                 YY_CURRENT_BUFFER_LVALUE =
01564             lomet_parser__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
01565         }
01566 
01567         lomet_parser__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
01568         lomet_parser__load_buffer_state(yyscanner );
01569 }
01570 
01571 /** Switch to a different input buffer.
01572  * @param new_buffer The new input buffer.
01573  * @param yyscanner The scanner object.
01574  */
01575     void lomet_parser__switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
01576 {
01577     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01578 
01579         /* TODO. We should be able to replace this entire function body
01580          * with
01581          *              lomet_parser_pop_buffer_state();
01582          *              lomet_parser_push_buffer_state(new_buffer);
01583      */
01584         lomet_parser_ensure_buffer_stack (yyscanner);
01585         if ( YY_CURRENT_BUFFER == new_buffer )
01586                 return;
01587 
01588         if ( YY_CURRENT_BUFFER )
01589                 {
01590                 /* Flush out information for old buffer. */
01591                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
01592                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01593                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01594                 }
01595 
01596         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01597         lomet_parser__load_buffer_state(yyscanner );
01598 
01599         /* We don't actually know whether we did this switch during
01600          * EOF (lomet_parser_wrap()) processing, but the only time this flag
01601          * is looked at is after lomet_parser_wrap() is called, so it's safe
01602          * to go ahead and always set it.
01603          */
01604         yyg->yy_did_buffer_switch_on_eof = 1;
01605 }
01606 
01607 static void lomet_parser__load_buffer_state  (yyscan_t yyscanner)
01608 {
01609     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01610         yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01611         yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01612         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01613         yyg->yy_hold_char = *yyg->yy_c_buf_p;
01614 }
01615 
01616 /** Allocate and initialize an input buffer state.
01617  * @param file A readable stream.
01618  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
01619  * @param yyscanner The scanner object.
01620  * @return the allocated buffer state.
01621  */
01622     YY_BUFFER_STATE lomet_parser__create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
01623 {
01624         YY_BUFFER_STATE b;
01625     
01626         b = (YY_BUFFER_STATE) lomet_parser_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01627         if ( ! b )
01628                 YY_FATAL_ERROR( "out of dynamic memory in lomet_parser__create_buffer()" );
01629 
01630         b->yy_buf_size = size;
01631 
01632         /* yy_ch_buf has to be 2 characters longer than the size given because
01633          * we need to put in 2 end-of-buffer characters.
01634          */
01635         b->yy_ch_buf = (char *) lomet_parser_alloc(b->yy_buf_size + 2 ,yyscanner );
01636         if ( ! b->yy_ch_buf )
01637                 YY_FATAL_ERROR( "out of dynamic memory in lomet_parser__create_buffer()" );
01638 
01639         b->yy_is_our_buffer = 1;
01640 
01641         lomet_parser__init_buffer(b,file ,yyscanner);
01642 
01643         return b;
01644 }
01645 
01646 /** Destroy the buffer.
01647  * @param b a buffer created with lomet_parser__create_buffer()
01648  * @param yyscanner The scanner object.
01649  */
01650     void lomet_parser__delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01651 {
01652     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01653 
01654         if ( ! b )
01655                 return;
01656 
01657         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01658                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01659 
01660         if ( b->yy_is_our_buffer )
01661                 lomet_parser_free((void *) b->yy_ch_buf ,yyscanner );
01662 
01663         lomet_parser_free((void *) b ,yyscanner );
01664 }
01665 
01666 /* Initializes or reinitializes a buffer.
01667  * This function is sometimes called more than once on the same buffer,
01668  * such as during a lomet_parser_restart() or at EOF.
01669  */
01670     static void lomet_parser__init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
01671 
01672 {
01673         int oerrno = errno;
01674     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01675 
01676         lomet_parser__flush_buffer(b ,yyscanner);
01677 
01678         b->yy_input_file = file;
01679         b->yy_fill_buffer = 1;
01680 
01681     /* If b is the current buffer, then lomet_parser__init_buffer was _probably_
01682      * called from lomet_parser_restart() or through yy_get_next_buffer.
01683      * In that case, we don't want to reset the lineno or column.
01684      */
01685     if (b != YY_CURRENT_BUFFER){
01686         b->yy_bs_lineno = 1;
01687         b->yy_bs_column = 0;
01688     }
01689 
01690         b->yy_is_interactive = 0;
01691     
01692         errno = oerrno;
01693 }
01694 
01695 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
01696  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
01697  * @param yyscanner The scanner object.
01698  */
01699     void lomet_parser__flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
01700 {
01701     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01702         if ( ! b )
01703                 return;
01704 
01705         b->yy_n_chars = 0;
01706 
01707         /* We always need two end-of-buffer characters.  The first causes
01708          * a transition to the end-of-buffer state.  The second causes
01709          * a jam in that state.
01710          */
01711         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01712         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01713 
01714         b->yy_buf_pos = &b->yy_ch_buf[0];
01715 
01716         b->yy_at_bol = 1;
01717         b->yy_buffer_status = YY_BUFFER_NEW;
01718 
01719         if ( b == YY_CURRENT_BUFFER )
01720                 lomet_parser__load_buffer_state(yyscanner );
01721 }
01722 
01723 /** Pushes the new state onto the stack. The new state becomes
01724  *  the current state. This function will allocate the stack
01725  *  if necessary.
01726  *  @param new_buffer The new state.
01727  *  @param yyscanner The scanner object.
01728  */
01729 void lomet_parser_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
01730 {
01731     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01732         if (new_buffer == NULL)
01733                 return;
01734 
01735         lomet_parser_ensure_buffer_stack(yyscanner);
01736 
01737         /* This block is copied from lomet_parser__switch_to_buffer. */
01738         if ( YY_CURRENT_BUFFER )
01739                 {
01740                 /* Flush out information for old buffer. */
01741                 *yyg->yy_c_buf_p = yyg->yy_hold_char;
01742                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
01743                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
01744                 }
01745 
01746         /* Only push if top exists. Otherwise, replace top. */
01747         if (YY_CURRENT_BUFFER)
01748                 yyg->yy_buffer_stack_top++;
01749         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01750 
01751         /* copied from lomet_parser__switch_to_buffer. */
01752         lomet_parser__load_buffer_state(yyscanner );
01753         yyg->yy_did_buffer_switch_on_eof = 1;
01754 }
01755 
01756 /** Removes and deletes the top of the stack, if present.
01757  *  The next element becomes the new top.
01758  *  @param yyscanner The scanner object.
01759  */
01760 void lomet_parser_pop_buffer_state (yyscan_t yyscanner)
01761 {
01762     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01763         if (!YY_CURRENT_BUFFER)
01764                 return;
01765 
01766         lomet_parser__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
01767         YY_CURRENT_BUFFER_LVALUE = NULL;
01768         if (yyg->yy_buffer_stack_top > 0)
01769                 --yyg->yy_buffer_stack_top;
01770 
01771         if (YY_CURRENT_BUFFER) {
01772                 lomet_parser__load_buffer_state(yyscanner );
01773                 yyg->yy_did_buffer_switch_on_eof = 1;
01774         }
01775 }
01776 
01777 /* Allocates the stack if it does not exist.
01778  *  Guarantees space for at least one push.
01779  */
01780 static void lomet_parser_ensure_buffer_stack (yyscan_t yyscanner)
01781 {
01782         int num_to_alloc;
01783     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01784 
01785         if (!yyg->yy_buffer_stack) {
01786 
01787                 /* First allocation is just for 2 elements, since we don't know if this
01788                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
01789                  * immediate realloc on the next call.
01790          */
01791                 num_to_alloc = 1;
01792                 yyg->yy_buffer_stack = (struct yy_buffer_state**)lomet_parser_alloc
01793                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01794                                                                 , yyscanner);
01795                 if ( ! yyg->yy_buffer_stack )
01796                         YY_FATAL_ERROR( "out of dynamic memory in lomet_parser_ensure_buffer_stack()" );
01797                                                                   
01798                 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01799                                 
01800                 yyg->yy_buffer_stack_max = num_to_alloc;
01801                 yyg->yy_buffer_stack_top = 0;
01802                 return;
01803         }
01804 
01805         if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
01806 
01807                 /* Increase the buffer to prepare for a possible push. */
01808                 int grow_size = 8 /* arbitrary grow size */;
01809 
01810                 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
01811                 yyg->yy_buffer_stack = (struct yy_buffer_state**)lomet_parser_realloc
01812                                                                 (yyg->yy_buffer_stack,
01813                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01814                                                                 , yyscanner);
01815                 if ( ! yyg->yy_buffer_stack )
01816                         YY_FATAL_ERROR( "out of dynamic memory in lomet_parser_ensure_buffer_stack()" );
01817 
01818                 /* zero only the new slots.*/
01819                 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
01820                 yyg->yy_buffer_stack_max = num_to_alloc;
01821         }
01822 }
01823 
01824 /** Setup the input buffer state to scan directly from a user-specified character buffer.
01825  * @param base the character buffer
01826  * @param size the size in bytes of the character buffer
01827  * @param yyscanner The scanner object.
01828  * @return the newly allocated buffer state object. 
01829  */
01830 YY_BUFFER_STATE lomet_parser__scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
01831 {
01832         YY_BUFFER_STATE b;
01833     
01834         if ( size < 2 ||
01835              base[size-2] != YY_END_OF_BUFFER_CHAR ||
01836              base[size-1] != YY_END_OF_BUFFER_CHAR )
01837                 /* They forgot to leave room for the EOB's. */
01838                 return 0;
01839 
01840         b = (YY_BUFFER_STATE) lomet_parser_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
01841         if ( ! b )
01842                 YY_FATAL_ERROR( "out of dynamic memory in lomet_parser__scan_buffer()" );
01843 
01844         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
01845         b->yy_buf_pos = b->yy_ch_buf = base;
01846         b->yy_is_our_buffer = 0;
01847         b->yy_input_file = 0;
01848         b->yy_n_chars = b->yy_buf_size;
01849         b->yy_is_interactive = 0;
01850         b->yy_at_bol = 1;
01851         b->yy_fill_buffer = 0;
01852         b->yy_buffer_status = YY_BUFFER_NEW;
01853 
01854         lomet_parser__switch_to_buffer(b ,yyscanner );
01855 
01856         return b;
01857 }
01858 
01859 /** Setup the input buffer state to scan a string. The next call to lomet_parser_lex() will
01860  * scan from a @e copy of @a str.
01861  * @param yystr a NUL-terminated string to scan
01862  * @param yyscanner The scanner object.
01863  * @return the newly allocated buffer state object.
01864  * @note If you want to scan bytes that may contain NUL values, then use
01865  *       lomet_parser__scan_bytes() instead.
01866  */
01867 YY_BUFFER_STATE lomet_parser__scan_string (yyconst char * yystr , yyscan_t yyscanner)
01868 {
01869     
01870         return lomet_parser__scan_bytes(yystr,strlen(yystr) ,yyscanner);
01871 }
01872 
01873 /** Setup the input buffer state to scan the given bytes. The next call to lomet_parser_lex() will
01874  * scan from a @e copy of @a bytes.
01875  * @param yybytes the byte buffer to scan
01876  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
01877  * @param yyscanner The scanner object.
01878  * @return the newly allocated buffer state object.
01879  */
01880 YY_BUFFER_STATE lomet_parser__scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
01881 {
01882         YY_BUFFER_STATE b;
01883         char *buf;
01884         yy_size_t n;
01885         int i;
01886     
01887         /* Get memory for full buffer, including space for trailing EOB's. */
01888         n = _yybytes_len + 2;
01889         buf = (char *) lomet_parser_alloc(n ,yyscanner );
01890         if ( ! buf )
01891                 YY_FATAL_ERROR( "out of dynamic memory in lomet_parser__scan_bytes()" );
01892 
01893         for ( i = 0; i < _yybytes_len; ++i )
01894                 buf[i] = yybytes[i];
01895 
01896         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01897 
01898         b = lomet_parser__scan_buffer(buf,n ,yyscanner);
01899         if ( ! b )
01900                 YY_FATAL_ERROR( "bad buffer in lomet_parser__scan_bytes()" );
01901 
01902         /* It's okay to grow etc. this buffer, and we should throw it
01903          * away when we're done.
01904          */
01905         b->yy_is_our_buffer = 1;
01906 
01907         return b;
01908 }
01909 
01910 #ifndef YY_EXIT_FAILURE
01911 #define YY_EXIT_FAILURE 2
01912 #endif
01913 
01914 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
01915 {
01916         (void) fprintf( stderr, "%s\n", msg );
01917         exit( YY_EXIT_FAILURE );
01918 }
01919 
01920 /* Redefine yyless() so it works in section 3 code. */
01921 
01922 #undef yyless
01923 #define yyless(n) \
01924         do \
01925                 { \
01926                 /* Undo effects of setting up yytext. */ \
01927         int yyless_macro_arg = (n); \
01928         YY_LESS_LINENO(yyless_macro_arg);\
01929                 yytext[yyleng] = yyg->yy_hold_char; \
01930                 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
01931                 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
01932                 *yyg->yy_c_buf_p = '\0'; \
01933                 yyleng = yyless_macro_arg; \
01934                 } \
01935         while ( 0 )
01936 
01937 /* Accessor  methods (get/set functions) to struct members. */
01938 
01939 /** Get the user-defined data for this scanner.
01940  * @param yyscanner The scanner object.
01941  */
01942 YY_EXTRA_TYPE lomet_parser_get_extra  (yyscan_t yyscanner)
01943 {
01944     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01945     return yyextra;
01946 }
01947 
01948 /** Get the current line number.
01949  * @param yyscanner The scanner object.
01950  */
01951 int lomet_parser_get_lineno  (yyscan_t yyscanner)
01952 {
01953     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01954     
01955         if (! YY_CURRENT_BUFFER)
01956             return 0;
01957     
01958     return yylineno;
01959 }
01960 
01961 /** Get the current column number.
01962  * @param yyscanner The scanner object.
01963  */
01964 int lomet_parser_get_column  (yyscan_t yyscanner)
01965 {
01966     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01967     
01968         if (! YY_CURRENT_BUFFER)
01969             return 0;
01970     
01971     return yycolumn;
01972 }
01973 
01974 /** Get the input stream.
01975  * @param yyscanner The scanner object.
01976  */
01977 FILE *lomet_parser_get_in  (yyscan_t yyscanner)
01978 {
01979     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01980     return yyin;
01981 }
01982 
01983 /** Get the output stream.
01984  * @param yyscanner The scanner object.
01985  */
01986 FILE *lomet_parser_get_out  (yyscan_t yyscanner)
01987 {
01988     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01989     return yyout;
01990 }
01991 
01992 /** Get the length of the current token.
01993  * @param yyscanner The scanner object.
01994  */
01995 int lomet_parser_get_leng  (yyscan_t yyscanner)
01996 {
01997     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
01998     return yyleng;
01999 }
02000 
02001 /** Get the current token.
02002  * @param yyscanner The scanner object.
02003  */
02004 
02005 char *lomet_parser_get_text  (yyscan_t yyscanner)
02006 {
02007     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02008     return yytext;
02009 }
02010 
02011 /** Set the user-defined data. This data is never touched by the scanner.
02012  * @param user_defined The data to be associated with this scanner.
02013  * @param yyscanner The scanner object.
02014  */
02015 void lomet_parser_set_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
02016 {
02017     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02018     yyextra = user_defined ;
02019 }
02020 
02021 /** Set the current line number.
02022  * @param line_number
02023  * @param yyscanner The scanner object.
02024  */
02025 void lomet_parser_set_lineno (int  line_number , yyscan_t yyscanner)
02026 {
02027     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02028 
02029         /* lineno is only valid if an input buffer exists. */
02030         if (! YY_CURRENT_BUFFER )
02031            yy_fatal_error( "lomet_parser_set_lineno called with no buffer" , yyscanner); 
02032     
02033     yylineno = line_number;
02034 }
02035 
02036 /** Set the current column.
02037  * @param line_number
02038  * @param yyscanner The scanner object.
02039  */
02040 void lomet_parser_set_column (int  column_no , yyscan_t yyscanner)
02041 {
02042     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02043 
02044         /* column is only valid if an input buffer exists. */
02045         if (! YY_CURRENT_BUFFER )
02046            yy_fatal_error( "lomet_parser_set_column called with no buffer" , yyscanner); 
02047     
02048     yycolumn = column_no;
02049 }
02050 
02051 /** Set the input stream. This does not discard the current
02052  * input buffer.
02053  * @param in_str A readable stream.
02054  * @param yyscanner The scanner object.
02055  * @see lomet_parser__switch_to_buffer
02056  */
02057 void lomet_parser_set_in (FILE *  in_str , yyscan_t yyscanner)
02058 {
02059     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02060     yyin = in_str ;
02061 }
02062 
02063 void lomet_parser_set_out (FILE *  out_str , yyscan_t yyscanner)
02064 {
02065     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02066     yyout = out_str ;
02067 }
02068 
02069 int lomet_parser_get_debug  (yyscan_t yyscanner)
02070 {
02071     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02072     return yy_flex_debug;
02073 }
02074 
02075 void lomet_parser_set_debug (int  bdebug , yyscan_t yyscanner)
02076 {
02077     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02078     yy_flex_debug = bdebug ;
02079 }
02080 
02081 /* Accessor methods for yylval and yylloc */
02082 
02083 /* User-visible API */
02084 
02085 /* lomet_parser_lex_init is special because it creates the scanner itself, so it is
02086  * the ONLY reentrant function that doesn't take the scanner as the last argument.
02087  * That's why we explicitly handle the declaration, instead of using our macros.
02088  */
02089 
02090 int lomet_parser_lex_init(yyscan_t* ptr_yy_globals)
02091 
02092 {
02093     if (ptr_yy_globals == NULL){
02094         errno = EINVAL;
02095         return 1;
02096     }
02097 
02098     *ptr_yy_globals = (yyscan_t) lomet_parser_alloc ( sizeof( struct yyguts_t ), NULL );
02099 
02100     if (*ptr_yy_globals == NULL){
02101         errno = ENOMEM;
02102         return 1;
02103     }
02104 
02105     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
02106     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02107 
02108     return yy_init_globals ( *ptr_yy_globals );
02109 }
02110 
02111 /* lomet_parser_lex_init_extra has the same functionality as lomet_parser_lex_init, but follows the
02112  * convention of taking the scanner as the last argument. Note however, that
02113  * this is a *pointer* to a scanner, as it will be allocated by this call (and
02114  * is the reason, too, why this function also must handle its own declaration).
02115  * The user defined value in the first argument will be available to lomet_parser_alloc in
02116  * the yyextra field.
02117  */
02118 
02119 int lomet_parser_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
02120 
02121 {
02122     struct yyguts_t dummy_yyguts;
02123 
02124     lomet_parser_set_extra (yy_user_defined, &dummy_yyguts);
02125 
02126     if (ptr_yy_globals == NULL){
02127         errno = EINVAL;
02128         return 1;
02129     }
02130         
02131     *ptr_yy_globals = (yyscan_t) lomet_parser_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
02132         
02133     if (*ptr_yy_globals == NULL){
02134         errno = ENOMEM;
02135         return 1;
02136     }
02137     
02138     /* By setting to 0xAA, we expose bugs in
02139     yy_init_globals. Leave at 0x00 for releases. */
02140     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
02141     
02142     lomet_parser_set_extra (yy_user_defined, *ptr_yy_globals);
02143     
02144     return yy_init_globals ( *ptr_yy_globals );
02145 }
02146 
02147 static int yy_init_globals (yyscan_t yyscanner)
02148 {
02149     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02150     /* Initialization is the same as for the non-reentrant scanner.
02151      * This function is called from lomet_parser_lex_destroy(), so don't allocate here.
02152      */
02153 
02154     yyg->yy_buffer_stack = 0;
02155     yyg->yy_buffer_stack_top = 0;
02156     yyg->yy_buffer_stack_max = 0;
02157     yyg->yy_c_buf_p = (char *) 0;
02158     yyg->yy_init = 0;
02159     yyg->yy_start = 0;
02160 
02161     yyg->yy_start_stack_ptr = 0;
02162     yyg->yy_start_stack_depth = 0;
02163     yyg->yy_start_stack =  NULL;
02164 
02165 /* Defined in main.c */
02166 #ifdef YY_STDINIT
02167     yyin = stdin;
02168     yyout = stdout;
02169 #else
02170     yyin = (FILE *) 0;
02171     yyout = (FILE *) 0;
02172 #endif
02173 
02174     /* For future reference: Set errno on error, since we are called by
02175      * lomet_parser_lex_init()
02176      */
02177     return 0;
02178 }
02179 
02180 /* lomet_parser_lex_destroy is for both reentrant and non-reentrant scanners. */
02181 int lomet_parser_lex_destroy  (yyscan_t yyscanner)
02182 {
02183     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
02184 
02185     /* Pop the buffer stack, destroying each element. */
02186         while(YY_CURRENT_BUFFER){
02187                 lomet_parser__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
02188                 YY_CURRENT_BUFFER_LVALUE = NULL;
02189                 lomet_parser_pop_buffer_state(yyscanner);
02190         }
02191 
02192         /* Destroy the stack itself. */
02193         lomet_parser_free(yyg->yy_buffer_stack ,yyscanner);
02194         yyg->yy_buffer_stack = NULL;
02195 
02196     /* Destroy the start condition stack. */
02197         lomet_parser_free(yyg->yy_start_stack ,yyscanner );
02198         yyg->yy_start_stack = NULL;
02199 
02200     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02201      * lomet_parser_lex() is called, initialization will occur. */
02202     yy_init_globals( yyscanner);
02203 
02204     /* Destroy the main struct (reentrant only). */
02205     lomet_parser_free ( yyscanner , yyscanner );
02206     yyscanner = NULL;
02207     return 0;
02208 }
02209 
02210 /*
02211  * Internal utility routines.
02212  */
02213 
02214 #ifndef yytext_ptr
02215 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
02216 {
02217         register int i;
02218         for ( i = 0; i < n; ++i )
02219                 s1[i] = s2[i];
02220 }
02221 #endif
02222 
02223 #ifdef YY_NEED_STRLEN
02224 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
02225 {
02226         register int n;
02227         for ( n = 0; s[n]; ++n )
02228                 ;
02229 
02230         return n;
02231 }
02232 #endif
02233 
02234 void *lomet_parser_alloc (yy_size_t  size , yyscan_t yyscanner)
02235 {
02236         return (void *) malloc( size );
02237 }
02238 
02239 void *lomet_parser_realloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
02240 {
02241         /* The cast to (char *) in the following accommodates both
02242          * implementations that use char* generic pointers, and those
02243          * that use void* generic pointers.  It works with the latter
02244          * because both ANSI C and C++ allow castless assignment from
02245          * any pointer type to void*, and deal with argument conversions
02246          * as though doing an assignment.
02247          */
02248         return (void *) realloc( (char *) ptr, size );
02249 }
02250 
02251 void lomet_parser_free (void * ptr , yyscan_t yyscanner)
02252 {
02253         free( (char *) ptr );   /* see lomet_parser_realloc() for (char *) cast */
02254 }
02255 
02256 #define YYTABLES_NAME "yytables"
02257 
02258 #line 274 "src/Robots/LoBot/metlog/LoMetlogParser.l"
Generated on Sun May 8 08:41:31 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3