GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: usr.bin/bc/scan.c Lines: 228 437 52.2 %
Date: 2017-11-07 Branches: 120 264 45.5 %

Line Branch Exec Source
1
#line 2 "scan.c"
2
3
#line 4 "scan.c"
4
5
#define  YY_INT_ALIGNED short int
6
7
/*	$OpenBSD: flex.skl,v 1.16 2017/05/02 19:16:19 millert Exp $	*/
8
9
/* A lexical scanner generated by flex */
10
11
#define FLEX_SCANNER
12
#define YY_FLEX_MAJOR_VERSION 2
13
#define YY_FLEX_MINOR_VERSION 5
14
#define YY_FLEX_SUBMINOR_VERSION 39
15
#if YY_FLEX_SUBMINOR_VERSION > 0
16
#define FLEX_BETA
17
#endif
18
19
/* First, we deal with  platform-specific or compiler-specific issues. */
20
21
/* begin standard C headers. */
22
#include <stdio.h>
23
#include <string.h>
24
#include <errno.h>
25
#include <stdlib.h>
26
27
/* end standard C headers. */
28
29
/* $OpenBSD: flexint.h,v 1.1 2015/11/19 19:43:40 tedu Exp $ */
30
31
/* flex integer type definitions */
32
33
#ifndef FLEXINT_H
34
#define FLEXINT_H
35
36
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
37
38
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
39
40
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41
 * if you want the limit (max/min) macros for int types.
42
 */
43
#ifndef __STDC_LIMIT_MACROS
44
#define __STDC_LIMIT_MACROS 1
45
#endif
46
47
#include <inttypes.h>
48
typedef int8_t flex_int8_t;
49
typedef uint8_t flex_uint8_t;
50
typedef int16_t flex_int16_t;
51
typedef uint16_t flex_uint16_t;
52
typedef int32_t flex_int32_t;
53
typedef uint32_t flex_uint32_t;
54
#else
55
typedef signed char flex_int8_t;
56
typedef short int flex_int16_t;
57
typedef int flex_int32_t;
58
typedef unsigned char flex_uint8_t;
59
typedef unsigned short int flex_uint16_t;
60
typedef unsigned int flex_uint32_t;
61
62
/* Limits of integral types. */
63
#ifndef INT8_MIN
64
42
#define INT8_MIN               (-128)
65
42
#endif
66
42
#ifndef INT16_MIN
67
406
#define INT16_MIN              (-32767-1)
68
364
#endif
69
#ifndef INT32_MIN
70
#define INT32_MIN              (-2147483647-1)
71
#endif
72
#ifndef INT8_MAX
73
763
#define INT8_MAX               (127)
74
763
#endif
75
819
#ifndef INT16_MAX
76
826
#define INT16_MAX              (32767)
77
14
#endif
78
168
#ifndef INT32_MAX
79
168
#define INT32_MAX              (2147483647)
80
770
#endif
81
#ifndef UINT8_MAX
82
#define UINT8_MAX              (255U)
83
#endif
84
#ifndef UINT16_MAX
85
3808
#define UINT16_MAX             (65535U)
86
3808
#endif
87
3808
#ifndef UINT32_MAX
88
3808
#define UINT32_MAX             (4294967295U)
89
#endif
90
3808
91
56
#endif /* ! C99 */
92
56
93
56
#endif /* ! FLEXINT_H */
94
56
95
#ifdef __cplusplus
96
56
97
84
/* The "const" storage-class-modifier is valid. */
98
84
#define YY_USE_CONST
99
56
100
#else	/* ! __cplusplus */
101
102
/* C99 requires __STDC__ to be defined as 1. */
103
#if defined (__STDC__)
104
105
56
#define YY_USE_CONST
106
56
107
#endif	/* defined (__STDC__) */
108
#endif	/* ! __cplusplus */
109
56
110
#ifdef YY_USE_CONST
111
3864
#define yyconst const
112
3864
#else
113
3864
#define yyconst
114
14
#endif
115
116
3850
/* Returned upon end-of-file. */
117
3850
#define YY_NULL 0
118
119
/* Promotes a possibly negative, possibly signed char to an unsigned
120
 * integer for use as an array index.  If the signed char is negative,
121
 * we want to instead treat it as an 8-bit unsigned char, hence the
122
49
 * double cast.
123
28
 */
124
28
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
125
126
126
287
/* Enter a start condition.  This macro really ought to take a parameter,
127
 * but we do it the disgusting crufty way forced on us by the ()-less
128
518
 * definition of BEGIN.
129
 */
130
91
#define BEGIN (yy_start) = 1 + 2 *
131
56
132
/* Translate the current start state into a value that can be later handed
133
133
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
134
 * compatibility.
135
133
 */
136
301
#define YY_START (((yy_start) - 1) / 2)
137
28
#define YYSTATE YY_START
138
189
139
/* Action number for EOF rule of a given start state. */
140
7
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
141
336
142
182
/* Special action meaning "start processing a new file". */
143
14
#define YY_NEW_FILE yyrestart(yyin  )
144
145
21
#define YY_END_OF_BUFFER_CHAR 0
146
91
147
70
/* Size of default input buffer. */
148
#ifndef YY_BUF_SIZE
149
259
#define YY_BUF_SIZE 16384
150
196
#endif
151
152
49
/* The state buf must be large enough to hold one state per character in the main buffer.
153
7
 */
154
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
155
2926
156
21
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
157
7
#define YY_TYPEDEF_YY_BUFFER_STATE
158
7
typedef struct yy_buffer_state *YY_BUFFER_STATE;
159
7
#endif
160
7
161
7
#ifndef YY_TYPEDEF_YY_SIZE_T
162
#define YY_TYPEDEF_YY_SIZE_T
163
182
typedef size_t yy_size_t;
164
42
#endif
165
28
166
28
extern yy_size_t yyleng;
167
140
168
84
extern FILE *yyin, *yyout;
169
170
469
#define EOB_ACT_CONTINUE_SCAN 0
171
322
#define EOB_ACT_END_OF_FILE 1
172
#define EOB_ACT_LAST_MATCH 2
173
1554
174
1554
    #define YY_LESS_LINENO(n)
175
    #define YY_LINENO_REWIND_TO(ptr)
176
21
177
21
/* Return all but the first "n" matched characters back to the input stream. */
178
#define yyless(n) \
179
392
	do \
180
392
		{ \
181
		/* Undo effects of setting up yytext. */ \
182
        int yyless_macro_arg = (n); \
183
        YY_LESS_LINENO(yyless_macro_arg);\
184
7224
		*yy_cp = (yy_hold_char); \
185
7224
		YY_RESTORE_YY_MORE_OFFSET \
186
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
187
7224
		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
188
7224
		} \
189
	while ( 0 )
190
191
#define unput(c) yyunput( c, (yytext_ptr)  )
192
193
6692
#ifndef YY_STRUCT_YY_BUFFER_STATE
194
#define YY_STRUCT_YY_BUFFER_STATE
195
struct yy_buffer_state
196
	{
197
126
	FILE *yy_input_file;
198
199
	char *yy_ch_buf;		/* input buffer */
200
	char *yy_buf_pos;		/* current position in input buffer */
201
202
	/* Size of input buffer in bytes, not including room for EOB
203
	 * characters.
204
	 */
205
	yy_size_t yy_buf_size;
206
207
	/* Number of characters read into yy_ch_buf, not including EOB
208
	 * characters.
209
	 */
210
	yy_size_t yy_n_chars;
211
212
	/* Whether we "own" the buffer - i.e., we know we created it,
213
	 * and can realloc() it to grow it, and should free() it to
214
	 * delete it.
215
	 */
216
	int yy_is_our_buffer;
217
218
	/* Whether this is an "interactive" input source; if so, and
219
	 * if we're using stdio for input, then we want to use getc()
220
	 * instead of fread(), to make sure we stop fetching input after
221
	 * each newline.
222
	 */
223
	int yy_is_interactive;
224
225
	/* Whether we're considered to be at the beginning of a line.
226
	 * If so, '^' rules will be active on the next match, otherwise
227
	 * not.
228
	 */
229
	int yy_at_bol;
230
231
    int yy_bs_lineno; /**< The line count. */
232
    int yy_bs_column; /**< The column count. */
233
234
	/* Whether to try to fill the input buffer when we reach the
235
	 * end of it.
236
	 */
237
	int yy_fill_buffer;
238
239
	int yy_buffer_status;
240
241
#define YY_BUFFER_NEW 0
242
#define YY_BUFFER_NORMAL 1
243
	/* When an EOF's been seen but there's still some text to process
244
	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
245
	 * shouldn't try reading from the input source any more.  We might
246
	 * still have a bunch of tokens to match, though, because of
247
	 * possible backing-up.
248
	 *
249
	 * When we actually see the EOF, we change the status to "new"
250
	 * (via yyrestart()), so that the user can continue scanning by
251
	 * just pointing yyin at a new input file.
252
	 */
253
#define YY_BUFFER_EOF_PENDING 2
254
255
	};
256
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
257
258
/* Stack of input buffers. */
259
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
260
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
261
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
262
263
/* We provide macros for accessing buffer states in case in the
264
 * future we want to put the buffer states in a more general
265
 * "scanner state".
266
 *
267
 * Returns the top of the stack, or NULL.
268
 */
269
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
270
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
271
                          : NULL)
272
273
/* Same as previous macro, but useful when we know that the buffer stack is not
274
 * NULL or when we need an lvalue. For internal use only.
275
 */
276
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
277
278
/* yy_hold_char holds the character lost when yytext is formed. */
279
static char yy_hold_char;
280
static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
281
yy_size_t yyleng;
282
283
/* Points to current character in buffer. */
284
static char *yy_c_buf_p = (char *) 0;
285
static int yy_init = 0;		/* whether we need to initialize */
286
static int yy_start = 0;	/* start state number */
287
288
/* Flag which is used to allow yywrap()'s to do buffer switches
289
 * instead of setting up a fresh yyin.  A bit of a hack ...
290
 */
291
static int yy_did_buffer_switch_on_eof;
292
293
void yyrestart (FILE *input_file  );
294
void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
295
YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
296
void yy_delete_buffer (YY_BUFFER_STATE b  );
297
void yy_flush_buffer (YY_BUFFER_STATE b  );
298
void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
299
void yypop_buffer_state (void );
300
301
static void yyensure_buffer_stack (void );
302
static void yy_load_buffer_state (void );
303
static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
304
305
#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
306
307
YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
308
YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
309
YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len  );
310
311
void *yyalloc (yy_size_t  );
312
void *yyrealloc (void *,yy_size_t  );
313
void yyfree (void *  );
314
315
#define yy_new_buffer yy_create_buffer
316
317
#define yy_set_interactive(is_interactive) \
318
	{ \
319
	if ( ! YY_CURRENT_BUFFER ){ \
320
        yyensure_buffer_stack (); \
321
		YY_CURRENT_BUFFER_LVALUE =    \
322
            yy_create_buffer(yyin,YY_BUF_SIZE ); \
323
	} \
324
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
325
	}
326
327
#define yy_set_bol(at_bol) \
328
	{ \
329
	if ( ! YY_CURRENT_BUFFER ){\
330
        yyensure_buffer_stack (); \
331
		YY_CURRENT_BUFFER_LVALUE =    \
332
            yy_create_buffer(yyin,YY_BUF_SIZE ); \
333
	} \
334
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
335
	}
336
337
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
338
339
/* Begin user sect3 */
340
341
typedef unsigned char YY_CHAR;
342
343
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
344
345
typedef int yy_state_type;
346
347
extern int yylineno;
348
349
int yylineno = 1;
350
351
extern char *yytext;
352
#define yytext_ptr yytext
353
354
static yy_state_type yy_get_previous_state (void );
355
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
356
static int yy_get_next_buffer (void );
357
static void yy_fatal_error (yyconst char msg[]  );
358
359
/* Done after the current pattern has been matched and before the
360
 * corresponding action - sets up yytext.
361
 */
362
#define YY_DO_BEFORE_ACTION \
363
	(yytext_ptr) = yy_bp; \
364
	yyleng = (size_t) (yy_cp - yy_bp); \
365
	(yy_hold_char) = *yy_cp; \
366
	*yy_cp = '\0'; \
367
	(yy_c_buf_p) = yy_cp;
368
369
#define YY_NUM_RULES 74
370
#define YY_END_OF_BUFFER 75
371
/* This struct is not used in this scanner,
372
   but its presence is necessary. */
373
struct yy_trans_info
374
	{
375
	flex_int32_t yy_verify;
376
	flex_int32_t yy_nxt;
377
	};
378
static yyconst flex_int16_t yy_accept[156] =
379
    {   0,
380
        0,    0,    0,    0,    0,    0,    0,    0,   75,   73,
381
       72,   70,   40,    6,   71,   39,   73,   62,   63,   37,
382
       43,   60,   44,   14,   38,   13,   61,   58,   47,   59,
383
       64,   73,   65,   36,   68,   68,   68,   68,   68,   68,
384
       68,   68,   68,   68,   68,   68,   68,   68,   68,   66,
385
       73,   67,    5,    3,    4,    7,   11,   12,    8,   10,
386
        9,   18,   16,   15,   18,   57,   71,   52,   41,   50,
387
       45,   48,   46,   49,    1,   51,   13,   55,   54,   56,
388
       69,   53,   68,   68,   68,   68,   68,   68,   68,   68,
389
       25,   68,   68,   68,   68,   68,   68,   68,   68,   68,
390
391
       42,    5,    2,    7,   15,   17,   68,   68,   68,   68,
392
       68,   27,   68,   68,   68,   68,   68,   68,   68,   68,
393
       68,   68,   17,   19,   68,   68,   68,   23,   68,   26,
394
       68,   68,   68,   31,   68,   68,   34,   68,   20,   68,
395
       68,   24,   68,   29,   30,   68,   33,   35,   68,   22,
396
       28,   32,   68,   21,    0
397
    } ;
398
399
static yyconst flex_int32_t yy_ec[256] =
400
    {   0,
401
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
402
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
403
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
404
        1,    2,    4,    5,    6,    1,    7,    8,    1,    9,
405
       10,   11,   12,   13,   14,   15,   16,   17,   17,   17,
406
       17,   17,   17,   17,   17,   17,   17,    1,   18,   19,
407
       20,   21,    1,    1,   22,   22,   22,   22,   22,   22,
408
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
409
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
410
       23,   24,   25,   26,   27,    1,   28,   29,   30,   31,
411
412
       32,   33,   34,   35,   36,   27,   37,   38,   27,   39,
413
       40,   41,   42,   43,   44,   45,   46,   27,   47,   27,
414
       27,   27,   48,   49,   50,    1,    1,    1,    1,    1,
415
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
416
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
417
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
418
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
419
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
420
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
421
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
422
423
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
424
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
425
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
426
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
427
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
428
        1,    1,    1,    1,    1
429
    } ;
430
431
static yyconst flex_int32_t yy_meta[51] =
432
    {   0,
433
        1,    1,    2,    1,    3,    1,    1,    1,    1,    1,
434
        4,    1,    1,    1,    1,    1,    5,    1,    1,    1,
435
        1,    1,    3,    3,    3,    1,    5,    5,    5,    5,
436
        5,    5,    5,    5,    5,    5,    5,    5,    5,    5,
437
        5,    5,    5,    5,    5,    5,    5,    1,    1,    1
438
    } ;
439
440
static yyconst flex_int16_t yy_base[163] =
441
    {   0,
442
        0,    0,   48,   49,   50,   53,   46,   47,  191,  192,
443
      192,  192,  170,  192,    0,  169,  180,  192,  192,  167,
444
       45,  192,   52,  192,   68,   63,  192,  166,  165,  164,
445
      192,  180,  192,  162,    0,  135,  137,  139,  146,  139,
446
      136,   53,   55,  146,  131,  127,  140,   51,  136,  192,
447
      121,  192,    0,  192,  153,    0,  192,  192,  192,  192,
448
      192,  192,  192,   67,  165,  192,    0,  192,  192,  192,
449
      192,  192,  192,  192,  192,  192,   73,  192,  192,  192,
450
      192,  192,    0,  122,  134,  126,  131,  119,  119,  133,
451
        0,  116,  120,  130,  121,  120,  110,  126,  110,  116,
452
453
      192,    0,  192,    0,   74,  149,  110,  121,  103,  111,
454
      114,    0,  101,   99,  109,   98,  102,   95,   93,  100,
455
       92,   98,  133,    0,   97,   97,   93,    0,   99,    0,
456
       85,   97,   83,    0,   84,   92,    0,   91,    0,   81,
457
       86,    0,   78,    0,    0,   55,    0,    0,   46,    0,
458
        0,    0,   35,    0,  192,   96,  101,  106,  111,   49,
459
      116,  121
460
    } ;
461
462
static yyconst flex_int16_t yy_def[163] =
463
    {   0,
464
      155,    1,  156,  156,  157,  157,  158,  158,  155,  155,
465
      155,  155,  155,  155,  159,  155,  155,  155,  155,  155,
466
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
467
      155,  155,  155,  155,  160,  160,  160,  160,  160,  160,
468
      160,  160,  160,  160,  160,  160,  160,  160,  160,  155,
469
      155,  155,  161,  155,  155,  162,  155,  155,  155,  155,
470
      155,  155,  155,  155,  155,  155,  159,  155,  155,  155,
471
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
472
      155,  155,  160,  160,  160,  160,  160,  160,  160,  160,
473
      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
474
475
      155,  161,  155,  162,  155,  155,  160,  160,  160,  160,
476
      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
477
      160,  160,  155,  160,  160,  160,  160,  160,  160,  160,
478
      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
479
      160,  160,  160,  160,  160,  160,  160,  160,  160,  160,
480
      160,  160,  160,  160,    0,  155,  155,  155,  155,  155,
481
      155,  155
482
    } ;
483
484
static yyconst flex_int16_t yy_nxt[243] =
485
    {   0,
486
       10,   11,   12,   13,   14,   15,   16,   17,   18,   19,
487
       20,   21,   22,   23,   24,   25,   26,   27,   28,   29,
488
       30,   26,   31,   32,   33,   34,   35,   36,   37,   38,
489
       39,   40,   41,   35,   35,   42,   35,   43,   35,   44,
490
       45,   46,   47,   48,   35,   35,   49,   50,   51,   52,
491
       54,   54,   57,   83,   58,   57,   71,   58,   55,   55,
492
       63,   63,   64,   64,   72,   73,  154,   64,   64,   65,
493
       65,   74,   59,   60,   61,   59,   60,   61,   75,   77,
494
       98,   90,   92,  105,   77,   91,   93,   76,  105,   77,
495
      105,  153,   99,  152,   77,  105,   53,   53,   53,   53,
496
497
       53,   56,   56,   56,   56,   56,   62,   62,   62,   62,
498
       62,   67,  151,   67,   67,   67,  102,  150,  102,  149,
499
      102,  104,  148,  147,  104,  104,  146,  145,  144,  143,
500
      142,  141,  140,  139,  123,  138,  137,  136,  135,  134,
501
      133,  132,  131,  130,  129,  128,  127,  126,  125,  124,
502
      123,  122,  121,  120,  119,  118,  117,  116,  115,  114,
503
      113,  112,  111,  110,  109,  108,  107,  106,  103,  101,
504
      100,   97,   96,   95,   94,   89,   88,   87,   86,   85,
505
       84,   82,   81,   80,   79,   78,   70,   69,   68,   66,
506
      155,    9,  155,  155,  155,  155,  155,  155,  155,  155,
507
508
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
509
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
510
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
511
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
512
      155,  155
513
    } ;
514
515
static yyconst flex_int16_t yy_chk[243] =
516
    {   0,
517
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
518
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
519
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
520
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
521
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
522
        3,    4,    5,  160,    5,    6,   21,    6,    3,    4,
523
        7,    8,    7,    8,   21,   23,  153,    7,    8,    7,
524
        8,   23,    5,    5,    5,    6,    6,    6,   25,   26,
525
       48,   42,   43,   64,   26,   42,   43,   25,   64,   77,
526
      105,  149,   48,  146,   77,  105,  156,  156,  156,  156,
527
528
      156,  157,  157,  157,  157,  157,  158,  158,  158,  158,
529
      158,  159,  143,  159,  159,  159,  161,  141,  161,  140,
530
      161,  162,  138,  136,  162,  162,  135,  133,  132,  131,
531
      129,  127,  126,  125,  123,  122,  121,  120,  119,  118,
532
      117,  116,  115,  114,  113,  111,  110,  109,  108,  107,
533
      106,  100,   99,   98,   97,   96,   95,   94,   93,   92,
534
       90,   89,   88,   87,   86,   85,   84,   65,   55,   51,
535
       49,   47,   46,   45,   44,   41,   40,   39,   38,   37,
536
       36,   34,   32,   30,   29,   28,   20,   17,   16,   13,
537
        9,  155,  155,  155,  155,  155,  155,  155,  155,  155,
538
539
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
540
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
541
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
542
      155,  155,  155,  155,  155,  155,  155,  155,  155,  155,
543
      155,  155
544
    } ;
545
546
static yy_state_type yy_last_accepting_state;
547
static char *yy_last_accepting_cpos;
548
549
extern int yy_flex_debug;
550
int yy_flex_debug = 0;
551
552
/* The intent behind this definition is that it'll catch
553
 * any uses of REJECT which flex missed.
554
 */
555
#define REJECT reject_used_but_not_detected
556
#define yymore() yymore_used_but_not_detected
557
#define YY_MORE_ADJ 0
558
#define YY_RESTORE_YY_MORE_OFFSET
559
char *yytext;
560
#line 1 "scan.l"
561
#line 2 "scan.l"
562
/*      $OpenBSD: scan.l,v 1.30 2017/07/19 12:50:33 espie Exp $	*/
563
564
/*
565
 * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
566
 *
567
 * Permission to use, copy, modify, and distribute this software for any
568
 * purpose with or without fee is hereby granted, provided that the above
569
 * copyright notice and this permission notice appear in all copies.
570
 *
571
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
572
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
573
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
574
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
575
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
576
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
577
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
578
 */
579
580
#include <err.h>
581
#include <histedit.h>
582
#include <signal.h>
583
#include <string.h>
584
#include <unistd.h>
585
586
#include "extern.h"
587
#include "pathnames.h"
588
#include "bc.h"
589
590
int		lineno;
591
bool		interactive;
592
593
HistEvent	 he;
594
EditLine	*el;
595
History		*hist;
596
597
static char	*strbuf = NULL;
598
static size_t	strbuf_sz = 1;
599
static bool	dot_seen;
600
static int	use_el;
601
static volatile sig_atomic_t skipchars;
602
603
static void	init_strbuf(void);
604
static void	add_str(const char *);
605
606
static int	 bc_yyinput(char *, int);
607
608
#undef YY_INPUT
609
#define YY_INPUT(buf,retval,max) \
610
	(retval = bc_yyinput(buf, max))
611
612
613
#line 614 "scan.c"
614
615
#define INITIAL 0
616
#define comment 1
617
#define string 2
618
#define number 3
619
620
#ifndef YY_NO_UNISTD_H
621
/* Special case for "unistd.h", since it is non-ANSI. We include it way
622
 * down here because we want the user's section 1 to have been scanned first.
623
 * The user has a chance to override it with an option.
624
 */
625
#include <unistd.h>
626
#endif
627
628
#ifndef YY_EXTRA_TYPE
629
#define YY_EXTRA_TYPE void *
630
#endif
631
632
static int yy_init_globals (void );
633
634
/* Accessor methods to globals.
635
   These are made visible to non-reentrant scanners for convenience. */
636
637
int yylex_destroy (void );
638
639
int yyget_debug (void );
640
641
void yyset_debug (int debug_flag  );
642
643
YY_EXTRA_TYPE yyget_extra (void );
644
645
void yyset_extra (YY_EXTRA_TYPE user_defined  );
646
647
FILE *yyget_in (void );
648
649
void yyset_in  (FILE * in_str  );
650
651
FILE *yyget_out (void );
652
653
void yyset_out  (FILE * out_str  );
654
655
yy_size_t yyget_leng (void );
656
657
char *yyget_text (void );
658
659
int yyget_lineno (void );
660
661
void yyset_lineno (int line_number  );
662
663
/* Macros after this point can all be overridden by user definitions in
664
 * section 1.
665
 */
666
667
#ifndef YY_SKIP_YYWRAP
668
#ifdef __cplusplus
669
extern "C" int yywrap (void );
670
#else
671
extern int yywrap (void );
672
#endif
673
#endif
674
675
    static void yyunput (int c,char *buf_ptr  );
676
677
#ifndef yytext_ptr
678
static void yy_flex_strncpy (char *,yyconst char *,int );
679
#endif
680
681
#ifdef YY_NEED_STRLEN
682
static int yy_flex_strlen (yyconst char * );
683
#endif
684
685
#ifndef YY_NO_INPUT
686
687
#ifdef __cplusplus
688
static int yyinput (void );
689
#else
690
static int input (void );
691
#endif
692
693
#endif
694
695
/* Amount of stuff to slurp up with each read. */
696
#ifndef YY_READ_BUF_SIZE
697
#define YY_READ_BUF_SIZE 8192
698
#endif
699
700
/* Copy whatever the last rule matched to the standard output. */
701
#ifndef ECHO
702
/* This used to be an fputs(), but since the string might contain NUL's,
703
 * we now use fwrite().
704
 */
705
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
706
#endif
707
708
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
709
 * is returned in "result".
710
 */
711
#ifndef YY_INPUT
712
#define YY_INPUT(buf,result,max_size) \
713
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
714
		{ \
715
		int c = '*'; \
716
		size_t n; \
717
		for ( n = 0; n < max_size && \
718
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
719
			buf[n] = (char) c; \
720
		if ( c == '\n' ) \
721
			buf[n++] = (char) c; \
722
		if ( c == EOF && ferror( yyin ) ) \
723
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
724
		result = n; \
725
		} \
726
	else \
727
		{ \
728
		errno=0; \
729
		while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
730
			{ \
731
			if( errno != EINTR) \
732
				{ \
733
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
734
				break; \
735
				} \
736
			errno=0; \
737
			clearerr(yyin); \
738
			} \
739
		}\
740
\
741
742
#endif
743
744
/* No semi-colon after return; correct usage is to write "yyterminate();" -
745
 * we don't want an extra ';' after the "return" because that will cause
746
 * some compilers to complain about unreachable statements.
747
 */
748
#ifndef yyterminate
749
#define yyterminate() return YY_NULL
750
#endif
751
752
/* Number of entries by which start-condition stack grows. */
753
#ifndef YY_START_STACK_INCR
754
#define YY_START_STACK_INCR 25
755
#endif
756
757
/* Report a fatal error. */
758
#ifndef YY_FATAL_ERROR
759
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
760
#endif
761
762
/* end tables serialization structures and prototypes */
763
764
/* Default declaration of generated scanner - a define so the user can
765
 * easily add parameters.
766
 */
767
#ifndef YY_DECL
768
#define YY_DECL_IS_OURS 1
769
770
extern int yylex (void);
771
772
#define YY_DECL int yylex (void)
773
#endif /* !YY_DECL */
774
775
/* Code executed at the beginning of each rule, after yytext and yyleng
776
 * have been set up.
777
 */
778
#ifndef YY_USER_ACTION
779
#define YY_USER_ACTION
780
#endif
781
782
/* Code executed at the end of each rule. */
783
#ifndef YY_BREAK
784
#define YY_BREAK break;
785
#endif
786
787
#define YY_RULE_SETUP \
788
	YY_USER_ACTION
789
790
/** The main scanner function which does all the work.
791
 */
792
YY_DECL
793
{
794
	yy_state_type yy_current_state;
795
	char *yy_cp, *yy_bp;
796
	int yy_act;
797
798
60158
	if ( !(yy_init) )
799
		{
800
126
		(yy_init) = 1;
801
802
#ifdef YY_USER_INIT
803
		YY_USER_INIT;
804
#endif
805
806
126
		if ( ! (yy_start) )
807
126
			(yy_start) = 1;	/* first start state */
808
809
126
		if ( ! yyin )
810
			yyin = stdin;
811
812
126
		if ( ! yyout )
813
126
			yyout = stdout;
814
815

126
		if ( ! YY_CURRENT_BUFFER ) {
816
126
			yyensure_buffer_stack ();
817
126
			YY_CURRENT_BUFFER_LVALUE =
818
126
				yy_create_buffer(yyin,YY_BUF_SIZE );
819
126
		}
820
821
126
		yy_load_buffer_state( );
822
126
		}
823
824
	{
825
#line 62 "scan.l"
826
827
828
#line 829 "scan.c"
829
830
	while ( 1 )		/* loops until end-of-file is reached */
831
		{
832
45052
		yy_cp = (yy_c_buf_p);
833
834
		/* Support of yytext. */
835
45052
		*yy_cp = (yy_hold_char);
836
837
		/* yy_bp points to the position in yy_ch_buf of the start of
838
		 * the current run.
839
		 */
840
		yy_bp = yy_cp;
841
842
45052
		yy_current_state = (yy_start);
843
yy_match:
844
52115
		do
845
			{
846
118839
			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
847
118839
			if ( yy_accept[yy_current_state] )
848
				{
849
66724
				(yy_last_accepting_state) = yy_current_state;
850
66724
				(yy_last_accepting_cpos) = yy_cp;
851
66724
				}
852
191541
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
853
				{
854
72702
				yy_current_state = (int) yy_def[yy_current_state];
855
72702
				if ( yy_current_state >= 156 )
856
46410
					yy_c = yy_meta[(unsigned int) yy_c];
857
				}
858
118839
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
859
118839
			++yy_cp;
860
118839
			}
861
118839
		while ( yy_base[yy_current_state] != 192 );
862
863
yy_find_action:
864
52115
		yy_act = yy_accept[yy_current_state];
865
52115
		if ( yy_act == 0 )
866
			{ /* have to back up */
867
26292
			yy_cp = (yy_last_accepting_cpos);
868
26292
			yy_current_state = (yy_last_accepting_state);
869
26292
			yy_act = yy_accept[yy_current_state];
870
26292
			}
871
872
52115
		YY_DO_BEFORE_ACTION;
873
874
do_action:	/* This label is used only to access EOF actions. */
875
876




















88410
		switch ( yy_act )
877
	{ /* beginning of action switch */
878
			case 0: /* must back up */
879
			/* undo the effects of YY_DO_BEFORE_ACTION */
880
			*yy_cp = (yy_hold_char);
881
			yy_cp = (yy_last_accepting_cpos);
882
			yy_current_state = (yy_last_accepting_state);
883
			goto yy_find_action;
884
885
case 1:
886
YY_RULE_SETUP
887
#line 64 "scan.l"
888
BEGIN(comment);
889
	YY_BREAK
890
891
case 2:
892
YY_RULE_SETUP
893
#line 66 "scan.l"
894
BEGIN(INITIAL);
895
	YY_BREAK
896
case 3:
897
/* rule 3 can match eol */
898
YY_RULE_SETUP
899
#line 67 "scan.l"
900
lineno++;
901
	YY_BREAK
902
case 4:
903
YY_RULE_SETUP
904
#line 68 "scan.l"
905
;
906
	YY_BREAK
907
case 5:
908
YY_RULE_SETUP
909
#line 69 "scan.l"
910
;
911
	YY_BREAK
912
case YY_STATE_EOF(comment):
913
#line 70 "scan.l"
914
fatal("end of file in comment");
915
	YY_BREAK
916
917
case 6:
918
YY_RULE_SETUP
919
#line 73 "scan.l"
920
BEGIN(string); init_strbuf();
921
	YY_BREAK
922
923
case 7:
924
YY_RULE_SETUP
925
#line 75 "scan.l"
926
add_str(yytext);
927
	YY_BREAK
928
case 8:
929
YY_RULE_SETUP
930
#line 76 "scan.l"
931
add_str("\\[");
932
	YY_BREAK
933
case 9:
934
YY_RULE_SETUP
935
#line 77 "scan.l"
936
add_str("\\]");
937
	YY_BREAK
938
case 10:
939
YY_RULE_SETUP
940
#line 78 "scan.l"
941
add_str("\\\\");
942
	YY_BREAK
943
case 11:
944
/* rule 11 can match eol */
945
YY_RULE_SETUP
946
#line 79 "scan.l"
947
add_str("\n"); lineno++;
948
	YY_BREAK
949
case 12:
950
YY_RULE_SETUP
951
#line 80 "scan.l"
952
BEGIN(INITIAL); yylval.str = strbuf; return STRING;
953
	YY_BREAK
954
case YY_STATE_EOF(string):
955
#line 81 "scan.l"
956
fatal("end of file in string");
957
	YY_BREAK
958
959
case 13:
960
YY_RULE_SETUP
961
#line 84 "scan.l"
962
{
963
			BEGIN(number);
964
			dot_seen = false;
965
			init_strbuf();
966
			add_str(yytext);
967
		}
968
	YY_BREAK
969
case 14:
970
YY_RULE_SETUP
971
#line 90 "scan.l"
972
{
973
			BEGIN(number);
974
			dot_seen = true;
975
			init_strbuf();
976
			add_str(".");
977
		}
978
	YY_BREAK
979
980
case 15:
981
YY_RULE_SETUP
982
#line 97 "scan.l"
983
add_str(yytext);
984
	YY_BREAK
985
case 16:
986
YY_RULE_SETUP
987
#line 98 "scan.l"
988
{
989
			if (dot_seen) {
990
				BEGIN(INITIAL);
991
				yylval.str = strbuf;
992
				unput('.');
993
				return NUMBER;
994
			} else {
995
				dot_seen = true;
996
				add_str(".");
997
			}
998
		}
999
	YY_BREAK
1000
case 17:
1001
/* rule 17 can match eol */
1002
YY_RULE_SETUP
1003
#line 109 "scan.l"
1004
lineno++;
1005
	YY_BREAK
1006
case 18:
1007
/* rule 18 can match eol */
1008
YY_RULE_SETUP
1009
#line 110 "scan.l"
1010
{
1011
			BEGIN(INITIAL);
1012
			unput(yytext[0]);
1013
			if (strcmp(strbuf, ".") == 0)
1014
				return DOT;
1015
			else {
1016
				yylval.str = strbuf;
1017
				return NUMBER;
1018
			}
1019
		}
1020
	YY_BREAK
1021
1022
case 19:
1023
YY_RULE_SETUP
1024
#line 122 "scan.l"
1025
return AUTO;
1026
	YY_BREAK
1027
case 20:
1028
YY_RULE_SETUP
1029
#line 123 "scan.l"
1030
return BREAK;
1031
	YY_BREAK
1032
case 21:
1033
YY_RULE_SETUP
1034
#line 124 "scan.l"
1035
return CONTINUE;
1036
	YY_BREAK
1037
case 22:
1038
YY_RULE_SETUP
1039
#line 125 "scan.l"
1040
return DEFINE;
1041
	YY_BREAK
1042
case 23:
1043
YY_RULE_SETUP
1044
#line 126 "scan.l"
1045
return ELSE;
1046
	YY_BREAK
1047
case 24:
1048
YY_RULE_SETUP
1049
#line 127 "scan.l"
1050
return IBASE;
1051
	YY_BREAK
1052
case 25:
1053
YY_RULE_SETUP
1054
#line 128 "scan.l"
1055
return IF;
1056
	YY_BREAK
1057
case 26:
1058
YY_RULE_SETUP
1059
#line 129 "scan.l"
1060
return DOT;
1061
	YY_BREAK
1062
case 27:
1063
YY_RULE_SETUP
1064
#line 130 "scan.l"
1065
return FOR;
1066
	YY_BREAK
1067
case 28:
1068
YY_RULE_SETUP
1069
#line 131 "scan.l"
1070
return LENGTH;
1071
	YY_BREAK
1072
case 29:
1073
YY_RULE_SETUP
1074
#line 132 "scan.l"
1075
return OBASE;
1076
	YY_BREAK
1077
case 30:
1078
YY_RULE_SETUP
1079
#line 133 "scan.l"
1080
return PRINT;
1081
	YY_BREAK
1082
case 31:
1083
YY_RULE_SETUP
1084
#line 134 "scan.l"
1085
return QUIT;
1086
	YY_BREAK
1087
case 32:
1088
YY_RULE_SETUP
1089
#line 135 "scan.l"
1090
return RETURN;
1091
	YY_BREAK
1092
case 33:
1093
YY_RULE_SETUP
1094
#line 136 "scan.l"
1095
return SCALE;
1096
	YY_BREAK
1097
case 34:
1098
YY_RULE_SETUP
1099
#line 137 "scan.l"
1100
return SQRT;
1101
	YY_BREAK
1102
case 35:
1103
YY_RULE_SETUP
1104
#line 138 "scan.l"
1105
return WHILE;
1106
	YY_BREAK
1107
case 36:
1108
YY_RULE_SETUP
1109
#line 140 "scan.l"
1110
return EXPONENT;
1111
	YY_BREAK
1112
case 37:
1113
YY_RULE_SETUP
1114
#line 141 "scan.l"
1115
return MULTIPLY;
1116
	YY_BREAK
1117
case 38:
1118
YY_RULE_SETUP
1119
#line 142 "scan.l"
1120
return DIVIDE;
1121
	YY_BREAK
1122
case 39:
1123
YY_RULE_SETUP
1124
#line 143 "scan.l"
1125
return REMAINDER;
1126
	YY_BREAK
1127
case 40:
1128
YY_RULE_SETUP
1129
#line 145 "scan.l"
1130
return BOOL_NOT;
1131
	YY_BREAK
1132
case 41:
1133
YY_RULE_SETUP
1134
#line 146 "scan.l"
1135
return BOOL_AND;
1136
	YY_BREAK
1137
case 42:
1138
YY_RULE_SETUP
1139
#line 147 "scan.l"
1140
return BOOL_OR;
1141
	YY_BREAK
1142
case 43:
1143
YY_RULE_SETUP
1144
#line 149 "scan.l"
1145
return PLUS;
1146
	YY_BREAK
1147
case 44:
1148
YY_RULE_SETUP
1149
#line 150 "scan.l"
1150
return MINUS;
1151
	YY_BREAK
1152
case 45:
1153
YY_RULE_SETUP
1154
#line 152 "scan.l"
1155
return INCR;
1156
	YY_BREAK
1157
case 46:
1158
YY_RULE_SETUP
1159
#line 153 "scan.l"
1160
return DECR;
1161
	YY_BREAK
1162
case 47:
1163
YY_RULE_SETUP
1164
#line 155 "scan.l"
1165
yylval.str = ""; return ASSIGN_OP;
1166
	YY_BREAK
1167
case 48:
1168
YY_RULE_SETUP
1169
#line 156 "scan.l"
1170
yylval.str = "+"; return ASSIGN_OP;
1171
	YY_BREAK
1172
case 49:
1173
YY_RULE_SETUP
1174
#line 157 "scan.l"
1175
yylval.str = "-"; return ASSIGN_OP;
1176
	YY_BREAK
1177
case 50:
1178
YY_RULE_SETUP
1179
#line 158 "scan.l"
1180
yylval.str = "*"; return ASSIGN_OP;
1181
	YY_BREAK
1182
case 51:
1183
YY_RULE_SETUP
1184
#line 159 "scan.l"
1185
yylval.str = "/"; return ASSIGN_OP;
1186
	YY_BREAK
1187
case 52:
1188
YY_RULE_SETUP
1189
#line 160 "scan.l"
1190
yylval.str = "%"; return ASSIGN_OP;
1191
	YY_BREAK
1192
case 53:
1193
YY_RULE_SETUP
1194
#line 161 "scan.l"
1195
yylval.str = "^"; return ASSIGN_OP;
1196
	YY_BREAK
1197
case 54:
1198
YY_RULE_SETUP
1199
#line 163 "scan.l"
1200
return EQUALS;
1201
	YY_BREAK
1202
case 55:
1203
YY_RULE_SETUP
1204
#line 164 "scan.l"
1205
return LESS_EQ;
1206
	YY_BREAK
1207
case 56:
1208
YY_RULE_SETUP
1209
#line 165 "scan.l"
1210
return GREATER_EQ;
1211
	YY_BREAK
1212
case 57:
1213
YY_RULE_SETUP
1214
#line 166 "scan.l"
1215
return UNEQUALS;
1216
	YY_BREAK
1217
case 58:
1218
YY_RULE_SETUP
1219
#line 167 "scan.l"
1220
return LESS;
1221
	YY_BREAK
1222
case 59:
1223
YY_RULE_SETUP
1224
#line 168 "scan.l"
1225
return GREATER;
1226
	YY_BREAK
1227
case 60:
1228
YY_RULE_SETUP
1229
#line 170 "scan.l"
1230
return COMMA;
1231
	YY_BREAK
1232
case 61:
1233
YY_RULE_SETUP
1234
#line 171 "scan.l"
1235
return SEMICOLON;
1236
	YY_BREAK
1237
case 62:
1238
YY_RULE_SETUP
1239
#line 173 "scan.l"
1240
return LPAR;
1241
	YY_BREAK
1242
case 63:
1243
YY_RULE_SETUP
1244
#line 174 "scan.l"
1245
return RPAR;
1246
	YY_BREAK
1247
case 64:
1248
YY_RULE_SETUP
1249
#line 176 "scan.l"
1250
return LBRACKET;
1251
	YY_BREAK
1252
case 65:
1253
YY_RULE_SETUP
1254
#line 177 "scan.l"
1255
return RBRACKET;
1256
	YY_BREAK
1257
case 66:
1258
YY_RULE_SETUP
1259
#line 179 "scan.l"
1260
return LBRACE;
1261
	YY_BREAK
1262
case 67:
1263
YY_RULE_SETUP
1264
#line 180 "scan.l"
1265
return RBRACE;
1266
	YY_BREAK
1267
case 68:
1268
YY_RULE_SETUP
1269
#line 182 "scan.l"
1270
{
1271
			/* alloc an extra byte for the type marker */
1272
			char *p = malloc(yyleng + 2);
1273
			if (p == NULL)
1274
				err(1, NULL);
1275
			strlcpy(p, yytext, yyleng + 1);
1276
			yylval.astr = p;
1277
			return LETTER;
1278
		}
1279
	YY_BREAK
1280
case 69:
1281
/* rule 69 can match eol */
1282
YY_RULE_SETUP
1283
#line 192 "scan.l"
1284
lineno++;
1285
	YY_BREAK
1286
case 70:
1287
/* rule 70 can match eol */
1288
YY_RULE_SETUP
1289
#line 193 "scan.l"
1290
lineno++; return NEWLINE;
1291
	YY_BREAK
1292
case 71:
1293
YY_RULE_SETUP
1294
#line 195 "scan.l"
1295
;
1296
	YY_BREAK
1297
case 72:
1298
YY_RULE_SETUP
1299
#line 196 "scan.l"
1300
;
1301
	YY_BREAK
1302
case YY_STATE_EOF(INITIAL):
1303
case YY_STATE_EOF(number):
1304
#line 197 "scan.l"
1305
return QUIT;
1306
	YY_BREAK
1307
case 73:
1308
YY_RULE_SETUP
1309
#line 198 "scan.l"
1310
yyerror("illegal character");
1311
	YY_BREAK
1312
case 74:
1313
YY_RULE_SETUP
1314
#line 200 "scan.l"
1315
ECHO;
1316
	YY_BREAK
1317
#line 1318 "scan.c"
1318
1319
	case YY_END_OF_BUFFER:
1320
		{
1321
		/* Amount of text matched not including the EOB char. */
1322
7189
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1323
1324
		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1325
7189
		*yy_cp = (yy_hold_char);
1326
		YY_RESTORE_YY_MORE_OFFSET
1327
1328
7189
		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1329
			{
1330
			/* We're scanning a new file or input source.  It's
1331
			 * possible that this happened because the user
1332
			 * just pointed yyin at a new source and called
1333
			 * yylex().  If so, then we have to assure
1334
			 * consistency between YY_CURRENT_BUFFER and our
1335
			 * globals.  Here is the right place to do so, because
1336
			 * this is the first action (other than possibly a
1337
			 * back-up) that will match for the new input source.
1338
			 */
1339
126
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1340
126
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1341
126
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1342
126
			}
1343
1344
		/* Note that here we test for yy_c_buf_p "<=" to the position
1345
		 * of the first EOB in the buffer, since yy_c_buf_p will
1346
		 * already have been incremented past the NUL character
1347
		 * (since all states make transitions on EOB to the
1348
		 * end-of-buffer state).  Contrast this with the test
1349
		 * in input().
1350
		 */
1351
7189
		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1352
			{ /* This was really a NUL. */
1353
			yy_state_type yy_next_state;
1354
1355
			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1356
1357
			yy_current_state = yy_get_previous_state(  );
1358
1359
			/* Okay, we're now positioned to make the NUL
1360
			 * transition.  We couldn't have
1361
			 * yy_get_previous_state() go ahead and do it
1362
			 * for us because it doesn't know how to deal
1363
			 * with the possibility of jamming (and we don't
1364
			 * want to build jamming into it because then it
1365
			 * will run more slowly).
1366
			 */
1367
1368
			yy_next_state = yy_try_NUL_trans( yy_current_state );
1369
1370
			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1371
1372
			if ( yy_next_state )
1373
				{
1374
				/* Consume the NUL. */
1375
				yy_cp = ++(yy_c_buf_p);
1376
				yy_current_state = yy_next_state;
1377
				goto yy_match;
1378
				}
1379
1380
			else
1381
				{
1382
				yy_cp = (yy_c_buf_p);
1383
				goto yy_find_action;
1384
				}
1385
			}
1386
1387

7189
		else switch ( yy_get_next_buffer(  ) )
1388
			{
1389
			case EOB_ACT_END_OF_FILE:
1390
				{
1391
126
				(yy_did_buffer_switch_on_eof) = 0;
1392
1393
126
				if ( yywrap( ) )
1394
					{
1395
					/* Note: because we've taken care in
1396
					 * yy_get_next_buffer() to have set up
1397
					 * yytext, we can now set up
1398
					 * yy_c_buf_p so that if some total
1399
					 * hoser (like flex itself) wants to
1400
					 * call the scanner after we return the
1401
					 * YY_NULL, it'll still work - another
1402
					 * YY_NULL will get returned.
1403
					 */
1404
126
					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1405
1406
126
					yy_act = YY_STATE_EOF(YY_START);
1407
126
					goto do_action;
1408
					}
1409
1410
				else
1411
					{
1412
					if ( ! (yy_did_buffer_switch_on_eof) )
1413
						YY_NEW_FILE;
1414
					}
1415
				break;
1416
				}
1417
1418
			case EOB_ACT_CONTINUE_SCAN:
1419
7063
				(yy_c_buf_p) =
1420
7063
					(yytext_ptr) + yy_amount_of_matched_text;
1421
1422
7063
				yy_current_state = yy_get_previous_state(  );
1423
1424
7063
				yy_cp = (yy_c_buf_p);
1425
7063
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1426
7063
				goto yy_match;
1427
1428
			case EOB_ACT_LAST_MATCH:
1429
				(yy_c_buf_p) =
1430
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1431
1432
				yy_current_state = yy_get_previous_state(  );
1433
1434
				yy_cp = (yy_c_buf_p);
1435
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1436
				goto yy_find_action;
1437
			}
1438
		break;
1439
		}
1440
1441
	default:
1442
		YY_FATAL_ERROR(
1443
			"fatal flex scanner internal error--no action found" );
1444
	} /* end of action switch */
1445
		} /* end of scanning one token */
1446
	} /* end of user's declarations */
1447
30079
} /* end of yylex */
1448
1449
/* yy_get_next_buffer - try to read in a new buffer
1450
 *
1451
 * Returns a code representing an action:
1452
 *	EOB_ACT_LAST_MATCH -
1453
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1454
 *	EOB_ACT_END_OF_FILE - end of file
1455
 */
1456
static int yy_get_next_buffer (void)
1457
{
1458
14378
    	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1459
7189
	char *source = (yytext_ptr);
1460
	int number_to_move, i;
1461
	int ret_val;
1462
1463
7189
	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1464
		YY_FATAL_ERROR(
1465
		"fatal flex scanner internal error--end of buffer missed" );
1466
1467
7189
	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1468
		{ /* Don't try to fill the buffer, so this is an EOF. */
1469
		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1470
			{
1471
			/* We matched a single character, the EOB, so
1472
			 * treat this as a final EOF.
1473
			 */
1474
			return EOB_ACT_END_OF_FILE;
1475
			}
1476
1477
		else
1478
			{
1479
			/* We matched some text prior to the EOB, first
1480
			 * process it.
1481
			 */
1482
			return EOB_ACT_LAST_MATCH;
1483
			}
1484
		}
1485
1486
	/* Try to read more data. */
1487
1488
	/* First move last chars to start of buffer. */
1489
7189
	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1490
1491
14378
	for ( i = 0; i < number_to_move; ++i )
1492
		*(dest++) = *(source++);
1493
1494
7189
	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1495
		/* don't do the read, it's not guaranteed to return an EOF,
1496
		 * just force an EOF
1497
		 */
1498
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1499
1500
	else
1501
		{
1502
			yy_size_t num_to_read =
1503
7189
			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1504
1505
14378
		while ( num_to_read <= 0 )
1506
			{ /* Not enough room in the buffer - grow it. */
1507
1508
			/* just a shorter name for the current buffer */
1509
			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1510
1511
			int yy_c_buf_p_offset =
1512
				(int) ((yy_c_buf_p) - b->yy_ch_buf);
1513
1514
			if ( b->yy_is_our_buffer )
1515
				{
1516
				yy_size_t new_size = b->yy_buf_size * 2;
1517
1518
				if ( new_size <= 0 )
1519
					b->yy_buf_size += b->yy_buf_size / 8;
1520
				else
1521
					b->yy_buf_size *= 2;
1522
1523
				b->yy_ch_buf = (char *)
1524
					/* Include room in for 2 EOB chars. */
1525
					yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
1526
				}
1527
			else
1528
				/* Can't grow it, we don't own it. */
1529
				b->yy_ch_buf = 0;
1530
1531
			if ( ! b->yy_ch_buf )
1532
				YY_FATAL_ERROR(
1533
				"fatal error - scanner input buffer overflow" );
1534
1535
			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1536
1537
			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1538
						number_to_move - 1;
1539
1540
			}
1541
1542
7189
		if ( num_to_read > YY_READ_BUF_SIZE )
1543
7189
			num_to_read = YY_READ_BUF_SIZE;
1544
1545
		/* Read in more data. */
1546
7189
		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1547
			(yy_n_chars), num_to_read );
1548
1549
7189
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1550
		}
1551
1552
7189
	if ( (yy_n_chars) == 0 )
1553
		{
1554
126
		if ( number_to_move == YY_MORE_ADJ )
1555
			{
1556
			ret_val = EOB_ACT_END_OF_FILE;
1557
126
			yyrestart(yyin  );
1558
126
			}
1559
1560
		else
1561
			{
1562
			ret_val = EOB_ACT_LAST_MATCH;
1563
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1564
				YY_BUFFER_EOF_PENDING;
1565
			}
1566
		}
1567
1568
	else
1569
		ret_val = EOB_ACT_CONTINUE_SCAN;
1570
1571
7189
	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1572
		/* Extend the array by 50%, plus the number we really need. */
1573
		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1574
		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
1575
		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1576
			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1577
		/* "- 2" to take care of EOB's */
1578
		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1579
	}
1580
1581
7189
	(yy_n_chars) += number_to_move;
1582
7189
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1583
7189
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1584
1585
7189
	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1586
1587
7189
	return ret_val;
1588
7189
}
1589
1590
/* yy_get_previous_state - get the state just before the EOB char was reached */
1591
1592
    static yy_state_type yy_get_previous_state (void)
1593
{
1594
	yy_state_type yy_current_state;
1595
	char *yy_cp;
1596
1597
14126
	yy_current_state = (yy_start);
1598
1599
14126
	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1600
		{
1601
		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1602
		if ( yy_accept[yy_current_state] )
1603
			{
1604
			(yy_last_accepting_state) = yy_current_state;
1605
			(yy_last_accepting_cpos) = yy_cp;
1606
			}
1607
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1608
			{
1609
			yy_current_state = (int) yy_def[yy_current_state];
1610
			if ( yy_current_state >= 156 )
1611
				yy_c = yy_meta[(unsigned int) yy_c];
1612
			}
1613
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1614
		}
1615
1616
7063
	return yy_current_state;
1617
}
1618
1619
/* yy_try_NUL_trans - try to make a transition on the NUL character
1620
 *
1621
 * synopsis
1622
 *	next_state = yy_try_NUL_trans( current_state );
1623
 */
1624
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1625
{
1626
	int yy_is_jam;
1627
    	char *yy_cp = (yy_c_buf_p);
1628
1629
	YY_CHAR yy_c = 1;
1630
	if ( yy_accept[yy_current_state] )
1631
		{
1632
		(yy_last_accepting_state) = yy_current_state;
1633
		(yy_last_accepting_cpos) = yy_cp;
1634
		}
1635
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1636
		{
1637
		yy_current_state = (int) yy_def[yy_current_state];
1638
		if ( yy_current_state >= 156 )
1639
			yy_c = yy_meta[(unsigned int) yy_c];
1640
		}
1641
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1642
	yy_is_jam = (yy_current_state == 155);
1643
1644
		return yy_is_jam ? 0 : yy_current_state;
1645
}
1646
1647
    static void yyunput (int c, char * yy_bp )
1648
{
1649
	char *yy_cp;
1650
1651
7728
    yy_cp = (yy_c_buf_p);
1652
1653
	/* undo effects of setting up yytext */
1654
3864
	*yy_cp = (yy_hold_char);
1655
1656
3864
	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1657
		{ /* need to shift things up to make room */
1658
		/* +2 for EOB chars. */
1659
		yy_size_t number_to_move = (yy_n_chars) + 2;
1660
		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1661
					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1662
		char *source =
1663
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1664
1665
		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1666
			*--dest = *--source;
1667
1668
		yy_cp += (int) (dest - source);
1669
		yy_bp += (int) (dest - source);
1670
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1671
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1672
1673
		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1674
			YY_FATAL_ERROR( "flex scanner push-back overflow" );
1675
		}
1676
1677
3864
	*--yy_cp = (char) c;
1678
1679
3864
	(yytext_ptr) = yy_bp;
1680
3864
	(yy_hold_char) = *yy_cp;
1681
3864
	(yy_c_buf_p) = yy_cp;
1682
3864
}
1683
1684
#ifndef YY_NO_INPUT
1685
#ifdef __cplusplus
1686
    static int yyinput (void)
1687
#else
1688
    static int input  (void)
1689
#endif
1690
1691
{
1692
	int c;
1693
1694
	*(yy_c_buf_p) = (yy_hold_char);
1695
1696
	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1697
		{
1698
		/* yy_c_buf_p now points to the character we want to return.
1699
		 * If this occurs *before* the EOB characters, then it's a
1700
		 * valid NUL; if not, then we've hit the end of the buffer.
1701
		 */
1702
		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1703
			/* This was really a NUL. */
1704
			*(yy_c_buf_p) = '\0';
1705
1706
		else
1707
			{ /* need more input */
1708
			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1709
			++(yy_c_buf_p);
1710
1711
			switch ( yy_get_next_buffer(  ) )
1712
				{
1713
				case EOB_ACT_LAST_MATCH:
1714
					/* This happens because yy_g_n_b()
1715
					 * sees that we've accumulated a
1716
					 * token and flags that we need to
1717
					 * try matching the token before
1718
					 * proceeding.  But for input(),
1719
					 * there's no matching to consider.
1720
					 * So convert the EOB_ACT_LAST_MATCH
1721
					 * to EOB_ACT_END_OF_FILE.
1722
					 */
1723
1724
					/* Reset buffer status. */
1725
					yyrestart(yyin );
1726
1727
					/*FALLTHROUGH*/
1728
1729
				case EOB_ACT_END_OF_FILE:
1730
					{
1731
					if ( yywrap( ) )
1732
						return EOF;
1733
1734
					if ( ! (yy_did_buffer_switch_on_eof) )
1735
						YY_NEW_FILE;
1736
#ifdef __cplusplus
1737
					return yyinput();
1738
#else
1739
					return input();
1740
#endif
1741
					}
1742
1743
				case EOB_ACT_CONTINUE_SCAN:
1744
					(yy_c_buf_p) = (yytext_ptr) + offset;
1745
					break;
1746
				}
1747
			}
1748
		}
1749
1750
	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
1751
	*(yy_c_buf_p) = '\0';	/* preserve yytext */
1752
	(yy_hold_char) = *++(yy_c_buf_p);
1753
1754
	return c;
1755
}
1756
#endif	/* ifndef YY_NO_INPUT */
1757
1758
/** Immediately switch to a different input stream.
1759
 * @param input_file A readable stream.
1760
 *
1761
 * @note This function does not reset the start condition to @c INITIAL .
1762
 */
1763
    void yyrestart  (FILE * input_file )
1764
{
1765
1766

378
	if ( ! YY_CURRENT_BUFFER ){
1767
        yyensure_buffer_stack ();
1768
		YY_CURRENT_BUFFER_LVALUE =
1769
            yy_create_buffer(yyin,YY_BUF_SIZE );
1770
	}
1771
1772
378
	yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1773
126
	yy_load_buffer_state( );
1774
126
}
1775
1776
/** Switch to a different input buffer.
1777
 * @param new_buffer The new input buffer.
1778
 *
1779
 */
1780
    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1781
{
1782
1783
	/* TODO. We should be able to replace this entire function body
1784
	 * with
1785
	 *		yypop_buffer_state();
1786
	 *		yypush_buffer_state(new_buffer);
1787
     */
1788
	yyensure_buffer_stack ();
1789
	if ( YY_CURRENT_BUFFER == new_buffer )
1790
		return;
1791
1792
	if ( YY_CURRENT_BUFFER )
1793
		{
1794
		/* Flush out information for old buffer. */
1795
		*(yy_c_buf_p) = (yy_hold_char);
1796
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1797
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1798
		}
1799
1800
	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1801
	yy_load_buffer_state( );
1802
1803
	/* We don't actually know whether we did this switch during
1804
	 * EOF (yywrap()) processing, but the only time this flag
1805
	 * is looked at is after yywrap() is called, so it's safe
1806
	 * to go ahead and always set it.
1807
	 */
1808
	(yy_did_buffer_switch_on_eof) = 1;
1809
}
1810
1811
static void yy_load_buffer_state  (void)
1812
{
1813
756
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1814
378
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1815
378
	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1816
378
	(yy_hold_char) = *(yy_c_buf_p);
1817
378
}
1818
1819
/** Allocate and initialize an input buffer state.
1820
 * @param file A readable stream.
1821
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1822
 *
1823
 * @return the allocated buffer state.
1824
 */
1825
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1826
{
1827
	YY_BUFFER_STATE b;
1828
1829
252
	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
1830
126
	if ( ! b )
1831
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1832
1833
126
	b->yy_buf_size = size;
1834
1835
	/* yy_ch_buf has to be 2 characters longer than the size given because
1836
	 * we need to put in 2 end-of-buffer characters.
1837
	 */
1838
126
	b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
1839
126
	if ( ! b->yy_ch_buf )
1840
		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1841
1842
126
	b->yy_is_our_buffer = 1;
1843
1844
126
	yy_init_buffer(b,file );
1845
1846
126
	return b;
1847
}
1848
1849
/** Destroy the buffer.
1850
 * @param b a buffer created with yy_create_buffer()
1851
 *
1852
 */
1853
    void yy_delete_buffer (YY_BUFFER_STATE  b )
1854
{
1855
1856
	if ( ! b )
1857
		return;
1858
1859
	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1860
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1861
1862
	if ( b->yy_is_our_buffer )
1863
		yyfree((void *) b->yy_ch_buf  );
1864
1865
	yyfree((void *) b  );
1866
}
1867
1868
/* Initializes or reinitializes a buffer.
1869
 * This function is sometimes called more than once on the same buffer,
1870
 * such as during a yyrestart() or at EOF.
1871
 */
1872
    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1873
1874
{
1875
504
	int oerrno = errno;
1876
1877
252
	yy_flush_buffer(b );
1878
1879
252
	b->yy_input_file = file;
1880
252
	b->yy_fill_buffer = 1;
1881
1882
    /* If b is the current buffer, then yy_init_buffer was _probably_
1883
     * called from yyrestart() or through yy_get_next_buffer.
1884
     * In that case, we don't want to reset the lineno or column.
1885
     */
1886

756
    if (b != YY_CURRENT_BUFFER){
1887
126
        b->yy_bs_lineno = 1;
1888
126
        b->yy_bs_column = 0;
1889
126
    }
1890
1891
252
	b->yy_is_interactive = 1;
1892
1893
252
	errno = oerrno;
1894
252
}
1895
1896
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1897
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1898
 *
1899
 */
1900
    void yy_flush_buffer (YY_BUFFER_STATE  b )
1901
{
1902
504
    	if ( ! b )
1903
		return;
1904
1905
252
	b->yy_n_chars = 0;
1906
1907
	/* We always need two end-of-buffer characters.  The first causes
1908
	 * a transition to the end-of-buffer state.  The second causes
1909
	 * a jam in that state.
1910
	 */
1911
252
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1912
252
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1913
1914
252
	b->yy_buf_pos = &b->yy_ch_buf[0];
1915
1916
252
	b->yy_at_bol = 1;
1917
252
	b->yy_buffer_status = YY_BUFFER_NEW;
1918
1919

756
	if ( b == YY_CURRENT_BUFFER )
1920
126
		yy_load_buffer_state( );
1921
252
}
1922
1923
/** Pushes the new state onto the stack. The new state becomes
1924
 *  the current state. This function will allocate the stack
1925
 *  if necessary.
1926
 *  @param new_buffer The new state.
1927
 *
1928
 */
1929
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1930
{
1931
    	if (new_buffer == NULL)
1932
		return;
1933
1934
	yyensure_buffer_stack();
1935
1936
	/* This block is copied from yy_switch_to_buffer. */
1937
	if ( YY_CURRENT_BUFFER )
1938
		{
1939
		/* Flush out information for old buffer. */
1940
		*(yy_c_buf_p) = (yy_hold_char);
1941
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1942
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1943
		}
1944
1945
	/* Only push if top exists. Otherwise, replace top. */
1946
	if (YY_CURRENT_BUFFER)
1947
		(yy_buffer_stack_top)++;
1948
	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1949
1950
	/* copied from yy_switch_to_buffer. */
1951
	yy_load_buffer_state( );
1952
	(yy_did_buffer_switch_on_eof) = 1;
1953
}
1954
1955
/** Removes and deletes the top of the stack, if present.
1956
 *  The next element becomes the new top.
1957
 *
1958
 */
1959
void yypop_buffer_state (void)
1960
{
1961
    	if (!YY_CURRENT_BUFFER)
1962
		return;
1963
1964
	yy_delete_buffer(YY_CURRENT_BUFFER );
1965
	YY_CURRENT_BUFFER_LVALUE = NULL;
1966
	if ((yy_buffer_stack_top) > 0)
1967
		--(yy_buffer_stack_top);
1968
1969
	if (YY_CURRENT_BUFFER) {
1970
		yy_load_buffer_state( );
1971
		(yy_did_buffer_switch_on_eof) = 1;
1972
	}
1973
}
1974
1975
/* Allocates the stack if it does not exist.
1976
 *  Guarantees space for at least one push.
1977
 */
1978
static void yyensure_buffer_stack (void)
1979
{
1980
	yy_size_t num_to_alloc;
1981
1982
252
	if (!(yy_buffer_stack)) {
1983
1984
		/* First allocation is just for 2 elements, since we don't know if this
1985
		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1986
		 * immediate realloc on the next call.
1987
         */
1988
		num_to_alloc = 1;
1989
126
		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1990
								(num_to_alloc * sizeof(struct yy_buffer_state*)
1991
								);
1992
126
		if ( ! (yy_buffer_stack) )
1993
			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1994
1995
126
		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1996
1997
126
		(yy_buffer_stack_max) = num_to_alloc;
1998
126
		(yy_buffer_stack_top) = 0;
1999
126
		return;
2000
	}
2001
2002
	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2003
2004
		/* Increase the buffer to prepare for a possible push. */
2005
		int grow_size = 8 /* arbitrary grow size */;
2006
2007
		num_to_alloc = (yy_buffer_stack_max) + grow_size;
2008
		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2009
								((yy_buffer_stack),
2010
								num_to_alloc * sizeof(struct yy_buffer_state*)
2011
								);
2012
		if ( ! (yy_buffer_stack) )
2013
			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2014
2015
		/* zero only the new slots.*/
2016
		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2017
		(yy_buffer_stack_max) = num_to_alloc;
2018
	}
2019
126
}
2020
2021
/** Setup the input buffer state to scan directly from a user-specified character buffer.
2022
 * @param base the character buffer
2023
 * @param size the size in bytes of the character buffer
2024
 *
2025
 * @return the newly allocated buffer state object.
2026
 */
2027
YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
2028
{
2029
	YY_BUFFER_STATE b;
2030
2031
	if ( size < 2 ||
2032
	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2033
	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2034
		/* They forgot to leave room for the EOB's. */
2035
		return 0;
2036
2037
	b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
2038
	if ( ! b )
2039
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2040
2041
	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
2042
	b->yy_buf_pos = b->yy_ch_buf = base;
2043
	b->yy_is_our_buffer = 0;
2044
	b->yy_input_file = 0;
2045
	b->yy_n_chars = b->yy_buf_size;
2046
	b->yy_is_interactive = 0;
2047
	b->yy_at_bol = 1;
2048
	b->yy_fill_buffer = 0;
2049
	b->yy_buffer_status = YY_BUFFER_NEW;
2050
2051
	yy_switch_to_buffer(b  );
2052
2053
	return b;
2054
}
2055
2056
/** Setup the input buffer state to scan a string. The next call to yylex() will
2057
 * scan from a @e copy of @a str.
2058
 * @param yystr a NUL-terminated string to scan
2059
 *
2060
 * @return the newly allocated buffer state object.
2061
 * @note If you want to scan bytes that may contain NUL values, then use
2062
 *       yy_scan_bytes() instead.
2063
 */
2064
YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
2065
{
2066
2067
	return yy_scan_bytes(yystr,strlen(yystr) );
2068
}
2069
2070
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2071
 * scan from a @e copy of @a bytes.
2072
 * @param yybytes the byte buffer to scan
2073
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2074
 *
2075
 * @return the newly allocated buffer state object.
2076
 */
2077
YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
2078
{
2079
	YY_BUFFER_STATE b;
2080
	char *buf;
2081
	yy_size_t n;
2082
	yy_size_t i;
2083
2084
	/* Get memory for full buffer, including space for trailing EOB's. */
2085
	n = _yybytes_len + 2;
2086
	buf = (char *) yyalloc(n  );
2087
	if ( ! buf )
2088
		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2089
2090
	for ( i = 0; i < _yybytes_len; ++i )
2091
		buf[i] = yybytes[i];
2092
2093
	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2094
2095
	b = yy_scan_buffer(buf,n );
2096
	if ( ! b )
2097
		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2098
2099
	/* It's okay to grow etc. this buffer, and we should throw it
2100
	 * away when we're done.
2101
	 */
2102
	b->yy_is_our_buffer = 1;
2103
2104
	return b;
2105
}
2106
2107
#ifndef YY_EXIT_FAILURE
2108
#define YY_EXIT_FAILURE 2
2109
#endif
2110
2111
static void yy_fatal_error (yyconst char* msg )
2112
{
2113
    	(void) fprintf( stderr, "%s\n", msg );
2114
	exit( YY_EXIT_FAILURE );
2115
}
2116
2117
/* Redefine yyless() so it works in section 3 code. */
2118
2119
#undef yyless
2120
#define yyless(n) \
2121
	do \
2122
		{ \
2123
		/* Undo effects of setting up yytext. */ \
2124
        int yyless_macro_arg = (n); \
2125
        YY_LESS_LINENO(yyless_macro_arg);\
2126
		yytext[yyleng] = (yy_hold_char); \
2127
		(yy_c_buf_p) = yytext + yyless_macro_arg; \
2128
		(yy_hold_char) = *(yy_c_buf_p); \
2129
		*(yy_c_buf_p) = '\0'; \
2130
		yyleng = yyless_macro_arg; \
2131
		} \
2132
	while ( 0 )
2133
2134
/* Accessor  methods (get/set functions) to struct members. */
2135
2136
/** Get the current line number.
2137
 *
2138
 */
2139
int yyget_lineno  (void)
2140
{
2141
2142
    return yylineno;
2143
}
2144
2145
/** Get the input stream.
2146
 *
2147
 */
2148
FILE *yyget_in  (void)
2149
{
2150
        return yyin;
2151
}
2152
2153
/** Get the output stream.
2154
 *
2155
 */
2156
FILE *yyget_out  (void)
2157
{
2158
        return yyout;
2159
}
2160
2161
/** Get the length of the current token.
2162
 *
2163
 */
2164
yy_size_t yyget_leng  (void)
2165
{
2166
        return yyleng;
2167
}
2168
2169
/** Get the current token.
2170
 *
2171
 */
2172
2173
char *yyget_text  (void)
2174
{
2175
        return yytext;
2176
}
2177
2178
/** Set the current line number.
2179
 * @param line_number
2180
 *
2181
 */
2182
void yyset_lineno (int  line_number )
2183
{
2184
2185
    yylineno = line_number;
2186
}
2187
2188
/** Set the input stream. This does not discard the current
2189
 * input buffer.
2190
 * @param in_str A readable stream.
2191
 *
2192
 * @see yy_switch_to_buffer
2193
 */
2194
void yyset_in (FILE *  in_str )
2195
{
2196
        yyin = in_str ;
2197
}
2198
2199
void yyset_out (FILE *  out_str )
2200
{
2201
        yyout = out_str ;
2202
}
2203
2204
int yyget_debug  (void)
2205
{
2206
        return yy_flex_debug;
2207
}
2208
2209
void yyset_debug (int  bdebug )
2210
{
2211
        yy_flex_debug = bdebug ;
2212
}
2213
2214
static int yy_init_globals (void)
2215
{
2216
        /* Initialization is the same as for the non-reentrant scanner.
2217
     * This function is called from yylex_destroy(), so don't allocate here.
2218
     */
2219
2220
    (yy_buffer_stack) = 0;
2221
    (yy_buffer_stack_top) = 0;
2222
    (yy_buffer_stack_max) = 0;
2223
    (yy_c_buf_p) = (char *) 0;
2224
    (yy_init) = 0;
2225
    (yy_start) = 0;
2226
2227
/* Defined in main.c */
2228
#ifdef YY_STDINIT
2229
    yyin = stdin;
2230
    yyout = stdout;
2231
#else
2232
    yyin = (FILE *) 0;
2233
    yyout = (FILE *) 0;
2234
#endif
2235
2236
    /* For future reference: Set errno on error, since we are called by
2237
     * yylex_init()
2238
     */
2239
    return 0;
2240
}
2241
2242
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2243
int yylex_destroy  (void)
2244
{
2245
2246
    /* Pop the buffer stack, destroying each element. */
2247
	while(YY_CURRENT_BUFFER){
2248
		yy_delete_buffer(YY_CURRENT_BUFFER  );
2249
		YY_CURRENT_BUFFER_LVALUE = NULL;
2250
		yypop_buffer_state();
2251
	}
2252
2253
	/* Destroy the stack itself. */
2254
	yyfree((yy_buffer_stack) );
2255
	(yy_buffer_stack) = NULL;
2256
2257
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2258
     * yylex() is called, initialization will occur. */
2259
    yy_init_globals( );
2260
2261
    return 0;
2262
}
2263
2264
/*
2265
 * Internal utility routines.
2266
 */
2267
2268
#ifndef yytext_ptr
2269
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2270
{
2271
	int i;
2272
	for ( i = 0; i < n; ++i )
2273
		s1[i] = s2[i];
2274
}
2275
#endif
2276
2277
#ifdef YY_NEED_STRLEN
2278
static int yy_flex_strlen (yyconst char * s )
2279
{
2280
	int n;
2281
	for ( n = 0; s[n]; ++n )
2282
		;
2283
2284
	return n;
2285
}
2286
#endif
2287
2288
void *yyalloc (yy_size_t  size )
2289
{
2290
756
	return (void *) malloc( size );
2291
}
2292
2293
void *yyrealloc  (void * ptr, yy_size_t  size )
2294
{
2295
	/* The cast to (char *) in the following accommodates both
2296
	 * implementations that use char* generic pointers, and those
2297
	 * that use void* generic pointers.  It works with the latter
2298
	 * because both ANSI C and C++ allow castless assignment from
2299
	 * any pointer type to void*, and deal with argument conversions
2300
	 * as though doing an assignment.
2301
	 */
2302
	return (void *) realloc( (char *) ptr, size );
2303
}
2304
2305
void yyfree (void * ptr )
2306
{
2307
	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
2308
}
2309
2310
#define YYTABLES_NAME "yytables"
2311
2312
#line 200 "scan.l"
2313
2314
2315
2316
static void
2317
init_strbuf(void)
2318
{
2319
	if (strbuf == NULL) {
2320
		strbuf = malloc(strbuf_sz);
2321
		if (strbuf == NULL)
2322
			err(1, NULL);
2323
	}
2324
	strbuf[0] = '\0';
2325
}
2326
2327
static void
2328
add_str(const char *str)
2329
{
2330
	size_t arglen;
2331
2332
	arglen = strlen(str);
2333
2334
	if (strlen(strbuf) + arglen + 1 > strbuf_sz) {
2335
		size_t newsize;
2336
		char *p;
2337
2338
		newsize = strbuf_sz + arglen + 1;
2339
		p = realloc(strbuf, newsize);
2340
		if (p == NULL) {
2341
			free(strbuf);
2342
			err(1, NULL);
2343
		}
2344
		strbuf_sz = newsize;
2345
		strbuf = p;
2346
	}
2347
	strlcat(strbuf, str, strbuf_sz);
2348
}
2349
2350
/* ARGSUSED */
2351
void
2352
abort_line(int sig)
2353
{
2354
	static const char str1[] = "[\n]P\n";
2355
	static const char str2[] = "[^C\n]P\n";
2356
	int save_errno;
2357
	const LineInfo *info;
2358
2359
	save_errno = errno;
2360
	if (use_el) {
2361
		write(STDOUT_FILENO, str2, sizeof(str2) - 1);
2362
		info = el_line(el);
2363
		skipchars = info->lastchar - info->buffer;
2364
	} else
2365
		write(STDOUT_FILENO, str1, sizeof(str1) - 1);
2366
	errno = save_errno;
2367
}
2368
2369
/*
2370
 * Avoid the echo of ^D by the default code of editline and take
2371
 * into account skipchars to make ^D work when the cursor is at start of
2372
 * line after a ^C.
2373
 */
2374
unsigned char
2375
bc_eof(EditLine *e, int ch)
2376
{
2377
	const struct lineinfo *info = el_line(e);
2378
2379
	if (info->buffer + skipchars == info->cursor &&
2380
	    info->cursor == info->lastchar)
2381
		return (CC_EOF);
2382
	else
2383
		return (CC_ERROR);
2384
}
2385
2386
int
2387
yywrap(void)
2388
{
2389
	static int state;
2390
	static YY_BUFFER_STATE buf;
2391
2392
	if (fileindex == 0 && sargc > 0 && strcmp(sargv[0], _PATH_LIBB) == 0) {
2393
		filename = sargv[fileindex++];
2394
		yyin = fopen(filename, "r");
2395
		lineno = 1;
2396
		if (yyin == NULL)
2397
			err(1, "cannot open %s", filename);
2398
		return (0);
2399
	}
2400
	if (state == 0 && cmdexpr[0] != '\0') {
2401
		buf = yy_scan_string(cmdexpr);
2402
		state++;
2403
		lineno = 1;
2404
		filename = "command line";
2405
		return (0);
2406
	} else if (state == 1) {
2407
		yy_delete_buffer(buf);
2408
		free(cmdexpr);
2409
		state++;
2410
	}
2411
	if (yyin != NULL && yyin != stdin)
2412
		fclose(yyin);
2413
	if (fileindex < sargc) {
2414
		filename = sargv[fileindex++];
2415
		yyin = fopen(filename, "r");
2416
		lineno = 1;
2417
		if (yyin == NULL)
2418
			err(1, "cannot open %s", filename);
2419
		return (0);
2420
	} else if (fileindex == sargc) {
2421
		fileindex++;
2422
		yyin = stdin;
2423
		if (interactive) {
2424
			signal(SIGINT, abort_line);
2425
			signal(SIGTSTP, tstpcont);
2426
		}
2427
		lineno = 1;
2428
		filename = "stdin";
2429
		return (0);
2430
	}
2431
	return (1);
2432
}
2433
2434
static int
2435
bc_yyinput(char *buf, int maxlen)
2436
{
2437
	int num;
2438
2439
	if (el != NULL)
2440
		el_get(el, EL_EDITMODE, &use_el);
2441
2442
	if (yyin == stdin && interactive && use_el) {
2443
		const char *bp;
2444
		sigset_t oset, nset;
2445
2446
		if ((bp = el_gets(el, &num)) == NULL || num == 0)
2447
			return (0);
2448
		sigemptyset(&nset);
2449
		sigaddset(&nset, SIGINT);
2450
		sigprocmask(SIG_BLOCK, &nset, &oset);
2451
		if (skipchars < num) {
2452
			bp += skipchars;
2453
			num -= skipchars;
2454
		}
2455
		skipchars = 0;
2456
		sigprocmask(SIG_SETMASK, &oset, NULL);
2457
		if (num > maxlen) {
2458
			el_push(el, (char *)(void *)bp + maxlen);
2459
			num = maxlen;
2460
		}
2461
		memcpy(buf, bp, num);
2462
		history(hist, &he, H_ENTER, bp);
2463
		el_get(el, EL_EDITMODE, &use_el);
2464
	} else {
2465
		int c = '*';
2466
		for (num = 0; num < maxlen &&
2467
		    (c = getc(yyin)) != EOF && c != '\n'; ++num)
2468
			buf[num] = (char) c;
2469
		if (c == '\n')
2470
			buf[num++] = (char) c;
2471
		if (c == EOF && ferror(yyin))
2472
			YY_FATAL_ERROR( "input in flex scanner failed" );
2473
	}
2474
	return (num);
2475
}
2476
2477
2478