Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 4183841#line 3 "calclex.c"23#define YY_INT_ALIGNED short int45/* A lexical scanner generated by flex */67#define FLEX_SCANNER8#define YY_FLEX_MAJOR_VERSION 29#define YY_FLEX_MINOR_VERSION 510#define YY_FLEX_SUBMINOR_VERSION 3711#if YY_FLEX_SUBMINOR_VERSION > 012#define FLEX_BETA13#endif1415/* First, we deal with platform-specific or compiler-specific issues. */1617/* begin standard C headers. */18#include <stdio.h>19#include <string.h>20#include <errno.h>21#include <stdlib.h>2223/* end standard C headers. */2425/* flex integer type definitions */2627#ifndef FLEXINT_H28#define FLEXINT_H2930/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */3132#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L3334/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,35* if you want the limit (max/min) macros for int types.36*/37#ifndef __STDC_LIMIT_MACROS38#define __STDC_LIMIT_MACROS 139#endif4041#include <inttypes.h>42typedef int8_t flex_int8_t;43typedef uint8_t flex_uint8_t;44typedef int16_t flex_int16_t;45typedef uint16_t flex_uint16_t;46typedef int32_t flex_int32_t;47typedef uint32_t flex_uint32_t;48#else49typedef signed char flex_int8_t;50typedef short int flex_int16_t;51typedef int flex_int32_t;52typedef unsigned char flex_uint8_t;53typedef unsigned short int flex_uint16_t;54typedef unsigned int flex_uint32_t;5556/* Limits of integral types. */57#ifndef INT8_MIN58#define INT8_MIN (-128)59#endif60#ifndef INT16_MIN61#define INT16_MIN (-32767-1)62#endif63#ifndef INT32_MIN64#define INT32_MIN (-2147483647-1)65#endif66#ifndef INT8_MAX67#define INT8_MAX (127)68#endif69#ifndef INT16_MAX70#define INT16_MAX (32767)71#endif72#ifndef INT32_MAX73#define INT32_MAX (2147483647)74#endif75#ifndef UINT8_MAX76#define UINT8_MAX (255U)77#endif78#ifndef UINT16_MAX79#define UINT16_MAX (65535U)80#endif81#ifndef UINT32_MAX82#define UINT32_MAX (4294967295U)83#endif8485#endif /* ! C99 */8687#endif /* ! FLEXINT_H */8889#ifdef __cplusplus9091/* The "const" storage-class-modifier is valid. */92#define YY_USE_CONST9394#else /* ! __cplusplus */9596/* C99 requires __STDC__ to be defined as 1. */97#if defined (__STDC__)9899#define YY_USE_CONST100101#endif /* defined (__STDC__) */102#endif /* ! __cplusplus */103104#ifdef YY_USE_CONST105#define yyconst const106#else107#define yyconst108#endif109110/* Returned upon end-of-file. */111#define YY_NULL 0112113/* Promotes a possibly negative, possibly signed char to an unsigned114* integer for use as an array index. If the signed char is negative,115* we want to instead treat it as an 8-bit unsigned char, hence the116* double cast.117*/118#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)119120/* Enter a start condition. This macro really ought to take a parameter,121* but we do it the disgusting crufty way forced on us by the ()-less122* definition of BEGIN.123*/124#define BEGIN (yy_start) = 1 + 2 *125126/* Translate the current start state into a value that can be later handed127* to BEGIN to return to the state. The YYSTATE alias is for lex128* compatibility.129*/130#define YY_START (((yy_start) - 1) / 2)131#define YYSTATE YY_START132133/* Action number for EOF rule of a given start state. */134#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)135136/* Special action meaning "start processing a new file". */137#define YY_NEW_FILE yyrestart(yyin )138139#define YY_END_OF_BUFFER_CHAR 0140141/* Size of default input buffer. */142#ifndef YY_BUF_SIZE143#define YY_BUF_SIZE 16384144#endif145146/* The state buf must be large enough to hold one state per character in the main buffer.147*/148#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))149150#ifndef YY_TYPEDEF_YY_BUFFER_STATE151#define YY_TYPEDEF_YY_BUFFER_STATE152typedef struct yy_buffer_state *YY_BUFFER_STATE;153#endif154155#ifndef YY_TYPEDEF_YY_SIZE_T156#define YY_TYPEDEF_YY_SIZE_T157typedef size_t yy_size_t;158#endif159160extern yy_size_t yyleng;161162extern FILE *yyin, *yyout;163164#define EOB_ACT_CONTINUE_SCAN 0165#define EOB_ACT_END_OF_FILE 1166#define EOB_ACT_LAST_MATCH 2167168#define YY_LESS_LINENO(n)169170/* Return all but the first "n" matched characters back to the input stream. */171#define yyless(n) \172do \173{ \174/* Undo effects of setting up yytext. */ \175int yyless_macro_arg = (n); \176YY_LESS_LINENO(yyless_macro_arg);\177*yy_cp = (yy_hold_char); \178YY_RESTORE_YY_MORE_OFFSET \179(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \180YY_DO_BEFORE_ACTION; /* set up yytext again */ \181} \182while ( 0 )183184#define unput(c) yyunput( c, (yytext_ptr) )185186#ifndef YY_STRUCT_YY_BUFFER_STATE187#define YY_STRUCT_YY_BUFFER_STATE188struct yy_buffer_state189{190FILE *yy_input_file;191192char *yy_ch_buf; /* input buffer */193char *yy_buf_pos; /* current position in input buffer */194195/* Size of input buffer in bytes, not including room for EOB196* characters.197*/198yy_size_t yy_buf_size;199200/* Number of characters read into yy_ch_buf, not including EOB201* characters.202*/203yy_size_t yy_n_chars;204205/* Whether we "own" the buffer - i.e., we know we created it,206* and can realloc() it to grow it, and should free() it to207* delete it.208*/209int yy_is_our_buffer;210211/* Whether this is an "interactive" input source; if so, and212* if we're using stdio for input, then we want to use getc()213* instead of fread(), to make sure we stop fetching input after214* each newline.215*/216int yy_is_interactive;217218/* Whether we're considered to be at the beginning of a line.219* If so, '^' rules will be active on the next match, otherwise220* not.221*/222int yy_at_bol;223224int yy_bs_lineno; /**< The line count. */225int yy_bs_column; /**< The column count. */226227/* Whether to try to fill the input buffer when we reach the228* end of it.229*/230int yy_fill_buffer;231232int yy_buffer_status;233234#define YY_BUFFER_NEW 0235#define YY_BUFFER_NORMAL 1236/* When an EOF's been seen but there's still some text to process237* then we mark the buffer as YY_EOF_PENDING, to indicate that we238* shouldn't try reading from the input source any more. We might239* still have a bunch of tokens to match, though, because of240* possible backing-up.241*242* When we actually see the EOF, we change the status to "new"243* (via yyrestart()), so that the user can continue scanning by244* just pointing yyin at a new input file.245*/246#define YY_BUFFER_EOF_PENDING 2247248};249#endif /* !YY_STRUCT_YY_BUFFER_STATE */250251/* Stack of input buffers. */252static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */253static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */254static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */255256/* We provide macros for accessing buffer states in case in the257* future we want to put the buffer states in a more general258* "scanner state".259*260* Returns the top of the stack, or NULL.261*/262#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \263? (yy_buffer_stack)[(yy_buffer_stack_top)] \264: NULL)265266/* Same as previous macro, but useful when we know that the buffer stack is not267* NULL or when we need an lvalue. For internal use only.268*/269#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]270271/* yy_hold_char holds the character lost when yytext is formed. */272static char yy_hold_char;273static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */274yy_size_t yyleng;275276/* Points to current character in buffer. */277static char *yy_c_buf_p = (char *) 0;278static int yy_init = 0; /* whether we need to initialize */279static int yy_start = 0; /* start state number */280281/* Flag which is used to allow yywrap()'s to do buffer switches282* instead of setting up a fresh yyin. A bit of a hack ...283*/284static int yy_did_buffer_switch_on_eof;285286void yyrestart (FILE *input_file );287void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );288YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );289void yy_delete_buffer (YY_BUFFER_STATE b );290void yy_flush_buffer (YY_BUFFER_STATE b );291void yypush_buffer_state (YY_BUFFER_STATE new_buffer );292void yypop_buffer_state (void );293294static void yyensure_buffer_stack (void );295static void yy_load_buffer_state (void );296static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );297298#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )299300YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );301YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );302YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );303304void *yyalloc (yy_size_t );305void *yyrealloc (void *,yy_size_t );306void yyfree (void * );307308#define yy_new_buffer yy_create_buffer309310#define yy_set_interactive(is_interactive) \311{ \312if ( ! YY_CURRENT_BUFFER ){ \313yyensure_buffer_stack (); \314YY_CURRENT_BUFFER_LVALUE = \315yy_create_buffer(yyin,YY_BUF_SIZE ); \316} \317YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \318}319320#define yy_set_bol(at_bol) \321{ \322if ( ! YY_CURRENT_BUFFER ){\323yyensure_buffer_stack (); \324YY_CURRENT_BUFFER_LVALUE = \325yy_create_buffer(yyin,YY_BUF_SIZE ); \326} \327YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \328}329330#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)331332/* Begin user sect3 */333334typedef unsigned char YY_CHAR;335336FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;337338typedef int yy_state_type;339340extern int yylineno;341342int yylineno = 1;343344extern char *yytext;345#define yytext_ptr yytext346347static yy_state_type yy_get_previous_state (void );348static yy_state_type yy_try_NUL_trans (yy_state_type current_state );349static int yy_get_next_buffer (void );350static void yy_fatal_error (yyconst char msg[] );351352/* Done after the current pattern has been matched and before the353* corresponding action - sets up yytext.354*/355#define YY_DO_BEFORE_ACTION \356(yytext_ptr) = yy_bp; \357yyleng = (size_t) (yy_cp - yy_bp); \358(yy_hold_char) = *yy_cp; \359*yy_cp = '\0'; \360(yy_c_buf_p) = yy_cp;361362#define YY_NUM_RULES 19363#define YY_END_OF_BUFFER 20364/* This struct is not used in this scanner,365but its presence is necessary. */366struct yy_trans_info367{368flex_int32_t yy_verify;369flex_int32_t yy_nxt;370};371static yyconst flex_int16_t yy_accept[39] =372{ 0,3730, 0, 20, 18, 1, 2, 7, 6, 7, 18,37416, 16, 2, 7, 7, 7, 16, 17, 18, 18,37511, 6, 5, 6, 14, 16, 0, 12, 8, 10,3769, 13, 16, 17, 3, 15, 4, 0377} ;378379static yyconst flex_int32_t yy_ec[256] =380{ 0,3811, 1, 1, 1, 1, 1, 1, 1, 2, 3,3821, 2, 1, 1, 1, 1, 1, 1, 1, 1,3831, 1, 1, 1, 1, 1, 1, 1, 1, 1,3841, 2, 4, 1, 5, 1, 6, 7, 1, 6,3856, 6, 6, 6, 6, 1, 6, 8, 9, 9,3869, 9, 9, 9, 9, 9, 9, 1, 10, 11,38712, 13, 1, 1, 14, 14, 14, 14, 14, 14,38815, 15, 15, 15, 15, 15, 15, 15, 15, 15,38915, 15, 15, 15, 15, 15, 15, 16, 15, 15,3901, 17, 1, 6, 1, 1, 15, 15, 15, 15,39139215, 15, 15, 15, 15, 15, 15, 15, 15, 15,39315, 15, 15, 15, 15, 15, 15, 15, 15, 16,39415, 15, 1, 18, 1, 1, 1, 1, 1, 1,3951, 1, 1, 1, 1, 1, 1, 1, 1, 1,3961, 1, 1, 1, 1, 1, 1, 1, 1, 1,3971, 1, 1, 1, 1, 1, 1, 1, 1, 1,3981, 1, 1, 1, 1, 1, 1, 1, 1, 1,3991, 1, 1, 1, 1, 1, 1, 1, 1, 1,4001, 1, 1, 1, 1, 1, 1, 1, 1, 1,4011, 1, 1, 1, 1, 1, 1, 1, 1, 1,4024031, 1, 1, 1, 1, 1, 1, 1, 1, 1,4041, 1, 1, 1, 1, 1, 1, 1, 1, 1,4051, 1, 1, 1, 1, 1, 1, 1, 1, 1,4061, 1, 1, 1, 1, 1, 1, 1, 1, 1,4071, 1, 1, 1, 1, 1, 1, 1, 1, 1,4081, 1, 1, 1, 1409} ;410411static yyconst flex_int32_t yy_meta[19] =412{ 0,4131, 1, 1, 1, 1, 1, 1, 2, 2, 1,4141, 1, 1, 2, 3, 2, 1, 1415} ;416417static yyconst flex_int16_t yy_base[43] =418{ 0,4190, 0, 39, 49, 49, 49, 26, 16, 49, 30,42020, 19, 49, 9, 22, 10, 9, 0, 29, 13,42149, 23, 49, 24, 49, 0, 0, 49, 49, 49,42249, 49, 13, 0, 49, 49, 49, 49, 41, 28,42343, 45424} ;425426static yyconst flex_int16_t yy_def[43] =427{ 0,42838, 1, 38, 38, 38, 38, 38, 39, 38, 38,42940, 40, 38, 38, 38, 38, 41, 42, 38, 38,43038, 39, 38, 39, 38, 12, 12, 38, 38, 38,43138, 38, 41, 42, 38, 38, 38, 0, 38, 38,43238, 38433} ;434435static yyconst flex_int16_t yy_nxt[68] =436{ 0,4374, 5, 6, 7, 8, 9, 10, 11, 12, 13,43814, 15, 16, 17, 18, 18, 19, 20, 23, 28,43929, 31, 32, 34, 34, 23, 37, 34, 34, 26,44036, 35, 24, 30, 38, 27, 25, 21, 38, 24,44124, 22, 22, 22, 33, 33, 34, 34, 3, 38,44238, 38, 38, 38, 38, 38, 38, 38, 38, 38,44338, 38, 38, 38, 38, 38, 38444} ;445446static yyconst flex_int16_t yy_chk[68] =447{ 0,4481, 1, 1, 1, 1, 1, 1, 1, 1, 1,4491, 1, 1, 1, 1, 1, 1, 1, 8, 14,45014, 16, 16, 17, 17, 22, 24, 33, 33, 40,45120, 19, 8, 15, 12, 11, 10, 7, 3, 22,45224, 39, 39, 39, 41, 41, 42, 42, 38, 38,45338, 38, 38, 38, 38, 38, 38, 38, 38, 38,45438, 38, 38, 38, 38, 38, 38455} ;456457static yy_state_type yy_last_accepting_state;458static char *yy_last_accepting_cpos;459460extern int yy_flex_debug;461int yy_flex_debug = 0;462463/* The intent behind this definition is that it'll catch464* any uses of REJECT which flex missed.465*/466#define REJECT reject_used_but_not_detected467#define yymore() yymore_used_but_not_detected468#define YY_MORE_ADJ 0469#define YY_RESTORE_YY_MORE_OFFSET470char *yytext;471#line 1 "calclex.l"472/* Lexical analyzer for calc program.473474Copyright 2000-2002 Free Software Foundation, Inc.475476This file is part of the GNU MP Library.477478This program is free software; you can redistribute it and/or modify it under479the terms of the GNU General Public License as published by the Free Software480Foundation; either version 3 of the License, or (at your option) any later481version.482483This program is distributed in the hope that it will be useful, but WITHOUT ANY484WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A485PARTICULAR PURPOSE. See the GNU General Public License for more details.486487You should have received a copy of the GNU General Public License along with488this program. If not, see https://www.gnu.org/licenses/. */489#line 20 "calclex.l"490#include <string.h>491#include "calc-common.h"492493494#if WITH_READLINE495/* Let GNU flex use readline. See the calcread.c redefined input() for a496way that might work for a standard lex too. */497#define YY_INPUT(buf,result,max_size) \498result = calc_input (buf, max_size);499#endif500501502/* Non-zero when reading the second or subsequent line of an expression,503used to give a different prompt when using readline. */504int calc_more_input = 0;505506507const struct calc_keywords_t calc_keywords[] = {508{ "abs", ABS },509{ "bin", BIN },510{ "decimal", DECIMAL },511{ "fib", FIB },512{ "hex", HEX },513{ "help", HELP },514{ "gcd", GCD },515{ "kron", KRON },516{ "lcm", LCM },517{ "lucnum", LUCNUM },518{ "nextprime", NEXTPRIME },519{ "powm", POWM },520{ "quit", QUIT },521{ "root", ROOT },522{ "sqrt", SQRT },523{ NULL }524};525#line 527 "calclex.c"526527#define INITIAL 0528529#ifndef YY_NO_UNISTD_H530/* Special case for "unistd.h", since it is non-ANSI. We include it way531* down here because we want the user's section 1 to have been scanned first.532* The user has a chance to override it with an option.533*/534#include <unistd.h>535#endif536537#ifndef YY_EXTRA_TYPE538#define YY_EXTRA_TYPE void *539#endif540541static int yy_init_globals (void );542543/* Accessor methods to globals.544These are made visible to non-reentrant scanners for convenience. */545546int yylex_destroy (void );547548int yyget_debug (void );549550void yyset_debug (int debug_flag );551552YY_EXTRA_TYPE yyget_extra (void );553554void yyset_extra (YY_EXTRA_TYPE user_defined );555556FILE *yyget_in (void );557558void yyset_in (FILE * in_str );559560FILE *yyget_out (void );561562void yyset_out (FILE * out_str );563564yy_size_t yyget_leng (void );565566char *yyget_text (void );567568int yyget_lineno (void );569570void yyset_lineno (int line_number );571572/* Macros after this point can all be overridden by user definitions in573* section 1.574*/575576#ifndef YY_SKIP_YYWRAP577#ifdef __cplusplus578extern "C" int yywrap (void );579#else580extern int yywrap (void );581#endif582#endif583584static void yyunput (int c,char *buf_ptr );585586#ifndef yytext_ptr587static void yy_flex_strncpy (char *,yyconst char *,int );588#endif589590#ifdef YY_NEED_STRLEN591static int yy_flex_strlen (yyconst char * );592#endif593594#ifndef YY_NO_INPUT595596#ifdef __cplusplus597static int yyinput (void );598#else599static int input (void );600#endif601602#endif603604/* Amount of stuff to slurp up with each read. */605#ifndef YY_READ_BUF_SIZE606#define YY_READ_BUF_SIZE 8192607#endif608609/* Copy whatever the last rule matched to the standard output. */610#ifndef ECHO611/* This used to be an fputs(), but since the string might contain NUL's,612* we now use fwrite().613*/614#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)615#endif616617/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,618* is returned in "result".619*/620#ifndef YY_INPUT621#define YY_INPUT(buf,result,max_size) \622if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \623{ \624int c = '*'; \625size_t n; \626for ( n = 0; n < max_size && \627(c = getc( yyin )) != EOF && c != '\n'; ++n ) \628buf[n] = (char) c; \629if ( c == '\n' ) \630buf[n++] = (char) c; \631if ( c == EOF && ferror( yyin ) ) \632YY_FATAL_ERROR( "input in flex scanner failed" ); \633result = n; \634} \635else \636{ \637errno=0; \638while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \639{ \640if( errno != EINTR) \641{ \642YY_FATAL_ERROR( "input in flex scanner failed" ); \643break; \644} \645errno=0; \646clearerr(yyin); \647} \648}\649\650651#endif652653/* No semi-colon after return; correct usage is to write "yyterminate();" -654* we don't want an extra ';' after the "return" because that will cause655* some compilers to complain about unreachable statements.656*/657#ifndef yyterminate658#define yyterminate() return YY_NULL659#endif660661/* Number of entries by which start-condition stack grows. */662#ifndef YY_START_STACK_INCR663#define YY_START_STACK_INCR 25664#endif665666/* Report a fatal error. */667#ifndef YY_FATAL_ERROR668#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )669#endif670671/* end tables serialization structures and prototypes */672673/* Default declaration of generated scanner - a define so the user can674* easily add parameters.675*/676#ifndef YY_DECL677#define YY_DECL_IS_OURS 1678679extern int yylex (void);680681#define YY_DECL int yylex (void)682#endif /* !YY_DECL */683684/* Code executed at the beginning of each rule, after yytext and yyleng685* have been set up.686*/687#ifndef YY_USER_ACTION688#define YY_USER_ACTION689#endif690691/* Code executed at the end of each rule. */692#ifndef YY_BREAK693#define YY_BREAK break;694#endif695696#define YY_RULE_SETUP \697YY_USER_ACTION698699/** The main scanner function which does all the work.700*/701YY_DECL702{703register yy_state_type yy_current_state;704register char *yy_cp, *yy_bp;705register int yy_act;706707#line 57 "calclex.l"708709710#line 712 "calclex.c"711712if ( !(yy_init) )713{714(yy_init) = 1;715716#ifdef YY_USER_INIT717YY_USER_INIT;718#endif719720if ( ! (yy_start) )721(yy_start) = 1; /* first start state */722723if ( ! yyin )724yyin = stdin;725726if ( ! yyout )727yyout = stdout;728729if ( ! YY_CURRENT_BUFFER ) {730yyensure_buffer_stack ();731YY_CURRENT_BUFFER_LVALUE =732yy_create_buffer(yyin,YY_BUF_SIZE );733}734735yy_load_buffer_state( );736}737738while ( 1 ) /* loops until end-of-file is reached */739{740yy_cp = (yy_c_buf_p);741742/* Support of yytext. */743*yy_cp = (yy_hold_char);744745/* yy_bp points to the position in yy_ch_buf of the start of746* the current run.747*/748yy_bp = yy_cp;749750yy_current_state = (yy_start);751yy_match:752do753{754register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];755if ( yy_accept[yy_current_state] )756{757(yy_last_accepting_state) = yy_current_state;758(yy_last_accepting_cpos) = yy_cp;759}760while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )761{762yy_current_state = (int) yy_def[yy_current_state];763if ( yy_current_state >= 39 )764yy_c = yy_meta[(unsigned int) yy_c];765}766yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];767++yy_cp;768}769while ( yy_base[yy_current_state] != 49 );770771yy_find_action:772yy_act = yy_accept[yy_current_state];773if ( yy_act == 0 )774{ /* have to back up */775yy_cp = (yy_last_accepting_cpos);776yy_current_state = (yy_last_accepting_state);777yy_act = yy_accept[yy_current_state];778}779780YY_DO_BEFORE_ACTION;781782do_action: /* This label is used only to access EOF actions. */783784switch ( yy_act )785{ /* beginning of action switch */786case 0: /* must back up */787/* undo the effects of YY_DO_BEFORE_ACTION */788*yy_cp = (yy_hold_char);789yy_cp = (yy_last_accepting_cpos);790yy_current_state = (yy_last_accepting_state);791goto yy_find_action;792793case 1:794YY_RULE_SETUP795#line 59 "calclex.l"796{ /* white space is skipped */ }797YY_BREAK798case 2:799/* rule 2 can match eol */800YY_RULE_SETUP801#line 61 "calclex.l"802{ /* semicolon or newline separates statements */803calc_more_input = 0;804return EOS; }805YY_BREAK806case 3:807/* rule 3 can match eol */808YY_RULE_SETUP809#line 64 "calclex.l"810{ /* escaped newlines are skipped */ }811YY_BREAK812case 4:813/* rule 4 can match eol */814YY_RULE_SETUP815#line 67 "calclex.l"816{817/* comment through to escaped newline is skipped */ }818YY_BREAK819case 5:820/* rule 5 can match eol */821YY_RULE_SETUP822#line 69 "calclex.l"823{ /* comment through to newline is a separator */824calc_more_input = 0;825return EOS; }826YY_BREAK827case 6:828YY_RULE_SETUP829#line 72 "calclex.l"830{ /* comment through to EOF skipped */ }831YY_BREAK832case 7:833YY_RULE_SETUP834#line 75 "calclex.l"835{ return yytext[0]; }836YY_BREAK837case 8:838YY_RULE_SETUP839#line 76 "calclex.l"840{ return LE; }841YY_BREAK842case 9:843YY_RULE_SETUP844#line 77 "calclex.l"845{ return GE; }846YY_BREAK847case 10:848YY_RULE_SETUP849#line 78 "calclex.l"850{ return EQ; }851YY_BREAK852case 11:853YY_RULE_SETUP854#line 79 "calclex.l"855{ return NE; }856YY_BREAK857case 12:858YY_RULE_SETUP859#line 80 "calclex.l"860{ return LSHIFT; }861YY_BREAK862case 13:863YY_RULE_SETUP864#line 81 "calclex.l"865{ return RSHIFT; }866YY_BREAK867case 14:868YY_RULE_SETUP869#line 82 "calclex.l"870{ return LAND; }871YY_BREAK872case 15:873YY_RULE_SETUP874#line 83 "calclex.l"875{ return LOR; }876YY_BREAK877case 16:878YY_RULE_SETUP879#line 85 "calclex.l"880{881yylval.str = yytext;882return NUMBER; }883YY_BREAK884case 17:885YY_RULE_SETUP886#line 89 "calclex.l"887{888int i;889890for (i = 0; calc_keywords[i].name != NULL; i++)891if (strcmp (yytext, calc_keywords[i].name) == 0)892return calc_keywords[i].value;893894if (yytext[0] >= 'a' && yytext[0] <= 'z' && yytext[1] == '\0')895{896yylval.var = yytext[0] - 'a';897return VARIABLE;898}899900return BAD;901}902YY_BREAK903case 18:904YY_RULE_SETUP905#line 105 "calclex.l"906{ return BAD; }907YY_BREAK908case 19:909YY_RULE_SETUP910#line 107 "calclex.l"911ECHO;912YY_BREAK913#line 915 "calclex.c"914case YY_STATE_EOF(INITIAL):915yyterminate();916917case YY_END_OF_BUFFER:918{919/* Amount of text matched not including the EOB char. */920int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;921922/* Undo the effects of YY_DO_BEFORE_ACTION. */923*yy_cp = (yy_hold_char);924YY_RESTORE_YY_MORE_OFFSET925926if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )927{928/* We're scanning a new file or input source. It's929* possible that this happened because the user930* just pointed yyin at a new source and called931* yylex(). If so, then we have to assure932* consistency between YY_CURRENT_BUFFER and our933* globals. Here is the right place to do so, because934* this is the first action (other than possibly a935* back-up) that will match for the new input source.936*/937(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;938YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;939YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;940}941942/* Note that here we test for yy_c_buf_p "<=" to the position943* of the first EOB in the buffer, since yy_c_buf_p will944* already have been incremented past the NUL character945* (since all states make transitions on EOB to the946* end-of-buffer state). Contrast this with the test947* in input().948*/949if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )950{ /* This was really a NUL. */951yy_state_type yy_next_state;952953(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;954955yy_current_state = yy_get_previous_state( );956957/* Okay, we're now positioned to make the NUL958* transition. We couldn't have959* yy_get_previous_state() go ahead and do it960* for us because it doesn't know how to deal961* with the possibility of jamming (and we don't962* want to build jamming into it because then it963* will run more slowly).964*/965966yy_next_state = yy_try_NUL_trans( yy_current_state );967968yy_bp = (yytext_ptr) + YY_MORE_ADJ;969970if ( yy_next_state )971{972/* Consume the NUL. */973yy_cp = ++(yy_c_buf_p);974yy_current_state = yy_next_state;975goto yy_match;976}977978else979{980yy_cp = (yy_c_buf_p);981goto yy_find_action;982}983}984985else switch ( yy_get_next_buffer( ) )986{987case EOB_ACT_END_OF_FILE:988{989(yy_did_buffer_switch_on_eof) = 0;990991if ( yywrap( ) )992{993/* Note: because we've taken care in994* yy_get_next_buffer() to have set up995* yytext, we can now set up996* yy_c_buf_p so that if some total997* hoser (like flex itself) wants to998* call the scanner after we return the999* YY_NULL, it'll still work - another1000* YY_NULL will get returned.1001*/1002(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;10031004yy_act = YY_STATE_EOF(YY_START);1005goto do_action;1006}10071008else1009{1010if ( ! (yy_did_buffer_switch_on_eof) )1011YY_NEW_FILE;1012}1013break;1014}10151016case EOB_ACT_CONTINUE_SCAN:1017(yy_c_buf_p) =1018(yytext_ptr) + yy_amount_of_matched_text;10191020yy_current_state = yy_get_previous_state( );10211022yy_cp = (yy_c_buf_p);1023yy_bp = (yytext_ptr) + YY_MORE_ADJ;1024goto yy_match;10251026case EOB_ACT_LAST_MATCH:1027(yy_c_buf_p) =1028&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];10291030yy_current_state = yy_get_previous_state( );10311032yy_cp = (yy_c_buf_p);1033yy_bp = (yytext_ptr) + YY_MORE_ADJ;1034goto yy_find_action;1035}1036break;1037}10381039default:1040YY_FATAL_ERROR(1041"fatal flex scanner internal error--no action found" );1042} /* end of action switch */1043} /* end of scanning one token */1044} /* end of yylex */10451046/* yy_get_next_buffer - try to read in a new buffer1047*1048* Returns a code representing an action:1049* EOB_ACT_LAST_MATCH -1050* EOB_ACT_CONTINUE_SCAN - continue scanning from current position1051* EOB_ACT_END_OF_FILE - end of file1052*/1053static int yy_get_next_buffer (void)1054{1055register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;1056register char *source = (yytext_ptr);1057register int number_to_move, i;1058int ret_val;10591060if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )1061YY_FATAL_ERROR(1062"fatal flex scanner internal error--end of buffer missed" );10631064if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )1065{ /* Don't try to fill the buffer, so this is an EOF. */1066if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )1067{1068/* We matched a single character, the EOB, so1069* treat this as a final EOF.1070*/1071return EOB_ACT_END_OF_FILE;1072}10731074else1075{1076/* We matched some text prior to the EOB, first1077* process it.1078*/1079return EOB_ACT_LAST_MATCH;1080}1081}10821083/* Try to read more data. */10841085/* First move last chars to start of buffer. */1086number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;10871088for ( i = 0; i < number_to_move; ++i )1089*(dest++) = *(source++);10901091if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )1092/* don't do the read, it's not guaranteed to return an EOF,1093* just force an EOF1094*/1095YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;10961097else1098{1099yy_size_t num_to_read =1100YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;11011102while ( num_to_read <= 0 )1103{ /* Not enough room in the buffer - grow it. */11041105/* just a shorter name for the current buffer */1106YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;11071108int yy_c_buf_p_offset =1109(int) ((yy_c_buf_p) - b->yy_ch_buf);11101111if ( b->yy_is_our_buffer )1112{1113yy_size_t new_size = b->yy_buf_size * 2;11141115if ( new_size <= 0 )1116b->yy_buf_size += b->yy_buf_size / 8;1117else1118b->yy_buf_size *= 2;11191120b->yy_ch_buf = (char *)1121/* Include room in for 2 EOB chars. */1122yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );1123}1124else1125/* Can't grow it, we don't own it. */1126b->yy_ch_buf = 0;11271128if ( ! b->yy_ch_buf )1129YY_FATAL_ERROR(1130"fatal error - scanner input buffer overflow" );11311132(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];11331134num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -1135number_to_move - 1;11361137}11381139if ( num_to_read > YY_READ_BUF_SIZE )1140num_to_read = YY_READ_BUF_SIZE;11411142/* Read in more data. */1143YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),1144(yy_n_chars), num_to_read );11451146YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);1147}11481149if ( (yy_n_chars) == 0 )1150{1151if ( number_to_move == YY_MORE_ADJ )1152{1153ret_val = EOB_ACT_END_OF_FILE;1154yyrestart(yyin );1155}11561157else1158{1159ret_val = EOB_ACT_LAST_MATCH;1160YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =1161YY_BUFFER_EOF_PENDING;1162}1163}11641165else1166ret_val = EOB_ACT_CONTINUE_SCAN;11671168if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {1169/* Extend the array by 50%, plus the number we really need. */1170yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);1171YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );1172if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )1173YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );1174}11751176(yy_n_chars) += number_to_move;1177YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;1178YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;11791180(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];11811182return ret_val;1183}11841185/* yy_get_previous_state - get the state just before the EOB char was reached */11861187static yy_state_type yy_get_previous_state (void)1188{1189register yy_state_type yy_current_state;1190register char *yy_cp;11911192yy_current_state = (yy_start);11931194for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )1195{1196register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);1197if ( yy_accept[yy_current_state] )1198{1199(yy_last_accepting_state) = yy_current_state;1200(yy_last_accepting_cpos) = yy_cp;1201}1202while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )1203{1204yy_current_state = (int) yy_def[yy_current_state];1205if ( yy_current_state >= 39 )1206yy_c = yy_meta[(unsigned int) yy_c];1207}1208yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];1209}12101211return yy_current_state;1212}12131214/* yy_try_NUL_trans - try to make a transition on the NUL character1215*1216* synopsis1217* next_state = yy_try_NUL_trans( current_state );1218*/1219static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )1220{1221register int yy_is_jam;1222register char *yy_cp = (yy_c_buf_p);12231224register YY_CHAR yy_c = 1;1225if ( yy_accept[yy_current_state] )1226{1227(yy_last_accepting_state) = yy_current_state;1228(yy_last_accepting_cpos) = yy_cp;1229}1230while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )1231{1232yy_current_state = (int) yy_def[yy_current_state];1233if ( yy_current_state >= 39 )1234yy_c = yy_meta[(unsigned int) yy_c];1235}1236yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];1237yy_is_jam = (yy_current_state == 38);12381239return yy_is_jam ? 0 : yy_current_state;1240}12411242static void yyunput (int c, register char * yy_bp )1243{1244register char *yy_cp;12451246yy_cp = (yy_c_buf_p);12471248/* undo effects of setting up yytext */1249*yy_cp = (yy_hold_char);12501251if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )1252{ /* need to shift things up to make room */1253/* +2 for EOB chars. */1254register yy_size_t number_to_move = (yy_n_chars) + 2;1255register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[1256YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];1257register char *source =1258&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];12591260while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )1261*--dest = *--source;12621263yy_cp += (int) (dest - source);1264yy_bp += (int) (dest - source);1265YY_CURRENT_BUFFER_LVALUE->yy_n_chars =1266(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;12671268if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )1269YY_FATAL_ERROR( "flex scanner push-back overflow" );1270}12711272*--yy_cp = (char) c;12731274(yytext_ptr) = yy_bp;1275(yy_hold_char) = *yy_cp;1276(yy_c_buf_p) = yy_cp;1277}12781279#ifndef YY_NO_INPUT1280#ifdef __cplusplus1281static int yyinput (void)1282#else1283static int input (void)1284#endif12851286{1287int c;12881289*(yy_c_buf_p) = (yy_hold_char);12901291if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )1292{1293/* yy_c_buf_p now points to the character we want to return.1294* If this occurs *before* the EOB characters, then it's a1295* valid NUL; if not, then we've hit the end of the buffer.1296*/1297if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )1298/* This was really a NUL. */1299*(yy_c_buf_p) = '\0';13001301else1302{ /* need more input */1303yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);1304++(yy_c_buf_p);13051306switch ( yy_get_next_buffer( ) )1307{1308case EOB_ACT_LAST_MATCH:1309/* This happens because yy_g_n_b()1310* sees that we've accumulated a1311* token and flags that we need to1312* try matching the token before1313* proceeding. But for input(),1314* there's no matching to consider.1315* So convert the EOB_ACT_LAST_MATCH1316* to EOB_ACT_END_OF_FILE.1317*/13181319/* Reset buffer status. */1320yyrestart(yyin );13211322/*FALLTHROUGH*/13231324case EOB_ACT_END_OF_FILE:1325{1326if ( yywrap( ) )1327return EOF;13281329if ( ! (yy_did_buffer_switch_on_eof) )1330YY_NEW_FILE;1331#ifdef __cplusplus1332return yyinput();1333#else1334return input();1335#endif1336}13371338case EOB_ACT_CONTINUE_SCAN:1339(yy_c_buf_p) = (yytext_ptr) + offset;1340break;1341}1342}1343}13441345c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */1346*(yy_c_buf_p) = '\0'; /* preserve yytext */1347(yy_hold_char) = *++(yy_c_buf_p);13481349return c;1350}1351#endif /* ifndef YY_NO_INPUT */13521353/** Immediately switch to a different input stream.1354* @param input_file A readable stream.1355*1356* @note This function does not reset the start condition to @c INITIAL .1357*/1358void yyrestart (FILE * input_file )1359{13601361if ( ! YY_CURRENT_BUFFER ){1362yyensure_buffer_stack ();1363YY_CURRENT_BUFFER_LVALUE =1364yy_create_buffer(yyin,YY_BUF_SIZE );1365}13661367yy_init_buffer(YY_CURRENT_BUFFER,input_file );1368yy_load_buffer_state( );1369}13701371/** Switch to a different input buffer.1372* @param new_buffer The new input buffer.1373*1374*/1375void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )1376{13771378/* TODO. We should be able to replace this entire function body1379* with1380* yypop_buffer_state();1381* yypush_buffer_state(new_buffer);1382*/1383yyensure_buffer_stack ();1384if ( YY_CURRENT_BUFFER == new_buffer )1385return;13861387if ( YY_CURRENT_BUFFER )1388{1389/* Flush out information for old buffer. */1390*(yy_c_buf_p) = (yy_hold_char);1391YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);1392YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);1393}13941395YY_CURRENT_BUFFER_LVALUE = new_buffer;1396yy_load_buffer_state( );13971398/* We don't actually know whether we did this switch during1399* EOF (yywrap()) processing, but the only time this flag1400* is looked at is after yywrap() is called, so it's safe1401* to go ahead and always set it.1402*/1403(yy_did_buffer_switch_on_eof) = 1;1404}14051406static void yy_load_buffer_state (void)1407{1408(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;1409(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;1410yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;1411(yy_hold_char) = *(yy_c_buf_p);1412}14131414/** Allocate and initialize an input buffer state.1415* @param file A readable stream.1416* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.1417*1418* @return the allocated buffer state.1419*/1420YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )1421{1422YY_BUFFER_STATE b;14231424b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );1425if ( ! b )1426YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );14271428b->yy_buf_size = size;14291430/* yy_ch_buf has to be 2 characters longer than the size given because1431* we need to put in 2 end-of-buffer characters.1432*/1433b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );1434if ( ! b->yy_ch_buf )1435YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );14361437b->yy_is_our_buffer = 1;14381439yy_init_buffer(b,file );14401441return b;1442}14431444/** Destroy the buffer.1445* @param b a buffer created with yy_create_buffer()1446*1447*/1448void yy_delete_buffer (YY_BUFFER_STATE b )1449{14501451if ( ! b )1452return;14531454if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */1455YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;14561457if ( b->yy_is_our_buffer )1458yyfree((void *) b->yy_ch_buf );14591460yyfree((void *) b );1461}14621463/* Initializes or reinitializes a buffer.1464* This function is sometimes called more than once on the same buffer,1465* such as during a yyrestart() or at EOF.1466*/1467static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )14681469{1470int oerrno = errno;14711472yy_flush_buffer(b );14731474b->yy_input_file = file;1475b->yy_fill_buffer = 1;14761477/* If b is the current buffer, then yy_init_buffer was _probably_1478* called from yyrestart() or through yy_get_next_buffer.1479* In that case, we don't want to reset the lineno or column.1480*/1481if (b != YY_CURRENT_BUFFER){1482b->yy_bs_lineno = 1;1483b->yy_bs_column = 0;1484}14851486b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;14871488errno = oerrno;1489}14901491/** Discard all buffered characters. On the next scan, YY_INPUT will be called.1492* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.1493*1494*/1495void yy_flush_buffer (YY_BUFFER_STATE b )1496{1497if ( ! b )1498return;14991500b->yy_n_chars = 0;15011502/* We always need two end-of-buffer characters. The first causes1503* a transition to the end-of-buffer state. The second causes1504* a jam in that state.1505*/1506b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;1507b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;15081509b->yy_buf_pos = &b->yy_ch_buf[0];15101511b->yy_at_bol = 1;1512b->yy_buffer_status = YY_BUFFER_NEW;15131514if ( b == YY_CURRENT_BUFFER )1515yy_load_buffer_state( );1516}15171518/** Pushes the new state onto the stack. The new state becomes1519* the current state. This function will allocate the stack1520* if necessary.1521* @param new_buffer The new state.1522*1523*/1524void yypush_buffer_state (YY_BUFFER_STATE new_buffer )1525{1526if (new_buffer == NULL)1527return;15281529yyensure_buffer_stack();15301531/* This block is copied from yy_switch_to_buffer. */1532if ( YY_CURRENT_BUFFER )1533{1534/* Flush out information for old buffer. */1535*(yy_c_buf_p) = (yy_hold_char);1536YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);1537YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);1538}15391540/* Only push if top exists. Otherwise, replace top. */1541if (YY_CURRENT_BUFFER)1542(yy_buffer_stack_top)++;1543YY_CURRENT_BUFFER_LVALUE = new_buffer;15441545/* copied from yy_switch_to_buffer. */1546yy_load_buffer_state( );1547(yy_did_buffer_switch_on_eof) = 1;1548}15491550/** Removes and deletes the top of the stack, if present.1551* The next element becomes the new top.1552*1553*/1554void yypop_buffer_state (void)1555{1556if (!YY_CURRENT_BUFFER)1557return;15581559yy_delete_buffer(YY_CURRENT_BUFFER );1560YY_CURRENT_BUFFER_LVALUE = NULL;1561if ((yy_buffer_stack_top) > 0)1562--(yy_buffer_stack_top);15631564if (YY_CURRENT_BUFFER) {1565yy_load_buffer_state( );1566(yy_did_buffer_switch_on_eof) = 1;1567}1568}15691570/* Allocates the stack if it does not exist.1571* Guarantees space for at least one push.1572*/1573static void yyensure_buffer_stack (void)1574{1575yy_size_t num_to_alloc;15761577if (!(yy_buffer_stack)) {15781579/* First allocation is just for 2 elements, since we don't know if this1580* scanner will even need a stack. We use 2 instead of 1 to avoid an1581* immediate realloc on the next call.1582*/1583num_to_alloc = 1;1584(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc1585(num_to_alloc * sizeof(struct yy_buffer_state*)1586);1587if ( ! (yy_buffer_stack) )1588YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );15891590memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));15911592(yy_buffer_stack_max) = num_to_alloc;1593(yy_buffer_stack_top) = 0;1594return;1595}15961597if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){15981599/* Increase the buffer to prepare for a possible push. */1600int grow_size = 8 /* arbitrary grow size */;16011602num_to_alloc = (yy_buffer_stack_max) + grow_size;1603(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc1604((yy_buffer_stack),1605num_to_alloc * sizeof(struct yy_buffer_state*)1606);1607if ( ! (yy_buffer_stack) )1608YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );16091610/* zero only the new slots.*/1611memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));1612(yy_buffer_stack_max) = num_to_alloc;1613}1614}16151616/** Setup the input buffer state to scan directly from a user-specified character buffer.1617* @param base the character buffer1618* @param size the size in bytes of the character buffer1619*1620* @return the newly allocated buffer state object.1621*/1622YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )1623{1624YY_BUFFER_STATE b;16251626if ( size < 2 ||1627base[size-2] != YY_END_OF_BUFFER_CHAR ||1628base[size-1] != YY_END_OF_BUFFER_CHAR )1629/* They forgot to leave room for the EOB's. */1630return 0;16311632b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );1633if ( ! b )1634YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );16351636b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */1637b->yy_buf_pos = b->yy_ch_buf = base;1638b->yy_is_our_buffer = 0;1639b->yy_input_file = 0;1640b->yy_n_chars = b->yy_buf_size;1641b->yy_is_interactive = 0;1642b->yy_at_bol = 1;1643b->yy_fill_buffer = 0;1644b->yy_buffer_status = YY_BUFFER_NEW;16451646yy_switch_to_buffer(b );16471648return b;1649}16501651/** Setup the input buffer state to scan a string. The next call to yylex() will1652* scan from a @e copy of @a str.1653* @param yystr a NUL-terminated string to scan1654*1655* @return the newly allocated buffer state object.1656* @note If you want to scan bytes that may contain NUL values, then use1657* yy_scan_bytes() instead.1658*/1659YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )1660{16611662return yy_scan_bytes(yystr,strlen(yystr) );1663}16641665/** Setup the input buffer state to scan the given bytes. The next call to yylex() will1666* scan from a @e copy of @a bytes.1667* @param yybytes the byte buffer to scan1668* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.1669*1670* @return the newly allocated buffer state object.1671*/1672YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )1673{1674YY_BUFFER_STATE b;1675char *buf;1676yy_size_t n;1677int i;16781679/* Get memory for full buffer, including space for trailing EOB's. */1680n = _yybytes_len + 2;1681buf = (char *) yyalloc(n );1682if ( ! buf )1683YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );16841685for ( i = 0; i < _yybytes_len; ++i )1686buf[i] = yybytes[i];16871688buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;16891690b = yy_scan_buffer(buf,n );1691if ( ! b )1692YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );16931694/* It's okay to grow etc. this buffer, and we should throw it1695* away when we're done.1696*/1697b->yy_is_our_buffer = 1;16981699return b;1700}17011702#ifndef YY_EXIT_FAILURE1703#define YY_EXIT_FAILURE 21704#endif17051706static void yy_fatal_error (yyconst char* msg )1707{1708(void) fprintf( stderr, "%s\n", msg );1709exit( YY_EXIT_FAILURE );1710}17111712/* Redefine yyless() so it works in section 3 code. */17131714#undef yyless1715#define yyless(n) \1716do \1717{ \1718/* Undo effects of setting up yytext. */ \1719int yyless_macro_arg = (n); \1720YY_LESS_LINENO(yyless_macro_arg);\1721yytext[yyleng] = (yy_hold_char); \1722(yy_c_buf_p) = yytext + yyless_macro_arg; \1723(yy_hold_char) = *(yy_c_buf_p); \1724*(yy_c_buf_p) = '\0'; \1725yyleng = yyless_macro_arg; \1726} \1727while ( 0 )17281729/* Accessor methods (get/set functions) to struct members. */17301731/** Get the current line number.1732*1733*/1734int yyget_lineno (void)1735{17361737return yylineno;1738}17391740/** Get the input stream.1741*1742*/1743FILE *yyget_in (void)1744{1745return yyin;1746}17471748/** Get the output stream.1749*1750*/1751FILE *yyget_out (void)1752{1753return yyout;1754}17551756/** Get the length of the current token.1757*1758*/1759yy_size_t yyget_leng (void)1760{1761return yyleng;1762}17631764/** Get the current token.1765*1766*/17671768char *yyget_text (void)1769{1770return yytext;1771}17721773/** Set the current line number.1774* @param line_number1775*1776*/1777void yyset_lineno (int line_number )1778{17791780yylineno = line_number;1781}17821783/** Set the input stream. This does not discard the current1784* input buffer.1785* @param in_str A readable stream.1786*1787* @see yy_switch_to_buffer1788*/1789void yyset_in (FILE * in_str )1790{1791yyin = in_str ;1792}17931794void yyset_out (FILE * out_str )1795{1796yyout = out_str ;1797}17981799int yyget_debug (void)1800{1801return yy_flex_debug;1802}18031804void yyset_debug (int bdebug )1805{1806yy_flex_debug = bdebug ;1807}18081809static int yy_init_globals (void)1810{1811/* Initialization is the same as for the non-reentrant scanner.1812* This function is called from yylex_destroy(), so don't allocate here.1813*/18141815(yy_buffer_stack) = 0;1816(yy_buffer_stack_top) = 0;1817(yy_buffer_stack_max) = 0;1818(yy_c_buf_p) = (char *) 0;1819(yy_init) = 0;1820(yy_start) = 0;18211822/* Defined in main.c */1823#ifdef YY_STDINIT1824yyin = stdin;1825yyout = stdout;1826#else1827yyin = (FILE *) 0;1828yyout = (FILE *) 0;1829#endif18301831/* For future reference: Set errno on error, since we are called by1832* yylex_init()1833*/1834return 0;1835}18361837/* yylex_destroy is for both reentrant and non-reentrant scanners. */1838int yylex_destroy (void)1839{18401841/* Pop the buffer stack, destroying each element. */1842while(YY_CURRENT_BUFFER){1843yy_delete_buffer(YY_CURRENT_BUFFER );1844YY_CURRENT_BUFFER_LVALUE = NULL;1845yypop_buffer_state();1846}18471848/* Destroy the stack itself. */1849yyfree((yy_buffer_stack) );1850(yy_buffer_stack) = NULL;18511852/* Reset the globals. This is important in a non-reentrant scanner so the next time1853* yylex() is called, initialization will occur. */1854yy_init_globals( );18551856return 0;1857}18581859/*1860* Internal utility routines.1861*/18621863#ifndef yytext_ptr1864static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )1865{1866register int i;1867for ( i = 0; i < n; ++i )1868s1[i] = s2[i];1869}1870#endif18711872#ifdef YY_NEED_STRLEN1873static int yy_flex_strlen (yyconst char * s )1874{1875register int n;1876for ( n = 0; s[n]; ++n )1877;18781879return n;1880}1881#endif18821883void *yyalloc (yy_size_t size )1884{1885return (void *) malloc( size );1886}18871888void *yyrealloc (void * ptr, yy_size_t size )1889{1890/* The cast to (char *) in the following accommodates both1891* implementations that use char* generic pointers, and those1892* that use void* generic pointers. It works with the latter1893* because both ANSI C and C++ allow castless assignment from1894* any pointer type to void*, and deal with argument conversions1895* as though doing an assignment.1896*/1897return (void *) realloc( (char *) ptr, size );1898}18991900void yyfree (void * ptr )1901{1902free( (char *) ptr ); /* see yyrealloc() for (char *) cast */1903}19041905#define YYTABLES_NAME "yytables"19061907#line 107 "calclex.l"1908190919101911int1912yywrap ()1913{1914return 1;1915}1916191719181919