## modules/rpsl/refer.lex.c

/* [<][>][^][v][top][bottom][index][help] */

## DEFINITIONS

This source file includes following functions.

1. YY_BUFFER_STATE
2. yy_size_t
3. YY_CHAR
4. yy_state_type
5. yy_get_next_buffer
6. yy_get_previous_state
7. yy_try_NUL_trans
8. yyunput
9. yyinput
10. yyrestart
11. yy_switch_to_buffer
12. yy_load_buffer_state
13. yy_create_buffer
14. yy_delete_buffer
15. yy_init_buffer
16. yy_flush_buffer
17. yy_scan_buffer
18. yy_scan_string
19. yy_scan_bytes
20. yy_push_state
21. yy_pop_state
22. yy_top_state
23. yy_fatal_error
24. yy_flex_strncpy
25. yy_flex_strlen
26. yy_flex_alloc
27. yy_flex_realloc
28. yy_flex_free
29. main
30. refer_reset

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

/* [<][>][^][v][top][bottom][index][help] */