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

Annotation of OpenXM_contrib/gmp/demos/calclex.c, Revision 1.1

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

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