[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.10

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