[BACK]Return to flex.skl CVS log [TXT][DIR] Up to [local] / src / usr.bin / lex

Annotation of src/usr.bin/lex/flex.skl, Revision 1.6

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