[BACK]Return to calclex.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / demos / calc

Annotation of OpenXM_contrib/gmp/demos/calc/calclex.c, Revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>