follex.cpp

00001 #line 2 "../src/parser/follex.cpp"
00002 
00003 #line 4 "../src/parser/follex.cpp"
00004 
00005 #define  YY_INT_ALIGNED short int
00006 
00007 /* A lexical scanner generated by flex */
00008 
00009 #define FLEX_SCANNER
00010 #define YY_FLEX_MAJOR_VERSION 2
00011 #define YY_FLEX_MINOR_VERSION 5
00012 #define YY_FLEX_SUBMINOR_VERSION 33
00013 #if YY_FLEX_SUBMINOR_VERSION > 0
00014 #define FLEX_BETA
00015 #endif
00016 
00017 /* 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 __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 #endif /* ! C99 */
00058 
00059 /* Limits of integral types. */
00060 #ifndef INT8_MIN
00061 #define INT8_MIN               (-128)
00062 #endif
00063 #ifndef INT16_MIN
00064 #define INT16_MIN              (-32767-1)
00065 #endif
00066 #ifndef INT32_MIN
00067 #define INT32_MIN              (-2147483647-1)
00068 #endif
00069 #ifndef INT8_MAX
00070 #define INT8_MAX               (127)
00071 #endif
00072 #ifndef INT16_MAX
00073 #define INT16_MAX              (32767)
00074 #endif
00075 #ifndef INT32_MAX
00076 #define INT32_MAX              (2147483647)
00077 #endif
00078 #ifndef UINT8_MAX
00079 #define UINT8_MAX              (255U)
00080 #endif
00081 #ifndef UINT16_MAX
00082 #define UINT16_MAX             (65535U)
00083 #endif
00084 #ifndef UINT32_MAX
00085 #define UINT32_MAX             (4294967295U)
00086 #endif
00087 
00088 #endif /* ! FLEXINT_H */
00089 
00090 #ifdef __cplusplus
00091 
00092 /* The "const" storage-class-modifier is valid. */
00093 #define YY_USE_CONST
00094 
00095 #else   /* ! __cplusplus */
00096 
00097 #if __STDC__
00098 
00099 #define YY_USE_CONST
00100 
00101 #endif  /* __STDC__ */
00102 #endif  /* ! __cplusplus */
00103 
00104 #ifdef YY_USE_CONST
00105 #define yyconst const
00106 #else
00107 #define yyconst
00108 #endif
00109 
00110 /* Returned upon end-of-file. */
00111 #define YY_NULL 0
00112 
00113 /* Promotes a possibly negative, possibly signed char to an unsigned
00114  * integer for use as an array index.  If the signed char is negative,
00115  * we want to instead treat it as an 8-bit unsigned char, hence the
00116  * double cast.
00117  */
00118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
00119 
00120 /* Enter a start condition.  This macro really ought to take a parameter,
00121  * but we do it the disgusting crufty way forced on us by the ()-less
00122  * definition of BEGIN.
00123  */
00124 #define BEGIN (yy_start) = 1 + 2 *
00125 
00126 /* Translate the current start state into a value that can be later handed
00127  * to BEGIN to return to the state.  The YYSTATE alias is for lex
00128  * compatibility.
00129  */
00130 #define YY_START (((yy_start) - 1) / 2)
00131 #define YYSTATE YY_START
00132 
00133 /* Action number for EOF rule of a given start state. */
00134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
00135 
00136 /* Special action meaning "start processing a new file". */
00137 #define YY_NEW_FILE yyrestart(yyin  )
00138 
00139 #define YY_END_OF_BUFFER_CHAR 0
00140 
00141 /* Size of default input buffer. */
00142 #ifndef YY_BUF_SIZE
00143 #define YY_BUF_SIZE 16384
00144 #endif
00145 
00146 /* The state buf must be large enough to hold one state per character in the main buffer.
00147  */
00148 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
00149 
00150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
00151 #define YY_TYPEDEF_YY_BUFFER_STATE
00152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
00153 #endif
00154 
00155 extern int yyleng;
00156 
00157 extern FILE *yyin, *yyout;
00158 
00159 #define EOB_ACT_CONTINUE_SCAN 0
00160 #define EOB_ACT_END_OF_FILE 1
00161 #define EOB_ACT_LAST_MATCH 2
00162 
00163     #define YY_LESS_LINENO(n)
00164     
00165 /* Return all but the first "n" matched characters back to the input stream. */
00166 #define yyless(n) \
00167         do \
00168                 { \
00169                 /* Undo effects of setting up yytext. */ \
00170         int yyless_macro_arg = (n); \
00171         YY_LESS_LINENO(yyless_macro_arg);\
00172                 *yy_cp = (yy_hold_char); \
00173                 YY_RESTORE_YY_MORE_OFFSET \
00174                 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
00175                 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
00176                 } \
00177         while ( 0 )
00178 
00179 #define unput(c) yyunput( c, (yytext_ptr)  )
00180 
00181 /* The following is because we cannot portably get our hands on size_t
00182  * (without autoconf's help, which isn't available because we want
00183  * flex-generated scanners to compile on their own).
00184  */
00185 
00186 #ifndef YY_TYPEDEF_YY_SIZE_T
00187 #define YY_TYPEDEF_YY_SIZE_T
00188 typedef unsigned int yy_size_t;
00189 #endif
00190 
00191 #ifndef YY_STRUCT_YY_BUFFER_STATE
00192 #define YY_STRUCT_YY_BUFFER_STATE
00193 struct yy_buffer_state
00194         {
00195         FILE *yy_input_file;
00196 
00197         char *yy_ch_buf;                /* input buffer */
00198         char *yy_buf_pos;               /* current position in input buffer */
00199 
00200         /* Size of input buffer in bytes, not including room for EOB
00201          * characters.
00202          */
00203         yy_size_t yy_buf_size;
00204 
00205         /* Number of characters read into yy_ch_buf, not including EOB
00206          * characters.
00207          */
00208         int yy_n_chars;
00209 
00210         /* Whether we "own" the buffer - i.e., we know we created it,
00211          * and can realloc() it to grow it, and should free() it to
00212          * delete it.
00213          */
00214         int yy_is_our_buffer;
00215 
00216         /* Whether this is an "interactive" input source; if so, and
00217          * if we're using stdio for input, then we want to use getc()
00218          * instead of fread(), to make sure we stop fetching input after
00219          * each newline.
00220          */
00221         int yy_is_interactive;
00222 
00223         /* Whether we're considered to be at the beginning of a line.
00224          * If so, '^' rules will be active on the next match, otherwise
00225          * not.
00226          */
00227         int yy_at_bol;
00228 
00229     int yy_bs_lineno; 
00230     int yy_bs_column; 
00232         /* Whether to try to fill the input buffer when we reach the
00233          * end of it.
00234          */
00235         int yy_fill_buffer;
00236 
00237         int yy_buffer_status;
00238 
00239 #define YY_BUFFER_NEW 0
00240 #define YY_BUFFER_NORMAL 1
00241         /* When an EOF's been seen but there's still some text to process
00242          * then we mark the buffer as YY_EOF_PENDING, to indicate that we
00243          * shouldn't try reading from the input source any more.  We might
00244          * still have a bunch of tokens to match, though, because of
00245          * possible backing-up.
00246          *
00247          * When we actually see the EOF, we change the status to "new"
00248          * (via yyrestart()), so that the user can continue scanning by
00249          * just pointing yyin at a new input file.
00250          */
00251 #define YY_BUFFER_EOF_PENDING 2
00252 
00253         };
00254 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
00255 
00256 /* Stack of input buffers. */
00257 static size_t yy_buffer_stack_top = 0; 
00258 static size_t yy_buffer_stack_max = 0; 
00259 static YY_BUFFER_STATE * yy_buffer_stack = 0; 
00261 /* We provide macros for accessing buffer states in case in the
00262  * future we want to put the buffer states in a more general
00263  * "scanner state".
00264  *
00265  * Returns the top of the stack, or NULL.
00266  */
00267 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
00268                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
00269                           : NULL)
00270 
00271 /* Same as previous macro, but useful when we know that the buffer stack is not
00272  * NULL or when we need an lvalue. For internal use only.
00273  */
00274 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
00275 
00276 /* yy_hold_char holds the character lost when yytext is formed. */
00277 static char yy_hold_char;
00278 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
00279 int yyleng;
00280 
00281 /* Points to current character in buffer. */
00282 static char *yy_c_buf_p = (char *) 0;
00283 static int yy_init = 0;         /* whether we need to initialize */
00284 static int yy_start = 0;        /* start state number */
00285 
00286 /* Flag which is used to allow yywrap()'s to do buffer switches
00287  * instead of setting up a fresh yyin.  A bit of a hack ...
00288  */
00289 static int yy_did_buffer_switch_on_eof;
00290 
00291 void yyrestart (FILE *input_file  );
00292 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
00293 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
00294 void yy_delete_buffer (YY_BUFFER_STATE b  );
00295 void yy_flush_buffer (YY_BUFFER_STATE b  );
00296 void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
00297 void yypop_buffer_state (void );
00298 
00299 static void yyensure_buffer_stack (void );
00300 static void yy_load_buffer_state (void );
00301 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
00302 
00303 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
00304 
00305 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
00306 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
00307 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
00308 
00309 void *yyalloc (yy_size_t  );
00310 void *yyrealloc (void *,yy_size_t  );
00311 void yyfree (void *  );
00312 
00313 #define yy_new_buffer yy_create_buffer
00314 
00315 #define yy_set_interactive(is_interactive) \
00316         { \
00317         if ( ! YY_CURRENT_BUFFER ){ \
00318         yyensure_buffer_stack (); \
00319                 YY_CURRENT_BUFFER_LVALUE =    \
00320             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00321         } \
00322         YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
00323         }
00324 
00325 #define yy_set_bol(at_bol) \
00326         { \
00327         if ( ! YY_CURRENT_BUFFER ){\
00328         yyensure_buffer_stack (); \
00329                 YY_CURRENT_BUFFER_LVALUE =    \
00330             yy_create_buffer(yyin,YY_BUF_SIZE ); \
00331         } \
00332         YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
00333         }
00334 
00335 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
00336 
00337 /* Begin user sect3 */
00338 
00339 #define yywrap(n) 1
00340 #define YY_SKIP_YYWRAP
00341 
00342 typedef unsigned char YY_CHAR;
00343 
00344 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
00345 
00346 typedef int yy_state_type;
00347 
00348 extern int yylineno;
00349 
00350 int yylineno = 1;
00351 
00352 extern char *yytext;
00353 #define yytext_ptr yytext
00354 
00355 static yy_state_type yy_get_previous_state (void );
00356 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
00357 static int yy_get_next_buffer (void );
00358 static void yy_fatal_error (yyconst char msg[]  );
00359 
00360 /* Done after the current pattern has been matched and before the
00361  * corresponding action - sets up yytext.
00362  */
00363 #define YY_DO_BEFORE_ACTION \
00364         (yytext_ptr) = yy_bp; \
00365         yyleng = (size_t) (yy_cp - yy_bp); \
00366         (yy_hold_char) = *yy_cp; \
00367         *yy_cp = '\0'; \
00368         (yy_c_buf_p) = yy_cp;
00369 
00370 #define YY_NUM_RULES 34
00371 #define YY_END_OF_BUFFER 35
00372 /* This struct is not used in this scanner,
00373    but its presence is necessary. */
00374 struct yy_trans_info
00375         {
00376         flex_int32_t yy_verify;
00377         flex_int32_t yy_nxt;
00378         };
00379 static yyconst flex_int16_t yy_accept[84] =
00380     {   0,
00381         0,    0,   35,   33,   32,   22,   22,   32,    6,   33,
00382        33,   25,   26,   13,   14,   27,   15,   31,   33,   17,
00383        33,   28,   16,   30,   21,   21,   21,   23,   24,    1,
00384         2,   32,   32,    0,    0,    0,   20,    0,    0,   21,
00385        17,    0,    0,    3,   18,   17,    0,    0,    9,   21,
00386        21,    8,    7,    0,   17,   21,   29,    0,    0,    3,
00387        18,    0,   19,   10,   21,   21,    0,   21,   19,    0,
00388         0,    4,   21,   21,    0,    0,   11,   21,    0,   12,
00389         0,    5,    0
00390     } ;
00391 
00392 static yyconst flex_int32_t yy_ec[256] =
00393     {   0,
00394         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
00395         1,    4,    5,    1,    1,    1,    1,    1,    1,    1,
00396         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00397         1,    6,    7,    8,    9,    1,    1,    1,   10,   11,
00398        12,   13,   14,   15,   16,   17,   18,   19,   19,   19,
00399        19,   19,   19,   19,   19,   19,   19,    1,    1,   20,
00400        21,   22,   23,   24,   25,   26,   26,   26,   27,   28,
00401        26,   26,   29,   26,   26,   30,   26,   26,   31,   26,
00402        26,   32,   33,   34,   26,   26,   26,   35,   26,   26,
00403        36,   37,   38,   39,   26,    1,   25,   40,   41,   42,
00404 
00405        43,   28,   26,   26,   44,   26,   26,   45,   26,   46,
00406        31,   26,   26,   47,   33,   48,   49,   50,   26,   35,
00407        26,   26,   51,    1,   52,    1,    1,    1,    1,    1,
00408         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00409         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00410         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00411         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00412         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00413         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00414         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00415 
00416         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00417         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00418         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00419         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00420         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00421         1,    1,    1,    1,    1
00422     } ;
00423 
00424 static yyconst flex_int32_t yy_meta[53] =
00425     {   0,
00426         1,    1,    2,    1,    2,    1,    1,    1,    1,    3,
00427         1,    1,    1,    1,    1,    3,    1,    1,    3,    1,
00428         1,    1,    1,    1,    3,    3,    3,    3,    3,    3,
00429         3,    3,    3,    3,    3,    1,    1,    1,    1,    3,
00430         3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
00431         1,    1
00432     } ;
00433 
00434 static yyconst flex_int16_t yy_base[90] =
00435     {   0,
00436         0,    0,  165,  166,   51,  166,  166,   52,  166,   47,
00437       120,  166,  166,  166,  166,  166,  144,  145,   43,   43,
00438       140,  138,  166,  166,    0,  124,  127,  166,  166,  166,
00439       166,   57,   62,   64,   68,   57,  166,   68,  111,    0,
00440        60,  139,  142,    0,   47,   63,   69,  132,  166,   52,
00441        57,   92,  104,  112,   94,  103,  166,  132,   74,    0,
00442        56,  120,  115,  166,  100,  106,   85,  110,  109,  114,
00443        87,  166,   84,   90,   77,  112,    0,   91,   82,    0,
00444        80,  166,  166,  137,   90,  140,  143,  146,  149
00445     } ;
00446 
00447 static yyconst flex_int16_t yy_def[90] =
00448     {   0,
00449        83,    1,   83,   83,   83,   83,   83,   83,   83,   84,
00450        83,   83,   83,   83,   83,   83,   85,   83,   83,   83,
00451        83,   83,   83,   83,   85,   85,   85,   83,   83,   83,
00452        83,   83,   83,   83,   83,   84,   83,   83,   83,   85,
00453        85,   83,   86,   87,   83,   83,   83,   83,   83,   85,
00454        85,   83,   83,   83,   85,   85,   83,   86,   88,   87,
00455        83,   83,   83,   83,   85,   85,   83,   85,   85,   89,
00456        88,   83,   85,   85,   83,   89,   85,   85,   83,   85,
00457        83,   83,    0,   83,   83,   83,   83,   83,   83
00458     } ;
00459 
00460 static yyconst flex_int16_t yy_nxt[219] =
00461     {   0,
00462         4,    5,    6,    4,    7,    8,    9,   10,   11,    4,
00463        12,   13,   14,   15,   16,   17,   18,   19,   20,   21,
00464        22,    4,   23,   24,   25,   25,   26,   27,   25,   25,
00465        25,   25,   25,   25,   25,   28,    4,   29,    4,   25,
00466        25,   25,   26,   25,   25,   25,   25,   25,   25,   25,
00467        30,   31,   32,   32,   37,   43,   32,   33,   32,   45,
00468        44,   46,   32,   32,   37,   61,   52,   33,   52,   52,
00469        53,   36,   53,   53,   61,   36,   45,   36,   55,   45,
00470        65,   46,   62,   38,   62,   47,   71,   63,   66,   47,
00471        34,   72,   40,   38,   52,   65,   52,   52,   47,   71,
00472 
00473        34,   35,   56,   66,   72,   47,   53,   36,   53,   53,
00474        45,   35,   55,   36,   36,   36,   62,   77,   68,   78,
00475        80,   69,   82,   81,   71,   79,   71,   69,   69,   75,
00476        74,   77,   73,   63,   78,   80,   56,   36,   63,   36,
00477        58,   58,   58,   60,   59,   60,   70,   70,   70,   76,
00478        76,   76,   67,   64,   59,   57,   54,   51,   50,   49,
00479        48,   42,   41,   39,   83,    3,   83,   83,   83,   83,
00480        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00481        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00482        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00483 
00484        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00485        83,   83,   83,   83,   83,   83,   83,   83
00486     } ;
00487 
00488 static yyconst flex_int16_t yy_chk[219] =
00489     {   0,
00490         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00491         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00492         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00493         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00494         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
00495         1,    1,    5,    8,   10,   19,    5,    8,   32,   20,
00496        19,   20,   32,   33,   36,   45,   34,   33,   34,   34,
00497        35,   38,   35,   35,   61,   38,   41,   38,   41,   46,
00498        50,   46,   47,   10,   47,   20,   59,   47,   51,   45,
00499         8,   59,   85,   36,   52,   50,   52,   52,   61,   71,
00500 
00501        33,    8,   41,   51,   71,   46,   53,   38,   53,   53,
00502        55,   33,   55,   38,   38,   38,   56,   73,   56,   74,
00503        78,   56,   81,   79,   76,   75,   70,   69,   68,   67,
00504        66,   73,   65,   63,   74,   78,   55,   84,   62,   84,
00505        86,   86,   86,   87,   58,   87,   88,   88,   88,   89,
00506        89,   89,   54,   48,   43,   42,   39,   27,   26,   22,
00507        21,   18,   17,   11,    3,   83,   83,   83,   83,   83,
00508        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00509        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00510        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00511 
00512        83,   83,   83,   83,   83,   83,   83,   83,   83,   83,
00513        83,   83,   83,   83,   83,   83,   83,   83
00514     } ;
00515 
00516 static yy_state_type yy_last_accepting_state;
00517 static char *yy_last_accepting_cpos;
00518 
00519 extern int yy_flex_debug;
00520 int yy_flex_debug = 0;
00521 
00522 /* The intent behind this definition is that it'll catch
00523  * any uses of REJECT which flex missed.
00524  */
00525 #define REJECT reject_used_but_not_detected
00526 #define yymore() yymore_used_but_not_detected
00527 #define YY_MORE_ADJ 0
00528 #define YY_RESTORE_YY_MORE_OFFSET
00529 char *yytext;
00530 #line 1 "../src/parser/follex.y"
00531 /*
00532  * All of the documentation and software included in the
00533  * Alchemy Software is copyrighted by Stanley Kok, Parag
00534  * Singla, Matthew Richardson, Pedro Domingos, Marc
00535  * Sumner, Hoifung Poon, and Daniel Lowd.
00536  * 
00537  * Copyright [2004-07] Stanley Kok, Parag Singla, Matthew
00538  * Richardson, Pedro Domingos, Marc Sumner, Hoifung
00539  * Poon, and Daniel Lowd. All rights reserved.
00540  * 
00541  * Contact: Pedro Domingos, University of Washington
00542  * (pedrod@cs.washington.edu).
00543  * 
00544  * Redistribution and use in source and binary forms, with
00545  * or without modification, are permitted provided that
00546  * the following conditions are met:
00547  * 
00548  * 1. Redistributions of source code must retain the above
00549  * copyright notice, this list of conditions and the
00550  * following disclaimer.
00551  * 
00552  * 2. Redistributions in binary form must reproduce the
00553  * above copyright notice, this list of conditions and the
00554  * following disclaimer in the documentation and/or other
00555  * materials provided with the distribution.
00556  * 
00557  * 3. All advertising materials mentioning features or use
00558  * of this software must display the following
00559  * acknowledgment: "This product includes software
00560  * developed by Stanley Kok, Parag Singla, Matthew
00561  * Richardson, Pedro Domingos, Marc Sumner, Hoifung
00562  * Poon, and Daniel Lowd in the Department of Computer Science and
00563  * Engineering at the University of Washington".
00564  * 
00565  * 4. Your publications acknowledge the use or
00566  * contribution made by the Software to your research
00567  * using the following citation(s): 
00568  * Stanley Kok, Parag Singla, Matthew Richardson and
00569  * Pedro Domingos (2005). "The Alchemy System for
00570  * Statistical Relational AI", Technical Report,
00571  * Department of Computer Science and Engineering,
00572  * University of Washington, Seattle, WA.
00573  * http://www.cs.washington.edu/ai/alchemy.
00574  * 
00575  * 5. Neither the name of the University of Washington nor
00576  * the names of its contributors may be used to endorse or
00577  * promote products derived from this software without
00578  * specific prior written permission.
00579  * 
00580  * THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF WASHINGTON
00581  * AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
00582  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00583  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00584  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY
00585  * OF WASHINGTON OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
00586  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00587  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00588  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00589  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00590  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00591  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00592  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
00593  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00594  * 
00595  */
00596 /* scanner for first-order language */
00597 #line 69 "../src/parser/follex.y"
00598 
00599 #include "folhelper.h"
00600 
00601 bool follexDbg = false; 
00602 //bool follexDbg = true; 
00603 
00604 /* not scanning another file after current one */
00605 /* double ' and " to avoid string syntax highlighting in xemacs */
00606 /*ZZ_STRING  [""]([^""\\n\r] | ([\][ntbr\f''""]))*[""]*/
00607 /* double ' to avoid string syntax highlighting in xemacs */
00608 /* ZZ_ID [a-zA-z_\-][a-zA-Z0-9_\-'']* */
00609 #line 610 "../src/parser/follex.cpp"
00610 
00611 #define INITIAL 0
00612 
00613 #ifndef YY_NO_UNISTD_H
00614 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00615  * down here because we want the user's section 1 to have been scanned first.
00616  * The user has a chance to override it with an option.
00617  */
00618 #include <unistd.h>
00619 #endif
00620 
00621 #ifndef YY_EXTRA_TYPE
00622 #define YY_EXTRA_TYPE void *
00623 #endif
00624 
00625 static int yy_init_globals (void );
00626 
00627 /* Macros after this point can all be overridden by user definitions in
00628  * section 1.
00629  */
00630 
00631 #ifndef YY_SKIP_YYWRAP
00632 #ifdef __cplusplus
00633 extern "C" int yywrap (void );
00634 #else
00635 extern int yywrap (void );
00636 #endif
00637 #endif
00638 
00639     static void yyunput (int c,char *buf_ptr  );
00640     
00641 #ifndef yytext_ptr
00642 static void yy_flex_strncpy (char *,yyconst char *,int );
00643 #endif
00644 
00645 #ifdef YY_NEED_STRLEN
00646 static int yy_flex_strlen (yyconst char * );
00647 #endif
00648 
00649 #ifndef YY_NO_INPUT
00650 
00651 #ifdef __cplusplus
00652 static int yyinput (void );
00653 #else
00654 static int input (void );
00655 #endif
00656 
00657 #endif
00658 
00659 /* Amount of stuff to slurp up with each read. */
00660 #ifndef YY_READ_BUF_SIZE
00661 #define YY_READ_BUF_SIZE 8192
00662 #endif
00663 
00664 /* Copy whatever the last rule matched to the standard output. */
00665 #ifndef ECHO
00666 /* This used to be an fputs(), but since the string might contain NUL's,
00667  * we now use fwrite().
00668  */
00669 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
00670 #endif
00671 
00672 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00673  * is returned in "result".
00674  */
00675 #ifndef YY_INPUT
00676 #define YY_INPUT(buf,result,max_size) \
00677         if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00678                 { \
00679                 int c = '*'; \
00680                 size_t n; \
00681                 for ( n = 0; n < max_size && \
00682                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00683                         buf[n] = (char) c; \
00684                 if ( c == '\n' ) \
00685                         buf[n++] = (char) c; \
00686                 if ( c == EOF && ferror( yyin ) ) \
00687                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
00688                 result = n; \
00689                 } \
00690         else \
00691                 { \
00692                 errno=0; \
00693                 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00694                         { \
00695                         if( errno != EINTR) \
00696                                 { \
00697                                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00698                                 break; \
00699                                 } \
00700                         errno=0; \
00701                         clearerr(yyin); \
00702                         } \
00703                 }\
00704 \
00705 
00706 #endif
00707 
00708 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00709  * we don't want an extra ';' after the "return" because that will cause
00710  * some compilers to complain about unreachable statements.
00711  */
00712 #ifndef yyterminate
00713 #define yyterminate() return YY_NULL
00714 #endif
00715 
00716 /* Number of entries by which start-condition stack grows. */
00717 #ifndef YY_START_STACK_INCR
00718 #define YY_START_STACK_INCR 25
00719 #endif
00720 
00721 /* Report a fatal error. */
00722 #ifndef YY_FATAL_ERROR
00723 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00724 #endif
00725 
00726 /* end tables serialization structures and prototypes */
00727 
00728 /* Default declaration of generated scanner - a define so the user can
00729  * easily add parameters.
00730  */
00731 #ifndef YY_DECL
00732 #define YY_DECL_IS_OURS 1
00733 
00734 extern int yylex (void);
00735 
00736 #define YY_DECL int yylex (void)
00737 #endif /* !YY_DECL */
00738 
00739 /* Code executed at the beginning of each rule, after yytext and yyleng
00740  * have been set up.
00741  */
00742 #ifndef YY_USER_ACTION
00743 #define YY_USER_ACTION
00744 #endif
00745 
00746 /* Code executed at the end of each rule. */
00747 #ifndef YY_BREAK
00748 #define YY_BREAK break;
00749 #endif
00750 
00751 #define YY_RULE_SETUP \
00752         YY_USER_ACTION
00753 
00756 YY_DECL
00757 {
00758         register yy_state_type yy_current_state;
00759         register char *yy_cp, *yy_bp;
00760         register int yy_act;
00761     
00762 #line 110 "../src/parser/follex.y"
00763 
00764 
00765 #line 766 "../src/parser/follex.cpp"
00766 
00767         if ( !(yy_init) )
00768                 {
00769                 (yy_init) = 1;
00770 
00771 #ifdef YY_USER_INIT
00772                 YY_USER_INIT;
00773 #endif
00774 
00775                 if ( ! (yy_start) )
00776                         (yy_start) = 1; /* first start state */
00777 
00778                 if ( ! yyin )
00779                         yyin = stdin;
00780 
00781                 if ( ! yyout )
00782                         yyout = stdout;
00783 
00784                 if ( ! YY_CURRENT_BUFFER ) {
00785                         yyensure_buffer_stack ();
00786                         YY_CURRENT_BUFFER_LVALUE =
00787                                 yy_create_buffer(yyin,YY_BUF_SIZE );
00788                 }
00789 
00790                 yy_load_buffer_state( );
00791                 }
00792 
00793         while ( 1 )             /* loops until end-of-file is reached */
00794                 {
00795                 yy_cp = (yy_c_buf_p);
00796 
00797                 /* Support of yytext. */
00798                 *yy_cp = (yy_hold_char);
00799 
00800                 /* yy_bp points to the position in yy_ch_buf of the start of
00801                  * the current run.
00802                  */
00803                 yy_bp = yy_cp;
00804 
00805                 yy_current_state = (yy_start);
00806 yy_match:
00807                 do
00808                         {
00809                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00810                         if ( yy_accept[yy_current_state] )
00811                                 {
00812                                 (yy_last_accepting_state) = yy_current_state;
00813                                 (yy_last_accepting_cpos) = yy_cp;
00814                                 }
00815                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00816                                 {
00817                                 yy_current_state = (int) yy_def[yy_current_state];
00818                                 if ( yy_current_state >= 84 )
00819                                         yy_c = yy_meta[(unsigned int) yy_c];
00820                                 }
00821                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00822                         ++yy_cp;
00823                         }
00824                 while ( yy_base[yy_current_state] != 166 );
00825 
00826 yy_find_action:
00827                 yy_act = yy_accept[yy_current_state];
00828                 if ( yy_act == 0 )
00829                         { /* have to back up */
00830                         yy_cp = (yy_last_accepting_cpos);
00831                         yy_current_state = (yy_last_accepting_state);
00832                         yy_act = yy_accept[yy_current_state];
00833                         }
00834 
00835                 YY_DO_BEFORE_ACTION;
00836 
00837 do_action:      /* This label is used only to access EOF actions. */
00838 
00839                 switch ( yy_act )
00840         { /* beginning of action switch */
00841                         case 0: /* must back up */
00842                         /* undo the effects of YY_DO_BEFORE_ACTION */
00843                         *yy_cp = (yy_hold_char);
00844                         yy_cp = (yy_last_accepting_cpos);
00845                         yy_current_state = (yy_last_accepting_state);
00846                         goto yy_find_action;
00847 
00848 case 1:
00849 YY_RULE_SETUP
00850 #line 112 "../src/parser/follex.y"
00851 {
00852   if (follexDbg) printf("LBRACE: %s\n", yytext);
00853   zzcolumn += strlen(yytext);
00854   zznumCharRead += strlen(yytext);
00855   zztokenList.add(yytext);
00856   return yytext[0];
00857 }
00858         YY_BREAK
00859 case 2:
00860 YY_RULE_SETUP
00861 #line 121 "../src/parser/follex.y"
00862 {
00863   if (follexDbg) printf("RBRACE: %s\n", yytext);
00864   zzcolumn += strlen(yytext);
00865   zznumCharRead += strlen(yytext);
00866   zztokenList.add(yytext);
00867   return yytext[0];
00868 }
00869         YY_BREAK
00870 case 3:
00871 YY_RULE_SETUP
00872 #line 130 "../src/parser/follex.y"
00873 { 
00874   if (follexDbg) printf("SINGLE_LINE_COMMENT: %s\n", yytext);
00875   if (yytext[strlen(yytext)-1] == '\n' || yytext[strlen(yytext)-1] == '\r') 
00876     {
00877       ++zzline;
00878       zzcolumn = -1;
00879     } 
00880     else
00881       zzcolumn += strlen(yytext);
00882   zznumCharRead += strlen(yytext);
00883 }
00884         YY_BREAK
00885 case 4:
00886 /* rule 4 can match eol */
00887 YY_RULE_SETUP
00888 #line 142 "../src/parser/follex.y"
00889 { 
00890   if (follexDbg) printf("MULTI_LINE_COMMENT: %s\n", yytext);
00891   int i=-1;
00892   while (yytext[++i] != '\0')
00893   {
00894     if (yytext[i] == '\n' || yytext[i] == '\r') 
00895     {
00896       ++zzline;
00897       zzcolumn = -1;
00898     } 
00899     else
00900       zzcolumn++;
00901   }
00902   zznumCharRead += strlen(yytext); 
00903 }
00904         YY_BREAK
00905 case 5:
00906 YY_RULE_SETUP
00907 #line 159 "../src/parser/follex.y"
00908 { 
00909   if (follexDbg) printf("INCLUDE: %s\n", yytext);
00910   zzcolumn += strlen(yytext);
00911   zznumCharRead += strlen(yytext);
00912   zztokenList.add(yytext);
00913   return ZZ_INCLUDE;
00914 }
00915         YY_BREAK
00916 case 6:
00917 YY_RULE_SETUP
00918 #line 168 "../src/parser/follex.y"
00919 {
00920   if (follexDbg) printf("NOT: %s\n", yytext);
00921   zzcolumn += strlen(yytext);
00922   zznumCharRead += strlen(yytext);
00923   zztokenList.add(yytext);
00924   return yytext[0];
00925 }
00926         YY_BREAK
00927 case 7:
00928 /* rule 7 can match eol */
00929 YY_RULE_SETUP
00930 #line 177 "../src/parser/follex.y"
00931 {
00932   if (follexDbg) printf("OR: %s\n", yytext);
00933   zzcolumn += strlen(yytext);
00934   zznumCharRead += strlen(yytext);
00935   zztokenList.add("v");
00936   return 'v';
00937 }
00938         YY_BREAK
00939 case 8:
00940 /* rule 8 can match eol */
00941 YY_RULE_SETUP
00942 #line 186 "../src/parser/follex.y"
00943 {
00944   if (follexDbg) printf("AND: %s\n", yytext);
00945   zzcolumn += strlen(yytext);
00946   zznumCharRead += strlen(yytext);
00947   zztokenList.add("^");
00948   return '^';
00949 }
00950         YY_BREAK
00951 case 9:
00952 YY_RULE_SETUP
00953 #line 195 "../src/parser/follex.y"
00954 {
00955   if (follexDbg) printf("IMPLY: %s\n", yytext);
00956   zzcolumn += strlen(yytext);
00957   zznumCharRead += strlen(yytext);
00958   zztokenList.add(yytext);
00959   return ZZ_IMPLY;
00960 }
00961         YY_BREAK
00962 case 10:
00963 YY_RULE_SETUP
00964 #line 204 "../src/parser/follex.y"
00965 {
00966   if (follexDbg) printf("EQUIV: %s\n", yytext);
00967   zzcolumn += strlen(yytext);
00968   zznumCharRead += strlen(yytext);
00969   zztokenList.add(yytext);
00970   return ZZ_EQUIV;
00971 }
00972         YY_BREAK
00973 case 11:
00974 YY_RULE_SETUP
00975 #line 213 "../src/parser/follex.y"
00976 { 
00977   if (follexDbg) printf("EXIST: %s\n", yytext);
00978   zzcolumn += strlen(yytext);
00979   zznumCharRead += strlen(yytext);
00980   zztokenList.add(yytext);
00981   return ZZ_EXIST;
00982 }
00983         YY_BREAK
00984 case 12:
00985 YY_RULE_SETUP
00986 #line 222 "../src/parser/follex.y"
00987 { 
00988   if (follexDbg) printf("FORALL: %s\n", yytext);
00989   zzcolumn += strlen(yytext);
00990   zznumCharRead += strlen(yytext);
00991   zztokenList.add(yytext);
00992   return ZZ_FORALL;
00993 }
00994         YY_BREAK
00995 case 13:
00996 YY_RULE_SETUP
00997 #line 231 "../src/parser/follex.y"
00998 {
00999   if (follexDbg) printf("ASTERISK: %s\n", yytext);
01000   zzcolumn += strlen(yytext);
01001   zznumCharRead += strlen(yytext);
01002   zztokenList.add(yytext);
01003   return yytext[0];
01004 }
01005         YY_BREAK
01006 case 14:
01007 YY_RULE_SETUP
01008 #line 240 "../src/parser/follex.y"
01009 {
01010   if (follexDbg) printf("PLUS: %s\n", yytext);
01011   zzcolumn += strlen(yytext);
01012   zznumCharRead += strlen(yytext);
01013   zztokenList.add(yytext);
01014   return yytext[0];
01015 }
01016         YY_BREAK
01017 case 15:
01018 YY_RULE_SETUP
01019 #line 249 "../src/parser/follex.y"
01020 {
01021   if (follexDbg) printf("MINUS: %s\n", yytext);
01022   zzcolumn += strlen(yytext);
01023   zznumCharRead += strlen(yytext);
01024   zztokenList.add(yytext);
01025   return yytext[0];
01026 }
01027         YY_BREAK
01028 case 16:
01029 YY_RULE_SETUP
01030 #line 257 "../src/parser/follex.y"
01031 {
01032   if (follexDbg) printf("QS: %s\n", yytext);
01033   zzcolumn += strlen(yytext);
01034   zznumCharRead += strlen(yytext);
01035   zztokenList.add(yytext);
01036   return yytext[0];
01037 }
01038         YY_BREAK
01039 case 17:
01040 YY_RULE_SETUP
01041 #line 266 "../src/parser/follex.y"
01042 {
01043   if (follexDbg) printf("INTEGER: %s (%d)\n", yytext, atoi(yytext));
01044   zzcolumn += strlen(yytext);
01045   zznumCharRead += strlen(yytext);
01046   zztokenList.add(yytext);
01047   return ZZ_NUM;  
01048 }
01049         YY_BREAK
01050 case 18:
01051 YY_RULE_SETUP
01052 #line 275 "../src/parser/follex.y"
01053 {
01054   if (follexDbg) printf("FLOAT: %s (%g)\n", yytext, atof(yytext));
01055   zzcolumn += strlen(yytext);
01056   zznumCharRead += strlen(yytext);
01057   zztokenList.add(yytext);
01058   return ZZ_NUM;
01059 }
01060         YY_BREAK
01061 case 19:
01062 YY_RULE_SETUP
01063 #line 284 "../src/parser/follex.y"
01064 {
01065   if (follexDbg) printf("EXP_FLOAT: %s (%e)\n", yytext, atof(yytext));
01066   zzcolumn += strlen(yytext);
01067   zznumCharRead += strlen(yytext);
01068   zztokenList.add(yytext);
01069   return ZZ_NUM;
01070 }
01071         YY_BREAK
01072 case 20:
01073 YY_RULE_SETUP
01074 #line 293 "../src/parser/follex.y"
01075 {
01076   if (follexDbg) printf("STRING: %s \n", yytext);
01077   zzcolumn += strlen(yytext);
01078   zznumCharRead += strlen(yytext);
01079   zztokenList.add(yytext);
01080   if (zzdomain->isConstant(yytext)) return ZZ_CONSTANT;
01081   return ZZ_STRING;
01082 }
01083         YY_BREAK
01084 case 21:
01085 YY_RULE_SETUP
01086 #line 303 "../src/parser/follex.y"
01087 {
01088   //if (follexDbg) printf("IDENTIFIER: %s\n", yytext );
01089   zzcolumn += strlen(yytext);
01090   zznumCharRead += strlen(yytext);
01091   zztokenList.add(yytext);
01092   if (zzdomain->isType(yytext))
01093   { 
01094     if (follexDbg) printf("ZZ_TYPE: %s\n", yytext ); 
01095     return ZZ_TYPE;
01096   }
01097   if (zzdomain->isPredicate(yytext)) 
01098   { 
01099     if (follexDbg) printf("ZZ_PREDICATE: %s\n", yytext ); 
01100     return ZZ_PREDICATE; 
01101   }
01102   if (zzdomain->isFunction(yytext))  
01103   {  
01104     if (follexDbg) printf("ZZ_FUNCTION: %s\n", yytext ); 
01105     return ZZ_FUNCTION;
01106   }
01107   if (zzdomain->isConstant(yytext))
01108   {
01109     if (follexDbg) printf("ZZ_CONSTANT: %s\n", yytext ); 
01110     return ZZ_CONSTANT;
01111   }
01112   if (follexDbg) printf("ZZ_VARIABLE: %s\n", yytext ); 
01113   return ZZ_VARIABLE;
01114 }
01115         YY_BREAK
01116 case 22:
01117 /* rule 22 can match eol */
01118 YY_RULE_SETUP
01119 #line 333 "../src/parser/follex.y"
01120 {
01121   if (follexDbg) 
01122   {
01123     if (zzparseGroundPred) printf("AT: %c\n", '@');
01124     else                   printf("NEWLINE: %s", yytext);
01125   }
01126   ++zzline;
01127   zznumCharRead += 1;
01128   zzcolumn = -1;
01129   if (zzparseGroundPred) { 
01130         zzafterRtParen = false;
01131         zztokenList.add("@");
01132         return '@';
01133   }
01134   zztokenList.add(yytext);
01135   return yytext[0];
01136 }
01137         YY_BREAK
01138 case 23:
01139 YY_RULE_SETUP
01140 #line 351 "../src/parser/follex.y"
01141 {
01142   if (follexDbg) printf("LEFT BRACKET: %s\n", yytext);
01143   zzcolumn += strlen(yytext);
01144   zznumCharRead += strlen(yytext);
01145   zztokenList.add(yytext);
01146   //if (zzparseGroundPred) zzafterRtParen = false;
01147   return yytext[0];
01148 }
01149         YY_BREAK
01150 case 24:
01151 YY_RULE_SETUP
01152 #line 361 "../src/parser/follex.y"
01153 {
01154   if (follexDbg) printf("RIGHT BRACKET: %s\n", yytext);
01155   zzcolumn += strlen(yytext);
01156   zznumCharRead += strlen(yytext);
01157   zztokenList.add(yytext);
01158   //if (zzparseGroundPred) zzafterRtParen = true;
01159   return yytext[0];
01160 }
01161         YY_BREAK
01162 case 25:
01163 YY_RULE_SETUP
01164 #line 371 "../src/parser/follex.y"
01165 {
01166   if (follexDbg) printf("LEFT PAREN: %s\n", yytext);
01167   zzcolumn += strlen(yytext);
01168   zznumCharRead += strlen(yytext);
01169   zztokenList.add(yytext);
01170   if (zzparseGroundPred) zzafterRtParen = false;
01171   return yytext[0];
01172 }
01173         YY_BREAK
01174 case 26:
01175 YY_RULE_SETUP
01176 #line 381 "../src/parser/follex.y"
01177 {
01178   if (follexDbg) printf("RIGHT PAREN: %s\n", yytext);
01179   zzcolumn += strlen(yytext);
01180   zznumCharRead += strlen(yytext);
01181   zztokenList.add(yytext);
01182   if (zzparseGroundPred) zzafterRtParen = true;
01183   return yytext[0];
01184 }
01185         YY_BREAK
01186 case 27:
01187 YY_RULE_SETUP
01188 #line 391 "../src/parser/follex.y"
01189 {
01190   if (follexDbg) printf("COMMA: %s\n", yytext);
01191   zzcolumn += strlen(yytext);
01192   zznumCharRead += strlen(yytext);
01193   zztokenList.add(yytext);
01194   return yytext[0];
01195 }
01196         YY_BREAK
01197 case 28:
01198 YY_RULE_SETUP
01199 #line 400 "../src/parser/follex.y"
01200 {
01201   if (follexDbg) printf("EQUAL: %s\n", yytext);
01202   zzcolumn += strlen(yytext);
01203   zznumCharRead += strlen(yytext);
01204   zztokenList.add("=");
01205   return '=';
01206 }
01207         YY_BREAK
01208 case 29:
01209 YY_RULE_SETUP
01210 #line 409 "../src/parser/follex.y"
01211 {
01212   if (follexDbg) printf("DOTDOTDOT: %s\n", yytext);
01213   zzcolumn += strlen(yytext);
01214   zznumCharRead += strlen(yytext);
01215   zztokenList.add("...");
01216   return ZZ_DOTDOTDOT;
01217 }
01218         YY_BREAK
01219 case 30:
01220 YY_RULE_SETUP
01221 #line 418 "../src/parser/follex.y"
01222 {
01223   if (follexDbg) printf("AT: %s\n", yytext);
01224   zzcolumn += strlen(yytext);
01225   zznumCharRead += strlen(yytext);
01226   zztokenList.add(yytext);
01227   return yytext[0];
01228 }
01229         YY_BREAK
01230 case 31:
01231 YY_RULE_SETUP
01232 #line 427 "../src/parser/follex.y"
01233 {
01234   if (follexDbg) printf("FULLSTOP: %s\n", yytext);
01235   zzcolumn += strlen(yytext);
01236   zznumCharRead += strlen(yytext);
01237   zztokenList.add(yytext);
01238   return yytext[0];
01239 }
01240         YY_BREAK
01241 case 32:
01242 YY_RULE_SETUP
01243 #line 436 "../src/parser/follex.y"
01244 { /* eat up whitespace */
01245   if (follexDbg) 
01246   {
01247     if (zzparseGroundPred) printf("WS:\n");
01248   }
01249   zzcolumn += strlen(yytext);
01250   zznumCharRead += strlen(yytext);
01251 
01252   if (zzparseGroundPred && zzafterRtParen) { zztokenList.add("@"); return '@'; }
01253 }
01254         YY_BREAK
01255 case 33:
01256 YY_RULE_SETUP
01257 #line 448 "../src/parser/follex.y"
01258 {
01259     // commented out so as to allow fol.y to deal with the problem
01260   //printf("\nERROR: Unrecognized character. %s: ln %d, col %d: %s \n", 
01261   //       zzinFileName.c_str(), zzline, zzcolumn+1, yytext);
01262   //exit(-1);
01263   if (follexDbg) printf("Unrecognized character: %s\n", yytext);
01264   zzcolumn += strlen(yytext);
01265   zznumCharRead += strlen(yytext);
01266   zztokenList.add(yytext);
01267   return yytext[0];
01268 
01269 }
01270         YY_BREAK
01271 case YY_STATE_EOF(INITIAL):
01272 #line 461 "../src/parser/follex.y"
01273 {
01274 
01275   if (zzparseGroundPred) 
01276   {
01277     if (zznumEofSeen == 0) 
01278     {
01279       zznumEofSeen++;
01280       if (follexDbg) printf("EOF returned as @:\n");
01281       zztokenList.add("@"); 
01282       return '@'; 
01283     }
01284     else
01285     {
01286       zzparseGroundPred = false;
01287       zzafterRtParen = false;
01288       zznumEofSeen = 0;
01289     }
01290   }
01291 
01292   if (zznumEofSeen==0)
01293   {
01294     ungetc(EOF, yyin);
01295     zznumEofSeen = 1;
01296     if (follexDbg) printf("EOF returned as \\n:\n");    
01297     zztokenList.add("\n");  // pretend that file ends with newline
01298     return '\n';
01299   }
01300   
01301   zznumEofSeen = 0;
01302   
01303   if (follexDbg) printf("EOF %s:\n", yytext);
01304   if (false) yyunput(1,NULL); //avoid compilation warning
01305 
01306   fclose(yyin);
01307   if (zzinStack.empty()) return 0;
01308 
01309   ZZFileState fileState = zzinStack.top();
01310   zzinFileName = fileState.inFileName_;
01311   zznumCharRead = fileState.numCharRead_;
01312   zzline = fileState.line_;
01313   zzcolumn = fileState.column_;
01314   zzinStack.pop();
01315 
01316   FILE* previn = fileState.file_;
01317   if (fseek(previn, zznumCharRead-1, SEEK_SET)!=0)
01318   {
01319     printf("\nERROR: In follex.y. Failed to seek to previous position in file "
01320            "%s, ln %d, col %d\n", zzinFileName.c_str(), zzline, zzcolumn+1);
01321     exit(-1);
01322   }
01323   yyrestart(previn);
01324   
01325 }
01326         YY_BREAK
01327 case 34:
01328 YY_RULE_SETUP
01329 #line 514 "../src/parser/follex.y"
01330 ECHO;
01331         YY_BREAK
01332 #line 1333 "../src/parser/follex.cpp"
01333 
01334         case YY_END_OF_BUFFER:
01335                 {
01336                 /* Amount of text matched not including the EOB char. */
01337                 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
01338 
01339                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
01340                 *yy_cp = (yy_hold_char);
01341                 YY_RESTORE_YY_MORE_OFFSET
01342 
01343                 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
01344                         {
01345                         /* We're scanning a new file or input source.  It's
01346                          * possible that this happened because the user
01347                          * just pointed yyin at a new source and called
01348                          * yylex().  If so, then we have to assure
01349                          * consistency between YY_CURRENT_BUFFER and our
01350                          * globals.  Here is the right place to do so, because
01351                          * this is the first action (other than possibly a
01352                          * back-up) that will match for the new input source.
01353                          */
01354                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01355                         YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
01356                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
01357                         }
01358 
01359                 /* Note that here we test for yy_c_buf_p "<=" to the position
01360                  * of the first EOB in the buffer, since yy_c_buf_p will
01361                  * already have been incremented past the NUL character
01362                  * (since all states make transitions on EOB to the
01363                  * end-of-buffer state).  Contrast this with the test
01364                  * in input().
01365                  */
01366                 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01367                         { /* This was really a NUL. */
01368                         yy_state_type yy_next_state;
01369 
01370                         (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
01371 
01372                         yy_current_state = yy_get_previous_state(  );
01373 
01374                         /* Okay, we're now positioned to make the NUL
01375                          * transition.  We couldn't have
01376                          * yy_get_previous_state() go ahead and do it
01377                          * for us because it doesn't know how to deal
01378                          * with the possibility of jamming (and we don't
01379                          * want to build jamming into it because then it
01380                          * will run more slowly).
01381                          */
01382 
01383                         yy_next_state = yy_try_NUL_trans( yy_current_state );
01384 
01385                         yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01386 
01387                         if ( yy_next_state )
01388                                 {
01389                                 /* Consume the NUL. */
01390                                 yy_cp = ++(yy_c_buf_p);
01391                                 yy_current_state = yy_next_state;
01392                                 goto yy_match;
01393                                 }
01394 
01395                         else
01396                                 {
01397                                 yy_cp = (yy_c_buf_p);
01398                                 goto yy_find_action;
01399                                 }
01400                         }
01401 
01402                 else switch ( yy_get_next_buffer(  ) )
01403                         {
01404                         case EOB_ACT_END_OF_FILE:
01405                                 {
01406                                 (yy_did_buffer_switch_on_eof) = 0;
01407 
01408                                 if ( yywrap( ) )
01409                                         {
01410                                         /* Note: because we've taken care in
01411                                          * yy_get_next_buffer() to have set up
01412                                          * yytext, we can now set up
01413                                          * yy_c_buf_p so that if some total
01414                                          * hoser (like flex itself) wants to
01415                                          * call the scanner after we return the
01416                                          * YY_NULL, it'll still work - another
01417                                          * YY_NULL will get returned.
01418                                          */
01419                                         (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
01420 
01421                                         yy_act = YY_STATE_EOF(YY_START);
01422                                         goto do_action;
01423                                         }
01424 
01425                                 else
01426                                         {
01427                                         if ( ! (yy_did_buffer_switch_on_eof) )
01428                                                 YY_NEW_FILE;
01429                                         }
01430                                 break;
01431                                 }
01432 
01433                         case EOB_ACT_CONTINUE_SCAN:
01434                                 (yy_c_buf_p) =
01435                                         (yytext_ptr) + yy_amount_of_matched_text;
01436 
01437                                 yy_current_state = yy_get_previous_state(  );
01438 
01439                                 yy_cp = (yy_c_buf_p);
01440                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01441                                 goto yy_match;
01442 
01443                         case EOB_ACT_LAST_MATCH:
01444                                 (yy_c_buf_p) =
01445                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
01446 
01447                                 yy_current_state = yy_get_previous_state(  );
01448 
01449                                 yy_cp = (yy_c_buf_p);
01450                                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
01451                                 goto yy_find_action;
01452                         }
01453                 break;
01454                 }
01455 
01456         default:
01457                 YY_FATAL_ERROR(
01458                         "fatal flex scanner internal error--no action found" );
01459         } /* end of action switch */
01460                 } /* end of scanning one token */
01461 } /* end of yylex */
01462 
01463 /* yy_get_next_buffer - try to read in a new buffer
01464  *
01465  * Returns a code representing an action:
01466  *      EOB_ACT_LAST_MATCH -
01467  *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
01468  *      EOB_ACT_END_OF_FILE - end of file
01469  */
01470 static int yy_get_next_buffer (void)
01471 {
01472         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
01473         register char *source = (yytext_ptr);
01474         register int number_to_move, i;
01475         int ret_val;
01476 
01477         if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
01478                 YY_FATAL_ERROR(
01479                 "fatal flex scanner internal error--end of buffer missed" );
01480 
01481         if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
01482                 { /* Don't try to fill the buffer, so this is an EOF. */
01483                 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
01484                         {
01485                         /* We matched a single character, the EOB, so
01486                          * treat this as a final EOF.
01487                          */
01488                         return EOB_ACT_END_OF_FILE;
01489                         }
01490 
01491                 else
01492                         {
01493                         /* We matched some text prior to the EOB, first
01494                          * process it.
01495                          */
01496                         return EOB_ACT_LAST_MATCH;
01497                         }
01498                 }
01499 
01500         /* Try to read more data. */
01501 
01502         /* First move last chars to start of buffer. */
01503         number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
01504 
01505         for ( i = 0; i < number_to_move; ++i )
01506                 *(dest++) = *(source++);
01507 
01508         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
01509                 /* don't do the read, it's not guaranteed to return an EOF,
01510                  * just force an EOF
01511                  */
01512                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
01513 
01514         else
01515                 {
01516                         int num_to_read =
01517                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
01518 
01519                 while ( num_to_read <= 0 )
01520                         { /* Not enough room in the buffer - grow it. */
01521 
01522                         /* just a shorter name for the current buffer */
01523                         YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
01524 
01525                         int yy_c_buf_p_offset =
01526                                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
01527 
01528                         if ( b->yy_is_our_buffer )
01529                                 {
01530                                 int new_size = b->yy_buf_size * 2;
01531 
01532                                 if ( new_size <= 0 )
01533                                         b->yy_buf_size += b->yy_buf_size / 8;
01534                                 else
01535                                         b->yy_buf_size *= 2;
01536 
01537                                 b->yy_ch_buf = (char *)
01538                                         /* Include room in for 2 EOB chars. */
01539                                         yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
01540                                 }
01541                         else
01542                                 /* Can't grow it, we don't own it. */
01543                                 b->yy_ch_buf = 0;
01544 
01545                         if ( ! b->yy_ch_buf )
01546                                 YY_FATAL_ERROR(
01547                                 "fatal error - scanner input buffer overflow" );
01548 
01549                         (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
01550 
01551                         num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
01552                                                 number_to_move - 1;
01553 
01554                         }
01555 
01556                 if ( num_to_read > YY_READ_BUF_SIZE )
01557                         num_to_read = YY_READ_BUF_SIZE;
01558 
01559                 /* Read in more data. */
01560                 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01561                         (yy_n_chars), num_to_read );
01562 
01563                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01564                 }
01565 
01566         if ( (yy_n_chars) == 0 )
01567                 {
01568                 if ( number_to_move == YY_MORE_ADJ )
01569                         {
01570                         ret_val = EOB_ACT_END_OF_FILE;
01571                         yyrestart(yyin  );
01572                         }
01573 
01574                 else
01575                         {
01576                         ret_val = EOB_ACT_LAST_MATCH;
01577                         YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01578                                 YY_BUFFER_EOF_PENDING;
01579                         }
01580                 }
01581 
01582         else
01583                 ret_val = EOB_ACT_CONTINUE_SCAN;
01584 
01585         (yy_n_chars) += number_to_move;
01586         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01587         YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01588 
01589         (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01590 
01591         return ret_val;
01592 }
01593 
01594 /* yy_get_previous_state - get the state just before the EOB char was reached */
01595 
01596     static yy_state_type yy_get_previous_state (void)
01597 {
01598         register yy_state_type yy_current_state;
01599         register char *yy_cp;
01600     
01601         yy_current_state = (yy_start);
01602 
01603         for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01604                 {
01605                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01606                 if ( yy_accept[yy_current_state] )
01607                         {
01608                         (yy_last_accepting_state) = yy_current_state;
01609                         (yy_last_accepting_cpos) = yy_cp;
01610                         }
01611                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01612                         {
01613                         yy_current_state = (int) yy_def[yy_current_state];
01614                         if ( yy_current_state >= 84 )
01615                                 yy_c = yy_meta[(unsigned int) yy_c];
01616                         }
01617                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01618                 }
01619 
01620         return yy_current_state;
01621 }
01622 
01623 /* yy_try_NUL_trans - try to make a transition on the NUL character
01624  *
01625  * synopsis
01626  *      next_state = yy_try_NUL_trans( current_state );
01627  */
01628     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
01629 {
01630         register int yy_is_jam;
01631         register char *yy_cp = (yy_c_buf_p);
01632 
01633         register YY_CHAR yy_c = 1;
01634         if ( yy_accept[yy_current_state] )
01635                 {
01636                 (yy_last_accepting_state) = yy_current_state;
01637                 (yy_last_accepting_cpos) = yy_cp;
01638                 }
01639         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01640                 {
01641                 yy_current_state = (int) yy_def[yy_current_state];
01642                 if ( yy_current_state >= 84 )
01643                         yy_c = yy_meta[(unsigned int) yy_c];
01644                 }
01645         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01646         yy_is_jam = (yy_current_state == 83);
01647 
01648         return yy_is_jam ? 0 : yy_current_state;
01649 }
01650 
01651     static void yyunput (int c, register char * yy_bp )
01652 {
01653         register char *yy_cp;
01654     
01655     yy_cp = (yy_c_buf_p);
01656 
01657         /* undo effects of setting up yytext */
01658         *yy_cp = (yy_hold_char);
01659 
01660         if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01661                 { /* need to shift things up to make room */
01662                 /* +2 for EOB chars. */
01663                 register int number_to_move = (yy_n_chars) + 2;
01664                 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
01665                                         YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
01666                 register char *source =
01667                                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
01668 
01669                 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
01670                         *--dest = *--source;
01671 
01672                 yy_cp += (int) (dest - source);
01673                 yy_bp += (int) (dest - source);
01674                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
01675                         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
01676 
01677                 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
01678                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
01679                 }
01680 
01681         *--yy_cp = (char) c;
01682 
01683         (yytext_ptr) = yy_bp;
01684         (yy_hold_char) = *yy_cp;
01685         (yy_c_buf_p) = yy_cp;
01686 }
01687 
01688 #ifndef YY_NO_INPUT
01689 #ifdef __cplusplus
01690     static int yyinput (void)
01691 #else
01692     static int input  (void)
01693 #endif
01694 
01695 {
01696         int c;
01697     
01698         *(yy_c_buf_p) = (yy_hold_char);
01699 
01700         if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01701                 {
01702                 /* yy_c_buf_p now points to the character we want to return.
01703                  * If this occurs *before* the EOB characters, then it's a
01704                  * valid NUL; if not, then we've hit the end of the buffer.
01705                  */
01706                 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01707                         /* This was really a NUL. */
01708                         *(yy_c_buf_p) = '\0';
01709 
01710                 else
01711                         { /* need more input */
01712                         int offset = (yy_c_buf_p) - (yytext_ptr);
01713                         ++(yy_c_buf_p);
01714 
01715                         switch ( yy_get_next_buffer(  ) )
01716                                 {
01717                                 case EOB_ACT_LAST_MATCH:
01718                                         /* This happens because yy_g_n_b()
01719                                          * sees that we've accumulated a
01720                                          * token and flags that we need to
01721                                          * try matching the token before
01722                                          * proceeding.  But for input(),
01723                                          * there's no matching to consider.
01724                                          * So convert the EOB_ACT_LAST_MATCH
01725                                          * to EOB_ACT_END_OF_FILE.
01726                                          */
01727 
01728                                         /* Reset buffer status. */
01729                                         yyrestart(yyin );
01730 
01731                                         /*FALLTHROUGH*/
01732 
01733                                 case EOB_ACT_END_OF_FILE:
01734                                         {
01735                                         if ( yywrap( ) )
01736                                                 return EOF;
01737 
01738                                         if ( ! (yy_did_buffer_switch_on_eof) )
01739                                                 YY_NEW_FILE;
01740 #ifdef __cplusplus
01741                                         return yyinput();
01742 #else
01743                                         return input();
01744 #endif
01745                                         }
01746 
01747                                 case EOB_ACT_CONTINUE_SCAN:
01748                                         (yy_c_buf_p) = (yytext_ptr) + offset;
01749                                         break;
01750                                 }
01751                         }
01752                 }
01753 
01754         c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01755         *(yy_c_buf_p) = '\0';   /* preserve yytext */
01756         (yy_hold_char) = *++(yy_c_buf_p);
01757 
01758         return c;
01759 }
01760 #endif  /* ifndef YY_NO_INPUT */
01761 
01767     void yyrestart  (FILE * input_file )
01768 {
01769     
01770         if ( ! YY_CURRENT_BUFFER ){
01771         yyensure_buffer_stack ();
01772                 YY_CURRENT_BUFFER_LVALUE =
01773             yy_create_buffer(yyin,YY_BUF_SIZE );
01774         }
01775 
01776         yy_init_buffer(YY_CURRENT_BUFFER,input_file );
01777         yy_load_buffer_state( );
01778 }
01779 
01784     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
01785 {
01786     
01787         /* TODO. We should be able to replace this entire function body
01788          * with
01789          *              yypop_buffer_state();
01790          *              yypush_buffer_state(new_buffer);
01791      */
01792         yyensure_buffer_stack ();
01793         if ( YY_CURRENT_BUFFER == new_buffer )
01794                 return;
01795 
01796         if ( YY_CURRENT_BUFFER )
01797                 {
01798                 /* Flush out information for old buffer. */
01799                 *(yy_c_buf_p) = (yy_hold_char);
01800                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01801                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01802                 }
01803 
01804         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01805         yy_load_buffer_state( );
01806 
01807         /* We don't actually know whether we did this switch during
01808          * EOF (yywrap()) processing, but the only time this flag
01809          * is looked at is after yywrap() is called, so it's safe
01810          * to go ahead and always set it.
01811          */
01812         (yy_did_buffer_switch_on_eof) = 1;
01813 }
01814 
01815 static void yy_load_buffer_state  (void)
01816 {
01817         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01818         (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01819         yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01820         (yy_hold_char) = *(yy_c_buf_p);
01821 }
01822 
01829     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
01830 {
01831         YY_BUFFER_STATE b;
01832     
01833         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
01834         if ( ! b )
01835                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01836 
01837         b->yy_buf_size = size;
01838 
01839         /* yy_ch_buf has to be 2 characters longer than the size given because
01840          * we need to put in 2 end-of-buffer characters.
01841          */
01842         b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
01843         if ( ! b->yy_ch_buf )
01844                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01845 
01846         b->yy_is_our_buffer = 1;
01847 
01848         yy_init_buffer(b,file );
01849 
01850         return b;
01851 }
01852 
01857     void yy_delete_buffer (YY_BUFFER_STATE  b )
01858 {
01859     
01860         if ( ! b )
01861                 return;
01862 
01863         if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01864                 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01865 
01866         if ( b->yy_is_our_buffer )
01867                 yyfree((void *) b->yy_ch_buf  );
01868 
01869         yyfree((void *) b  );
01870 }
01871 
01872 #ifndef __cplusplus
01873 extern int isatty (int );
01874 #endif /* __cplusplus */
01875     
01876 /* Initializes or reinitializes a buffer.
01877  * This function is sometimes called more than once on the same buffer,
01878  * such as during a yyrestart() or at EOF.
01879  */
01880     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
01881 
01882 {
01883         int oerrno = errno;
01884     
01885         yy_flush_buffer(b );
01886 
01887         b->yy_input_file = file;
01888         b->yy_fill_buffer = 1;
01889 
01890     /* If b is the current buffer, then yy_init_buffer was _probably_
01891      * called from yyrestart() or through yy_get_next_buffer.
01892      * In that case, we don't want to reset the lineno or column.
01893      */
01894     if (b != YY_CURRENT_BUFFER){
01895         b->yy_bs_lineno = 1;
01896         b->yy_bs_column = 0;
01897     }
01898 
01899         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01900     
01901         errno = oerrno;
01902 }
01903 
01908     void yy_flush_buffer (YY_BUFFER_STATE  b )
01909 {
01910         if ( ! b )
01911                 return;
01912 
01913         b->yy_n_chars = 0;
01914 
01915         /* We always need two end-of-buffer characters.  The first causes
01916          * a transition to the end-of-buffer state.  The second causes
01917          * a jam in that state.
01918          */
01919         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01920         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01921 
01922         b->yy_buf_pos = &b->yy_ch_buf[0];
01923 
01924         b->yy_at_bol = 1;
01925         b->yy_buffer_status = YY_BUFFER_NEW;
01926 
01927         if ( b == YY_CURRENT_BUFFER )
01928                 yy_load_buffer_state( );
01929 }
01930 
01937 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
01938 {
01939         if (new_buffer == NULL)
01940                 return;
01941 
01942         yyensure_buffer_stack();
01943 
01944         /* This block is copied from yy_switch_to_buffer. */
01945         if ( YY_CURRENT_BUFFER )
01946                 {
01947                 /* Flush out information for old buffer. */
01948                 *(yy_c_buf_p) = (yy_hold_char);
01949                 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01950                 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01951                 }
01952 
01953         /* Only push if top exists. Otherwise, replace top. */
01954         if (YY_CURRENT_BUFFER)
01955                 (yy_buffer_stack_top)++;
01956         YY_CURRENT_BUFFER_LVALUE = new_buffer;
01957 
01958         /* copied from yy_switch_to_buffer. */
01959         yy_load_buffer_state( );
01960         (yy_did_buffer_switch_on_eof) = 1;
01961 }
01962 
01967 void yypop_buffer_state (void)
01968 {
01969         if (!YY_CURRENT_BUFFER)
01970                 return;
01971 
01972         yy_delete_buffer(YY_CURRENT_BUFFER );
01973         YY_CURRENT_BUFFER_LVALUE = NULL;
01974         if ((yy_buffer_stack_top) > 0)
01975                 --(yy_buffer_stack_top);
01976 
01977         if (YY_CURRENT_BUFFER) {
01978                 yy_load_buffer_state( );
01979                 (yy_did_buffer_switch_on_eof) = 1;
01980         }
01981 }
01982 
01983 /* Allocates the stack if it does not exist.
01984  *  Guarantees space for at least one push.
01985  */
01986 static void yyensure_buffer_stack (void)
01987 {
01988         int num_to_alloc;
01989     
01990         if (!(yy_buffer_stack)) {
01991 
01992                 /* First allocation is just for 2 elements, since we don't know if this
01993                  * scanner will even need a stack. We use 2 instead of 1 to avoid an
01994                  * immediate realloc on the next call.
01995          */
01996                 num_to_alloc = 1;
01997                 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
01998                                                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01999                                                                 );
02000                 
02001                 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
02002                                 
02003                 (yy_buffer_stack_max) = num_to_alloc;
02004                 (yy_buffer_stack_top) = 0;
02005                 return;
02006         }
02007 
02008         if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
02009 
02010                 /* Increase the buffer to prepare for a possible push. */
02011                 int grow_size = 8 /* arbitrary grow size */;
02012 
02013                 num_to_alloc = (yy_buffer_stack_max) + grow_size;
02014                 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
02015                                                                 ((yy_buffer_stack),
02016                                                                 num_to_alloc * sizeof(struct yy_buffer_state*)
02017                                                                 );
02018 
02019                 /* zero only the new slots.*/
02020                 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
02021                 (yy_buffer_stack_max) = num_to_alloc;
02022         }
02023 }
02024 
02031 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
02032 {
02033         YY_BUFFER_STATE b;
02034     
02035         if ( size < 2 ||
02036              base[size-2] != YY_END_OF_BUFFER_CHAR ||
02037              base[size-1] != YY_END_OF_BUFFER_CHAR )
02038                 /* They forgot to leave room for the EOB's. */
02039                 return 0;
02040 
02041         b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
02042         if ( ! b )
02043                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
02044 
02045         b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
02046         b->yy_buf_pos = b->yy_ch_buf = base;
02047         b->yy_is_our_buffer = 0;
02048         b->yy_input_file = 0;
02049         b->yy_n_chars = b->yy_buf_size;
02050         b->yy_is_interactive = 0;
02051         b->yy_at_bol = 1;
02052         b->yy_fill_buffer = 0;
02053         b->yy_buffer_status = YY_BUFFER_NEW;
02054 
02055         yy_switch_to_buffer(b  );
02056 
02057         return b;
02058 }
02059 
02068 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
02069 {
02070     
02071         return yy_scan_bytes(yystr,strlen(yystr) );
02072 }
02073 
02081 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
02082 {
02083         YY_BUFFER_STATE b;
02084         char *buf;
02085         yy_size_t n;
02086         int i;
02087     
02088         /* Get memory for full buffer, including space for trailing EOB's. */
02089         n = _yybytes_len + 2;
02090         buf = (char *) yyalloc(n  );
02091         if ( ! buf )
02092                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
02093 
02094         for ( i = 0; i < _yybytes_len; ++i )
02095                 buf[i] = yybytes[i];
02096 
02097         buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
02098 
02099         b = yy_scan_buffer(buf,n );
02100         if ( ! b )
02101                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
02102 
02103         /* It's okay to grow etc. this buffer, and we should throw it
02104          * away when we're done.
02105          */
02106         b->yy_is_our_buffer = 1;
02107 
02108         return b;
02109 }
02110 
02111 #ifndef YY_EXIT_FAILURE
02112 #define YY_EXIT_FAILURE 2
02113 #endif
02114 
02115 static void yy_fatal_error (yyconst char* msg )
02116 {
02117         (void) fprintf( stderr, "%s\n", msg );
02118         exit( YY_EXIT_FAILURE );
02119 }
02120 
02121 /* Redefine yyless() so it works in section 3 code. */
02122 
02123 #undef yyless
02124 #define yyless(n) \
02125         do \
02126                 { \
02127                 /* Undo effects of setting up yytext. */ \
02128         int yyless_macro_arg = (n); \
02129         YY_LESS_LINENO(yyless_macro_arg);\
02130                 yytext[yyleng] = (yy_hold_char); \
02131                 (yy_c_buf_p) = yytext + yyless_macro_arg; \
02132                 (yy_hold_char) = *(yy_c_buf_p); \
02133                 *(yy_c_buf_p) = '\0'; \
02134                 yyleng = yyless_macro_arg; \
02135                 } \
02136         while ( 0 )
02137 
02138 /* Accessor  methods (get/set functions) to struct members. */
02139 
02143 int yyget_lineno  (void)
02144 {
02145         
02146     return yylineno;
02147 }
02148 
02152 FILE *yyget_in  (void)
02153 {
02154         return yyin;
02155 }
02156 
02160 FILE *yyget_out  (void)
02161 {
02162         return yyout;
02163 }
02164 
02168 int yyget_leng  (void)
02169 {
02170         return yyleng;
02171 }
02172 
02177 char *yyget_text  (void)
02178 {
02179         return yytext;
02180 }
02181 
02186 void yyset_lineno (int  line_number )
02187 {
02188     
02189     yylineno = line_number;
02190 }
02191 
02198 void yyset_in (FILE *  in_str )
02199 {
02200         yyin = in_str ;
02201 }
02202 
02203 void yyset_out (FILE *  out_str )
02204 {
02205         yyout = out_str ;
02206 }
02207 
02208 int yyget_debug  (void)
02209 {
02210         return yy_flex_debug;
02211 }
02212 
02213 void yyset_debug (int  bdebug )
02214 {
02215         yy_flex_debug = bdebug ;
02216 }
02217 
02218 static int yy_init_globals (void)
02219 {
02220         /* Initialization is the same as for the non-reentrant scanner.
02221      * This function is called from yylex_destroy(), so don't allocate here.
02222      */
02223 
02224     (yy_buffer_stack) = 0;
02225     (yy_buffer_stack_top) = 0;
02226     (yy_buffer_stack_max) = 0;
02227     (yy_c_buf_p) = (char *) 0;
02228     (yy_init) = 0;
02229     (yy_start) = 0;
02230 
02231 /* Defined in main.c */
02232 #ifdef YY_STDINIT
02233     yyin = stdin;
02234     yyout = stdout;
02235 #else
02236     yyin = (FILE *) 0;
02237     yyout = (FILE *) 0;
02238 #endif
02239 
02240     /* For future reference: Set errno on error, since we are called by
02241      * yylex_init()
02242      */
02243     return 0;
02244 }
02245 
02246 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
02247 int yylex_destroy  (void)
02248 {
02249     
02250     /* Pop the buffer stack, destroying each element. */
02251         while(YY_CURRENT_BUFFER){
02252                 yy_delete_buffer(YY_CURRENT_BUFFER  );
02253                 YY_CURRENT_BUFFER_LVALUE = NULL;
02254                 yypop_buffer_state();
02255         }
02256 
02257         /* Destroy the stack itself. */
02258         yyfree((yy_buffer_stack) );
02259         (yy_buffer_stack) = NULL;
02260 
02261     /* Reset the globals. This is important in a non-reentrant scanner so the next time
02262      * yylex() is called, initialization will occur. */
02263     yy_init_globals( );
02264 
02265     return 0;
02266 }
02267 
02268 /*
02269  * Internal utility routines.
02270  */
02271 
02272 #ifndef yytext_ptr
02273 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
02274 {
02275         register int i;
02276         for ( i = 0; i < n; ++i )
02277                 s1[i] = s2[i];
02278 }
02279 #endif
02280 
02281 #ifdef YY_NEED_STRLEN
02282 static int yy_flex_strlen (yyconst char * s )
02283 {
02284         register int n;
02285         for ( n = 0; s[n]; ++n )
02286                 ;
02287 
02288         return n;
02289 }
02290 #endif
02291 
02292 void *yyalloc (yy_size_t  size )
02293 {
02294         return (void *) malloc( size );
02295 }
02296 
02297 void *yyrealloc  (void * ptr, yy_size_t  size )
02298 {
02299         /* The cast to (char *) in the following accommodates both
02300          * implementations that use char* generic pointers, and those
02301          * that use void* generic pointers.  It works with the latter
02302          * because both ANSI C and C++ allow castless assignment from
02303          * any pointer type to void*, and deal with argument conversions
02304          * as though doing an assignment.
02305          */
02306         return (void *) realloc( (char *) ptr, size );
02307 }
02308 
02309 void yyfree (void * ptr )
02310 {
02311         free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
02312 }
02313 
02314 #define YYTABLES_NAME "yytables"
02315 
02316 #line 514 "../src/parser/follex.y"
02317 
02318 
02319 

Generated on Sun Jun 7 11:55:19 2009 for Alchemy by  doxygen 1.5.1