| 1 | /* A lexical scanner generated by flex */ |
| 2 | |
| 3 | /* scanner skeleton version: |
| 4 | * |
| 5 | * $Header: flex/RCS/flex.skel,v 2.13 90/05/26 17:24:13 vern Exp $ |
| 6 | * |
| 7 | * @(#)lex.skel 5.5 (Berkeley) 5/6/91 |
| 8 | */ |
| 9 | |
| 10 | #define FLEX_SCANNER |
| 11 | |
| 12 | #include <stdio.h> |
| 13 | #include <stdlib.h> |
| 14 | |
| 15 | #ifdef __STDC__ |
| 16 | |
| 17 | #define YY_USE_PROTOS |
| 18 | #endif |
| 19 | |
| 20 | |
| 21 | /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ |
| 22 | #ifdef c_plusplus |
| 23 | #ifndef __cplusplus |
| 24 | #define __cplusplus |
| 25 | #endif |
| 26 | #endif |
| 27 | |
| 28 | |
| 29 | #ifdef __cplusplus |
| 30 | |
| 31 | #include <osfcn.h> |
| 32 | |
| 33 | /* use prototypes in function declarations */ |
| 34 | #define YY_USE_PROTOS |
| 35 | |
| 36 | #endif |
| 37 | |
| 38 | |
| 39 | #ifdef YY_USE_PROTOS |
| 40 | #define YY_PROTO(proto) proto |
| 41 | #else |
| 42 | #define YY_PROTO(proto) () |
| 43 | #endif |
| 44 | |
| 45 | |
| 46 | /* amount of stuff to slurp up with each read */ |
| 47 | #ifndef YY_READ_BUF_SIZE |
| 48 | #define YY_READ_BUF_SIZE 8192 |
| 49 | #endif |
| 50 | |
| 51 | /* returned upon end-of-file */ |
| 52 | #define YY_END_TOK 0 |
| 53 | |
| 54 | /* copy whatever the last rule matched to the standard output */ |
| 55 | |
| 56 | /* cast to (char *) is because for 8-bit chars, yytext is (unsigned char *) */ |
| 57 | /* this used to be an fputs(), but since the string might contain NUL's, |
| 58 | * we now use fwrite() |
| 59 | */ |
| 60 | #define ECHO (void) fwrite( (char *) yytext, yyleng, 1, yyout ) |
| 61 | |
| 62 | /* gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
| 63 | * is returned in "result". |
| 64 | */ |
| 65 | #define YY_INPUT(buf,result,max_size) \ |
| 66 | if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ |
| 67 | YY_FATAL_ERROR( "read() in flex scanner failed" ); |
| 68 | #define YY_NULL 0 |
| 69 | |
| 70 | /* no semi-colon after return; correct usage is to write "yyterminate();" - |
| 71 | * we don't want an extra ';' after the "return" because that will cause |
| 72 | * some compilers to complain about unreachable statements. |
| 73 | */ |
| 74 | #define yyterminate() return ( YY_NULL ) |
| 75 | |
| 76 | /* report a fatal error */ |
| 77 | |
| 78 | /* The funky do-while is used to turn this macro definition into |
| 79 | * a single C statement (which needs a semi-colon terminator). |
| 80 | * This avoids problems with code like: |
| 81 | * |
| 82 | * if ( something_happens ) |
| 83 | * YY_FATAL_ERROR( "oops, the something happened" ); |
| 84 | * else |
| 85 | * everything_okay(); |
| 86 | * |
| 87 | * Prior to using the do-while the compiler would get upset at the |
| 88 | * "else" because it interpreted the "if" statement as being all |
| 89 | * done when it reached the ';' after the YY_FATAL_ERROR() call. |
| 90 | */ |
| 91 | |
| 92 | #define YY_FATAL_ERROR(msg) \ |
| 93 | do \ |
| 94 | { \ |
| 95 | (void) fputs( msg, stderr ); \ |
| 96 | (void) putc( '\n', stderr ); \ |
| 97 | exit( 1 ); \ |
| 98 | } \ |
| 99 | while ( 0 ) |
| 100 | |
| 101 | /* default yywrap function - always treat EOF as an EOF */ |
| 102 | #define yywrap() 1 |
| 103 | |
| 104 | /* enter a start condition. This macro really ought to take a parameter, |
| 105 | * but we do it the disgusting crufty way forced on us by the ()-less |
| 106 | * definition of BEGIN |
| 107 | */ |
| 108 | #define BEGIN yy_start = 1 + 2 * |
| 109 | |
| 110 | /* action number for EOF rule of a given start state */ |
| 111 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
| 112 | |
| 113 | /* special action meaning "start processing a new file" */ |
| 114 | #define YY_NEW_FILE \ |
| 115 | do \ |
| 116 | { \ |
| 117 | yy_init_buffer( yy_current_buffer, yyin ); \ |
| 118 | yy_load_buffer_state(); \ |
| 119 | } \ |
| 120 | while ( 0 ) |
| 121 | |
| 122 | /* default declaration of generated scanner - a define so the user can |
| 123 | * easily add parameters |
| 124 | */ |
| 125 | #define YY_DECL int yylex YY_PROTO(( void )) |
| 126 | |
| 127 | /* code executed at the end of each rule */ |
| 128 | #define YY_BREAK break; |
| 129 | |
| 130 | #define YY_END_OF_BUFFER_CHAR 0 |
| 131 | |
| 132 | #ifndef YY_BUF_SIZE |
| 133 | #define YY_BUF_SIZE (YY_READ_BUF_SIZE * 2) /* size of default input buffer */ |
| 134 | #endif |
| 135 | |
| 136 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
| 137 | |
| 138 | #define YY_CHAR char |
| 139 | # line 1 "scan.l" |
| 140 | #define INITIAL 0 |
| 141 | # line 2 "scan.l" |
| 142 | /* scan.l: the (f)lex description file for the scanner. */ |
| 143 | |
| 144 | /* This file is part of bc written for MINIX. |
| 145 | Copyright (C) 1991 Free Software Foundation, Inc. |
| 146 | |
| 147 | This program is free software; you can redistribute it and/or modify |
| 148 | it under the terms of the GNU General Public License as published by |
| 149 | the Free Software Foundation; either version 2 of the License , or |
| 150 | (at your option) any later version. |
| 151 | |
| 152 | This program is distributed in the hope that it will be useful, |
| 153 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 154 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 155 | GNU General Public License for more details. |
| 156 | |
| 157 | You should have received a copy of the GNU General Public License |
| 158 | along with this program; see the file COPYING. If not, write to |
| 159 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
| 160 | |
| 161 | You may contact the author by: |
| 162 | e-mail: phil@cs.wwu.edu |
| 163 | us-mail: Philip A. Nelson |
| 164 | Computer Science Department, 9062 |
| 165 | Western Washington University |
| 166 | Bellingham, WA 98226-9062 |
| 167 | |
| 168 | *************************************************************************/ |
| 169 | |
| 170 | #include "bcdefs.h" |
| 171 | #include "y.tab.h" |
| 172 | #include "global.h" |
| 173 | #include "proto.h" |
| 174 | |
| 175 | /* Using flex, we can ask for a smaller input buffer. With lex, this |
| 176 | does nothing! */ |
| 177 | |
| 178 | #ifdef SMALL_BUF |
| 179 | #undef YY_READ_BUF_SIZE |
| 180 | #define YY_READ_BUF_SIZE 512 |
| 181 | #endif |
| 182 | |
| 183 | /* We want to define our own yywrap. */ |
| 184 | #undef yywrap |
| 185 | _PROTOTYPE(int yywrap, (void)); |
| 186 | |
| 187 | /* MINIX returns from read with < 0 if SIGINT is encountered. |
| 188 | In flex, we can redefine YY_INPUT to the following. In lex, this |
| 189 | does nothing! */ |
| 190 | #include <errno.h> |
| 191 | #undef YY_INPUT |
| 192 | #define YY_INPUT(buf,result,max_size) \ |
| 193 | while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ |
| 194 | if (errno != EINTR) \ |
| 195 | YY_FATAL_ERROR( "read() in flex scanner failed" ); |
| 196 | |
| 197 | # line 60 "scan.l" |
| 198 | |
| 199 | /* done after the current pattern has been matched and before the |
| 200 | * corresponding action - sets up yytext |
| 201 | */ |
| 202 | #define YY_DO_BEFORE_ACTION \ |
| 203 | yytext = yy_bp; \ |
| 204 | yyleng = yy_cp - yy_bp; \ |
| 205 | yy_hold_char = *yy_cp; \ |
| 206 | *yy_cp = '\0'; \ |
| 207 | yy_c_buf_p = yy_cp; |
| 208 | |
| 209 | #define EOB_ACT_CONTINUE_SCAN 0 |
| 210 | #define EOB_ACT_END_OF_FILE 1 |
| 211 | #define EOB_ACT_LAST_MATCH 2 |
| 212 | |
| 213 | /* return all but the first 'n' matched characters back to the input stream */ |
| 214 | #define yyless(n) \ |
| 215 | do \ |
| 216 | { \ |
| 217 | /* undo effects of setting up yytext */ \ |
| 218 | *yy_cp = yy_hold_char; \ |
| 219 | yy_c_buf_p = yy_cp = yy_bp + n; \ |
| 220 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
| 221 | } \ |
| 222 | while ( 0 ) |
| 223 | |
| 224 | #define unput(c) yyunput( c, yytext ) |
| 225 | |
| 226 | |
| 227 | struct yy_buffer_state |
| 228 | { |
| 229 | FILE *yy_input_file; |
| 230 | |
| 231 | YY_CHAR *yy_ch_buf; /* input buffer */ |
| 232 | YY_CHAR *yy_buf_pos; /* current position in input buffer */ |
| 233 | |
| 234 | /* size of input buffer in bytes, not including room for EOB characters*/ |
| 235 | int yy_buf_size; |
| 236 | |
| 237 | /* number of characters read into yy_ch_buf, not including EOB characters */ |
| 238 | int yy_n_chars; |
| 239 | |
| 240 | int yy_eof_status; /* whether we've seen an EOF on this buffer */ |
| 241 | #define EOF_NOT_SEEN 0 |
| 242 | /* "pending" happens when the EOF has been seen but there's still |
| 243 | * some text process |
| 244 | */ |
| 245 | #define EOF_PENDING 1 |
| 246 | #define EOF_DONE 2 |
| 247 | }; |
| 248 | |
| 249 | static YY_BUFFER_STATE yy_current_buffer; |
| 250 | |
| 251 | /* we provide macros for accessing buffer states in case in the |
| 252 | * future we want to put the buffer states in a more general |
| 253 | * "scanner state" |
| 254 | */ |
| 255 | #define YY_CURRENT_BUFFER yy_current_buffer |
| 256 | |
| 257 | |
| 258 | /* yy_hold_char holds the character lost when yytext is formed */ |
| 259 | static YY_CHAR yy_hold_char; |
| 260 | |
| 261 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
| 262 | |
| 263 | |
| 264 | |
| 265 | #ifndef YY_USER_ACTION |
| 266 | #define YY_USER_ACTION |
| 267 | #endif |
| 268 | |
| 269 | #ifndef YY_USER_INIT |
| 270 | #define YY_USER_INIT |
| 271 | #endif |
| 272 | |
| 273 | extern YY_CHAR *yytext; |
| 274 | extern int yyleng; |
| 275 | extern FILE *yyin, *yyout; |
| 276 | |
| 277 | YY_CHAR *yytext; |
| 278 | int yyleng; |
| 279 | |
| 280 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
| 281 | |
| 282 | #define YY_END_OF_BUFFER 40 |
| 283 | typedef int yy_state_type; |
| 284 | static const short int yy_accept[144] = |
| 285 | { 0, |
| 286 | 0, 0, 40, 38, 33, 31, 25, 38, 26, 38, |
| 287 | 22, 26, 22, 22, 38, 26, 37, 29, 27, 29, |
| 288 | 38, 22, 35, 35, 35, 35, 35, 35, 35, 35, |
| 289 | 35, 35, 35, 35, 35, 35, 35, 35, 38, 33, |
| 290 | 29, 0, 36, 27, 23, 30, 37, 0, 34, 37, |
| 291 | 37, 0, 28, 32, 35, 35, 35, 35, 35, 35, |
| 292 | 35, 35, 35, 7, 35, 35, 35, 35, 35, 35, |
| 293 | 35, 35, 35, 35, 35, 24, 37, 0, 0, 37, |
| 294 | 0, 35, 35, 35, 35, 35, 6, 35, 35, 35, |
| 295 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, |
| 296 | |
| 297 | 35, 13, 35, 35, 35, 14, 16, 35, 17, 35, |
| 298 | 35, 35, 35, 3, 15, 35, 35, 9, 35, 35, |
| 299 | 2, 35, 35, 11, 35, 35, 12, 20, 35, 10, |
| 300 | 35, 8, 35, 1, 4, 21, 5, 35, 35, 35, |
| 301 | 19, 18, 0 |
| 302 | } ; |
| 303 | |
| 304 | static const YY_CHAR yy_ec[128] = |
| 305 | { 0, |
| 306 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
| 307 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 308 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 309 | 1, 2, 4, 5, 1, 1, 6, 7, 1, 8, |
| 310 | 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, |
| 311 | 16, 16, 16, 16, 16, 16, 16, 1, 17, 18, |
| 312 | 19, 20, 1, 1, 21, 21, 21, 21, 21, 21, |
| 313 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 314 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 315 | 22, 23, 24, 25, 26, 1, 27, 28, 29, 30, |
| 316 | |
| 317 | 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 318 | 41, 42, 43, 44, 45, 46, 47, 36, 48, 36, |
| 319 | 49, 36, 50, 51, 52, 1, 1 |
| 320 | } ; |
| 321 | |
| 322 | static const YY_CHAR yy_meta[53] = |
| 323 | { 0, |
| 324 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 325 | 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, |
| 326 | 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, |
| 327 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, |
| 328 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, |
| 329 | 1, 1 |
| 330 | } ; |
| 331 | |
| 332 | static const short int yy_base[146] = |
| 333 | { 0, |
| 334 | 0, 0, 193, 194, 190, 194, 172, 185, 170, 181, |
| 335 | 194, 168, 42, 41, 41, 46, 52, 167, 61, 166, |
| 336 | 181, 164, 135, 137, 139, 148, 140, 136, 0, 149, |
| 337 | 27, 50, 147, 130, 126, 141, 40, 36, 120, 168, |
| 338 | 194, 164, 194, 194, 194, 194, 66, 165, 194, 72, |
| 339 | 76, 164, 194, 194, 0, 120, 134, 124, 131, 117, |
| 340 | 117, 122, 132, 0, 113, 117, 117, 128, 119, 118, |
| 341 | 52, 125, 107, 106, 114, 194, 80, 145, 84, 88, |
| 342 | 144, 105, 118, 98, 108, 111, 0, 95, 95, 93, |
| 343 | 105, 102, 91, 95, 88, 103, 85, 93, 84, 85, |
| 344 | |
| 345 | 90, 0, 90, 91, 85, 0, 0, 93, 0, 77, |
| 346 | 76, 90, 74, 0, 0, 75, 87, 0, 90, 85, |
| 347 | 0, 75, 83, 0, 76, 63, 0, 0, 66, 0, |
| 348 | 62, 0, 47, 0, 0, 0, 0, 45, 53, 29, |
| 349 | 0, 0, 194, 111, 56 |
| 350 | } ; |
| 351 | |
| 352 | static const short int yy_def[146] = |
| 353 | { 0, |
| 354 | 143, 1, 143, 143, 143, 143, 143, 144, 143, 143, |
| 355 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 356 | 143, 143, 145, 145, 145, 145, 145, 145, 145, 145, |
| 357 | 145, 145, 145, 145, 145, 145, 145, 145, 143, 143, |
| 358 | 143, 144, 143, 143, 143, 143, 143, 143, 143, 143, |
| 359 | 143, 143, 143, 143, 145, 145, 145, 145, 145, 145, |
| 360 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 361 | 145, 145, 145, 145, 145, 143, 143, 143, 143, 143, |
| 362 | 143, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 363 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 364 | |
| 365 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 366 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 367 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 368 | 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, |
| 369 | 145, 145, 0, 143, 143 |
| 370 | } ; |
| 371 | |
| 372 | static const short int yy_nxt[247] = |
| 373 | { 0, |
| 374 | 4, 5, 6, 7, 8, 9, 10, 11, 11, 12, |
| 375 | 13, 11, 14, 15, 16, 17, 11, 18, 19, 20, |
| 376 | 17, 11, 21, 11, 22, 4, 23, 24, 25, 26, |
| 377 | 27, 28, 29, 30, 31, 29, 29, 32, 29, 29, |
| 378 | 33, 34, 35, 36, 37, 29, 29, 38, 29, 11, |
| 379 | 39, 11, 46, 46, 63, 49, 47, 55, 64, 44, |
| 380 | 44, 47, 74, 48, 44, 50, 53, 51, 72, 75, |
| 381 | 53, 53, 51, 53, 52, 53, 65, 142, 96, 41, |
| 382 | 66, 77, 73, 141, 67, 53, 77, 80, 78, 50, |
| 383 | 140, 51, 80, 139, 81, 77, 51, 97, 52, 47, |
| 384 | |
| 385 | 77, 138, 78, 80, 47, 137, 48, 136, 80, 135, |
| 386 | 81, 42, 42, 134, 133, 132, 131, 130, 129, 128, |
| 387 | 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, |
| 388 | 117, 116, 115, 114, 113, 112, 111, 110, 109, 108, |
| 389 | 107, 106, 105, 104, 103, 102, 80, 77, 101, 100, |
| 390 | 99, 98, 95, 94, 93, 92, 91, 90, 89, 88, |
| 391 | 87, 86, 85, 84, 83, 82, 51, 79, 43, 40, |
| 392 | 76, 71, 70, 69, 68, 62, 61, 60, 59, 58, |
| 393 | 57, 56, 44, 54, 41, 41, 44, 45, 44, 43, |
| 394 | 41, 40, 143, 3, 143, 143, 143, 143, 143, 143, |
| 395 | |
| 396 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 397 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 398 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 399 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 400 | 143, 143, 143, 143, 143, 143 |
| 401 | } ; |
| 402 | |
| 403 | static const short int yy_chk[247] = |
| 404 | { 0, |
| 405 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 407 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 408 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 410 | 1, 1, 13, 14, 31, 16, 15, 145, 31, 14, |
| 411 | 13, 15, 38, 15, 16, 17, 19, 17, 37, 38, |
| 412 | 19, 19, 17, 19, 17, 19, 32, 140, 71, 19, |
| 413 | 32, 47, 37, 139, 32, 19, 47, 50, 47, 51, |
| 414 | 138, 51, 50, 133, 50, 77, 51, 71, 51, 79, |
| 415 | |
| 416 | 77, 131, 77, 80, 79, 129, 79, 126, 80, 125, |
| 417 | 80, 144, 144, 123, 122, 120, 119, 117, 116, 113, |
| 418 | 112, 111, 110, 108, 105, 104, 103, 101, 100, 99, |
| 419 | 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, |
| 420 | 88, 86, 85, 84, 83, 82, 81, 78, 75, 74, |
| 421 | 73, 72, 70, 69, 68, 67, 66, 65, 63, 62, |
| 422 | 61, 60, 59, 58, 57, 56, 52, 48, 42, 40, |
| 423 | 39, 36, 35, 34, 33, 30, 28, 27, 26, 25, |
| 424 | 24, 23, 22, 21, 20, 18, 12, 10, 9, 8, |
| 425 | 7, 5, 3, 143, 143, 143, 143, 143, 143, 143, |
| 426 | |
| 427 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 428 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 429 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 430 | 143, 143, 143, 143, 143, 143, 143, 143, 143, 143, |
| 431 | 143, 143, 143, 143, 143, 143 |
| 432 | } ; |
| 433 | |
| 434 | static yy_state_type yy_last_accepting_state; |
| 435 | static YY_CHAR *yy_last_accepting_cpos; |
| 436 | |
| 437 | /* the intent behind this definition is that it'll catch |
| 438 | * any uses of REJECT which flex missed |
| 439 | */ |
| 440 | #define REJECT reject_used_but_not_detected |
| 441 | #define yymore() yymore_used_but_not_detected |
| 442 | #define YY_MORE_ADJ 0 |
| 443 | |
| 444 | /* these variables are all declared out here so that section 3 code can |
| 445 | * manipulate them |
| 446 | */ |
| 447 | /* points to current character in buffer */ |
| 448 | static YY_CHAR *yy_c_buf_p = (YY_CHAR *) 0; |
| 449 | static int yy_init = 1; /* whether we need to initialize */ |
| 450 | static int yy_start = 0; /* start state number */ |
| 451 | |
| 452 | /* flag which is used to allow yywrap()'s to do buffer switches |
| 453 | * instead of setting up a fresh yyin. A bit of a hack ... |
| 454 | */ |
| 455 | static int yy_did_buffer_switch_on_eof; |
| 456 | |
| 457 | static yy_state_type yy_get_previous_state YY_PROTO(( void )); |
| 458 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); |
| 459 | static int yy_get_next_buffer YY_PROTO(( void )); |
| 460 | static void yyunput YY_PROTO(( YY_CHAR c, YY_CHAR *buf_ptr )); |
| 461 | void yyrestart YY_PROTO(( FILE *input_file )); |
| 462 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); |
| 463 | void yy_load_buffer_state YY_PROTO(( void )); |
| 464 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); |
| 465 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
| 466 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); |
| 467 | |
| 468 | #define yy_new_buffer yy_create_buffer |
| 469 | |
| 470 | #ifdef __cplusplus |
| 471 | static int yyinput YY_PROTO(( void )); |
| 472 | #else |
| 473 | static int input YY_PROTO(( void )); |
| 474 | #endif |
| 475 | |
| 476 | YY_DECL |
| 477 | { |
| 478 | register yy_state_type yy_current_state; |
| 479 | register YY_CHAR *yy_cp, *yy_bp; |
| 480 | register int yy_act; |
| 481 | |
| 482 | |
| 483 | |
| 484 | if ( yy_init ) |
| 485 | { |
| 486 | YY_USER_INIT; |
| 487 | |
| 488 | if ( ! yy_start ) |
| 489 | yy_start = 1; /* first start state */ |
| 490 | |
| 491 | if ( ! yyin ) |
| 492 | yyin = stdin; |
| 493 | |
| 494 | if ( ! yyout ) |
| 495 | yyout = stdout; |
| 496 | |
| 497 | if ( yy_current_buffer ) |
| 498 | yy_init_buffer( yy_current_buffer, yyin ); |
| 499 | else |
| 500 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); |
| 501 | |
| 502 | yy_load_buffer_state(); |
| 503 | |
| 504 | yy_init = 0; |
| 505 | } |
| 506 | |
| 507 | while ( 1 ) /* loops until end-of-file is reached */ |
| 508 | { |
| 509 | yy_cp = yy_c_buf_p; |
| 510 | |
| 511 | /* support of yytext */ |
| 512 | *yy_cp = yy_hold_char; |
| 513 | |
| 514 | /* yy_bp points to the position in yy_ch_buf of the start of the |
| 515 | * current run. |
| 516 | */ |
| 517 | yy_bp = yy_cp; |
| 518 | |
| 519 | yy_current_state = yy_start; |
| 520 | yy_match: |
| 521 | do |
| 522 | { |
| 523 | register YY_CHAR yy_c = yy_ec[*yy_cp]; |
| 524 | if ( yy_accept[yy_current_state] ) |
| 525 | { |
| 526 | yy_last_accepting_state = yy_current_state; |
| 527 | yy_last_accepting_cpos = yy_cp; |
| 528 | } |
| 529 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 530 | { |
| 531 | yy_current_state = yy_def[yy_current_state]; |
| 532 | if ( yy_current_state >= 144 ) |
| 533 | yy_c = yy_meta[yy_c]; |
| 534 | } |
| 535 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 536 | ++yy_cp; |
| 537 | } |
| 538 | while ( yy_base[yy_current_state] != 194 ); |
| 539 | |
| 540 | yy_find_action: |
| 541 | yy_act = yy_accept[yy_current_state]; |
| 542 | |
| 543 | YY_DO_BEFORE_ACTION; |
| 544 | YY_USER_ACTION; |
| 545 | |
| 546 | do_action: /* this label is used only to access EOF actions */ |
| 547 | |
| 548 | |
| 549 | switch ( yy_act ) |
| 550 | { |
| 551 | case 0: /* must backtrack */ |
| 552 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
| 553 | *yy_cp = yy_hold_char; |
| 554 | yy_cp = yy_last_accepting_cpos; |
| 555 | yy_current_state = yy_last_accepting_state; |
| 556 | goto yy_find_action; |
| 557 | |
| 558 | case 1: |
| 559 | # line 61 "scan.l" |
| 560 | return(Define); |
| 561 | YY_BREAK |
| 562 | case 2: |
| 563 | # line 62 "scan.l" |
| 564 | return(Break); |
| 565 | YY_BREAK |
| 566 | case 3: |
| 567 | # line 63 "scan.l" |
| 568 | return(Quit); |
| 569 | YY_BREAK |
| 570 | case 4: |
| 571 | # line 64 "scan.l" |
| 572 | return(Length); |
| 573 | YY_BREAK |
| 574 | case 5: |
| 575 | # line 65 "scan.l" |
| 576 | return(Return); |
| 577 | YY_BREAK |
| 578 | case 6: |
| 579 | # line 66 "scan.l" |
| 580 | return(For); |
| 581 | YY_BREAK |
| 582 | case 7: |
| 583 | # line 67 "scan.l" |
| 584 | return(If); |
| 585 | YY_BREAK |
| 586 | case 8: |
| 587 | # line 68 "scan.l" |
| 588 | return(While); |
| 589 | YY_BREAK |
| 590 | case 9: |
| 591 | # line 69 "scan.l" |
| 592 | return(Sqrt); |
| 593 | YY_BREAK |
| 594 | case 10: |
| 595 | # line 70 "scan.l" |
| 596 | return(Scale); |
| 597 | YY_BREAK |
| 598 | case 11: |
| 599 | # line 71 "scan.l" |
| 600 | return(Ibase); |
| 601 | YY_BREAK |
| 602 | case 12: |
| 603 | # line 72 "scan.l" |
| 604 | return(Obase); |
| 605 | YY_BREAK |
| 606 | case 13: |
| 607 | # line 73 "scan.l" |
| 608 | return(Auto); |
| 609 | YY_BREAK |
| 610 | case 14: |
| 611 | # line 74 "scan.l" |
| 612 | return(Else); |
| 613 | YY_BREAK |
| 614 | case 15: |
| 615 | # line 75 "scan.l" |
| 616 | return(Read); |
| 617 | YY_BREAK |
| 618 | case 16: |
| 619 | # line 76 "scan.l" |
| 620 | return(Halt); |
| 621 | YY_BREAK |
| 622 | case 17: |
| 623 | # line 77 "scan.l" |
| 624 | return(Last); |
| 625 | YY_BREAK |
| 626 | case 18: |
| 627 | # line 78 "scan.l" |
| 628 | return(Warranty); |
| 629 | YY_BREAK |
| 630 | case 19: |
| 631 | # line 79 "scan.l" |
| 632 | return(Continue); |
| 633 | YY_BREAK |
| 634 | case 20: |
| 635 | # line 80 "scan.l" |
| 636 | return(Print); |
| 637 | YY_BREAK |
| 638 | case 21: |
| 639 | # line 81 "scan.l" |
| 640 | return(Limits); |
| 641 | YY_BREAK |
| 642 | case 22: |
| 643 | # line 82 "scan.l" |
| 644 | { yylval.c_value = yytext[0]; |
| 645 | return((int)yytext[0]); } |
| 646 | YY_BREAK |
| 647 | case 23: |
| 648 | # line 84 "scan.l" |
| 649 | { return(AND); } |
| 650 | YY_BREAK |
| 651 | case 24: |
| 652 | # line 85 "scan.l" |
| 653 | { return(OR); } |
| 654 | YY_BREAK |
| 655 | case 25: |
| 656 | # line 86 "scan.l" |
| 657 | { return(NOT); } |
| 658 | YY_BREAK |
| 659 | case 26: |
| 660 | # line 87 "scan.l" |
| 661 | { yylval.c_value = yytext[0]; return(MUL_OP); } |
| 662 | YY_BREAK |
| 663 | case 27: |
| 664 | # line 88 "scan.l" |
| 665 | { yylval.c_value = yytext[0]; return(ASSIGN_OP); } |
| 666 | YY_BREAK |
| 667 | case 28: |
| 668 | # line 89 "scan.l" |
| 669 | { |
| 670 | #ifdef OLD_EQ_OP |
| 671 | char warn_save; |
| 672 | warn_save = warn_not_std; |
| 673 | warn_not_std = TRUE; |
| 674 | warn ("Old fashioned =<op>"); |
| 675 | warn_not_std = warn_save; |
| 676 | yylval.c_value = yytext[1]; |
| 677 | #else |
| 678 | yylval.c_value = '='; |
| 679 | yyless (1); |
| 680 | #endif |
| 681 | return(ASSIGN_OP); |
| 682 | } |
| 683 | YY_BREAK |
| 684 | case 29: |
| 685 | # line 103 "scan.l" |
| 686 | { yylval.s_value = strcopyof(yytext); return(REL_OP); } |
| 687 | YY_BREAK |
| 688 | case 30: |
| 689 | # line 104 "scan.l" |
| 690 | { yylval.c_value = yytext[0]; return(INCR_DECR); } |
| 691 | YY_BREAK |
| 692 | case 31: |
| 693 | # line 105 "scan.l" |
| 694 | { line_no++; return(NEWLINE); } |
| 695 | YY_BREAK |
| 696 | case 32: |
| 697 | # line 106 "scan.l" |
| 698 | { line_no++; /* ignore a "quoted" newline */ } |
| 699 | YY_BREAK |
| 700 | case 33: |
| 701 | # line 107 "scan.l" |
| 702 | { /* ignore spaces and tabs */ } |
| 703 | YY_BREAK |
| 704 | case 34: |
| 705 | # line 108 "scan.l" |
| 706 | { |
| 707 | int c; |
| 708 | |
| 709 | for (;;) |
| 710 | { |
| 711 | while ( ((c=input()) != '*') && (c != EOF)) |
| 712 | /* eat it */ |
| 713 | if (c == '\n') line_no++; |
| 714 | if (c == '*') |
| 715 | { |
| 716 | while ( (c=input()) == '*') /* eat it*/; |
| 717 | if (c == '/') break; /* at end of comment */ |
| 718 | if (c == '\n') line_no++; |
| 719 | } |
| 720 | if (c == EOF) |
| 721 | { |
| 722 | fprintf (stderr,"EOF encountered in a comment.\n"); |
| 723 | break; |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | YY_BREAK |
| 728 | case 35: |
| 729 | # line 129 "scan.l" |
| 730 | { yylval.s_value = strcopyof(yytext); return(NAME); } |
| 731 | YY_BREAK |
| 732 | case 36: |
| 733 | # line 130 "scan.l" |
| 734 | { |
| 735 | char *look; |
| 736 | yylval.s_value = strcopyof(yytext); |
| 737 | for (look = yytext; *look != 0; look++) |
| 738 | if (*look == '\n') line_no++; |
| 739 | return(STRING); |
| 740 | } |
| 741 | YY_BREAK |
| 742 | case 37: |
| 743 | # line 137 "scan.l" |
| 744 | { |
| 745 | char *src, *dst; |
| 746 | int len; |
| 747 | /* remove a trailing decimal point. */ |
| 748 | len = strlen(yytext); |
| 749 | if (yytext[len-1] == '.') |
| 750 | yytext[len-1] = 0; |
| 751 | /* remove leading zeros. */ |
| 752 | src = yytext; |
| 753 | dst = yytext; |
| 754 | while (*src == '0') src++; |
| 755 | if (*src == 0) src--; |
| 756 | /* Copy strings removing the newlines. */ |
| 757 | while (*src != 0) |
| 758 | { |
| 759 | if (*src == '\\') |
| 760 | { |
| 761 | src++; src++; |
| 762 | line_no++; |
| 763 | } |
| 764 | else |
| 765 | *dst++ = *src++; |
| 766 | } |
| 767 | *dst = 0; |
| 768 | yylval.s_value = strcopyof(yytext); |
| 769 | return(NUMBER); |
| 770 | } |
| 771 | YY_BREAK |
| 772 | case 38: |
| 773 | # line 164 "scan.l" |
| 774 | yyerror ("illegal character: %s",yytext); |
| 775 | YY_BREAK |
| 776 | case 39: |
| 777 | # line 165 "scan.l" |
| 778 | ECHO; |
| 779 | YY_BREAK |
| 780 | case YY_STATE_EOF(INITIAL): |
| 781 | yyterminate(); |
| 782 | |
| 783 | case YY_END_OF_BUFFER: |
| 784 | { |
| 785 | /* amount of text matched not including the EOB char */ |
| 786 | int yy_amount_of_matched_text = yy_cp - yytext - 1; |
| 787 | |
| 788 | /* undo the effects of YY_DO_BEFORE_ACTION */ |
| 789 | *yy_cp = yy_hold_char; |
| 790 | |
| 791 | /* note that here we test for yy_c_buf_p "<=" to the position |
| 792 | * of the first EOB in the buffer, since yy_c_buf_p will |
| 793 | * already have been incremented past the NUL character |
| 794 | * (since all states make transitions on EOB to the end- |
| 795 | * of-buffer state). Contrast this with the test in yyinput(). |
| 796 | */ |
| 797 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
| 798 | /* this was really a NUL */ |
| 799 | { |
| 800 | yy_state_type yy_next_state; |
| 801 | |
| 802 | yy_c_buf_p = yytext + yy_amount_of_matched_text; |
| 803 | |
| 804 | yy_current_state = yy_get_previous_state(); |
| 805 | |
| 806 | /* okay, we're now positioned to make the |
| 807 | * NUL transition. We couldn't have |
| 808 | * yy_get_previous_state() go ahead and do it |
| 809 | * for us because it doesn't know how to deal |
| 810 | * with the possibility of jamming (and we |
| 811 | * don't want to build jamming into it because |
| 812 | * then it will run more slowly) |
| 813 | */ |
| 814 | |
| 815 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
| 816 | |
| 817 | yy_bp = yytext + YY_MORE_ADJ; |
| 818 | |
| 819 | if ( yy_next_state ) |
| 820 | { |
| 821 | /* consume the NUL */ |
| 822 | yy_cp = ++yy_c_buf_p; |
| 823 | yy_current_state = yy_next_state; |
| 824 | goto yy_match; |
| 825 | } |
| 826 | |
| 827 | else |
| 828 | { |
| 829 | goto yy_find_action; |
| 830 | } |
| 831 | } |
| 832 | |
| 833 | else switch ( yy_get_next_buffer() ) |
| 834 | { |
| 835 | case EOB_ACT_END_OF_FILE: |
| 836 | { |
| 837 | yy_did_buffer_switch_on_eof = 0; |
| 838 | |
| 839 | if ( yywrap() ) |
| 840 | { |
| 841 | /* note: because we've taken care in |
| 842 | * yy_get_next_buffer() to have set up yytext, |
| 843 | * we can now set up yy_c_buf_p so that if some |
| 844 | * total hoser (like flex itself) wants |
| 845 | * to call the scanner after we return the |
| 846 | * YY_NULL, it'll still work - another YY_NULL |
| 847 | * will get returned. |
| 848 | */ |
| 849 | yy_c_buf_p = yytext + YY_MORE_ADJ; |
| 850 | |
| 851 | yy_act = YY_STATE_EOF((yy_start - 1) / 2); |
| 852 | goto do_action; |
| 853 | } |
| 854 | |
| 855 | else |
| 856 | { |
| 857 | if ( ! yy_did_buffer_switch_on_eof ) |
| 858 | YY_NEW_FILE; |
| 859 | } |
| 860 | } |
| 861 | break; |
| 862 | |
| 863 | case EOB_ACT_CONTINUE_SCAN: |
| 864 | yy_c_buf_p = yytext + yy_amount_of_matched_text; |
| 865 | |
| 866 | yy_current_state = yy_get_previous_state(); |
| 867 | |
| 868 | yy_cp = yy_c_buf_p; |
| 869 | yy_bp = yytext + YY_MORE_ADJ; |
| 870 | goto yy_match; |
| 871 | |
| 872 | case EOB_ACT_LAST_MATCH: |
| 873 | yy_c_buf_p = |
| 874 | &yy_current_buffer->yy_ch_buf[yy_n_chars]; |
| 875 | |
| 876 | yy_current_state = yy_get_previous_state(); |
| 877 | |
| 878 | yy_cp = yy_c_buf_p; |
| 879 | yy_bp = yytext + YY_MORE_ADJ; |
| 880 | goto yy_find_action; |
| 881 | } |
| 882 | break; |
| 883 | } |
| 884 | |
| 885 | default: |
| 886 | #ifdef FLEX_DEBUG |
| 887 | printf( "action # %d\n", yy_act ); |
| 888 | #endif |
| 889 | YY_FATAL_ERROR( |
| 890 | "fatal flex scanner internal error--no action found" ); |
| 891 | } |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | |
| 896 | /* yy_get_next_buffer - try to read in a new buffer |
| 897 | * |
| 898 | * synopsis |
| 899 | * int yy_get_next_buffer(); |
| 900 | * |
| 901 | * returns a code representing an action |
| 902 | * EOB_ACT_LAST_MATCH - |
| 903 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
| 904 | * EOB_ACT_END_OF_FILE - end of file |
| 905 | */ |
| 906 | |
| 907 | static int yy_get_next_buffer() |
| 908 | |
| 909 | { |
| 910 | register YY_CHAR *dest = yy_current_buffer->yy_ch_buf; |
| 911 | register YY_CHAR *source = yytext - 1; /* copy prev. char, too */ |
| 912 | register int number_to_move, i; |
| 913 | int ret_val; |
| 914 | |
| 915 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) |
| 916 | YY_FATAL_ERROR( |
| 917 | "fatal flex scanner internal error--end of buffer missed" ); |
| 918 | |
| 919 | /* try to read more data */ |
| 920 | |
| 921 | /* first move last chars to start of buffer */ |
| 922 | number_to_move = yy_c_buf_p - yytext; |
| 923 | |
| 924 | for ( i = 0; i < number_to_move; ++i ) |
| 925 | *(dest++) = *(source++); |
| 926 | |
| 927 | if ( yy_current_buffer->yy_eof_status != EOF_NOT_SEEN ) |
| 928 | /* don't do the read, it's not guaranteed to return an EOF, |
| 929 | * just force an EOF |
| 930 | */ |
| 931 | yy_n_chars = 0; |
| 932 | |
| 933 | else |
| 934 | { |
| 935 | int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; |
| 936 | |
| 937 | if ( num_to_read > YY_READ_BUF_SIZE ) |
| 938 | num_to_read = YY_READ_BUF_SIZE; |
| 939 | |
| 940 | else if ( num_to_read <= 0 ) |
| 941 | YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); |
| 942 | |
| 943 | /* read in more data */ |
| 944 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), |
| 945 | yy_n_chars, num_to_read ); |
| 946 | } |
| 947 | |
| 948 | if ( yy_n_chars == 0 ) |
| 949 | { |
| 950 | if ( number_to_move == 1 ) |
| 951 | { |
| 952 | ret_val = EOB_ACT_END_OF_FILE; |
| 953 | yy_current_buffer->yy_eof_status = EOF_DONE; |
| 954 | } |
| 955 | |
| 956 | else |
| 957 | { |
| 958 | ret_val = EOB_ACT_LAST_MATCH; |
| 959 | yy_current_buffer->yy_eof_status = EOF_PENDING; |
| 960 | } |
| 961 | } |
| 962 | |
| 963 | else |
| 964 | ret_val = EOB_ACT_CONTINUE_SCAN; |
| 965 | |
| 966 | yy_n_chars += number_to_move; |
| 967 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
| 968 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
| 969 | |
| 970 | /* yytext begins at the second character in yy_ch_buf; the first |
| 971 | * character is the one which preceded it before reading in the latest |
| 972 | * buffer; it needs to be kept around in case it's a newline, so |
| 973 | * yy_get_previous_state() will have with '^' rules active |
| 974 | */ |
| 975 | |
| 976 | yytext = &yy_current_buffer->yy_ch_buf[1]; |
| 977 | |
| 978 | return ( ret_val ); |
| 979 | } |
| 980 | |
| 981 | |
| 982 | /* yy_get_previous_state - get the state just before the EOB char was reached |
| 983 | * |
| 984 | * synopsis |
| 985 | * yy_state_type yy_get_previous_state(); |
| 986 | */ |
| 987 | |
| 988 | static yy_state_type yy_get_previous_state() |
| 989 | |
| 990 | { |
| 991 | register yy_state_type yy_current_state; |
| 992 | register YY_CHAR *yy_cp; |
| 993 | |
| 994 | yy_current_state = yy_start; |
| 995 | |
| 996 | for ( yy_cp = yytext + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) |
| 997 | { |
| 998 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[*yy_cp] : 1); |
| 999 | if ( yy_accept[yy_current_state] ) |
| 1000 | { |
| 1001 | yy_last_accepting_state = yy_current_state; |
| 1002 | yy_last_accepting_cpos = yy_cp; |
| 1003 | } |
| 1004 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1005 | { |
| 1006 | yy_current_state = yy_def[yy_current_state]; |
| 1007 | if ( yy_current_state >= 144 ) |
| 1008 | yy_c = yy_meta[yy_c]; |
| 1009 | } |
| 1010 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 1011 | } |
| 1012 | |
| 1013 | return ( yy_current_state ); |
| 1014 | } |
| 1015 | |
| 1016 | |
| 1017 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
| 1018 | * |
| 1019 | * synopsis |
| 1020 | * next_state = yy_try_NUL_trans( current_state ); |
| 1021 | */ |
| 1022 | |
| 1023 | #ifdef YY_USE_PROTOS |
| 1024 | static yy_state_type yy_try_NUL_trans( register yy_state_type yy_current_state ) |
| 1025 | #else |
| 1026 | static yy_state_type yy_try_NUL_trans( yy_current_state ) |
| 1027 | register yy_state_type yy_current_state; |
| 1028 | #endif |
| 1029 | |
| 1030 | { |
| 1031 | register int yy_is_jam; |
| 1032 | register YY_CHAR *yy_cp = yy_c_buf_p; |
| 1033 | |
| 1034 | register YY_CHAR yy_c = 1; |
| 1035 | if ( yy_accept[yy_current_state] ) |
| 1036 | { |
| 1037 | yy_last_accepting_state = yy_current_state; |
| 1038 | yy_last_accepting_cpos = yy_cp; |
| 1039 | } |
| 1040 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
| 1041 | { |
| 1042 | yy_current_state = yy_def[yy_current_state]; |
| 1043 | if ( yy_current_state >= 144 ) |
| 1044 | yy_c = yy_meta[yy_c]; |
| 1045 | } |
| 1046 | yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; |
| 1047 | yy_is_jam = (yy_base[yy_current_state] == 194); |
| 1048 | |
| 1049 | return ( yy_is_jam ? 0 : yy_current_state ); |
| 1050 | } |
| 1051 | |
| 1052 | |
| 1053 | #ifdef YY_USE_PROTOS |
| 1054 | static void yyunput( YY_CHAR c, register YY_CHAR *yy_bp ) |
| 1055 | #else |
| 1056 | static void yyunput( c, yy_bp ) |
| 1057 | YY_CHAR c; |
| 1058 | register YY_CHAR *yy_bp; |
| 1059 | #endif |
| 1060 | |
| 1061 | { |
| 1062 | register YY_CHAR *yy_cp = yy_c_buf_p; |
| 1063 | |
| 1064 | /* undo effects of setting up yytext */ |
| 1065 | *yy_cp = yy_hold_char; |
| 1066 | |
| 1067 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
| 1068 | { /* need to shift things up to make room */ |
| 1069 | register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */ |
| 1070 | register YY_CHAR *dest = |
| 1071 | &yy_current_buffer->yy_ch_buf[yy_current_buffer->yy_buf_size + 2]; |
| 1072 | register YY_CHAR *source = |
| 1073 | &yy_current_buffer->yy_ch_buf[number_to_move]; |
| 1074 | |
| 1075 | while ( source > yy_current_buffer->yy_ch_buf ) |
| 1076 | *--dest = *--source; |
| 1077 | |
| 1078 | yy_cp += dest - source; |
| 1079 | yy_bp += dest - source; |
| 1080 | yy_n_chars = yy_current_buffer->yy_buf_size; |
| 1081 | |
| 1082 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
| 1083 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
| 1084 | } |
| 1085 | |
| 1086 | if ( yy_cp > yy_bp && yy_cp[-1] == '\n' ) |
| 1087 | yy_cp[-2] = '\n'; |
| 1088 | |
| 1089 | *--yy_cp = c; |
| 1090 | |
| 1091 | /* note: the formal parameter *must* be called "yy_bp" for this |
| 1092 | * macro to now work correctly |
| 1093 | */ |
| 1094 | YY_DO_BEFORE_ACTION; /* set up yytext again */ |
| 1095 | } |
| 1096 | |
| 1097 | |
| 1098 | #ifdef __cplusplus |
| 1099 | static int yyinput() |
| 1100 | #else |
| 1101 | static int input() |
| 1102 | #endif |
| 1103 | |
| 1104 | { |
| 1105 | int c; |
| 1106 | YY_CHAR *yy_cp = yy_c_buf_p; |
| 1107 | |
| 1108 | *yy_cp = yy_hold_char; |
| 1109 | |
| 1110 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
| 1111 | { |
| 1112 | /* yy_c_buf_p now points to the character we want to return. |
| 1113 | * If this occurs *before* the EOB characters, then it's a |
| 1114 | * valid NUL; if not, then we've hit the end of the buffer. |
| 1115 | */ |
| 1116 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
| 1117 | /* this was really a NUL */ |
| 1118 | *yy_c_buf_p = '\0'; |
| 1119 | |
| 1120 | else |
| 1121 | { /* need more input */ |
| 1122 | yytext = yy_c_buf_p; |
| 1123 | ++yy_c_buf_p; |
| 1124 | |
| 1125 | switch ( yy_get_next_buffer() ) |
| 1126 | { |
| 1127 | case EOB_ACT_END_OF_FILE: |
| 1128 | { |
| 1129 | if ( yywrap() ) |
| 1130 | { |
| 1131 | yy_c_buf_p = yytext + YY_MORE_ADJ; |
| 1132 | return ( EOF ); |
| 1133 | } |
| 1134 | |
| 1135 | YY_NEW_FILE; |
| 1136 | |
| 1137 | #ifdef __cplusplus |
| 1138 | return ( yyinput() ); |
| 1139 | #else |
| 1140 | return ( input() ); |
| 1141 | #endif |
| 1142 | } |
| 1143 | break; |
| 1144 | |
| 1145 | case EOB_ACT_CONTINUE_SCAN: |
| 1146 | yy_c_buf_p = yytext + YY_MORE_ADJ; |
| 1147 | break; |
| 1148 | |
| 1149 | case EOB_ACT_LAST_MATCH: |
| 1150 | #ifdef __cplusplus |
| 1151 | YY_FATAL_ERROR( "unexpected last match in yyinput()" ); |
| 1152 | #else |
| 1153 | YY_FATAL_ERROR( "unexpected last match in input()" ); |
| 1154 | #endif |
| 1155 | } |
| 1156 | } |
| 1157 | } |
| 1158 | |
| 1159 | c = *yy_c_buf_p; |
| 1160 | yy_hold_char = *++yy_c_buf_p; |
| 1161 | |
| 1162 | return ( c ); |
| 1163 | } |
| 1164 | |
| 1165 | |
| 1166 | #ifdef YY_USE_PROTOS |
| 1167 | void yyrestart( FILE *input_file ) |
| 1168 | #else |
| 1169 | void yyrestart( input_file ) |
| 1170 | FILE *input_file; |
| 1171 | #endif |
| 1172 | |
| 1173 | { |
| 1174 | yy_init_buffer( yy_current_buffer, input_file ); |
| 1175 | yy_load_buffer_state(); |
| 1176 | } |
| 1177 | |
| 1178 | |
| 1179 | #ifdef YY_USE_PROTOS |
| 1180 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) |
| 1181 | #else |
| 1182 | void yy_switch_to_buffer( new_buffer ) |
| 1183 | YY_BUFFER_STATE new_buffer; |
| 1184 | #endif |
| 1185 | |
| 1186 | { |
| 1187 | if ( yy_current_buffer == new_buffer ) |
| 1188 | return; |
| 1189 | |
| 1190 | if ( yy_current_buffer ) |
| 1191 | { |
| 1192 | /* flush out information for old buffer */ |
| 1193 | *yy_c_buf_p = yy_hold_char; |
| 1194 | yy_current_buffer->yy_buf_pos = yy_c_buf_p; |
| 1195 | yy_current_buffer->yy_n_chars = yy_n_chars; |
| 1196 | } |
| 1197 | |
| 1198 | yy_current_buffer = new_buffer; |
| 1199 | yy_load_buffer_state(); |
| 1200 | |
| 1201 | /* we don't actually know whether we did this switch during |
| 1202 | * EOF (yywrap()) processing, but the only time this flag |
| 1203 | * is looked at is after yywrap() is called, so it's safe |
| 1204 | * to go ahead and always set it. |
| 1205 | */ |
| 1206 | yy_did_buffer_switch_on_eof = 1; |
| 1207 | } |
| 1208 | |
| 1209 | |
| 1210 | #ifdef YY_USE_PROTOS |
| 1211 | void yy_load_buffer_state( void ) |
| 1212 | #else |
| 1213 | void yy_load_buffer_state() |
| 1214 | #endif |
| 1215 | |
| 1216 | { |
| 1217 | yy_n_chars = yy_current_buffer->yy_n_chars; |
| 1218 | yytext = yy_c_buf_p = yy_current_buffer->yy_buf_pos; |
| 1219 | yyin = yy_current_buffer->yy_input_file; |
| 1220 | yy_hold_char = *yy_c_buf_p; |
| 1221 | } |
| 1222 | |
| 1223 | |
| 1224 | #ifdef YY_USE_PROTOS |
| 1225 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) |
| 1226 | #else |
| 1227 | YY_BUFFER_STATE yy_create_buffer( file, size ) |
| 1228 | FILE *file; |
| 1229 | int size; |
| 1230 | #endif |
| 1231 | |
| 1232 | { |
| 1233 | YY_BUFFER_STATE b; |
| 1234 | |
| 1235 | b = (YY_BUFFER_STATE) malloc( sizeof( struct yy_buffer_state ) ); |
| 1236 | |
| 1237 | if ( ! b ) |
| 1238 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1239 | |
| 1240 | b->yy_buf_size = size; |
| 1241 | |
| 1242 | /* yy_ch_buf has to be 2 characters longer than the size given because |
| 1243 | * we need to put in 2 end-of-buffer characters. |
| 1244 | */ |
| 1245 | b->yy_ch_buf = (YY_CHAR *) malloc( (unsigned) (b->yy_buf_size + 2) ); |
| 1246 | |
| 1247 | if ( ! b->yy_ch_buf ) |
| 1248 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
| 1249 | |
| 1250 | yy_init_buffer( b, file ); |
| 1251 | |
| 1252 | return ( b ); |
| 1253 | } |
| 1254 | |
| 1255 | |
| 1256 | #ifdef YY_USE_PROTOS |
| 1257 | void yy_delete_buffer( YY_BUFFER_STATE b ) |
| 1258 | #else |
| 1259 | void yy_delete_buffer( b ) |
| 1260 | YY_BUFFER_STATE b; |
| 1261 | #endif |
| 1262 | |
| 1263 | { |
| 1264 | if ( b == yy_current_buffer ) |
| 1265 | yy_current_buffer = (YY_BUFFER_STATE) 0; |
| 1266 | |
| 1267 | free( (char *) b->yy_ch_buf ); |
| 1268 | free( (char *) b ); |
| 1269 | } |
| 1270 | |
| 1271 | |
| 1272 | #ifdef YY_USE_PROTOS |
| 1273 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) |
| 1274 | #else |
| 1275 | void yy_init_buffer( b, file ) |
| 1276 | YY_BUFFER_STATE b; |
| 1277 | FILE *file; |
| 1278 | #endif |
| 1279 | |
| 1280 | { |
| 1281 | b->yy_input_file = file; |
| 1282 | |
| 1283 | /* we put in the '\n' and start reading from [1] so that an |
| 1284 | * initial match-at-newline will be true. |
| 1285 | */ |
| 1286 | |
| 1287 | b->yy_ch_buf[0] = '\n'; |
| 1288 | b->yy_n_chars = 1; |
| 1289 | |
| 1290 | /* we always need two end-of-buffer characters. The first causes |
| 1291 | * a transition to the end-of-buffer state. The second causes |
| 1292 | * a jam in that state. |
| 1293 | */ |
| 1294 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
| 1295 | b->yy_ch_buf[2] = YY_END_OF_BUFFER_CHAR; |
| 1296 | |
| 1297 | b->yy_buf_pos = &b->yy_ch_buf[1]; |
| 1298 | |
| 1299 | b->yy_eof_status = EOF_NOT_SEEN; |
| 1300 | } |
| 1301 | # line 165 "scan.l" |
| 1302 | |
| 1303 | |
| 1304 | |
| 1305 | |
| 1306 | /* This is the way to get multiple files input into lex. */ |
| 1307 | |
| 1308 | int |
| 1309 | yywrap() |
| 1310 | { |
| 1311 | if (!open_new_file ()) return (1); /* EOF on standard in. */ |
| 1312 | return (0); /* We have more input. */ |
| 1313 | } |