Coverage Report

Created: 2026-02-14 07:03

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdbm/tools/lex.c
Line
Count
Source
1
#line 2 "lex.c"
2
3
#line 4 "lex.c"
4
5
#define  YY_INT_ALIGNED short int
6
7
/* A lexical scanner generated by flex */
8
9
#define FLEX_SCANNER
10
#define YY_FLEX_MAJOR_VERSION 2
11
#define YY_FLEX_MINOR_VERSION 6
12
#define YY_FLEX_SUBMINOR_VERSION 4
13
#if YY_FLEX_SUBMINOR_VERSION > 0
14
#define FLEX_BETA
15
#endif
16
17
/* First, we deal with  platform-specific or compiler-specific issues. */
18
19
/* begin standard C headers. */
20
#include <stdio.h>
21
#include <string.h>
22
#include <errno.h>
23
#include <stdlib.h>
24
25
/* end standard C headers. */
26
27
/* flex integer type definitions */
28
29
#ifndef FLEXINT_H
30
#define FLEXINT_H
31
32
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33
34
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35
36
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37
 * if you want the limit (max/min) macros for int types. 
38
 */
39
#ifndef __STDC_LIMIT_MACROS
40
#define __STDC_LIMIT_MACROS 1
41
#endif
42
43
#include <inttypes.h>
44
typedef int8_t flex_int8_t;
45
typedef uint8_t flex_uint8_t;
46
typedef int16_t flex_int16_t;
47
typedef uint16_t flex_uint16_t;
48
typedef int32_t flex_int32_t;
49
typedef uint32_t flex_uint32_t;
50
#else
51
typedef signed char flex_int8_t;
52
typedef short int flex_int16_t;
53
typedef int flex_int32_t;
54
typedef unsigned char flex_uint8_t; 
55
typedef unsigned short int flex_uint16_t;
56
typedef unsigned int flex_uint32_t;
57
58
/* Limits of integral types. */
59
#ifndef INT8_MIN
60
#define INT8_MIN               (-128)
61
#endif
62
#ifndef INT16_MIN
63
#define INT16_MIN              (-32767-1)
64
#endif
65
#ifndef INT32_MIN
66
#define INT32_MIN              (-2147483647-1)
67
#endif
68
#ifndef INT8_MAX
69
#define INT8_MAX               (127)
70
#endif
71
#ifndef INT16_MAX
72
#define INT16_MAX              (32767)
73
#endif
74
#ifndef INT32_MAX
75
#define INT32_MAX              (2147483647)
76
#endif
77
#ifndef UINT8_MAX
78
#define UINT8_MAX              (255U)
79
#endif
80
#ifndef UINT16_MAX
81
#define UINT16_MAX             (65535U)
82
#endif
83
#ifndef UINT32_MAX
84
#define UINT32_MAX             (4294967295U)
85
#endif
86
87
#ifndef SIZE_MAX
88
#define SIZE_MAX               (~(size_t)0)
89
#endif
90
91
#endif /* ! C99 */
92
93
#endif /* ! FLEXINT_H */
94
95
/* begin standard C++ headers. */
96
97
/* TODO: this is always defined, so inline it */
98
#define yyconst const
99
100
#if defined(__GNUC__) && __GNUC__ >= 3
101
#define yynoreturn __attribute__((__noreturn__))
102
#else
103
#define yynoreturn
104
#endif
105
106
/* Returned upon end-of-file. */
107
2.06k
#define YY_NULL 0
108
109
/* Promotes a possibly negative, possibly signed char to an
110
 *   integer in range [0..255] for use as an array index.
111
 */
112
1.48M
#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
113
114
/* Enter a start condition.  This macro really ought to take a parameter,
115
 * but we do it the disgusting crufty way forced on us by the ()-less
116
 * definition of BEGIN.
117
 */
118
110k
#define BEGIN (yy_start) = 1 + 2 *
119
/* Translate the current start state into a value that can be later handed
120
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
121
 * compatibility.
122
 */
123
214k
#define YY_START (((yy_start) - 1) / 2)
124
214k
#define YYSTATE YY_START
125
/* Action number for EOF rule of a given start state. */
126
20.6k
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127
/* Special action meaning "start processing a new file". */
128
0
#define YY_NEW_FILE yyrestart( yyin  )
129
23.4k
#define YY_END_OF_BUFFER_CHAR 0
130
131
/* Size of default input buffer. */
132
#ifndef YY_BUF_SIZE
133
#ifdef __ia64__
134
/* On IA-64, the buffer size is 16k, not 8k.
135
 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
136
 * Ditto for the __ia64__ case accordingly.
137
 */
138
#define YY_BUF_SIZE 32768
139
#else
140
7.59k
#define YY_BUF_SIZE 16384
141
#endif /* __ia64__ */
142
#endif
143
144
/* The state buf must be large enough to hold one state per character in the main buffer.
145
 */
146
2.76k
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
147
148
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
149
#define YY_TYPEDEF_YY_BUFFER_STATE
150
typedef struct yy_buffer_state *YY_BUFFER_STATE;
151
#endif
152
153
#ifndef YY_TYPEDEF_YY_SIZE_T
154
#define YY_TYPEDEF_YY_SIZE_T
155
typedef size_t yy_size_t;
156
#endif
157
158
extern int yyleng;
159
160
extern FILE *yyin, *yyout;
161
162
5.53k
#define EOB_ACT_CONTINUE_SCAN 0
163
4.13k
#define EOB_ACT_END_OF_FILE 1
164
0
#define EOB_ACT_LAST_MATCH 2
165
    
166
    #define YY_LESS_LINENO(n)
167
    #define YY_LINENO_REWIND_TO(ptr)
168
    
169
/* Return all but the first "n" matched characters back to the input stream. */
170
#define yyless(n) \
171
0
  do \
172
0
    { \
173
0
    /* Undo effects of setting up yytext. */ \
174
0
        int yyless_macro_arg = (n); \
175
0
        YY_LESS_LINENO(yyless_macro_arg);\
176
0
    *yy_cp = (yy_hold_char); \
177
0
    YY_RESTORE_YY_MORE_OFFSET \
178
0
    (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
179
0
    YY_DO_BEFORE_ACTION; /* set up yytext again */ \
180
0
    } \
181
0
  while ( 0 )
182
#define unput(c) yyunput( c, (yytext_ptr)  )
183
184
#ifndef YY_STRUCT_YY_BUFFER_STATE
185
#define YY_STRUCT_YY_BUFFER_STATE
186
struct yy_buffer_state
187
  {
188
  FILE *yy_input_file;
189
190
  char *yy_ch_buf;    /* input buffer */
191
  char *yy_buf_pos;   /* current position in input buffer */
192
193
  /* Size of input buffer in bytes, not including room for EOB
194
   * characters.
195
   */
196
  int yy_buf_size;
197
198
  /* Number of characters read into yy_ch_buf, not including EOB
199
   * characters.
200
   */
201
  int yy_n_chars;
202
203
  /* Whether we "own" the buffer - i.e., we know we created it,
204
   * and can realloc() it to grow it, and should free() it to
205
   * delete it.
206
   */
207
  int yy_is_our_buffer;
208
209
  /* Whether this is an "interactive" input source; if so, and
210
   * if we're using stdio for input, then we want to use getc()
211
   * instead of fread(), to make sure we stop fetching input after
212
   * each newline.
213
   */
214
  int yy_is_interactive;
215
216
  /* Whether we're considered to be at the beginning of a line.
217
   * If so, '^' rules will be active on the next match, otherwise
218
   * not.
219
   */
220
  int yy_at_bol;
221
222
    int yy_bs_lineno; /**< The line count. */
223
    int yy_bs_column; /**< The column count. */
224
225
  /* Whether to try to fill the input buffer when we reach the
226
   * end of it.
227
   */
228
  int yy_fill_buffer;
229
230
  int yy_buffer_status;
231
232
11.7k
#define YY_BUFFER_NEW 0
233
4.83k
#define YY_BUFFER_NORMAL 1
234
  /* When an EOF's been seen but there's still some text to process
235
   * then we mark the buffer as YY_EOF_PENDING, to indicate that we
236
   * shouldn't try reading from the input source any more.  We might
237
   * still have a bunch of tokens to match, though, because of
238
   * possible backing-up.
239
   *
240
   * When we actually see the EOF, we change the status to "new"
241
   * (via yyrestart()), so that the user can continue scanning by
242
   * just pointing yyin at a new input file.
243
   */
244
4.83k
#define YY_BUFFER_EOF_PENDING 2
245
246
  };
247
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
248
249
/* Stack of input buffers. */
250
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
251
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
252
static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
253
254
/* We provide macros for accessing buffer states in case in the
255
 * future we want to put the buffer states in a more general
256
 * "scanner state".
257
 *
258
 * Returns the top of the stack, or NULL.
259
 */
260
47.6k
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
261
47.6k
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
262
47.6k
                          : NULL)
263
/* Same as previous macro, but useful when we know that the buffer stack is not
264
 * NULL or when we need an lvalue. For internal use only.
265
 */
266
550k
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
267
268
/* yy_hold_char holds the character lost when yytext is formed. */
269
static char yy_hold_char;
270
static int yy_n_chars;    /* number of characters read into yy_ch_buf */
271
int yyleng;
272
273
/* Points to current character in buffer. */
274
static char *yy_c_buf_p = NULL;
275
static int yy_init = 0;   /* whether we need to initialize */
276
static int yy_start = 0;  /* start state number */
277
278
/* Flag which is used to allow yywrap()'s to do buffer switches
279
 * instead of setting up a fresh yyin.  A bit of a hack ...
280
 */
281
static int yy_did_buffer_switch_on_eof;
282
283
void yyrestart ( FILE *input_file  );
284
void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
285
YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
286
void yy_delete_buffer ( YY_BUFFER_STATE b  );
287
void yy_flush_buffer ( YY_BUFFER_STATE b  );
288
void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
289
void yypop_buffer_state ( void );
290
291
static void yyensure_buffer_stack ( void );
292
static void yy_load_buffer_state ( void );
293
static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
294
#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
295
296
YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
297
YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
298
YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
299
300
void *yyalloc ( yy_size_t  );
301
void *yyrealloc ( void *, yy_size_t  );
302
void yyfree ( void *  );
303
304
#define yy_new_buffer yy_create_buffer
305
#define yy_set_interactive(is_interactive) \
306
  { \
307
  if ( ! YY_CURRENT_BUFFER ){ \
308
        yyensure_buffer_stack (); \
309
    YY_CURRENT_BUFFER_LVALUE =    \
310
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
311
  } \
312
  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
313
  }
314
#define yy_set_bol(at_bol) \
315
  { \
316
  if ( ! YY_CURRENT_BUFFER ){\
317
        yyensure_buffer_stack (); \
318
    YY_CURRENT_BUFFER_LVALUE =    \
319
            yy_create_buffer( yyin, YY_BUF_SIZE ); \
320
  } \
321
  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322
  }
323
219k
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324
325
/* Begin user sect3 */
326
typedef flex_uint8_t YY_CHAR;
327
328
FILE *yyin = NULL, *yyout = NULL;
329
330
typedef int yy_state_type;
331
332
extern int yylineno;
333
int yylineno = 1;
334
335
extern char *yytext;
336
#ifdef yytext_ptr
337
#undef yytext_ptr
338
#endif
339
260k
#define yytext_ptr yytext
340
341
static yy_state_type yy_get_previous_state ( void );
342
static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
343
static int yy_get_next_buffer ( void );
344
static void yynoreturn yy_fatal_error ( const char* msg  );
345
346
/* Done after the current pattern has been matched and before the
347
 * corresponding action - sets up yytext.
348
 */
349
#define YY_DO_BEFORE_ACTION \
350
219k
  (yytext_ptr) = yy_bp; \
351
219k
  yyleng = (int) (yy_cp - yy_bp); \
352
219k
  (yy_hold_char) = *yy_cp; \
353
219k
  *yy_cp = '\0'; \
354
219k
  (yy_c_buf_p) = yy_cp;
355
#define YY_NUM_RULES 46
356
25.5k
#define YY_END_OF_BUFFER 47
357
/* This struct is not used in this scanner,
358
   but its presence is necessary. */
359
struct yy_trans_info
360
  {
361
  flex_int32_t yy_verify;
362
  flex_int32_t yy_nxt;
363
  };
364
static const flex_int16_t yy_acclist[179] =
365
    {   0,
366
       47,   45,   46,    7,   45,   46,   44,   46,    5,   45,
367
       46,    3,   45,   46,    4,   45,   46,    6,   45,   46,
368
        7,   45,   46,    3,   45,   46,   19,   45,   46,   25,
369
       45,   46,   45,   46,   23,   45,   46,   18,   19,   45,
370
       46,   45,   46,   46,   26,   46,   46,   14,   17,   45,
371
       46,   16,   17,   45,   46,   15,   44,   46,   17,   45,
372
       46,   12,   14,   17,   45,   46,   12,   14,   17,   45,
373
       46,   13,   14,   17,   45,   46,   13,   14,   17,   45,
374
       46,   13,   14,   17,   45,   46,   46,   29,   46,   30,
375
       44,   46,   39,   46,   38,   44,   46,   39,   46,   39,
376
377
       46,   39,   46,   46,   44,   46,   41,   46,   46,   46,
378
       42,   44,   46,   43,   46,    7,    3,    2,    6,    7,
379
        3,    3,   19,   25,   20,   18,   19,   24,   26,   28,
380
       27,   14,   16,   11,   14,   14,   12,   14,   13,   14,
381
       13,   14,   13,   14,   29,   36,   35,   34,   33,   32,
382
       31,   41,   40,   42,   43,    3,   22,   21,   11,   14,
383
       10,   14,    8,   13,   14,    9,   13,   14,   37,    3,
384
       10,   14,    3,    3,    3,    1,    2,    1
385
    } ;
386
387
static const flex_int16_t yy_accept[133] =
388
    {   0,
389
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
390
        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
391
        4,    7,    9,   12,   15,   18,   21,   24,   27,   30,
392
       33,   35,   38,   42,   44,   45,   47,   48,   52,   56,
393
       59,   62,   67,   72,   77,   82,   87,   88,   90,   93,
394
       95,   98,  100,  102,  104,  105,  107,  109,  110,  111,
395
      114,  116,  117,  118,  119,  120,  121,  121,  122,  123,
396
      124,  125,  125,  126,  126,  128,  128,  129,  129,  129,
397
      130,  130,  131,  132,  133,  134,  136,  137,  139,  141,
398
      143,  145,  146,  146,  147,  148,  148,  148,  149,  150,
399
400
      151,  152,  152,  153,  153,  154,  154,  155,  156,  156,
401
      156,  157,  158,  159,  161,  163,  166,  169,  170,  170,
402
      171,  173,  173,  174,  174,  175,  175,  176,  178,  178,
403
      179,  179
404
    } ;
405
406
static const YY_CHAR yy_ec[256] =
407
    {   0,
408
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
409
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
410
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
411
        1,    4,    5,    6,    7,    1,    1,    1,    8,    1,
412
        1,    1,    1,    9,   10,    1,    1,   11,   12,   12,
413
       12,   12,   12,   12,   12,   13,   13,    1,   14,    1,
414
        9,    1,   15,    1,   16,   16,   16,   16,   16,   16,
415
       17,   17,   17,   17,   17,   17,   17,   17,   17,   17,
416
       17,   17,   17,   17,   17,   17,   17,   18,   17,   17,
417
        9,   19,    9,    1,   17,    1,   20,   16,   16,   21,
418
419
       22,   23,   17,   17,   24,   17,   17,   25,   17,   26,
420
       27,   28,   17,   17,   17,   29,   17,   17,   17,   18,
421
       17,   17,    9,   30,    9,    1,    1,    1,    1,    1,
422
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
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,    1,    1,    1,    1,    1,
429
430
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
431
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
432
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
433
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
434
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
435
        1,    1,    1,    1,    1
436
    } ;
437
438
static const YY_CHAR yy_meta[31] =
439
    {   0,
440
        1,    2,    3,    2,    1,    2,    1,    1,    2,    4,
441
        4,    4,    4,    2,    1,    4,    4,    4,    1,    4,
442
        4,    4,    4,    4,    4,    4,    4,    4,    4,    5
443
    } ;
444
445
static const flex_int16_t yy_base[157] =
446
    {   0,
447
        0,   29,   36,    0,   64,   65,   66,   70,   89,    0,
448
       75,   78,  117,  118,  124,  125,  126,  130,  285,  412,
449
       30,  412,  412,  281,  412,    0,  138,  144,    0,   84,
450
       68,  412,  169,  146,  116,  412,  273,    0,  137,  412,
451
      412,  140,  142,  188,  218,  136,  412,  158,  412,  412,
452
      412,  160,  164,  272,  159,  162,  412,    0,  177,  412,
453
      412,  169,  271,  412,    0,  190,  196,  202,  158,    0,
454
      197,  196,  412,  269,  248,  268,  412,  183,  203,  412,
455
      263,  412,  412,    0,  206,  179,  257,  217,  241,  235,
456
      190,  212,  228,  412,  412,    0,  232,  412,  412,  412,
457
458
      412,  226,  412,    0,  412,  235,  412,  412,  240,  233,
459
      233,  412,  412,  239,  270,  223,  216,  412,  198,  161,
460
        0,  198,  258,  250,  214,  154,  129,  412,   72,  412,
461
      412,  293,  298,  303,  308,  313,  318,   31,  323,  327,
462
      332,  336,  341,  346,  351,  356,  361,  366,  371,  376,
463
      381,  386,  391,  396,  401,  406
464
    } ;
465
466
static const flex_int16_t yy_def[157] =
467
    {   0,
468
      131,    1,  131,    3,  132,  132,  132,  132,  131,    9,
469
      133,  133,  134,  134,  135,  135,  136,  136,  131,  131,
470
      131,  131,  131,  137,  131,  138,  131,  137,  139,  131,
471
      140,  131,  141,  142,  143,  131,  144,  145,  131,  131,
472
      131,  145,  145,  146,  146,   45,  131,  131,  131,  131,
473
      131,  147,  148,  149,  150,  150,  131,  151,  152,  131,
474
      131,  131,  137,  131,  138,  131,  131,  137,  137,  139,
475
      131,  140,  131,  153,  141,  142,  131,  142,  143,  131,
476
      144,  131,  131,  145,  131,  145,  145,  145,   45,   45,
477
       45,  131,  147,  131,  131,  154,  148,  131,  131,  131,
478
479
      131,  150,  131,  151,  131,  152,  131,  131,  131,  131,
480
      137,  131,  131,  145,  145,   45,   45,  131,  131,  137,
481
      115,  131,  137,  131,  155,  156,  155,  131,  156,  131,
482
        0,  131,  131,  131,  131,  131,  131,  131,  131,  131,
483
      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
484
      131,  131,  131,  131,  131,  131
485
    } ;
486
487
static const flex_int16_t yy_nxt[443] =
488
    {   0,
489
       20,   21,   22,   21,   23,   20,   24,   20,   20,   20,
490
       20,   20,   20,   20,   25,   26,   26,   26,   20,   26,
491
       26,   26,   26,   26,   26,   26,   26,   26,   26,   20,
492
       27,   62,   27,   62,   65,   28,   29,   30,   22,   30,
493
       29,   31,   29,   29,   20,   29,   29,   29,   29,   32,
494
       29,   33,   33,   33,   29,   33,   33,   33,   33,   33,
495
       33,   33,   33,   33,   33,   34,   22,   22,   22,   36,
496
       36,   36,   22,   73,  130,   36,   48,   49,   48,   48,
497
       49,   48,   37,   37,   37,   71,   74,   71,   37,   38,
498
       39,   40,   39,   38,   41,   38,   38,   41,   38,   42,
499
500
       43,   43,   41,   38,   44,   44,   44,   38,   44,   44,
501
       44,   44,   44,   44,   44,   45,   46,   44,   38,   51,
502
       51,   80,   52,   52,   53,   53,   56,   56,   60,   57,
503
       57,  128,   60,   61,   81,   54,   54,   61,   85,   66,
504
       85,   66,   58,   58,   67,   68,   64,   68,   77,   78,
505
       86,   86,   88,   88,   88,   91,  130,   87,   89,   92,
506
       64,   92,   94,   64,  103,   95,   98,  103,   69,   70,
507
       62,   99,   62,   70,   78,   70,   70,  104,   96,  107,
508
      104,  111,  123,   70,  108,   77,   78,   70,   84,  114,
509
      114,   66,   84,   66,   84,   84,   67,  109,   71,  109,
510
511
       71,   73,   84,   68,   64,   68,   84,   85,   80,   85,
512
      117,   78,   89,   92,   74,   92,  128,   84,   84,  124,
513
      110,   81,   84,  122,   84,   84,   69,   88,   88,   88,
514
       94,  103,   84,   95,   98,   64,   84,  107,   89,   99,
515
       90,  109,  108,  109,  104,   89,   96,   84,   70,  114,
516
      114,  126,   70,  126,   70,   70,  119,  116,  120,  125,
517
       64,  125,   70,   89,  110,   83,   70,  115,  115,  115,
518
       77,  113,  115,   64,  101,   83,  115,  115,  115,  115,
519
      121,  121,  121,   64,  131,  121,  131,  131,  131,  121,
520
      121,  121,  121,   35,   35,   35,   35,   35,   47,   47,
521
522
       47,   47,   47,   50,   50,   50,   50,   50,   55,   55,
523
       55,   55,   55,   59,   59,   59,   59,   59,   63,   63,
524
       63,   63,   63,   70,  131,  131,   70,   72,   72,  131,
525
       72,   72,   75,  131,  131,   75,   76,   76,   76,   76,
526
       76,   79,   79,  131,   79,   79,   82,   82,   82,   82,
527
       82,   84,  131,  131,   84,   84,   89,  131,  131,   89,
528
       89,   93,   93,   93,   93,   93,   97,   97,   97,   97,
529
       97,  100,  100,  100,  100,  100,  102,  102,  102,  102,
530
      102,  105,  105,  131,  105,  105,  106,  106,  106,  106,
531
      106,  112,  112,  112,  112,  112,  118,  118,  131,  118,
532
533
      118,  127,  127,  127,  127,  127,  129,  129,  129,  129,
534
      129,   19,  131,  131,  131,  131,  131,  131,  131,  131,
535
      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
536
      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
537
      131,  131
538
    } ;
539
540
static const flex_int16_t yy_chk[443] =
541
    {   0,
542
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
543
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
544
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
545
        2,   21,    2,   21,  138,    2,    3,    3,    3,    3,
546
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
547
        3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
548
        3,    3,    3,    3,    3,    3,    5,    6,    7,    5,
549
        6,    7,    8,   31,  129,    8,   11,   11,   11,   12,
550
       12,   12,    5,    6,    7,   30,   31,   30,    8,    9,
551
        9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
552
553
        9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
554
        9,    9,    9,    9,    9,    9,    9,    9,    9,   13,
555
       14,   35,   13,   14,   13,   14,   15,   16,   17,   15,
556
       16,  127,   18,   17,   35,   13,   14,   18,   39,   27,
557
       39,   27,   15,   16,   27,   28,   28,   28,   34,   34,
558
       42,   42,   43,   43,   43,   46,  126,   42,   46,   48,
559
       69,   48,   52,  120,   55,   52,   53,   56,   28,   33,
560
       62,   53,   62,   33,   34,   33,   33,   55,   52,   59,
561
       56,   69,  120,   33,   59,   78,   78,   33,   44,   86,
562
       86,   66,   44,   66,   44,   44,   66,   67,   71,   67,
563
564
       71,   72,   44,   68,   68,   68,   44,   85,   79,   85,
565
       91,   78,   91,   92,   72,   92,  125,   44,   45,  122,
566
       67,   79,   45,  119,   45,   45,   68,   88,   88,   88,
567
       93,  102,   45,   93,   97,  111,   45,  106,  117,   97,
568
       45,  109,  106,  109,  102,  116,   93,   45,   75,  114,
569
      114,  124,   75,  124,   75,   75,  110,   90,  111,  123,
570
      123,  123,   75,   89,  109,   81,   75,   87,   87,   87,
571
       76,   74,   87,   63,   54,   37,   87,   87,   87,   87,
572
      115,  115,  115,   24,   19,  115,    0,    0,    0,  115,
573
      115,  115,  115,  132,  132,  132,  132,  132,  133,  133,
574
575
      133,  133,  133,  134,  134,  134,  134,  134,  135,  135,
576
      135,  135,  135,  136,  136,  136,  136,  136,  137,  137,
577
      137,  137,  137,  139,    0,    0,  139,  140,  140,    0,
578
      140,  140,  141,    0,    0,  141,  142,  142,  142,  142,
579
      142,  143,  143,    0,  143,  143,  144,  144,  144,  144,
580
      144,  145,    0,    0,  145,  145,  146,    0,    0,  146,
581
      146,  147,  147,  147,  147,  147,  148,  148,  148,  148,
582
      148,  149,  149,  149,  149,  149,  150,  150,  150,  150,
583
      150,  151,  151,    0,  151,  151,  152,  152,  152,  152,
584
      152,  153,  153,  153,  153,  153,  154,  154,    0,  154,
585
586
      154,  155,  155,  155,  155,  155,  156,  156,  156,  156,
587
      156,  131,  131,  131,  131,  131,  131,  131,  131,  131,
588
      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
589
      131,  131,  131,  131,  131,  131,  131,  131,  131,  131,
590
      131,  131
591
    } ;
592
593
extern int yy_flex_debug;
594
int yy_flex_debug = 0;
595
596
static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
597
static char *yy_full_match;
598
static int yy_lp;
599
0
#define REJECT \
600
0
{ \
601
0
*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
602
0
yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
603
0
++(yy_lp); \
604
0
goto find_rule; \
605
0
}
606
607
#define yymore() yymore_used_but_not_detected
608
9.66k
#define YY_MORE_ADJ 0
609
#define YY_RESTORE_YY_MORE_OFFSET
610
char *yytext;
611
#line 1 "lex.l"
612
#line 2 "lex.l"
613
/* This file is part of GDBM, the GNU data base manager.
614
   Copyright (C) 1990-2025 Free Software Foundation, Inc.
615
616
   GDBM is free software; you can redistribute it and/or modify
617
   it under the terms of the GNU General Public License as published by
618
   the Free Software Foundation; either version 3, or (at your option)
619
   any later version.
620
621
   GDBM is distributed in the hope that it will be useful,
622
   but WITHOUT ANY WARRANTY; without even the implied warranty of
623
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
624
   GNU General Public License for more details.
625
626
   You should have received a copy of the GNU General Public License
627
   along with GDBM. If not, see <http://www.gnu.org/licenses/>.    */
628
629
#include "gdbmtool.h"
630
#include "gram.h"
631
632
struct context                /* Input context */
633
{
634
  struct context *parent;     /* Pointer to the parent context */
635
  struct locus locus;         /* Locus */
636
  struct point point;
637
  YY_BUFFER_STATE buf;        /* Buffer */
638
  instream_t input;
639
};
640
641
static struct context *context_tos;
642
643
/* Advance locus to the next line */
644
void
645
advance_line (void)
646
68.9k
{
647
68.9k
  ++context_tos->point.line;
648
68.9k
  context_tos->point.col = 0;
649
68.9k
}
650
651
static int setbeg (void);
652
 
653
#define YY_USER_ACTION              \
654
214k
  do                  \
655
214k
    {                 \
656
214k
      if (setbeg ())             \
657
214k
  {               \
658
214k
    yylloc.beg = context_tos->point;        \
659
214k
    yylloc.beg.col++;           \
660
214k
  }                \
661
214k
      context_tos->point.col += yyleng;         \
662
214k
      yylloc.end = context_tos->point;          \
663
214k
    }                 \
664
214k
  while (0);
665
666
#undef YY_INPUT
667
#define YY_INPUT(buf,result,max_size)                                   \
668
4.83k
  do                  \
669
4.83k
    {                 \
670
4.83k
      if (context_tos)             \
671
4.83k
        result = instream_read (context_tos->input, buf, max_size); \
672
4.83k
      else                \
673
4.83k
  result = 0;             \
674
4.83k
    }                 \
675
4.83k
  while (0);
676
 
677
void string_begin (void);
678
void string_add (const char *s, int l);
679
void string_addc (int c);
680
char *string_end (int empty_null);
681
int unescape (int c);
682
683
struct file_name
684
{
685
  struct file_name *next;
686
  char str[1];
687
};
688
689
static struct file_name *file_head;
690
691
static void
692
file_names_free (void)
693
1
{
694
4.83k
  while (file_head)
695
4.83k
    {
696
4.83k
      struct file_name *next = file_head->next;
697
4.83k
      free (file_head);
698
4.83k
      file_head = next;
699
4.83k
    }
700
1
}
701
 
702
char *
703
file_name_alloc (char const *s)
704
4.83k
{
705
4.83k
  struct file_name *f = emalloc (sizeof (*f) + strlen (s));
706
4.83k
  strcpy (f->str, s);
707
4.83k
  f->next = file_head;
708
4.83k
  if (!file_head)
709
1
    atexit (file_names_free);
710
4.83k
  file_head = f;
711
4.83k
  return f->str;
712
4.83k
}
713
714
int
715
interactive (void)
716
49.6k
{
717
49.6k
  return context_tos && instream_interactive (context_tos->input);
718
49.6k
}
719
720
int
721
input_history_size (void)
722
0
{
723
0
  return context_tos ? instream_history_size (context_tos->input) : 0;
724
0
}
725
726
const char *
727
input_history_get (int n)  
728
0
{
729
0
  return context_tos ? instream_history_get (context_tos->input, n) : NULL;
730
0
}
731
732
const char *
733
input_stream_name (void)
734
0
{
735
0
  return context_tos ? context_tos->input->in_name : "NULL";
736
0
}
737
 
738
static struct context *
739
input_context_lookup (instream_t istr)
740
4.83k
{
741
4.83k
  struct context *cp;
742
743
4.83k
  for (cp = context_tos; cp; cp = cp->parent)
744
0
    if (instream_eq (cp->input, istr))
745
0
      break;
746
4.83k
  return cp;
747
4.83k
}
748
 
749
int
750
input_context_push (instream_t input)
751
4.83k
{
752
4.83k
  struct context *cp;
753
754
4.83k
  cp = input_context_lookup (input);
755
4.83k
  if (cp)
756
0
    {
757
0
      terror (_("recursive sourcing"));
758
0
      if (cp->parent)
759
0
  lerror (&cp->locus, _("%s already sourced here"),
760
0
    instream_name (input));
761
0
      return 1;
762
0
    }
763
764
4.83k
  yy_switch_to_buffer (yy_create_buffer (NULL, YY_BUF_SIZE));
765
766
  /* Create new context */
767
768
4.83k
  cp = ecalloc (1, sizeof (*cp));
769
4.83k
  cp->locus = yylloc;
770
4.83k
  cp->point.file = file_name_alloc (instream_name (input));
771
4.83k
  cp->point.line = 1;
772
4.83k
  cp->point.col = 0;
773
  
774
4.83k
  cp->input = input;
775
4.83k
  cp->buf = YY_CURRENT_BUFFER;
776
4.83k
  cp->parent = context_tos;
777
4.83k
  context_tos = cp;
778
779
4.83k
  return 0;
780
4.83k
}
781
782
void
783
lex_trace (int n)
784
2.76k
{
785
2.76k
  yy_flex_debug = n;
786
2.76k
}
787
    
788
int
789
input_context_pop (void)
790
6.89k
{
791
6.89k
  struct context *cp;
792
793
6.89k
  if (!context_tos)
794
2.06k
    return 1;
795
4.83k
  instream_close (context_tos->input);
796
4.83k
  cp = context_tos->parent;
797
4.83k
  free (context_tos);
798
4.83k
  context_tos = cp;
799
4.83k
  yy_delete_buffer (YY_CURRENT_BUFFER);
800
4.83k
  if (!cp)
801
4.83k
    return 1;
802
  
803
0
  yylloc = cp->locus;
804
0
  yy_switch_to_buffer (cp->buf);
805
806
0
  return 0;
807
4.83k
}
808
809
void
810
input_context_drain (void)
811
4.83k
{
812
4.83k
   while (!input_context_pop ())
813
0
    ;
814
4.83k
}
815
816
static int
817
t_num (int base)
818
0
{
819
0
  long n;
820
0
  errno = 0;
821
0
  n = strtol (yytext, NULL, base);
822
0
  if (errno)
823
0
    {
824
0
      lerror (&yylloc, "%s", strerror (errno));
825
0
      return T_BOGUS;
826
0
    }
827
0
  if (n < INT_MIN || n > INT_MAX)
828
0
    {
829
0
      lerror (&yylloc, "value out of range");
830
0
      return T_BOGUS;
831
0
    }
832
0
  yylval.num = n;
833
0
  return T_NUM;  
834
0
}
835
 
836
#line 837 "lex.c"
837
#define YY_NO_INPUT 1
838
839
#line 840 "lex.c"
840
841
124k
#define INITIAL 0
842
269k
#define CMD 1
843
0
#define STR 2
844
0
#define MLSTR 3
845
214k
#define DEF 4
846
0
#define SHELLWS 5
847
214k
#define SHELL 6
848
0
#define SHSTR 7
849
0
#define SHQ 8
850
851
#ifndef YY_NO_UNISTD_H
852
/* Special case for "unistd.h", since it is non-ANSI. We include it way
853
 * down here because we want the user's section 1 to have been scanned first.
854
 * The user has a chance to override it with an option.
855
 */
856
#include <unistd.h>
857
#endif
858
859
#ifndef YY_EXTRA_TYPE
860
#define YY_EXTRA_TYPE void *
861
#endif
862
863
static int yy_init_globals ( void );
864
865
/* Accessor methods to globals.
866
   These are made visible to non-reentrant scanners for convenience. */
867
868
int yylex_destroy ( void );
869
870
int yyget_debug ( void );
871
872
void yyset_debug ( int debug_flag  );
873
874
YY_EXTRA_TYPE yyget_extra ( void );
875
876
void yyset_extra ( YY_EXTRA_TYPE user_defined  );
877
878
FILE *yyget_in ( void );
879
880
void yyset_in  ( FILE * _in_str  );
881
882
FILE *yyget_out ( void );
883
884
void yyset_out  ( FILE * _out_str  );
885
886
      int yyget_leng ( void );
887
888
char *yyget_text ( void );
889
890
int yyget_lineno ( void );
891
892
void yyset_lineno ( int _line_number  );
893
894
/* Macros after this point can all be overridden by user definitions in
895
 * section 1.
896
 */
897
898
#ifndef YY_SKIP_YYWRAP
899
#ifdef __cplusplus
900
extern "C" int yywrap ( void );
901
#else
902
extern int yywrap ( void );
903
#endif
904
#endif
905
906
#ifndef YY_NO_UNPUT
907
    
908
#endif
909
910
#ifndef yytext_ptr
911
static void yy_flex_strncpy ( char *, const char *, int );
912
#endif
913
914
#ifdef YY_NEED_STRLEN
915
static int yy_flex_strlen ( const char * );
916
#endif
917
918
#ifndef YY_NO_INPUT
919
#ifdef __cplusplus
920
static int yyinput ( void );
921
#else
922
static int input ( void );
923
#endif
924
925
#endif
926
927
/* Amount of stuff to slurp up with each read. */
928
#ifndef YY_READ_BUF_SIZE
929
#ifdef __ia64__
930
/* On IA-64, the buffer size is 16k, not 8k */
931
#define YY_READ_BUF_SIZE 16384
932
#else
933
9.66k
#define YY_READ_BUF_SIZE 8192
934
#endif /* __ia64__ */
935
#endif
936
937
/* Copy whatever the last rule matched to the standard output. */
938
#ifndef ECHO
939
/* This used to be an fputs(), but since the string might contain NUL's,
940
 * we now use fwrite().
941
 */
942
#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
943
#endif
944
945
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
946
 * is returned in "result".
947
 */
948
#ifndef YY_INPUT
949
#define YY_INPUT(buf,result,max_size) \
950
  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
951
    { \
952
    int c = '*'; \
953
    int n; \
954
    for ( n = 0; n < max_size && \
955
           (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
956
      buf[n] = (char) c; \
957
    if ( c == '\n' ) \
958
      buf[n++] = (char) c; \
959
    if ( c == EOF && ferror( yyin ) ) \
960
      YY_FATAL_ERROR( "input in flex scanner failed" ); \
961
    result = n; \
962
    } \
963
  else \
964
    { \
965
    errno=0; \
966
    while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
967
      { \
968
      if( errno != EINTR) \
969
        { \
970
        YY_FATAL_ERROR( "input in flex scanner failed" ); \
971
        break; \
972
        } \
973
      errno=0; \
974
      clearerr(yyin); \
975
      } \
976
    }\
977
\
978
979
#endif
980
981
/* No semi-colon after return; correct usage is to write "yyterminate();" -
982
 * we don't want an extra ';' after the "return" because that will cause
983
 * some compilers to complain about unreachable statements.
984
 */
985
#ifndef yyterminate
986
2.06k
#define yyterminate() return YY_NULL
987
#endif
988
989
/* Number of entries by which start-condition stack grows. */
990
#ifndef YY_START_STACK_INCR
991
#define YY_START_STACK_INCR 25
992
#endif
993
994
/* Report a fatal error. */
995
#ifndef YY_FATAL_ERROR
996
0
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
997
#endif
998
999
/* end tables serialization structures and prototypes */
1000
1001
/* Default declaration of generated scanner - a define so the user can
1002
 * easily add parameters.
1003
 */
1004
#ifndef YY_DECL
1005
#define YY_DECL_IS_OURS 1
1006
1007
extern int yylex (void);
1008
1009
#define YY_DECL int yylex (void)
1010
#endif /* !YY_DECL */
1011
1012
/* Code executed at the beginning of each rule, after yytext and yyleng
1013
 * have been set up.
1014
 */
1015
#ifndef YY_USER_ACTION
1016
#define YY_USER_ACTION
1017
#endif
1018
1019
/* Code executed at the end of each rule. */
1020
#ifndef YY_BREAK
1021
80.6k
#define YY_BREAK /*LINTED*/break;
1022
#endif
1023
1024
#define YY_RULE_SETUP \
1025
214k
  if ( yyleng > 0 ) \
1026
214k
    YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1027
214k
        (yytext[yyleng - 1] == '\n'); \
1028
214k
  YY_USER_ACTION
1029
1030
/** The main scanner function which does all the work.
1031
 */
1032
YY_DECL
1033
135k
{
1034
135k
  yy_state_type yy_current_state;
1035
135k
  char *yy_cp, *yy_bp;
1036
135k
  int yy_act;
1037
    
1038
135k
  if ( !(yy_init) )
1039
2.76k
    {
1040
2.76k
    (yy_init) = 1;
1041
1042
#ifdef YY_USER_INIT
1043
    YY_USER_INIT;
1044
#endif
1045
1046
        /* Create the reject buffer large enough to save one state per allowed character. */
1047
2.76k
        if ( ! (yy_state_buf) )
1048
2.76k
            (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  );
1049
2.76k
            if ( ! (yy_state_buf) )
1050
0
                YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1051
1052
2.76k
    if ( ! (yy_start) )
1053
2.76k
      (yy_start) = 1; /* first start state */
1054
1055
2.76k
    if ( ! yyin )
1056
2.76k
      yyin = stdin;
1057
1058
2.76k
    if ( ! yyout )
1059
2.76k
      yyout = stdout;
1060
1061
2.76k
    if ( ! YY_CURRENT_BUFFER ) {
1062
0
      yyensure_buffer_stack ();
1063
0
      YY_CURRENT_BUFFER_LVALUE =
1064
0
        yy_create_buffer( yyin, YY_BUF_SIZE );
1065
0
    }
1066
1067
2.76k
    yy_load_buffer_state(  );
1068
2.76k
    }
1069
1070
135k
  {
1071
135k
#line 240 "lex.l"
1072
1073
135k
#line 1074 "lex.c"
1074
1075
216k
  while ( /*CONSTCOND*/1 )    /* loops until end-of-file is reached */
1076
216k
    {
1077
216k
    yy_cp = (yy_c_buf_p);
1078
1079
    /* Support of yytext. */
1080
216k
    *yy_cp = (yy_hold_char);
1081
1082
    /* yy_bp points to the position in yy_ch_buf of the start of
1083
     * the current run.
1084
     */
1085
216k
    yy_bp = yy_cp;
1086
1087
216k
    yy_current_state = (yy_start);
1088
216k
    yy_current_state += YY_AT_BOL();
1089
1090
216k
    (yy_state_ptr) = (yy_state_buf);
1091
216k
    *(yy_state_ptr)++ = yy_current_state;
1092
1093
219k
yy_match:
1094
219k
    do
1095
1.48M
      {
1096
1.48M
      YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1097
2.85M
      while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1098
1.37M
        {
1099
1.37M
        yy_current_state = (int) yy_def[yy_current_state];
1100
1.37M
        if ( yy_current_state >= 132 )
1101
1.16M
          yy_c = yy_meta[yy_c];
1102
1.37M
        }
1103
1.48M
      yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1104
1.48M
      *(yy_state_ptr)++ = yy_current_state;
1105
1.48M
      ++yy_cp;
1106
1.48M
      }
1107
1.48M
    while ( yy_base[yy_current_state] != 412 );
1108
1109
219k
yy_find_action:
1110
219k
    yy_current_state = *--(yy_state_ptr);
1111
219k
    (yy_lp) = yy_accept[yy_current_state];
1112
1113
219k
find_rule: /* we branch to this label when backing up */
1114
1115
219k
    for ( ; ; ) /* until we find what rule we matched */
1116
369k
      {
1117
369k
      if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
1118
219k
        {
1119
219k
        yy_act = yy_acclist[(yy_lp)];
1120
219k
          {
1121
219k
          (yy_full_match) = yy_cp;
1122
219k
          break;
1123
219k
          }
1124
219k
        }
1125
150k
      --yy_cp;
1126
150k
      yy_current_state = *--(yy_state_ptr);
1127
150k
      (yy_lp) = yy_accept[yy_current_state];
1128
150k
      }
1129
1130
219k
    YY_DO_BEFORE_ACTION;
1131
1132
221k
do_action:  /* This label is used only to access EOF actions. */
1133
1134
221k
    switch ( yy_act )
1135
221k
  { /* beginning of action switch */
1136
0
case 1:
1137
/* rule 1 can match eol */
1138
0
YY_RULE_SETUP
1139
0
#line 241 "lex.l"
1140
0
{
1141
0
  char *p;
1142
0
  char *file = NULL;
1143
0
  int line, len;
1144
  
1145
0
  for (p = strchr (yytext, '#') + 1; *p == ' ' || *p == '\t'; p++);
1146
0
  p += 4;
1147
0
  for (; *p == ' ' || *p == '\t'; p++);
1148
1149
0
  line = strtol (p, &p, 10);
1150
0
  for (; *p == ' ' || *p == '\t'; p++);
1151
1152
0
  if (*p == '"')
1153
0
    {
1154
0
      p++;
1155
0
      len = strcspn (p, "\"");
1156
0
      if (p[len] == 0)
1157
0
  {
1158
0
    yyerror (_("invalid #line statement"));
1159
0
    REJECT;
1160
0
  }
1161
0
      file = emalloc (len + 1);
1162
0
      memcpy (file, p, len);
1163
0
      file[len] = 0;
1164
0
      for (p += len + 1; *p == ' ' || *p == '\t'; p++);
1165
0
    }
1166
0
  if (*p != '\n' )
1167
0
    {
1168
0
      yyerror (_("invalid #line statement"));
1169
0
      free (file);
1170
0
      REJECT;
1171
0
    }
1172
0
  if (file)
1173
0
    context_tos->point.file = file;
1174
0
  context_tos->point.line = line;
1175
0
  context_tos->point.col = 0;
1176
0
}
1177
0
  YY_BREAK
1178
13.8k
case 2:
1179
/* rule 2 can match eol */
1180
13.8k
YY_RULE_SETUP
1181
13.8k
#line 278 "lex.l"
1182
13.8k
advance_line ();
1183
13.8k
  YY_BREAK
1184
0
case 3:
1185
0
YY_RULE_SETUP
1186
0
#line 279 "lex.l"
1187
0
/* end-of-file comment */;
1188
0
  YY_BREAK
1189
1190
0
case 4:
1191
0
YY_RULE_SETUP
1192
0
#line 282 "lex.l"
1193
0
{ BEGIN (CMD);
1194
0
            return command_lookup ("help", &yylloc, &yylval.cmd); }
1195
0
  YY_BREAK
1196
0
case 5:
1197
0
YY_RULE_SETUP
1198
0
#line 284 "lex.l"
1199
0
{
1200
0
  BEGIN (SHELLWS);
1201
0
  string_begin ();
1202
0
  return command_lookup ("shell", &yylloc, &yylval.cmd); 
1203
0
 }
1204
0
  YY_BREAK
1205
55.1k
case 6:
1206
55.1k
YY_RULE_SETUP
1207
55.1k
#line 289 "lex.l"
1208
55.1k
{
1209
55.1k
  int t;
1210
55.1k
  t = command_lookup (yytext, &yylloc, &yylval.cmd);
1211
55.1k
  if (t == T_SHELL)
1212
0
    BEGIN (SHELLWS);
1213
55.1k
  else
1214
55.1k
    BEGIN (CMD);
1215
55.1k
  return t;
1216
0
 }
1217
0
  YY_BREAK
1218
0
case 7:
1219
0
YY_RULE_SETUP
1220
0
#line 298 "lex.l"
1221
0
; 
1222
0
  YY_BREAK
1223
1224
1225
0
case 8:
1226
0
YY_RULE_SETUP
1227
0
#line 302 "lex.l"
1228
0
{ return T_OFF; }
1229
0
  YY_BREAK
1230
0
case 9:
1231
0
YY_RULE_SETUP
1232
0
#line 303 "lex.l"
1233
0
{ return T_PAD; }
1234
0
  YY_BREAK
1235
0
case 10:
1236
0
YY_RULE_SETUP
1237
0
#line 304 "lex.l"
1238
0
{ return t_num (8); };
1239
0
  YY_BREAK
1240
0
case 11:
1241
0
YY_RULE_SETUP
1242
0
#line 305 "lex.l"
1243
0
{ return t_num (16); };
1244
0
  YY_BREAK
1245
0
case 12:
1246
0
YY_RULE_SETUP
1247
0
#line 306 "lex.l"
1248
0
{ return t_num (10); };
1249
0
  YY_BREAK
1250
0
case 13:
1251
0
YY_RULE_SETUP
1252
0
#line 307 "lex.l"
1253
0
{ if ((yylval.type = datadef_lookup (yytext)))
1254
0
                  return T_TYPE;
1255
0
                else
1256
0
      {
1257
0
        yylval.string = estrdup (yytext);
1258
0
        return T_IDENT;
1259
0
      }
1260
0
              }
1261
0
  YY_BREAK
1262
0
case 14:
1263
0
YY_RULE_SETUP
1264
0
#line 315 "lex.l"
1265
0
{ yylval.string = estrdup (yytext); return T_WORD; }
1266
0
  YY_BREAK
1267
0
case 15:
1268
/* rule 15 can match eol */
1269
0
YY_RULE_SETUP
1270
0
#line 316 "lex.l"
1271
0
{ advance_line (); }
1272
0
  YY_BREAK
1273
0
case 16:
1274
0
YY_RULE_SETUP
1275
0
#line 317 "lex.l"
1276
0
;
1277
0
  YY_BREAK
1278
0
case 17:
1279
0
YY_RULE_SETUP
1280
0
#line 318 "lex.l"
1281
0
return yytext[0]; 
1282
0
  YY_BREAK
1283
1284
1285
11.0k
case 18:
1286
11.0k
YY_RULE_SETUP
1287
11.0k
#line 322 "lex.l"
1288
11.0k
{ yylval.string = estrdup (yytext); return T_IDENT; }
1289
0
  YY_BREAK
1290
12.4k
case 19:
1291
12.4k
YY_RULE_SETUP
1292
12.4k
#line 323 "lex.l"
1293
12.4k
{ yylval.string = estrdup (yytext); return T_WORD; }
1294
0
  YY_BREAK
1295
0
case 20:
1296
0
YY_RULE_SETUP
1297
0
#line 324 "lex.l"
1298
0
{
1299
0
                     yylval.string = emalloc (yyleng - 1);
1300
0
                     memcpy (yylval.string, yytext+1, yyleng-2);
1301
0
         yylval.string[yyleng-2] = 0;
1302
0
         return T_WORD; }
1303
0
  YY_BREAK
1304
0
case 21:
1305
/* rule 21 can match eol */
1306
0
YY_RULE_SETUP
1307
0
#line 329 "lex.l"
1308
0
{
1309
0
                     advance_line ();
1310
0
                     string_begin ();
1311
0
                     string_add (yytext + 1, yyleng - 2);
1312
0
                     BEGIN (MLSTR); }
1313
0
  YY_BREAK
1314
0
case 22:
1315
0
YY_RULE_SETUP
1316
0
#line 334 "lex.l"
1317
0
{
1318
0
                     string_begin ();
1319
0
                     string_add (yytext + 1, yyleng - 3);
1320
0
         string_addc (unescape (yytext[yyleng-1]));
1321
0
                     BEGIN (STR); }
1322
0
  YY_BREAK
1323
0
case 23:
1324
0
YY_RULE_SETUP
1325
0
#line 339 "lex.l"
1326
0
{ BEGIN (INITIAL); return ';'; }
1327
0
  YY_BREAK
1328
0
case 24:
1329
/* rule 24 can match eol */
1330
0
YY_RULE_SETUP
1331
0
#line 340 "lex.l"
1332
0
{
1333
0
  int i, len;
1334
1335
0
  yyless (yyleng - 1);
1336
0
  BEGIN (INITIAL);
1337
1338
0
  for (i = 1; i < yyleng && (yytext[i] == ' ' || yytext[i] == '\t'); i++)
1339
0
    ;
1340
0
  if (i == yyleng)
1341
0
    {
1342
0
      yyerror (_("malformed pipeline"));
1343
0
      return T_BOGUS;
1344
0
    }
1345
0
  len = yyleng - i;
1346
0
  yylval.string = emalloc (len + 1);
1347
0
  memcpy (yylval.string, yytext + i, len);
1348
0
  yylval.string[len] = 0;
1349
1350
0
  return T_PIPELINE;
1351
0
 }
1352
0
  YY_BREAK
1353
66.8k
case 25:
1354
66.8k
YY_RULE_SETUP
1355
66.8k
#line 360 "lex.l"
1356
66.8k
; 
1357
66.8k
  YY_BREAK
1358
1359
1360
0
case 26:
1361
0
YY_RULE_SETUP
1362
0
#line 364 "lex.l"
1363
0
{ if (yyleng > 1)
1364
0
           string_add (yytext, yyleng - 1);
1365
0
         yylval.string = string_end (FALSE);
1366
0
         BEGIN (CMD);
1367
0
         return T_WORD; }
1368
0
  YY_BREAK
1369
0
case 27:
1370
/* rule 27 can match eol */
1371
0
YY_RULE_SETUP
1372
0
#line 369 "lex.l"
1373
0
{ advance_line ();
1374
0
                     string_add (yytext, yyleng - 1); }
1375
0
  YY_BREAK
1376
0
case 28:
1377
0
YY_RULE_SETUP
1378
0
#line 371 "lex.l"
1379
0
{ string_add (yytext, yyleng - 2);
1380
0
                     string_addc (unescape (yytext[yyleng-1])); }
1381
0
  YY_BREAK
1382
1383
1384
0
case 29:
1385
0
YY_RULE_SETUP
1386
0
#line 376 "lex.l"
1387
0
{ BEGIN(SHELL); }
1388
0
  YY_BREAK
1389
0
case 30:
1390
/* rule 30 can match eol */
1391
0
YY_RULE_SETUP
1392
0
#line 377 "lex.l"
1393
0
{
1394
0
    BEGIN (INITIAL);
1395
0
    advance_line ();
1396
0
    return '\n';
1397
0
 }
1398
0
  YY_BREAK
1399
1400
1401
0
case 31:
1402
/* rule 31 can match eol */
1403
0
YY_RULE_SETUP
1404
0
#line 385 "lex.l"
1405
0
{ advance_line (); string_add (yytext, yyleng); }
1406
0
  YY_BREAK
1407
0
case 32:
1408
0
YY_RULE_SETUP
1409
0
#line 386 "lex.l"
1410
0
{ string_add (yytext, yyleng); }
1411
0
  YY_BREAK
1412
0
case 33:
1413
0
YY_RULE_SETUP
1414
0
#line 387 "lex.l"
1415
0
{ string_add (yytext, yyleng); }
1416
0
  YY_BREAK
1417
0
case 34:
1418
/* rule 34 can match eol */
1419
0
YY_RULE_SETUP
1420
0
#line 388 "lex.l"
1421
0
{ advance_line ();
1422
0
               string_add (yytext, yyleng);
1423
0
         BEGIN (SHQ); }
1424
0
  YY_BREAK
1425
0
case 35:
1426
0
YY_RULE_SETUP
1427
0
#line 391 "lex.l"
1428
0
{ string_add (yytext, yyleng); }
1429
0
  YY_BREAK
1430
0
case 36:
1431
/* rule 36 can match eol */
1432
0
YY_RULE_SETUP
1433
0
#line 392 "lex.l"
1434
0
{ advance_line ();
1435
0
                 string_add (yytext, yyleng);
1436
0
           BEGIN (SHSTR); }
1437
0
  YY_BREAK
1438
0
case 37:
1439
0
YY_RULE_SETUP
1440
0
#line 395 "lex.l"
1441
0
{ string_add (yytext, yyleng);
1442
0
                  BEGIN (SHSTR); }
1443
0
  YY_BREAK
1444
0
case 38:
1445
/* rule 38 can match eol */
1446
0
YY_RULE_SETUP
1447
0
#line 397 "lex.l"
1448
0
{
1449
0
    BEGIN (INITIAL);
1450
0
    advance_line ();
1451
0
    yyless (0);
1452
0
    if ((yylval.string = string_end (TRUE)) != NULL)
1453
0
      return T_WORD;    
1454
0
 }
1455
0
  YY_BREAK
1456
0
case 39:
1457
0
YY_RULE_SETUP
1458
0
#line 404 "lex.l"
1459
0
string_addc (yytext[0]);
1460
0
  YY_BREAK
1461
1462
1463
0
case 40:
1464
/* rule 40 can match eol */
1465
0
YY_RULE_SETUP
1466
0
#line 408 "lex.l"
1467
0
{ string_add (yytext, yyleng); }
1468
0
  YY_BREAK
1469
0
case 41:
1470
/* rule 41 can match eol */
1471
0
YY_RULE_SETUP
1472
0
#line 409 "lex.l"
1473
0
{ string_add (yytext, yyleng);
1474
0
              BEGIN (SHELL); }
1475
0
  YY_BREAK
1476
1477
1478
0
case 42:
1479
/* rule 42 can match eol */
1480
0
YY_RULE_SETUP
1481
0
#line 414 "lex.l"
1482
0
{ advance_line ();
1483
0
              string_add (yytext, yyleng); }
1484
0
  YY_BREAK
1485
0
case 43:
1486
0
YY_RULE_SETUP
1487
0
#line 416 "lex.l"
1488
0
{ string_add (yytext, yyleng);
1489
0
              BEGIN (SHELL); } 
1490
0
  YY_BREAK
1491
1492
55.1k
case 44:
1493
/* rule 44 can match eol */
1494
55.1k
YY_RULE_SETUP
1495
55.1k
#line 420 "lex.l"
1496
55.1k
{ BEGIN (INITIAL); advance_line (); return '\n'; }
1497
0
  YY_BREAK
1498
0
case 45:
1499
0
YY_RULE_SETUP
1500
0
#line 422 "lex.l"
1501
0
return yytext[0];
1502
0
  YY_BREAK
1503
0
case 46:
1504
0
YY_RULE_SETUP
1505
0
#line 423 "lex.l"
1506
0
YY_FATAL_ERROR( "flex scanner jammed" );
1507
0
  YY_BREAK
1508
0
#line 1509 "lex.c"
1509
2.06k
      case YY_STATE_EOF(INITIAL):
1510
2.06k
      case YY_STATE_EOF(CMD):
1511
2.06k
      case YY_STATE_EOF(STR):
1512
2.06k
      case YY_STATE_EOF(MLSTR):
1513
2.06k
      case YY_STATE_EOF(DEF):
1514
2.06k
      case YY_STATE_EOF(SHELLWS):
1515
2.06k
      case YY_STATE_EOF(SHELL):
1516
2.06k
      case YY_STATE_EOF(SHSTR):
1517
2.06k
      case YY_STATE_EOF(SHQ):
1518
2.06k
        yyterminate();
1519
1520
4.83k
  case YY_END_OF_BUFFER:
1521
4.83k
    {
1522
    /* Amount of text matched not including the EOB char. */
1523
4.83k
    int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1524
1525
    /* Undo the effects of YY_DO_BEFORE_ACTION. */
1526
4.83k
    *yy_cp = (yy_hold_char);
1527
4.83k
    YY_RESTORE_YY_MORE_OFFSET
1528
1529
4.83k
    if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1530
4.83k
      {
1531
      /* We're scanning a new file or input source.  It's
1532
       * possible that this happened because the user
1533
       * just pointed yyin at a new source and called
1534
       * yylex().  If so, then we have to assure
1535
       * consistency between YY_CURRENT_BUFFER and our
1536
       * globals.  Here is the right place to do so, because
1537
       * this is the first action (other than possibly a
1538
       * back-up) that will match for the new input source.
1539
       */
1540
4.83k
      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1541
4.83k
      YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1542
4.83k
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1543
4.83k
      }
1544
1545
    /* Note that here we test for yy_c_buf_p "<=" to the position
1546
     * of the first EOB in the buffer, since yy_c_buf_p will
1547
     * already have been incremented past the NUL character
1548
     * (since all states make transitions on EOB to the
1549
     * end-of-buffer state).  Contrast this with the test
1550
     * in input().
1551
     */
1552
4.83k
    if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1553
0
      { /* This was really a NUL. */
1554
0
      yy_state_type yy_next_state;
1555
1556
0
      (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1557
1558
0
      yy_current_state = yy_get_previous_state(  );
1559
1560
      /* Okay, we're now positioned to make the NUL
1561
       * transition.  We couldn't have
1562
       * yy_get_previous_state() go ahead and do it
1563
       * for us because it doesn't know how to deal
1564
       * with the possibility of jamming (and we don't
1565
       * want to build jamming into it because then it
1566
       * will run more slowly).
1567
       */
1568
1569
0
      yy_next_state = yy_try_NUL_trans( yy_current_state );
1570
1571
0
      yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1572
1573
0
      if ( yy_next_state )
1574
0
        {
1575
        /* Consume the NUL. */
1576
0
        yy_cp = ++(yy_c_buf_p);
1577
0
        yy_current_state = yy_next_state;
1578
0
        goto yy_match;
1579
0
        }
1580
1581
0
      else
1582
0
        {
1583
0
        yy_cp = (yy_c_buf_p);
1584
0
        goto yy_find_action;
1585
0
        }
1586
0
      }
1587
1588
4.83k
    else switch ( yy_get_next_buffer(  ) )
1589
4.83k
      {
1590
2.06k
      case EOB_ACT_END_OF_FILE:
1591
2.06k
        {
1592
2.06k
        (yy_did_buffer_switch_on_eof) = 0;
1593
1594
2.06k
        if ( yywrap(  ) )
1595
2.06k
          {
1596
          /* Note: because we've taken care in
1597
           * yy_get_next_buffer() to have set up
1598
           * yytext, we can now set up
1599
           * yy_c_buf_p so that if some total
1600
           * hoser (like flex itself) wants to
1601
           * call the scanner after we return the
1602
           * YY_NULL, it'll still work - another
1603
           * YY_NULL will get returned.
1604
           */
1605
2.06k
          (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1606
1607
2.06k
          yy_act = YY_STATE_EOF(YY_START);
1608
2.06k
          goto do_action;
1609
2.06k
          }
1610
1611
0
        else
1612
0
          {
1613
0
          if ( ! (yy_did_buffer_switch_on_eof) )
1614
0
            YY_NEW_FILE;
1615
0
          }
1616
0
        break;
1617
2.06k
        }
1618
1619
2.76k
      case EOB_ACT_CONTINUE_SCAN:
1620
2.76k
        (yy_c_buf_p) =
1621
2.76k
          (yytext_ptr) + yy_amount_of_matched_text;
1622
1623
2.76k
        yy_current_state = yy_get_previous_state(  );
1624
1625
2.76k
        yy_cp = (yy_c_buf_p);
1626
2.76k
        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1627
2.76k
        goto yy_match;
1628
1629
0
      case EOB_ACT_LAST_MATCH:
1630
0
        (yy_c_buf_p) =
1631
0
        &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1632
1633
0
        yy_current_state = yy_get_previous_state(  );
1634
1635
0
        yy_cp = (yy_c_buf_p);
1636
0
        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1637
0
        goto yy_find_action;
1638
4.83k
      }
1639
0
    break;
1640
4.83k
    }
1641
1642
0
  default:
1643
0
    YY_FATAL_ERROR(
1644
221k
      "fatal flex scanner internal error--no action found" );
1645
221k
  } /* end of action switch */
1646
221k
    } /* end of scanning one token */
1647
135k
  } /* end of user's declarations */
1648
135k
} /* end of yylex */
1649
1650
/* yy_get_next_buffer - try to read in a new buffer
1651
 *
1652
 * Returns a code representing an action:
1653
 *  EOB_ACT_LAST_MATCH -
1654
 *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1655
 *  EOB_ACT_END_OF_FILE - end of file
1656
 */
1657
static int yy_get_next_buffer (void)
1658
4.83k
{
1659
4.83k
      char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1660
4.83k
  char *source = (yytext_ptr);
1661
4.83k
  int number_to_move, i;
1662
4.83k
  int ret_val;
1663
1664
4.83k
  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1665
0
    YY_FATAL_ERROR(
1666
4.83k
    "fatal flex scanner internal error--end of buffer missed" );
1667
1668
4.83k
  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1669
0
    { /* Don't try to fill the buffer, so this is an EOF. */
1670
0
    if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1671
0
      {
1672
      /* We matched a single character, the EOB, so
1673
       * treat this as a final EOF.
1674
       */
1675
0
      return EOB_ACT_END_OF_FILE;
1676
0
      }
1677
1678
0
    else
1679
0
      {
1680
      /* We matched some text prior to the EOB, first
1681
       * process it.
1682
       */
1683
0
      return EOB_ACT_LAST_MATCH;
1684
0
      }
1685
0
    }
1686
1687
  /* Try to read more data. */
1688
1689
  /* First move last chars to start of buffer. */
1690
4.83k
  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1691
1692
4.83k
  for ( i = 0; i < number_to_move; ++i )
1693
0
    *(dest++) = *(source++);
1694
1695
4.83k
  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1696
    /* don't do the read, it's not guaranteed to return an EOF,
1697
     * just force an EOF
1698
     */
1699
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1700
1701
4.83k
  else
1702
4.83k
    {
1703
4.83k
      int num_to_read =
1704
4.83k
      YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1705
1706
4.83k
    while ( num_to_read <= 0 )
1707
0
      { /* Not enough room in the buffer - grow it. */
1708
1709
0
      YY_FATAL_ERROR(
1710
0
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1711
1712
0
      }
1713
1714
4.83k
    if ( num_to_read > YY_READ_BUF_SIZE )
1715
4.83k
      num_to_read = YY_READ_BUF_SIZE;
1716
1717
    /* Read in more data. */
1718
4.83k
    YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1719
4.83k
      (yy_n_chars), num_to_read );
1720
1721
4.83k
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1722
4.83k
    }
1723
1724
4.83k
  if ( (yy_n_chars) == 0 )
1725
2.06k
    {
1726
2.06k
    if ( number_to_move == YY_MORE_ADJ )
1727
2.06k
      {
1728
2.06k
      ret_val = EOB_ACT_END_OF_FILE;
1729
2.06k
      yyrestart( yyin  );
1730
2.06k
      }
1731
1732
0
    else
1733
0
      {
1734
0
      ret_val = EOB_ACT_LAST_MATCH;
1735
0
      YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1736
0
        YY_BUFFER_EOF_PENDING;
1737
0
      }
1738
2.06k
    }
1739
1740
2.76k
  else
1741
2.76k
    ret_val = EOB_ACT_CONTINUE_SCAN;
1742
1743
4.83k
  if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1744
    /* Extend the array by 50%, plus the number we really need. */
1745
0
    int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1746
0
    YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1747
0
      (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
1748
0
    if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1749
0
      YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1750
    /* "- 2" to take care of EOB's */
1751
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1752
0
  }
1753
1754
4.83k
  (yy_n_chars) += number_to_move;
1755
4.83k
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1756
4.83k
  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1757
1758
4.83k
  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1759
1760
4.83k
  return ret_val;
1761
4.83k
}
1762
1763
/* yy_get_previous_state - get the state just before the EOB char was reached */
1764
1765
    static yy_state_type yy_get_previous_state (void)
1766
2.76k
{
1767
2.76k
  yy_state_type yy_current_state;
1768
2.76k
  char *yy_cp;
1769
    
1770
2.76k
  yy_current_state = (yy_start);
1771
2.76k
  yy_current_state += YY_AT_BOL();
1772
1773
2.76k
  (yy_state_ptr) = (yy_state_buf);
1774
2.76k
  *(yy_state_ptr)++ = yy_current_state;
1775
1776
2.76k
  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1777
0
    {
1778
0
    YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1779
0
    while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1780
0
      {
1781
0
      yy_current_state = (int) yy_def[yy_current_state];
1782
0
      if ( yy_current_state >= 132 )
1783
0
        yy_c = yy_meta[yy_c];
1784
0
      }
1785
0
    yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1786
0
    *(yy_state_ptr)++ = yy_current_state;
1787
0
    }
1788
1789
2.76k
  return yy_current_state;
1790
2.76k
}
1791
1792
/* yy_try_NUL_trans - try to make a transition on the NUL character
1793
 *
1794
 * synopsis
1795
 *  next_state = yy_try_NUL_trans( current_state );
1796
 */
1797
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1798
0
{
1799
0
  int yy_is_jam;
1800
    
1801
0
  YY_CHAR yy_c = 1;
1802
0
  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1803
0
    {
1804
0
    yy_current_state = (int) yy_def[yy_current_state];
1805
0
    if ( yy_current_state >= 132 )
1806
0
      yy_c = yy_meta[yy_c];
1807
0
    }
1808
0
  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1809
0
  yy_is_jam = (yy_current_state == 131);
1810
0
  if ( ! yy_is_jam )
1811
0
    *(yy_state_ptr)++ = yy_current_state;
1812
1813
0
    return yy_is_jam ? 0 : yy_current_state;
1814
0
}
1815
1816
#ifndef YY_NO_UNPUT
1817
1818
#endif
1819
1820
#ifndef YY_NO_INPUT
1821
#ifdef __cplusplus
1822
    static int yyinput (void)
1823
#else
1824
    static int input  (void)
1825
#endif
1826
1827
{
1828
  int c;
1829
    
1830
  *(yy_c_buf_p) = (yy_hold_char);
1831
1832
  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1833
    {
1834
    /* yy_c_buf_p now points to the character we want to return.
1835
     * If this occurs *before* the EOB characters, then it's a
1836
     * valid NUL; if not, then we've hit the end of the buffer.
1837
     */
1838
    if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1839
      /* This was really a NUL. */
1840
      *(yy_c_buf_p) = '\0';
1841
1842
    else
1843
      { /* need more input */
1844
      int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1845
      ++(yy_c_buf_p);
1846
1847
      switch ( yy_get_next_buffer(  ) )
1848
        {
1849
        case EOB_ACT_LAST_MATCH:
1850
          /* This happens because yy_g_n_b()
1851
           * sees that we've accumulated a
1852
           * token and flags that we need to
1853
           * try matching the token before
1854
           * proceeding.  But for input(),
1855
           * there's no matching to consider.
1856
           * So convert the EOB_ACT_LAST_MATCH
1857
           * to EOB_ACT_END_OF_FILE.
1858
           */
1859
1860
          /* Reset buffer status. */
1861
          yyrestart( yyin );
1862
1863
          /*FALLTHROUGH*/
1864
1865
        case EOB_ACT_END_OF_FILE:
1866
          {
1867
          if ( yywrap(  ) )
1868
            return 0;
1869
1870
          if ( ! (yy_did_buffer_switch_on_eof) )
1871
            YY_NEW_FILE;
1872
#ifdef __cplusplus
1873
          return yyinput();
1874
#else
1875
          return input();
1876
#endif
1877
          }
1878
1879
        case EOB_ACT_CONTINUE_SCAN:
1880
          (yy_c_buf_p) = (yytext_ptr) + offset;
1881
          break;
1882
        }
1883
      }
1884
    }
1885
1886
  c = *(unsigned char *) (yy_c_buf_p);  /* cast for 8-bit char's */
1887
  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1888
  (yy_hold_char) = *++(yy_c_buf_p);
1889
1890
  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1891
1892
  return c;
1893
}
1894
#endif  /* ifndef YY_NO_INPUT */
1895
1896
/** Immediately switch to a different input stream.
1897
 * @param input_file A readable stream.
1898
 * 
1899
 * @note This function does not reset the start condition to @c INITIAL .
1900
 */
1901
    void yyrestart  (FILE * input_file )
1902
2.06k
{
1903
    
1904
2.06k
  if ( ! YY_CURRENT_BUFFER ){
1905
0
        yyensure_buffer_stack ();
1906
0
    YY_CURRENT_BUFFER_LVALUE =
1907
0
            yy_create_buffer( yyin, YY_BUF_SIZE );
1908
0
  }
1909
1910
2.06k
  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1911
2.06k
  yy_load_buffer_state(  );
1912
2.06k
}
1913
1914
/** Switch to a different input buffer.
1915
 * @param new_buffer The new input buffer.
1916
 * 
1917
 */
1918
    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1919
4.83k
{
1920
    
1921
  /* TODO. We should be able to replace this entire function body
1922
   * with
1923
   *    yypop_buffer_state();
1924
   *    yypush_buffer_state(new_buffer);
1925
     */
1926
4.83k
  yyensure_buffer_stack ();
1927
4.83k
  if ( YY_CURRENT_BUFFER == new_buffer )
1928
0
    return;
1929
1930
4.83k
  if ( YY_CURRENT_BUFFER )
1931
0
    {
1932
    /* Flush out information for old buffer. */
1933
0
    *(yy_c_buf_p) = (yy_hold_char);
1934
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1935
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1936
0
    }
1937
1938
4.83k
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1939
4.83k
  yy_load_buffer_state(  );
1940
1941
  /* We don't actually know whether we did this switch during
1942
   * EOF (yywrap()) processing, but the only time this flag
1943
   * is looked at is after yywrap() is called, so it's safe
1944
   * to go ahead and always set it.
1945
   */
1946
4.83k
  (yy_did_buffer_switch_on_eof) = 1;
1947
4.83k
}
1948
1949
static void yy_load_buffer_state  (void)
1950
11.7k
{
1951
11.7k
      (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1952
11.7k
  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1953
11.7k
  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1954
11.7k
  (yy_hold_char) = *(yy_c_buf_p);
1955
11.7k
}
1956
1957
/** Allocate and initialize an input buffer state.
1958
 * @param file A readable stream.
1959
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1960
 * 
1961
 * @return the allocated buffer state.
1962
 */
1963
    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1964
4.83k
{
1965
4.83k
  YY_BUFFER_STATE b;
1966
    
1967
4.83k
  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
1968
4.83k
  if ( ! b )
1969
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1970
1971
4.83k
  b->yy_buf_size = size;
1972
1973
  /* yy_ch_buf has to be 2 characters longer than the size given because
1974
   * we need to put in 2 end-of-buffer characters.
1975
   */
1976
4.83k
  b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
1977
4.83k
  if ( ! b->yy_ch_buf )
1978
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1979
1980
4.83k
  b->yy_is_our_buffer = 1;
1981
1982
4.83k
  yy_init_buffer( b, file );
1983
1984
4.83k
  return b;
1985
4.83k
}
1986
1987
/** Destroy the buffer.
1988
 * @param b a buffer created with yy_create_buffer()
1989
 * 
1990
 */
1991
    void yy_delete_buffer (YY_BUFFER_STATE  b )
1992
4.83k
{
1993
    
1994
4.83k
  if ( ! b )
1995
0
    return;
1996
1997
4.83k
  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1998
4.83k
    YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1999
2000
4.83k
  if ( b->yy_is_our_buffer )
2001
4.83k
    yyfree( (void *) b->yy_ch_buf  );
2002
2003
4.83k
  yyfree( (void *) b  );
2004
4.83k
}
2005
2006
/* Initializes or reinitializes a buffer.
2007
 * This function is sometimes called more than once on the same buffer,
2008
 * such as during a yyrestart() or at EOF.
2009
 */
2010
    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
2011
2012
6.89k
{
2013
6.89k
  int oerrno = errno;
2014
    
2015
6.89k
  yy_flush_buffer( b );
2016
2017
6.89k
  b->yy_input_file = file;
2018
6.89k
  b->yy_fill_buffer = 1;
2019
2020
    /* If b is the current buffer, then yy_init_buffer was _probably_
2021
     * called from yyrestart() or through yy_get_next_buffer.
2022
     * In that case, we don't want to reset the lineno or column.
2023
     */
2024
6.89k
    if (b != YY_CURRENT_BUFFER){
2025
4.83k
        b->yy_bs_lineno = 1;
2026
4.83k
        b->yy_bs_column = 0;
2027
4.83k
    }
2028
2029
6.89k
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2030
    
2031
6.89k
  errno = oerrno;
2032
6.89k
}
2033
2034
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2035
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2036
 * 
2037
 */
2038
    void yy_flush_buffer (YY_BUFFER_STATE  b )
2039
6.89k
{
2040
6.89k
      if ( ! b )
2041
0
    return;
2042
2043
6.89k
  b->yy_n_chars = 0;
2044
2045
  /* We always need two end-of-buffer characters.  The first causes
2046
   * a transition to the end-of-buffer state.  The second causes
2047
   * a jam in that state.
2048
   */
2049
6.89k
  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2050
6.89k
  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2051
2052
6.89k
  b->yy_buf_pos = &b->yy_ch_buf[0];
2053
2054
6.89k
  b->yy_at_bol = 1;
2055
6.89k
  b->yy_buffer_status = YY_BUFFER_NEW;
2056
2057
6.89k
  if ( b == YY_CURRENT_BUFFER )
2058
2.06k
    yy_load_buffer_state(  );
2059
6.89k
}
2060
2061
/** Pushes the new state onto the stack. The new state becomes
2062
 *  the current state. This function will allocate the stack
2063
 *  if necessary.
2064
 *  @param new_buffer The new state.
2065
 *  
2066
 */
2067
void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
2068
0
{
2069
0
      if (new_buffer == NULL)
2070
0
    return;
2071
2072
0
  yyensure_buffer_stack();
2073
2074
  /* This block is copied from yy_switch_to_buffer. */
2075
0
  if ( YY_CURRENT_BUFFER )
2076
0
    {
2077
    /* Flush out information for old buffer. */
2078
0
    *(yy_c_buf_p) = (yy_hold_char);
2079
0
    YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2080
0
    YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2081
0
    }
2082
2083
  /* Only push if top exists. Otherwise, replace top. */
2084
0
  if (YY_CURRENT_BUFFER)
2085
0
    (yy_buffer_stack_top)++;
2086
0
  YY_CURRENT_BUFFER_LVALUE = new_buffer;
2087
2088
  /* copied from yy_switch_to_buffer. */
2089
0
  yy_load_buffer_state(  );
2090
0
  (yy_did_buffer_switch_on_eof) = 1;
2091
0
}
2092
2093
/** Removes and deletes the top of the stack, if present.
2094
 *  The next element becomes the new top.
2095
 *  
2096
 */
2097
void yypop_buffer_state (void)
2098
0
{
2099
0
      if (!YY_CURRENT_BUFFER)
2100
0
    return;
2101
2102
0
  yy_delete_buffer(YY_CURRENT_BUFFER );
2103
0
  YY_CURRENT_BUFFER_LVALUE = NULL;
2104
0
  if ((yy_buffer_stack_top) > 0)
2105
0
    --(yy_buffer_stack_top);
2106
2107
0
  if (YY_CURRENT_BUFFER) {
2108
0
    yy_load_buffer_state(  );
2109
0
    (yy_did_buffer_switch_on_eof) = 1;
2110
0
  }
2111
0
}
2112
2113
/* Allocates the stack if it does not exist.
2114
 *  Guarantees space for at least one push.
2115
 */
2116
static void yyensure_buffer_stack (void)
2117
4.83k
{
2118
4.83k
  yy_size_t num_to_alloc;
2119
    
2120
4.83k
  if (!(yy_buffer_stack)) {
2121
2122
    /* First allocation is just for 2 elements, since we don't know if this
2123
     * scanner will even need a stack. We use 2 instead of 1 to avoid an
2124
     * immediate realloc on the next call.
2125
         */
2126
2.76k
      num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2127
2.76k
    (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2128
2.76k
                (num_to_alloc * sizeof(struct yy_buffer_state*)
2129
2.76k
                );
2130
2.76k
    if ( ! (yy_buffer_stack) )
2131
0
      YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2132
2133
2.76k
    memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2134
2135
2.76k
    (yy_buffer_stack_max) = num_to_alloc;
2136
2.76k
    (yy_buffer_stack_top) = 0;
2137
2.76k
    return;
2138
2.76k
  }
2139
2140
2.06k
  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2141
2142
    /* Increase the buffer to prepare for a possible push. */
2143
2.06k
    yy_size_t grow_size = 8 /* arbitrary grow size */;
2144
2145
2.06k
    num_to_alloc = (yy_buffer_stack_max) + grow_size;
2146
2.06k
    (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2147
2.06k
                ((yy_buffer_stack),
2148
2.06k
                num_to_alloc * sizeof(struct yy_buffer_state*)
2149
2.06k
                );
2150
2.06k
    if ( ! (yy_buffer_stack) )
2151
0
      YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2152
2153
    /* zero only the new slots.*/
2154
2.06k
    memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2155
2.06k
    (yy_buffer_stack_max) = num_to_alloc;
2156
2.06k
  }
2157
2.06k
}
2158
2159
/** Setup the input buffer state to scan directly from a user-specified character buffer.
2160
 * @param base the character buffer
2161
 * @param size the size in bytes of the character buffer
2162
 * 
2163
 * @return the newly allocated buffer state object.
2164
 */
2165
YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
2166
0
{
2167
0
  YY_BUFFER_STATE b;
2168
    
2169
0
  if ( size < 2 ||
2170
0
       base[size-2] != YY_END_OF_BUFFER_CHAR ||
2171
0
       base[size-1] != YY_END_OF_BUFFER_CHAR )
2172
    /* They forgot to leave room for the EOB's. */
2173
0
    return NULL;
2174
2175
0
  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
2176
0
  if ( ! b )
2177
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2178
2179
0
  b->yy_buf_size = (int) (size - 2);  /* "- 2" to take care of EOB's */
2180
0
  b->yy_buf_pos = b->yy_ch_buf = base;
2181
0
  b->yy_is_our_buffer = 0;
2182
0
  b->yy_input_file = NULL;
2183
0
  b->yy_n_chars = b->yy_buf_size;
2184
0
  b->yy_is_interactive = 0;
2185
0
  b->yy_at_bol = 1;
2186
0
  b->yy_fill_buffer = 0;
2187
0
  b->yy_buffer_status = YY_BUFFER_NEW;
2188
2189
0
  yy_switch_to_buffer( b  );
2190
2191
0
  return b;
2192
0
}
2193
2194
/** Setup the input buffer state to scan a string. The next call to yylex() will
2195
 * scan from a @e copy of @a str.
2196
 * @param yystr a NUL-terminated string to scan
2197
 * 
2198
 * @return the newly allocated buffer state object.
2199
 * @note If you want to scan bytes that may contain NUL values, then use
2200
 *       yy_scan_bytes() instead.
2201
 */
2202
YY_BUFFER_STATE yy_scan_string (const char * yystr )
2203
0
{
2204
    
2205
0
  return yy_scan_bytes( yystr, (int) strlen(yystr) );
2206
0
}
2207
2208
/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2209
 * scan from a @e copy of @a bytes.
2210
 * @param yybytes the byte buffer to scan
2211
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2212
 * 
2213
 * @return the newly allocated buffer state object.
2214
 */
2215
YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
2216
0
{
2217
0
  YY_BUFFER_STATE b;
2218
0
  char *buf;
2219
0
  yy_size_t n;
2220
0
  int i;
2221
    
2222
  /* Get memory for full buffer, including space for trailing EOB's. */
2223
0
  n = (yy_size_t) (_yybytes_len + 2);
2224
0
  buf = (char *) yyalloc( n  );
2225
0
  if ( ! buf )
2226
0
    YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2227
2228
0
  for ( i = 0; i < _yybytes_len; ++i )
2229
0
    buf[i] = yybytes[i];
2230
2231
0
  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2232
2233
0
  b = yy_scan_buffer( buf, n );
2234
0
  if ( ! b )
2235
0
    YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2236
2237
  /* It's okay to grow etc. this buffer, and we should throw it
2238
   * away when we're done.
2239
   */
2240
0
  b->yy_is_our_buffer = 1;
2241
2242
0
  return b;
2243
0
}
2244
2245
#ifndef YY_EXIT_FAILURE
2246
0
#define YY_EXIT_FAILURE 2
2247
#endif
2248
2249
static void yynoreturn yy_fatal_error (const char* msg )
2250
0
{
2251
0
      fprintf( stderr, "%s\n", msg );
2252
0
  exit( YY_EXIT_FAILURE );
2253
0
}
2254
2255
/* Redefine yyless() so it works in section 3 code. */
2256
2257
#undef yyless
2258
#define yyless(n) \
2259
  do \
2260
    { \
2261
    /* Undo effects of setting up yytext. */ \
2262
        int yyless_macro_arg = (n); \
2263
        YY_LESS_LINENO(yyless_macro_arg);\
2264
    yytext[yyleng] = (yy_hold_char); \
2265
    (yy_c_buf_p) = yytext + yyless_macro_arg; \
2266
    (yy_hold_char) = *(yy_c_buf_p); \
2267
    *(yy_c_buf_p) = '\0'; \
2268
    yyleng = yyless_macro_arg; \
2269
    } \
2270
  while ( 0 )
2271
2272
/* Accessor  methods (get/set functions) to struct members. */
2273
2274
/** Get the current line number.
2275
 * 
2276
 */
2277
int yyget_lineno  (void)
2278
0
{
2279
    
2280
0
    return yylineno;
2281
0
}
2282
2283
/** Get the input stream.
2284
 * 
2285
 */
2286
FILE *yyget_in  (void)
2287
0
{
2288
0
        return yyin;
2289
0
}
2290
2291
/** Get the output stream.
2292
 * 
2293
 */
2294
FILE *yyget_out  (void)
2295
0
{
2296
0
        return yyout;
2297
0
}
2298
2299
/** Get the length of the current token.
2300
 * 
2301
 */
2302
int yyget_leng  (void)
2303
0
{
2304
0
        return yyleng;
2305
0
}
2306
2307
/** Get the current token.
2308
 * 
2309
 */
2310
2311
char *yyget_text  (void)
2312
0
{
2313
0
        return yytext;
2314
0
}
2315
2316
/** Set the current line number.
2317
 * @param _line_number line number
2318
 * 
2319
 */
2320
void yyset_lineno (int  _line_number )
2321
0
{
2322
    
2323
0
    yylineno = _line_number;
2324
0
}
2325
2326
/** Set the input stream. This does not discard the current
2327
 * input buffer.
2328
 * @param _in_str A readable stream.
2329
 * 
2330
 * @see yy_switch_to_buffer
2331
 */
2332
void yyset_in (FILE *  _in_str )
2333
0
{
2334
0
        yyin = _in_str ;
2335
0
}
2336
2337
void yyset_out (FILE *  _out_str )
2338
0
{
2339
0
        yyout = _out_str ;
2340
0
}
2341
2342
int yyget_debug  (void)
2343
0
{
2344
0
        return yy_flex_debug;
2345
0
}
2346
2347
void yyset_debug (int  _bdebug )
2348
0
{
2349
0
        yy_flex_debug = _bdebug ;
2350
0
}
2351
2352
static int yy_init_globals (void)
2353
2.76k
{
2354
        /* Initialization is the same as for the non-reentrant scanner.
2355
     * This function is called from yylex_destroy(), so don't allocate here.
2356
     */
2357
2358
2.76k
    (yy_buffer_stack) = NULL;
2359
2.76k
    (yy_buffer_stack_top) = 0;
2360
2.76k
    (yy_buffer_stack_max) = 0;
2361
2.76k
    (yy_c_buf_p) = NULL;
2362
2.76k
    (yy_init) = 0;
2363
2.76k
    (yy_start) = 0;
2364
2365
2.76k
    (yy_state_buf) = 0;
2366
2.76k
    (yy_state_ptr) = 0;
2367
2.76k
    (yy_full_match) = 0;
2368
2.76k
    (yy_lp) = 0;
2369
2370
/* Defined in main.c */
2371
#ifdef YY_STDINIT
2372
    yyin = stdin;
2373
    yyout = stdout;
2374
#else
2375
2.76k
    yyin = NULL;
2376
2.76k
    yyout = NULL;
2377
2.76k
#endif
2378
2379
    /* For future reference: Set errno on error, since we are called by
2380
     * yylex_init()
2381
     */
2382
2.76k
    return 0;
2383
2.76k
}
2384
2385
/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2386
int yylex_destroy  (void)
2387
2.76k
{
2388
    
2389
    /* Pop the buffer stack, destroying each element. */
2390
2.76k
  while(YY_CURRENT_BUFFER){
2391
0
    yy_delete_buffer( YY_CURRENT_BUFFER  );
2392
0
    YY_CURRENT_BUFFER_LVALUE = NULL;
2393
0
    yypop_buffer_state();
2394
0
  }
2395
2396
  /* Destroy the stack itself. */
2397
2.76k
  yyfree((yy_buffer_stack) );
2398
2.76k
  (yy_buffer_stack) = NULL;
2399
2400
2.76k
    yyfree ( (yy_state_buf) );
2401
2.76k
    (yy_state_buf)  = NULL;
2402
2403
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2404
     * yylex() is called, initialization will occur. */
2405
2.76k
    yy_init_globals( );
2406
2407
2.76k
    return 0;
2408
2.76k
}
2409
2410
/*
2411
 * Internal utility routines.
2412
 */
2413
2414
#ifndef yytext_ptr
2415
static void yy_flex_strncpy (char* s1, const char * s2, int n )
2416
{
2417
    
2418
  int i;
2419
  for ( i = 0; i < n; ++i )
2420
    s1[i] = s2[i];
2421
}
2422
#endif
2423
2424
#ifdef YY_NEED_STRLEN
2425
static int yy_flex_strlen (const char * s )
2426
{
2427
  int n;
2428
  for ( n = 0; s[n]; ++n )
2429
    ;
2430
2431
  return n;
2432
}
2433
#endif
2434
2435
void *yyalloc (yy_size_t  size )
2436
15.1k
{
2437
15.1k
      return malloc(size);
2438
15.1k
}
2439
2440
void *yyrealloc  (void * ptr, yy_size_t  size )
2441
2.06k
{
2442
    
2443
  /* The cast to (char *) in the following accommodates both
2444
   * implementations that use char* generic pointers, and those
2445
   * that use void* generic pointers.  It works with the latter
2446
   * because both ANSI C and C++ allow castless assignment from
2447
   * any pointer type to void*, and deal with argument conversions
2448
   * as though doing an assignment.
2449
   */
2450
2.06k
  return realloc(ptr, size);
2451
2.06k
}
2452
2453
void yyfree (void * ptr )
2454
15.1k
{
2455
15.1k
      free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2456
15.1k
}
2457
2458
#define YYTABLES_NAME "yytables"
2459
2460
#line 423 "lex.l"
2461
2462
2463
int
2464
yywrap (void)
2465
2.06k
{
2466
2.06k
  return input_context_pop ();
2467
2.06k
}
2468
2469
void
2470
begin_def (void)
2471
0
{
2472
0
  BEGIN (DEF);
2473
0
}
2474
2475
void
2476
end_def (void)
2477
0
{
2478
0
  BEGIN (CMD);
2479
0
} 
2480
2481
void
2482
print_prompt_at_bol (void)
2483
0
{
2484
0
  if (YY_AT_BOL ())
2485
0
    {
2486
0
      char *s = make_prompt ();
2487
0
      fputs (s, stdout);
2488
0
      fflush (stdout);
2489
0
      free (s);
2490
0
    }
2491
0
}
2492
  
2493

2494
struct strseg
2495
{
2496
  struct strseg *next;
2497
  int len;
2498
  char ptr[1];
2499
};
2500
2501
static struct strseg *strseg_head, *strseg_tail;
2502
2503
void
2504
string_begin (void)
2505
0
{
2506
0
  strseg_head = strseg_tail = NULL;
2507
0
}
2508
2509
void
2510
strseg_attach (struct strseg *seg)
2511
0
{
2512
0
  seg->next = NULL;
2513
0
  if (strseg_tail)
2514
0
    strseg_tail->next = seg;
2515
0
  else
2516
0
    strseg_head = seg;
2517
0
  strseg_tail = seg;
2518
0
}  
2519
2520
void
2521
string_add (const char *s, int l)
2522
0
{
2523
0
  struct strseg *seg = emalloc (sizeof (*seg) + l);
2524
0
  memcpy (seg->ptr, s, l);
2525
0
  seg->len = l;
2526
0
  strseg_attach (seg);
2527
0
}
2528
2529
void
2530
string_addc (int c)
2531
0
{
2532
0
  struct strseg *seg = emalloc (sizeof (*seg));
2533
0
  seg->ptr[0] = c;
2534
0
  seg->len = 1;
2535
0
  strseg_attach (seg);
2536
0
}
2537
2538
/*
2539
 * Compose the collected string segments into a nul-terminated string.
2540
 * Return the allocated string.
2541
 * If EMPTY_NULL is TRUE and the resulting string length is 0, return
2542
 * NULL instead.
2543
 */
2544
char *
2545
string_end (int empty_null)
2546
0
{
2547
0
  int len = 0;
2548
0
  struct strseg *seg;
2549
0
  char *ret, *p;
2550
  
2551
0
  for (seg = strseg_head; seg; seg = seg->next)
2552
0
    len += seg->len;
2553
2554
0
  if (len == 0 && empty_null)
2555
0
    ret = NULL;
2556
0
  else
2557
0
    {
2558
0
      ret = emalloc (len + 1);
2559
0
      p = ret;
2560
0
      for (seg = strseg_head; seg; )
2561
0
  {
2562
0
    struct strseg *next = seg->next;
2563
0
    memcpy (p, seg->ptr, seg->len);
2564
0
    p += seg->len;
2565
0
    free (seg);
2566
0
    seg = next;
2567
0
  }
2568
0
      *p = 0;
2569
0
    }
2570
0
  strseg_head = strseg_tail = NULL;
2571
2572
0
  return ret;
2573
0
}
2574
2575
static char transtab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
2576
2577
int
2578
unescape (int c)
2579
0
{
2580
0
  char *p;
2581
2582
0
  for (p = transtab; *p; p += 2)
2583
0
    {
2584
0
      if (*p == c)
2585
0
  return p[1];
2586
0
    }
2587
0
  return c;
2588
0
}
2589
2590
int
2591
escape (int c)
2592
221k
{
2593
221k
  char *p;
2594
2.12M
  for (p = transtab + sizeof (transtab) - 2; p > transtab; p -= 2)
2595
1.92M
    {
2596
1.92M
      if (*p == c)
2597
16.2k
  return p[-1];
2598
1.92M
    }
2599
204k
  return 0;
2600
221k
}
2601

2602
void
2603
locus_print (FILE *fp, struct locus const *loc)
2604
698
{               
2605
698
  if (loc->beg.file)
2606
698
    {
2607
698
      if (loc->beg.col == 0)
2608
0
  fprintf (fp, "%s:%u",
2609
0
     loc->beg.file,
2610
0
     loc->beg.line);
2611
698
      else if (strcmp (loc->beg.file, loc->end.file))
2612
0
  fprintf (fp, "%s:%u.%u-%s:%u.%u",
2613
0
     loc->beg.file,
2614
0
     loc->beg.line, loc->beg.col,
2615
0
     loc->end.file,
2616
0
     loc->end.line, loc->end.col);
2617
698
      else if (loc->beg.line != loc->end.line)
2618
0
  fprintf (fp, "%s:%u.%u-%u.%u",
2619
0
     loc->beg.file,
2620
0
     loc->beg.line, loc->beg.col,
2621
0
     loc->end.line, loc->end.col);
2622
698
      else if (loc->beg.col != loc->end.col)
2623
0
  fprintf (fp, "%s:%u.%u-%u",
2624
0
     loc->beg.file,
2625
0
     loc->beg.line, loc->beg.col,
2626
0
     loc->end.col);
2627
698
      else
2628
698
  fprintf (fp, "%s:%u.%u",
2629
698
     loc->beg.file,
2630
698
     loc->beg.line,
2631
698
     loc->beg.col);
2632
698
    }
2633
698
}
2634
2635
void
2636
vlerror (struct locus const *loc, const char *fmt, va_list ap)
2637
0
{
2638
0
  if (!interactive ())
2639
0
    fprintf (stderr, "%s: ", progname);
2640
0
  if (loc && loc->beg.file)
2641
0
    {
2642
0
      YY_LOCATION_PRINT (stderr, *loc);
2643
0
      fprintf (stderr, ": ");
2644
0
    }
2645
0
  vfprintf (stderr, fmt, ap);
2646
0
  fputc ('\n', stderr);
2647
0
}
2648
2649
void
2650
lerror (struct locus const *loc, const char *fmt, ...)
2651
0
{
2652
0
  va_list ap;
2653
2654
0
  va_start (ap, fmt);
2655
0
  vlerror (loc, fmt, ap);
2656
0
  va_end (ap);
2657
0
}
2658
2659

2660
static struct slist *
2661
pe_file_name (void)
2662
0
{
2663
0
  char *name = NULL;
2664
0
  variable_get ("filename", VART_STRING, (void**) &name);
2665
0
  return name ? slist_new (name) : NULL;
2666
0
}
2667
2668
static struct slist *
2669
pe_program_name (void)
2670
0
{
2671
0
  return slist_new (progname);
2672
0
}
2673
2674
static struct slist *
2675
pe_package_name (void)
2676
0
{
2677
0
  return slist_new (PACKAGE_NAME);
2678
0
}
2679
2680
static struct slist *
2681
pe_program_version (void)
2682
0
{
2683
0
  return slist_new (PACKAGE_VERSION);
2684
0
}
2685
2686
static struct slist *
2687
pe_space (void)
2688
0
{
2689
0
  return slist_new (" ");
2690
0
}
2691
2692
struct prompt_exp
2693
{
2694
  int ch;
2695
  struct slist *(*fun) (void);
2696
};
2697
2698
struct prompt_exp prompt_exp[] = {
2699
  { 'f', pe_file_name },
2700
  { 'p', pe_program_name },
2701
  { 'P', pe_package_name },
2702
  { 'v', pe_program_version },
2703
  { '_', pe_space },
2704
  { 0 }
2705
};
2706
2707
static int
2708
expand_char (int c, struct slist **tailp)
2709
0
{
2710
0
  struct prompt_exp *p;
2711
2712
0
  if (c && c != '%')
2713
0
    {
2714
0
      for (p = prompt_exp; p->ch; p++)
2715
0
  {
2716
0
    if (c == p->ch)
2717
0
      {
2718
0
        struct slist *s = p->fun ();
2719
0
        if (s)
2720
0
    slist_insert (tailp, s);
2721
0
        return 0;
2722
0
      }
2723
0
  }
2724
0
    }
2725
0
  return 1;
2726
0
}
2727
2728
char const *
2729
psname (void)
2730
0
{
2731
0
  switch (YYSTATE)
2732
0
    {
2733
0
    case DEF:
2734
0
    case MLSTR:
2735
0
    case SHSTR:
2736
0
    case SHQ:
2737
0
      return "ps2";
2738
2739
0
    default:
2740
0
      return "ps1";
2741
0
    }
2742
0
}
2743
2744
static int
2745
setbeg (void)
2746
214k
{
2747
214k
  switch (YYSTATE)
2748
214k
    {
2749
68.9k
    case INITIAL:
2750
214k
    case CMD:
2751
214k
    case SHELL:
2752
214k
    case DEF:
2753
214k
      return 1;
2754
2755
0
    default:
2756
      /* STR MLSTR SHELLWS SHSTR SHQ */
2757
0
      return 0;
2758
214k
    }
2759
214k
}
2760
    
2761
char *
2762
make_prompt (void)
2763
0
{
2764
0
  const char *s;
2765
0
  const char *prompt;
2766
0
  struct slist *head = NULL, *tail = NULL, *p;
2767
0
  char *ret, *end;
2768
0
  size_t len;
2769
  
2770
0
  switch (variable_get (psname (), VART_STRING, (void *) &prompt))
2771
0
    {
2772
0
    case VAR_OK:
2773
0
      break;
2774
2775
0
    case VAR_ERR_NOTSET:
2776
0
      return NULL;
2777
      
2778
0
    default:
2779
0
      abort ();
2780
0
    }
2781
2782
0
  for (s = prompt; *s; )
2783
0
    {
2784
0
      if (*s == '%' && s[1])
2785
0
  {
2786
0
    if (s > prompt)
2787
0
      {
2788
0
        slist_insert (&tail, slist_new_l (prompt, s - prompt));
2789
0
        if (!head)
2790
0
    head = tail;
2791
0
      }
2792
0
    if (expand_char (s[1], &tail) == 0)
2793
0
      {
2794
0
        if (!head)
2795
0
    head = tail;
2796
0
        prompt = s + 2;
2797
0
      }
2798
0
    else
2799
0
      prompt = s;
2800
0
    s += 2;
2801
0
  }
2802
0
      else
2803
0
  ++s;
2804
0
    }
2805
2806
0
  if (s > prompt)
2807
0
    {
2808
0
      slist_insert (&tail, slist_new_l (prompt, s - prompt));
2809
0
      if (!head)
2810
0
  head = tail;
2811
0
    }
2812
2813
0
  len = 0;
2814
0
  for (p = head; p; p = p->next)
2815
0
    len += strlen (p->str);
2816
2817
0
  ret = emalloc (len + 1);
2818
0
  end = ret;
2819
0
  for (p = head; p; p = p->next)
2820
0
    {
2821
0
      s = p->str;
2822
0
      while (*s)
2823
0
  *end++ = *s++;
2824
0
    }
2825
0
  *end = 0;
2826
2827
0
  slist_free (head);
2828
  
2829
0
  return ret;
2830
0
}
2831
  
2832