source: trunk/minix/commands/bc/scan.c@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

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