imap_ncsa_lex.c 49.6 KB
Newer Older
Sven Neumann's avatar
Sven Neumann committed
1

2 3 4 5 6
#line 3 "<stdout>"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */
7

8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#define yy_create_buffer ncsa__create_buffer
#define yy_delete_buffer ncsa__delete_buffer
#define yy_flex_debug ncsa__flex_debug
#define yy_init_buffer ncsa__init_buffer
#define yy_flush_buffer ncsa__flush_buffer
#define yy_load_buffer_state ncsa__load_buffer_state
#define yy_switch_to_buffer ncsa__switch_to_buffer
#define yyin ncsa_in
#define yyleng ncsa_leng
#define yylex ncsa_lex
#define yylineno ncsa_lineno
#define yyout ncsa_out
#define yyrestart ncsa_restart
#define yytext ncsa_text
#define yywrap ncsa_wrap
#define yyalloc ncsa_alloc
#define yyrealloc ncsa_realloc
#define yyfree ncsa_free

Sven Neumann's avatar
Sven Neumann committed
27 28 29
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
30
#define YY_FLEX_SUBMINOR_VERSION 36
31 32 33
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
Sven Neumann's avatar
Sven Neumann committed
34

35 36 37
/* First, we deal with  platform-specific or compiler-specific issues. */

/* begin standard C headers. */
Sven Neumann's avatar
Sven Neumann committed
38
#include <stdio.h>
39 40 41
#include <string.h>
#include <errno.h>
#include <stdlib.h>
42

43
/* end standard C headers. */
44

45 46 47 48 49 50 51
/* flex integer type definitions */

#ifndef FLEXINT_H
#define FLEXINT_H

/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */

52
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
53 54

/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
55
 * if you want the limit (max/min) macros for int types.
56 57 58
 */
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
Sven Neumann's avatar
Sven Neumann committed
59 60
#endif

61 62 63 64 65 66 67 68 69 70 71
#include <inttypes.h>
typedef int8_t flex_int8_t;
typedef uint8_t flex_uint8_t;
typedef int16_t flex_int16_t;
typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
72
typedef unsigned char flex_uint8_t;
73 74
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
Sven Neumann's avatar
Sven Neumann committed
75

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
/* Limits of integral types. */
#ifndef INT8_MIN
#define INT8_MIN               (-128)
#endif
#ifndef INT16_MIN
#define INT16_MIN              (-32767-1)
#endif
#ifndef INT32_MIN
#define INT32_MIN              (-2147483647-1)
#endif
#ifndef INT8_MAX
#define INT8_MAX               (127)
#endif
#ifndef INT16_MAX
#define INT16_MAX              (32767)
#endif
#ifndef INT32_MAX
#define INT32_MAX              (2147483647)
#endif
#ifndef UINT8_MAX
#define UINT8_MAX              (255U)
#endif
#ifndef UINT16_MAX
#define UINT16_MAX             (65535U)
#endif
#ifndef UINT32_MAX
#define UINT32_MAX             (4294967295U)
#endif
Sven Neumann's avatar
Sven Neumann committed
104

105 106
#endif /* ! C99 */

107
#endif /* ! FLEXINT_H */
108

109
#ifdef __cplusplus
110

Sven Neumann's avatar
Sven Neumann committed
111 112 113
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST

114
#else	/* ! __cplusplus */
Sven Neumann's avatar
Sven Neumann committed
115

116 117
/* C99 requires __STDC__ to be defined as 1. */
#if defined (__STDC__)
Sven Neumann's avatar
Sven Neumann committed
118 119 120

#define YY_USE_CONST

121 122
#endif	/* defined (__STDC__) */
#endif	/* ! __cplusplus */
Sven Neumann's avatar
Sven Neumann committed
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143

#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif

/* Returned upon end-of-file. */
#define YY_NULL 0

/* Promotes a possibly negative, possibly signed char to an unsigned
 * integer for use as an array index.  If the signed char is negative,
 * we want to instead treat it as an 8-bit unsigned char, hence the
 * double cast.
 */
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)

/* Enter a start condition.  This macro really ought to take a parameter,
 * but we do it the disgusting crufty way forced on us by the ()-less
 * definition of BEGIN.
 */
144
#define BEGIN (yy_start) = 1 + 2 *
Sven Neumann's avatar
Sven Neumann committed
145 146 147 148 149

/* Translate the current start state into a value that can be later handed
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 * compatibility.
 */
150
#define YY_START (((yy_start) - 1) / 2)
Sven Neumann's avatar
Sven Neumann committed
151 152 153 154 155 156
#define YYSTATE YY_START

/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)

/* Special action meaning "start processing a new file". */
157
#define YY_NEW_FILE ncsa_restart(ncsa_in  )
Sven Neumann's avatar
Sven Neumann committed
158 159 160 161

#define YY_END_OF_BUFFER_CHAR 0

/* Size of default input buffer. */
162
#ifndef YY_BUF_SIZE
Sven Neumann's avatar
Sven Neumann committed
163
#define YY_BUF_SIZE 16384
164 165 166 167 168
#endif

/* The state buf must be large enough to hold one state per character in the main buffer.
 */
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
Sven Neumann's avatar
Sven Neumann committed
169

170 171
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
#define YY_TYPEDEF_YY_BUFFER_STATE
Sven Neumann's avatar
Sven Neumann committed
172
typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 174
#endif

175 176 177 178 179 180
#ifndef YY_TYPEDEF_YY_SIZE_T
#define YY_TYPEDEF_YY_SIZE_T
typedef size_t yy_size_t;
#endif

extern yy_size_t ncsa_leng;
181

182
extern FILE *ncsa_in, *ncsa_out;
Sven Neumann's avatar
Sven Neumann committed
183 184 185 186 187

#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2

188
    #define YY_LESS_LINENO(n)
189

190
/* Return all but the first "n" matched characters back to the input stream. */
Sven Neumann's avatar
Sven Neumann committed
191
#define yyless(n) \
192 193 194
	do \
		{ \
		/* Undo effects of setting up ncsa_text. */ \
195 196
        int yyless_macro_arg = (n); \
        YY_LESS_LINENO(yyless_macro_arg);\
197 198 199 200 201 202
		*yy_cp = (yy_hold_char); \
		YY_RESTORE_YY_MORE_OFFSET \
		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
		YY_DO_BEFORE_ACTION; /* set up ncsa_text again */ \
		} \
	while ( 0 )
Sven Neumann's avatar
Sven Neumann committed
203

204
#define unput(c) yyunput( c, (yytext_ptr)  )
Sven Neumann's avatar
Sven Neumann committed
205

206 207
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
Sven Neumann's avatar
Sven Neumann committed
208
struct yy_buffer_state
209 210 211 212 213 214 215 216 217 218 219 220 221 222
	{
	FILE *yy_input_file;

	char *yy_ch_buf;		/* input buffer */
	char *yy_buf_pos;		/* current position in input buffer */

	/* Size of input buffer in bytes, not including room for EOB
	 * characters.
	 */
	yy_size_t yy_buf_size;

	/* Number of characters read into yy_ch_buf, not including EOB
	 * characters.
	 */
223
	yy_size_t yy_n_chars;
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242

	/* Whether we "own" the buffer - i.e., we know we created it,
	 * and can realloc() it to grow it, and should free() it to
	 * delete it.
	 */
	int yy_is_our_buffer;

	/* Whether this is an "interactive" input source; if so, and
	 * if we're using stdio for input, then we want to use getc()
	 * instead of fread(), to make sure we stop fetching input after
	 * each newline.
	 */
	int yy_is_interactive;

	/* Whether we're considered to be at the beginning of a line.
	 * If so, '^' rules will be active on the next match, otherwise
	 * not.
	 */
	int yy_at_bol;
Sven Neumann's avatar
Sven Neumann committed
243

244 245
    int yy_bs_lineno; /**< The line count. */
    int yy_bs_column; /**< The column count. */
246

247 248 249 250
	/* Whether to try to fill the input buffer when we reach the
	 * end of it.
	 */
	int yy_fill_buffer;
Sven Neumann's avatar
Sven Neumann committed
251

252
	int yy_buffer_status;
253

Sven Neumann's avatar
Sven Neumann committed
254 255
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
256 257 258 259 260 261 262 263 264 265
	/* When an EOF's been seen but there's still some text to process
	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
	 * shouldn't try reading from the input source any more.  We might
	 * still have a bunch of tokens to match, though, because of
	 * possible backing-up.
	 *
	 * When we actually see the EOF, we change the status to "new"
	 * (via ncsa_restart()), so that the user can continue scanning by
	 * just pointing ncsa_in at a new input file.
	 */
Sven Neumann's avatar
Sven Neumann committed
266
#define YY_BUFFER_EOF_PENDING 2
267

268
	};
269
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
Sven Neumann's avatar
Sven Neumann committed
270

271 272 273 274
/* Stack of input buffers. */
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
Sven Neumann's avatar
Sven Neumann committed
275 276 277 278

/* We provide macros for accessing buffer states in case in the
 * future we want to put the buffer states in a more general
 * "scanner state".
279 280
 *
 * Returns the top of the stack, or NULL.
Sven Neumann's avatar
Sven Neumann committed
281
 */
282 283 284
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
                          : NULL)
Sven Neumann's avatar
Sven Neumann committed
285

286 287 288 289
/* Same as previous macro, but useful when we know that the buffer stack is not
 * NULL or when we need an lvalue. For internal use only.
 */
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
Sven Neumann's avatar
Sven Neumann committed
290

291
/* yy_hold_char holds the character lost when ncsa_text is formed. */
Sven Neumann's avatar
Sven Neumann committed
292
static char yy_hold_char;
293 294
static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
yy_size_t ncsa_leng;
Sven Neumann's avatar
Sven Neumann committed
295 296 297

/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
298 299
static int yy_init = 0;		/* whether we need to initialize */
static int yy_start = 0;	/* start state number */
Sven Neumann's avatar
Sven Neumann committed
300

301 302
/* Flag which is used to allow ncsa_wrap()'s to do buffer switches
 * instead of setting up a fresh ncsa_in.  A bit of a hack ...
Sven Neumann's avatar
Sven Neumann committed
303 304 305
 */
static int yy_did_buffer_switch_on_eof;

306 307 308 309 310 311 312
void ncsa_restart (FILE *input_file  );
void ncsa__switch_to_buffer (YY_BUFFER_STATE new_buffer  );
YY_BUFFER_STATE ncsa__create_buffer (FILE *file,int size  );
void ncsa__delete_buffer (YY_BUFFER_STATE b  );
void ncsa__flush_buffer (YY_BUFFER_STATE b  );
void ncsa_push_buffer_state (YY_BUFFER_STATE new_buffer  );
void ncsa_pop_buffer_state (void );
313

314 315 316
static void ncsa_ensure_buffer_stack (void );
static void ncsa__load_buffer_state (void );
static void ncsa__init_buffer (YY_BUFFER_STATE b,FILE *file  );
Sven Neumann's avatar
Sven Neumann committed
317

318
#define YY_FLUSH_BUFFER ncsa__flush_buffer(YY_CURRENT_BUFFER )
Sven Neumann's avatar
Sven Neumann committed
319

320 321
YY_BUFFER_STATE ncsa__scan_buffer (char *base,yy_size_t size  );
YY_BUFFER_STATE ncsa__scan_string (yyconst char *yy_str  );
322
YY_BUFFER_STATE ncsa__scan_bytes (yyconst char *bytes,yy_size_t len  );
Sven Neumann's avatar
Sven Neumann committed
323

324 325 326 327 328
void *ncsa_alloc (yy_size_t  );
void *ncsa_realloc (void *,yy_size_t  );
void ncsa_free (void *  );

#define yy_new_buffer ncsa__create_buffer
Sven Neumann's avatar
Sven Neumann committed
329 330

#define yy_set_interactive(is_interactive) \
331 332
	{ \
	if ( ! YY_CURRENT_BUFFER ){ \
333
        ncsa_ensure_buffer_stack (); \
334
		YY_CURRENT_BUFFER_LVALUE =    \
335
            ncsa__create_buffer(ncsa_in,YY_BUF_SIZE ); \
336 337 338
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
	}
Sven Neumann's avatar
Sven Neumann committed
339 340

#define yy_set_bol(at_bol) \
341 342
	{ \
	if ( ! YY_CURRENT_BUFFER ){\
343
        ncsa_ensure_buffer_stack (); \
344
		YY_CURRENT_BUFFER_LVALUE =    \
345
            ncsa__create_buffer(ncsa_in,YY_BUF_SIZE ); \
346 347 348
	} \
	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
	}
Sven Neumann's avatar
Sven Neumann committed
349

350
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
Sven Neumann's avatar
Sven Neumann committed
351

352
/* Begin user sect3 */
Sven Neumann's avatar
Sven Neumann committed
353

354
#define ncsa_wrap() 1
Sven Neumann's avatar
Sven Neumann committed
355
#define YY_SKIP_YYWRAP
356

Sven Neumann's avatar
Sven Neumann committed
357
typedef unsigned char YY_CHAR;
358 359 360

FILE *ncsa_in = (FILE *) 0, *ncsa_out = (FILE *) 0;

Sven Neumann's avatar
Sven Neumann committed
361 362
typedef int yy_state_type;

363 364 365 366 367 368 369 370 371 372 373
extern int ncsa_lineno;

int ncsa_lineno = 1;

extern char *ncsa_text;
#define yytext_ptr ncsa_text

static yy_state_type yy_get_previous_state (void );
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
static int yy_get_next_buffer (void );
static void yy_fatal_error (yyconst char msg[]  );
Sven Neumann's avatar
Sven Neumann committed
374 375

/* Done after the current pattern has been matched and before the
376
 * corresponding action - sets up ncsa_text.
Sven Neumann's avatar
Sven Neumann committed
377 378
 */
#define YY_DO_BEFORE_ACTION \
379 380 381 382 383
	(yytext_ptr) = yy_bp; \
	ncsa_leng = (size_t) (yy_cp - yy_bp); \
	(yy_hold_char) = *yy_cp; \
	*yy_cp = '\0'; \
	(yy_c_buf_p) = yy_cp;
Sven Neumann's avatar
Sven Neumann committed
384 385 386

#define YY_NUM_RULES 14
#define YY_END_OF_BUFFER 15
387 388 389
/* This struct is not used in this scanner,
   but its presence is necessary. */
struct yy_trans_info
390 391 392 393
	{
	flex_int32_t yy_verify;
	flex_int32_t yy_nxt;
	};
394
static yyconst flex_int16_t yy_accept[76] =
Sven Neumann's avatar
Sven Neumann committed
395 396 397 398 399 400 401 402 403 404 405
    {   0,
       11,   11,    0,    0,    5,    5,   15,   13,   12,   12,
        4,   11,   11,   11,   13,   13,   11,   13,   13,   10,
       14,    5,   12,    0,   11,   11,   11,   11,    0,    0,
       11,   11,    0,    0,   10,    5,    0,    0,    0,    0,
        0,    0,    0,    0,    0,    0,    0,    0,    8,    6,
        0,    0,    0,    0,    0,    0,    0,    0,    7,    0,
        0,    0,    0,    9,    0,    0,    2,    1,    0,    0,
        0,    0,    0,    3,    0
    } ;

406
static yyconst flex_int32_t yy_ec[256] =
Sven Neumann's avatar
Sven Neumann committed
407 408 409 410 411 412 413 414 415 416
    {   0,
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    2,    1,    1,    4,    5,    1,    1,    1,    1,
        1,    1,    6,    7,    8,    9,    1,   10,   10,   10,
       10,   10,   10,   10,   10,   10,   10,   11,    1,    1,
        1,    1,    1,    1,   12,    1,   13,   14,   15,   16,
        1,   17,   18,    1,    1,   19,    1,   20,   21,   22,
        1,   23,   24,   25,   26,    1,    1,    1,   27,    1,
417
        1,    1,    1,    1,    1,    1,   28,    1,   29,   30,
Sven Neumann's avatar
Sven Neumann committed
418

419 420 421
       31,   32,    1,   33,   34,    1,    1,   35,    1,   36,
       37,   38,    1,   39,   40,   41,   42,    1,    1,    1,
       43,    1,    1,    1,    1,    1,    1,    1,    1,    1,
Sven Neumann's avatar
Sven Neumann committed
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,

        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1
    } ;

438
static yyconst flex_int32_t yy_meta[44] =
Sven Neumann's avatar
Sven Neumann committed
439 440 441
    {   0,
        1,    2,    3,    1,    1,    1,    2,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
442 443 444
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
        1,    1,    1
Sven Neumann's avatar
Sven Neumann committed
445 446
    } ;

447
static yyconst flex_int16_t yy_base[81] =
Sven Neumann's avatar
Sven Neumann committed
448
    {   0,
449 450 451 452 453 454 455 456
        0,   38,    4,   14,   62,   61,   58,  178,   16,   22,
       49,   18,   35,   47,    2,   28,   64,   34,   48,    0,
      178,    0,   32,   61,   70,   72,   82,   83,   60,   68,
       34,   27,   75,   82,    0,    0,   70,   82,   86,   92,
       94,   80,   83,   84,   91,   91,   98,   92,  178,  178,
      102,  113,  108,  113,  110,  109,  113,  122,  178,  113,
      116,  122,   21,  178,   15,  119,  178,  178,  122,  130,
      128,  130,    1,  178,  178,  166,  169,  172,    0,  175
Sven Neumann's avatar
Sven Neumann committed
457 458
    } ;

459
static yyconst flex_int16_t yy_def[81] =
Sven Neumann's avatar
Sven Neumann committed
460
    {   0,
461 462 463 464
       76,   76,   77,   77,   78,   78,   75,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   79,
       75,   80,   75,   75,   75,   75,   75,   75,   75,   75,
       75,   75,   75,   75,   79,   80,   75,   75,   75,   75,
Sven Neumann's avatar
Sven Neumann committed
465 466 467
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
468
       75,   75,   75,   75,    0,   75,   75,   75,   75,   75
Sven Neumann's avatar
Sven Neumann committed
469 470
    } ;

471
static yyconst flex_int16_t yy_nxt[222] =
Sven Neumann's avatar
Sven Neumann committed
472
    {   0,
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492
       35,    9,   10,   11,   75,   21,   21,   12,   13,   14,
       21,   74,   15,   16,   17,   21,   21,   23,   23,   29,
       21,   18,   19,   23,   23,   68,   25,   26,   15,   16,
       17,   67,   27,   23,   23,   29,   32,   18,   19,    9,
       10,   11,   30,   32,   28,   12,   13,   14,   27,   27,
       15,   16,   17,   24,   33,   25,   26,   75,   30,   18,
       19,   27,   34,   21,   21,   27,   15,   16,   17,   31,
       33,   31,   37,   32,   38,   18,   19,   27,   34,   28,
       25,   26,   40,   41,   27,   39,   27,   31,   37,   31,
       38,   32,   28,   42,   43,   44,   45,   27,   40,   41,

       27,   39,   27,   46,   47,   48,   49,   50,   51,   42,
       43,   44,   45,   27,   52,   53,   54,   55,   56,   46,
       47,   48,   49,   50,   51,   57,   58,   59,   60,   61,
       52,   53,   54,   55,   56,   62,   63,   64,   65,   66,
       69,   57,   58,   59,   60,   61,   70,   71,   72,   73,
       75,   62,   63,   64,   65,   66,   69,   75,   75,   75,
       75,   75,   70,   71,   72,   73,    8,    8,    8,   20,
       20,   20,   22,   22,   22,   36,   36,    7,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
Sven Neumann's avatar
Sven Neumann committed
493
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
494

Sven Neumann's avatar
Sven Neumann committed
495
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
496 497
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       75
Sven Neumann's avatar
Sven Neumann committed
498 499
    } ;

500
static yyconst flex_int16_t yy_chk[222] =
Sven Neumann's avatar
Sven Neumann committed
501
    {   0,
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523
       79,    1,    1,    1,    0,    3,    3,    1,    1,    1,
        3,   73,    1,    1,    1,    4,    4,    9,    9,   15,
        4,    1,    1,   10,   10,   65,   12,   12,    1,    1,
        1,   63,   12,   23,   23,   15,   32,    1,    1,    2,
        2,    2,   16,   31,   13,    2,    2,    2,   12,   13,
        2,    2,    2,   11,   18,   14,   14,    7,   16,    2,
        2,   14,   19,    6,    5,   13,    2,    2,    2,   17,
       18,   17,   24,   17,   24,    2,    2,   14,   19,   25,
       26,   26,   29,   30,   25,   24,   26,   27,   24,   27,
       24,   27,   28,   33,   34,   37,   38,   28,   29,   30,

       25,   24,   26,   39,   40,   41,   42,   43,   44,   33,
       34,   37,   38,   28,   45,   46,   47,   48,   51,   39,
       40,   41,   42,   43,   44,   52,   53,   54,   55,   56,
       45,   46,   47,   48,   51,   57,   58,   60,   61,   62,
       66,   52,   53,   54,   55,   56,   69,   70,   71,   72,
        0,   57,   58,   60,   61,   62,   66,    0,    0,    0,
        0,    0,   69,   70,   71,   72,   76,   76,   76,   77,
       77,   77,   78,   78,   78,   80,   80,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,

Sven Neumann's avatar
Sven Neumann committed
524 525
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
       75,   75,   75,   75,   75,   75,   75,   75,   75,   75,
526
       75
Sven Neumann's avatar
Sven Neumann committed
527 528 529 530 531
    } ;

static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;

532 533 534
extern int ncsa__flex_debug;
int ncsa__flex_debug = 0;

Sven Neumann's avatar
Sven Neumann committed
535 536 537 538 539 540 541
/* The intent behind this definition is that it'll catch
 * any uses of REJECT which flex missed.
 */
#define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET
542
char *ncsa_text;
Sven Neumann's avatar
Sven Neumann committed
543 544 545
#line 1 "imap_ncsa.l"
#line 2 "imap_ncsa.l"
/*
546
 * This is a plug-in for GIMP.
Sven Neumann's avatar
Sven Neumann committed
547 548 549 550 551
 *
 * Generates clickable image maps.
 *
 * Copyright (C) 1998-1999 Maurits Rijk  lpeek.mrijk@consunet.nl
 *
552
 * This program is free software: you can redistribute it and/or modify
Sven Neumann's avatar
Sven Neumann committed
553
 * it under the terms of the GNU General Public License as published by
554
 * the Free Software Foundation; either version 3 of the License, or
Sven Neumann's avatar
Sven Neumann committed
555 556 557 558 559 560 561 562
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
563
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
Sven Neumann's avatar
Sven Neumann committed
564 565 566
 *
 */

567 568
#include <string.h>

569 570
#include <glib.h>

Sven Neumann's avatar
Sven Neumann committed
571 572
#include "imap_ncsa_parse.h"

573 574 575 576
#ifdef FLEX_SCANNER
#define YY_NO_UNPUT
#endif /* FLEX_SCANNER */

577
#define YY_NO_INPUT 1
578 579


580
#line 581 "<stdout>"
581 582 583

#define INITIAL 0
#define imap_link 1
584
#define comment 2
585

586 587 588 589 590 591 592 593 594 595 596 597 598
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 * down here because we want the user's section 1 to have been scanned first.
 * The user has a chance to override it with an option.
 */
#include <unistd.h>
#endif

#ifndef YY_EXTRA_TYPE
#define YY_EXTRA_TYPE void *
#endif

static int yy_init_globals (void );
Sven Neumann's avatar
Sven Neumann committed
599

600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620
/* Accessor methods to globals.
   These are made visible to non-reentrant scanners for convenience. */

int ncsa_lex_destroy (void );

int ncsa_get_debug (void );

void ncsa_set_debug (int debug_flag  );

YY_EXTRA_TYPE ncsa_get_extra (void );

void ncsa_set_extra (YY_EXTRA_TYPE user_defined  );

FILE *ncsa_get_in (void );

void ncsa_set_in  (FILE * in_str  );

FILE *ncsa_get_out (void );

void ncsa_set_out  (FILE * out_str  );

621
yy_size_t ncsa_get_leng (void );
622 623 624 625 626 627 628

char *ncsa_get_text (void );

int ncsa_get_lineno (void );

void ncsa_set_lineno (int line_number  );

Sven Neumann's avatar
Sven Neumann committed
629 630 631 632 633 634
/* Macros after this point can all be overridden by user definitions in
 * section 1.
 */

#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
635
extern "C" int ncsa_wrap (void );
Sven Neumann's avatar
Sven Neumann committed
636
#else
637
extern int ncsa_wrap (void );
Sven Neumann's avatar
Sven Neumann committed
638 639 640 641
#endif
#endif

#ifndef yytext_ptr
642
static void yy_flex_strncpy (char *,yyconst char *,int );
Sven Neumann's avatar
Sven Neumann committed
643 644 645
#endif

#ifdef YY_NEED_STRLEN
646
static int yy_flex_strlen (yyconst char * );
Sven Neumann's avatar
Sven Neumann committed
647 648 649
#endif

#ifndef YY_NO_INPUT
650

651 652
#ifdef __cplusplus
static int yyinput (void );
653
#else
654
static int input (void );
655 656
#endif

Sven Neumann's avatar
Sven Neumann committed
657 658 659 660 661 662 663 664 665 666 667 668
#endif

/* Amount of stuff to slurp up with each read. */
#ifndef YY_READ_BUF_SIZE
#define YY_READ_BUF_SIZE 8192
#endif

/* Copy whatever the last rule matched to the standard output. */
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
 * we now use fwrite().
 */
669
#define ECHO do { if (fwrite( ncsa_text, ncsa_leng, 1, ncsa_out )) {} } while (0)
Sven Neumann's avatar
Sven Neumann committed
670 671 672 673 674 675 676
#endif

/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 * is returned in "result".
 */
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
677 678 679
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
		{ \
		int c = '*'; \
680
		size_t n; \
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703
		for ( n = 0; n < max_size && \
			     (c = getc( ncsa_in )) != EOF && c != '\n'; ++n ) \
			buf[n] = (char) c; \
		if ( c == '\n' ) \
			buf[n++] = (char) c; \
		if ( c == EOF && ferror( ncsa_in ) ) \
			YY_FATAL_ERROR( "input in flex scanner failed" ); \
		result = n; \
		} \
	else \
		{ \
		errno=0; \
		while ( (result = fread(buf, 1, max_size, ncsa_in))==0 && ferror(ncsa_in)) \
			{ \
			if( errno != EINTR) \
				{ \
				YY_FATAL_ERROR( "input in flex scanner failed" ); \
				break; \
				} \
			errno=0; \
			clearerr(ncsa_in); \
			} \
		}\
704 705
\

Sven Neumann's avatar
Sven Neumann committed
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725
#endif

/* No semi-colon after return; correct usage is to write "yyterminate();" -
 * we don't want an extra ';' after the "return" because that will cause
 * some compilers to complain about unreachable statements.
 */
#ifndef yyterminate
#define yyterminate() return YY_NULL
#endif

/* Number of entries by which start-condition stack grows. */
#ifndef YY_START_STACK_INCR
#define YY_START_STACK_INCR 25
#endif

/* Report a fatal error. */
#ifndef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif

726 727
/* end tables serialization structures and prototypes */

Sven Neumann's avatar
Sven Neumann committed
728 729 730 731
/* Default declaration of generated scanner - a define so the user can
 * easily add parameters.
 */
#ifndef YY_DECL
732 733 734
#define YY_DECL_IS_OURS 1

extern int ncsa_lex (void);
735

736 737 738 739
#define YY_DECL int ncsa_lex (void)
#endif /* !YY_DECL */

/* Code executed at the beginning of each rule, after ncsa_text and ncsa_leng
Sven Neumann's avatar
Sven Neumann committed
740 741 742 743 744 745 746 747 748 749 750 751
 * have been set up.
 */
#ifndef YY_USER_ACTION
#define YY_USER_ACTION
#endif

/* Code executed at the end of each rule. */
#ifndef YY_BREAK
#define YY_BREAK break;
#endif

#define YY_RULE_SETUP \
752
	YY_USER_ACTION
Sven Neumann's avatar
Sven Neumann committed
753

754 755
/** The main scanner function which does all the work.
 */
Sven Neumann's avatar
Sven Neumann committed
756
YY_DECL
757
{
758 759 760
	register yy_state_type yy_current_state;
	register char *yy_cp, *yy_bp;
	register int yy_act;
761

762
#line 47 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
763 764


765
#line 766 "<stdout>"
Sven Neumann's avatar
Sven Neumann committed
766

767 768 769
	if ( !(yy_init) )
		{
		(yy_init) = 1;
Sven Neumann's avatar
Sven Neumann committed
770 771

#ifdef YY_USER_INIT
772
		YY_USER_INIT;
Sven Neumann's avatar
Sven Neumann committed
773 774
#endif

775 776
		if ( ! (yy_start) )
			(yy_start) = 1;	/* first start state */
Sven Neumann's avatar
Sven Neumann committed
777

778 779
		if ( ! ncsa_in )
			ncsa_in = stdin;
Sven Neumann's avatar
Sven Neumann committed
780

781 782
		if ( ! ncsa_out )
			ncsa_out = stdout;
Sven Neumann's avatar
Sven Neumann committed
783

784 785 786 787 788
		if ( ! YY_CURRENT_BUFFER ) {
			ncsa_ensure_buffer_stack ();
			YY_CURRENT_BUFFER_LVALUE =
				ncsa__create_buffer(ncsa_in,YY_BUF_SIZE );
		}
Sven Neumann's avatar
Sven Neumann committed
789

790 791
		ncsa__load_buffer_state( );
		}
Sven Neumann's avatar
Sven Neumann committed
792

793 794 795
	while ( 1 )		/* loops until end-of-file is reached */
		{
		yy_cp = (yy_c_buf_p);
Sven Neumann's avatar
Sven Neumann committed
796

797 798
		/* Support of ncsa_text. */
		*yy_cp = (yy_hold_char);
Sven Neumann's avatar
Sven Neumann committed
799

800 801 802 803
		/* yy_bp points to the position in yy_ch_buf of the start of
		 * the current run.
		 */
		yy_bp = yy_cp;
Sven Neumann's avatar
Sven Neumann committed
804

805
		yy_current_state = (yy_start);
Sven Neumann's avatar
Sven Neumann committed
806
yy_match:
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824
		do
			{
			register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
			if ( yy_accept[yy_current_state] )
				{
				(yy_last_accepting_state) = yy_current_state;
				(yy_last_accepting_cpos) = yy_cp;
				}
			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
				{
				yy_current_state = (int) yy_def[yy_current_state];
				if ( yy_current_state >= 76 )
					yy_c = yy_meta[(unsigned int) yy_c];
				}
			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
			++yy_cp;
			}
		while ( yy_base[yy_current_state] != 178 );
Sven Neumann's avatar
Sven Neumann committed
825 826

yy_find_action:
827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846
		yy_act = yy_accept[yy_current_state];
		if ( yy_act == 0 )
			{ /* have to back up */
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			yy_act = yy_accept[yy_current_state];
			}

		YY_DO_BEFORE_ACTION;

do_action:	/* This label is used only to access EOF actions. */

		switch ( yy_act )
	{ /* beginning of action switch */
			case 0: /* must back up */
			/* undo the effects of YY_DO_BEFORE_ACTION */
			*yy_cp = (yy_hold_char);
			yy_cp = (yy_last_accepting_cpos);
			yy_current_state = (yy_last_accepting_state);
			goto yy_find_action;
Sven Neumann's avatar
Sven Neumann committed
847 848 849

case 1:
YY_RULE_SETUP
850
#line 49 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
851
{
852 853 854 855
				   BEGIN(comment);
				   return AUTHOR;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
856 857
case 2:
YY_RULE_SETUP
858
#line 54 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
859
{
860 861 862 863
				   BEGIN(comment);
				   return TITLE;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
864 865
case 3:
YY_RULE_SETUP
866
#line 59 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
867
{
868 869 870 871
				   BEGIN(comment);
				   return DESCRIPTION;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
872 873
case 4:
YY_RULE_SETUP
874
#line 64 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
875
{
876 877 878 879
				   BEGIN(comment);
				   return BEGIN_COMMENT;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
880 881
case 5:
YY_RULE_SETUP
882
#line 69 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
883
{
884 885 886 887 888
				   BEGIN(INITIAL);
   				   ncsa_lval.id = g_strndup (ncsa_text, ncsa_leng);
   				   return COMMENT;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
889 890
case 6:
YY_RULE_SETUP
891
#line 75 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
892
{
893 894 895 896
				   BEGIN(imap_link);
   				   return RECTANGLE;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
897 898
case 7:
YY_RULE_SETUP
899
#line 80 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
900
{
901 902 903 904
				   BEGIN(imap_link);
				   return CIRCLE;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
905 906
case 8:
YY_RULE_SETUP
907
#line 85 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
908
{
909 910 911 912
				   BEGIN(imap_link);
				   return POLYGON;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
913 914
case 9:
YY_RULE_SETUP
915
#line 90 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
916
{
917 918 919 920
				   BEGIN(imap_link);
				   return DEFAULT;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
921 922
case 10:
YY_RULE_SETUP
923
#line 95 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
924
{
925 926 927 928 929
   				   BEGIN(INITIAL);
   				   ncsa_lval.id = g_strndup (ncsa_text, ncsa_leng);
				   return LINK;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
930 931
case 11:
YY_RULE_SETUP
932
#line 101 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
933
{
934
                                   ncsa_lval.value = g_ascii_strtod (ncsa_text, NULL);
935 936 937
				   return FLOAT;
				}
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
938
case 12:
939
/* rule 12 can match eol */
Sven Neumann's avatar
Sven Neumann committed
940
YY_RULE_SETUP
941
#line 106 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
942
; /* Eat white space */
943
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
944 945
case 13:
YY_RULE_SETUP
946
#line 108 "imap_ncsa.l"
947
return *ncsa_text;
948
	YY_BREAK
Sven Neumann's avatar
Sven Neumann committed
949 950
case 14:
YY_RULE_SETUP
951
#line 110 "imap_ncsa.l"
Sven Neumann's avatar
Sven Neumann committed
952
ECHO;
953
	YY_BREAK
954
#line 955 "<stdout>"
Sven Neumann's avatar
Sven Neumann committed
955
case YY_STATE_EOF(INITIAL):
956
case YY_STATE_EOF(imap_link):
Sven Neumann's avatar
Sven Neumann committed
957
case YY_STATE_EOF(comment):
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086
	yyterminate();

	case YY_END_OF_BUFFER:
		{
		/* Amount of text matched not including the EOB char. */
		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;

		/* Undo the effects of YY_DO_BEFORE_ACTION. */
		*yy_cp = (yy_hold_char);
		YY_RESTORE_YY_MORE_OFFSET

		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
			{
			/* We're scanning a new file or input source.  It's
			 * possible that this happened because the user
			 * just pointed ncsa_in at a new source and called
			 * ncsa_lex().  If so, then we have to assure
			 * consistency between YY_CURRENT_BUFFER and our
			 * globals.  Here is the right place to do so, because
			 * this is the first action (other than possibly a
			 * back-up) that will match for the new input source.
			 */
			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
			YY_CURRENT_BUFFER_LVALUE->yy_input_file = ncsa_in;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
			}

		/* Note that here we test for yy_c_buf_p "<=" to the position
		 * of the first EOB in the buffer, since yy_c_buf_p will
		 * already have been incremented past the NUL character
		 * (since all states make transitions on EOB to the
		 * end-of-buffer state).  Contrast this with the test
		 * in input().
		 */
		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			{ /* This was really a NUL. */
			yy_state_type yy_next_state;

			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;

			yy_current_state = yy_get_previous_state(  );

			/* Okay, we're now positioned to make the NUL
			 * transition.  We couldn't have
			 * yy_get_previous_state() go ahead and do it
			 * for us because it doesn't know how to deal
			 * with the possibility of jamming (and we don't
			 * want to build jamming into it because then it
			 * will run more slowly).
			 */

			yy_next_state = yy_try_NUL_trans( yy_current_state );

			yy_bp = (yytext_ptr) + YY_MORE_ADJ;

			if ( yy_next_state )
				{
				/* Consume the NUL. */
				yy_cp = ++(yy_c_buf_p);
				yy_current_state = yy_next_state;
				goto yy_match;
				}

			else
				{
				yy_cp = (yy_c_buf_p);
				goto yy_find_action;
				}
			}

		else switch ( yy_get_next_buffer(  ) )
			{
			case EOB_ACT_END_OF_FILE:
				{
				(yy_did_buffer_switch_on_eof) = 0;

				if ( ncsa_wrap( ) )
					{
					/* Note: because we've taken care in
					 * yy_get_next_buffer() to have set up
					 * ncsa_text, we can now set up
					 * yy_c_buf_p so that if some total
					 * hoser (like flex itself) wants to
					 * call the scanner after we return the
					 * YY_NULL, it'll still work - another
					 * YY_NULL will get returned.
					 */
					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;

					yy_act = YY_STATE_EOF(YY_START);
					goto do_action;
					}

				else
					{
					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
					}
				break;
				}

			case EOB_ACT_CONTINUE_SCAN:
				(yy_c_buf_p) =
					(yytext_ptr) + yy_amount_of_matched_text;

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_match;

			case EOB_ACT_LAST_MATCH:
				(yy_c_buf_p) =
				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];

				yy_current_state = yy_get_previous_state(  );

				yy_cp = (yy_c_buf_p);
				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
				goto yy_find_action;
			}
		break;
		}

	default:
		YY_FATAL_ERROR(
			"fatal flex scanner internal error--no action found" );
	} /* end of action switch */
		} /* end of scanning one token */
1087
} /* end of ncsa_lex */
Sven Neumann's avatar
Sven Neumann committed
1088 1089 1090 1091

/* yy_get_next_buffer - try to read in a new buffer
 *
 * Returns a code representing an action:
1092 1093 1094
 *	EOB_ACT_LAST_MATCH -
 *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 *	EOB_ACT_END_OF_FILE - end of file
Sven Neumann's avatar
Sven Neumann committed
1095
 */
1096 1097
static int yy_get_next_buffer (void)
{
1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141
    	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
	register char *source = (yytext_ptr);
	register int number_to_move, i;
	int ret_val;

	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
		YY_FATAL_ERROR(
		"fatal flex scanner internal error--end of buffer missed" );

	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
		{ /* Don't try to fill the buffer, so this is an EOF. */
		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
			{
			/* We matched a single character, the EOB, so
			 * treat this as a final EOF.
			 */
			return EOB_ACT_END_OF_FILE;
			}

		else
			{
			/* We matched some text prior to the EOB, first
			 * process it.
			 */
			return EOB_ACT_LAST_MATCH;
			}
		}

	/* Try to read more data. */

	/* First move last chars to start of buffer. */
	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;

	for ( i = 0; i < number_to_move; ++i )
		*(dest++) = *(source++);

	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
		/* don't do the read, it's not guaranteed to return an EOF,
		 * just force an EOF
		 */
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;

	else
		{
1142
			yy_size_t num_to_read =
1143 1144 1145 1146 1147 1148
			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;

		while ( num_to_read <= 0 )
			{ /* Not enough room in the buffer - grow it. */

			/* just a shorter name for the current buffer */
1149
			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1150 1151 1152 1153 1154 1155

			int yy_c_buf_p_offset =
				(int) ((yy_c_buf_p) - b->yy_ch_buf);

			if ( b->yy_is_our_buffer )
				{
1156
				yy_size_t new_size = b->yy_buf_size * 2;
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186

				if ( new_size <= 0 )
					b->yy_buf_size += b->yy_buf_size / 8;
				else
					b->yy_buf_size *= 2;

				b->yy_ch_buf = (char *)
					/* Include room in for 2 EOB chars. */
					ncsa_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
				}
			else
				/* Can't grow it, we don't own it. */
				b->yy_ch_buf = 0;

			if ( ! b->yy_ch_buf )
				YY_FATAL_ERROR(
				"fatal error - scanner input buffer overflow" );

			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];

			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
						number_to_move - 1;

			}

		if ( num_to_read > YY_READ_BUF_SIZE )
			num_to_read = YY_READ_BUF_SIZE;

		/* Read in more data. */
		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1187
			(yy_n_chars), num_to_read );
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223

		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	if ( (yy_n_chars) == 0 )
		{
		if ( number_to_move == YY_MORE_ADJ )
			{
			ret_val = EOB_ACT_END_OF_FILE;
			ncsa_restart(ncsa_in  );
			}

		else
			{
			ret_val = EOB_ACT_LAST_MATCH;
			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
				YY_BUFFER_EOF_PENDING;
			}
		}

	else
		ret_val = EOB_ACT_CONTINUE_SCAN;

	if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
		/* Extend the array by 50%, plus the number we really need. */
		yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncsa_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
	}

	(yy_n_chars) += number_to_move;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;

	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
Sven Neumann's avatar
Sven Neumann committed
1224

1225
	return ret_val;
1226
}
Sven Neumann's avatar
Sven Neumann committed
1227 1228 1229

/* yy_get_previous_state - get the state just before the EOB char was reached */

1230 1231
    static yy_state_type yy_get_previous_state (void)
{
1232 1233
	register yy_state_type yy_current_state;
	register char *yy_cp;
1234

1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254
	yy_current_state = (yy_start);

	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
		{
		register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
		if ( yy_accept[yy_current_state] )
			{
			(yy_last_accepting_state) = yy_current_state;
			(yy_last_accepting_cpos) = yy_cp;
			}
		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
			{
			yy_current_state = (int) yy_def[yy_current_state];
			if ( yy_current_state >= 76 )
				yy_c = yy_meta[(unsigned int) yy_c];
			}
		yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
		}

	return yy_current_state;
1255
}
Sven Neumann's avatar
Sven Neumann committed
1256 1257 1258 1259

/* yy_try_NUL_trans - try to make a transition on the NUL character
 *
 * synopsis
1260
 *	next_state = yy_try_NUL_trans( current_state );
Sven Neumann's avatar
Sven Neumann committed
1261
 */
1262 1263
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
{
1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281
	register int yy_is_jam;
    	register char *yy_cp = (yy_c_buf_p);

	register YY_CHAR yy_c = 1;
	if ( yy_accept[yy_current_state] )
		{
		(yy_last_accepting_state) = yy_current_state;
		(yy_last_accepting_cpos) = yy_cp;
		}
	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
		{
		yy_current_state = (int) yy_def[yy_current_state];
		if ( yy_current_state >= 76 )
			yy_c = yy_meta[(unsigned int) yy_c];
		}
	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
	yy_is_jam = (yy_current_state == 75);

1282
		return yy_is_jam ? 0 : yy_current_state;
1283
}
Sven Neumann's avatar
Sven Neumann committed
1284

1285
#ifndef YY_NO_INPUT
Sven Neumann's avatar
Sven Neumann committed
1286
#ifdef __cplusplus
1287
    static int yyinput (void)
Sven Neumann's avatar
Sven Neumann committed
1288
#else
1289
    static int input  (void)
Sven Neumann's avatar
Sven Neumann committed
1290 1291
#endif

1292
{
1293
	int c;
1294

1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308
	*(yy_c_buf_p) = (yy_hold_char);

	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
		{
		/* yy_c_buf_p now points to the character we want to return.
		 * If this occurs *before* the EOB characters, then it's a
		 * valid NUL; if not, then we've hit the end of the buffer.
		 */
		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
			/* This was really a NUL. */
			*(yy_c_buf_p) = '\0';

		else
			{ /* need more input */
1309
			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336
			++(yy_c_buf_p);

			switch ( yy_get_next_buffer(  ) )
				{
				case EOB_ACT_LAST_MATCH:
					/* This happens because yy_g_n_b()
					 * sees that we've accumulated a
					 * token and flags that we need to
					 * try matching the token before
					 * proceeding.  But for input(),
					 * there's no matching to consider.
					 * So convert the EOB_ACT_LAST_MATCH
					 * to EOB_ACT_END_OF_FILE.
					 */

					/* Reset buffer status. */
					ncsa_restart(ncsa_in );

					/*FALLTHROUGH*/

				case EOB_ACT_END_OF_FILE:
					{
					if ( ncsa_wrap( ) )
						return EOF;

					if ( ! (yy_did_buffer_switch_on_eof) )
						YY_NEW_FILE;
Sven Neumann's avatar
Sven Neumann committed
1337
#ifdef __cplusplus
1338
					return yyinput();
Sven Neumann's avatar
Sven Neumann committed
1339
#else
1340
					return input();
Sven Neumann's avatar
Sven Neumann committed
1341
#endif
1342
					}
Sven Neumann's avatar
Sven Neumann committed
1343

1344 1345 1346 1347 1348 1349
				case EOB_ACT_CONTINUE_SCAN:
					(yy_c_buf_p) = (yytext_ptr) + offset;
					break;
				}
			}
		}
Sven Neumann's avatar
Sven Neumann committed
1350

1351 1352 1353
	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
	*(yy_c_buf_p) = '\0';	/* preserve ncsa_text */
	(yy_hold_char) = *++(yy_c_buf_p);
Sven Neumann's avatar
Sven Neumann committed
1354

1355
	return c;
1356
}
1357
#endif	/* ifndef YY_NO_INPUT */
1358

1359 1360
/** Immediately switch to a different input stream.
 * @param input_file A readable stream.
1361
 *
1362 1363 1364 1365
 * @note This function does not reset the start condition to @c INITIAL .
 */
    void ncsa_restart  (FILE * input_file )
{
1366

1367
	if ( ! YY_CURRENT_BUFFER ){
1368
        ncsa_ensure_buffer_stack ();
1369
		YY_CURRENT_BUFFER_LVALUE =
1370
            ncsa__create_buffer(ncsa_in,YY_BUF_SIZE );
1371
	}
Sven Neumann's avatar
Sven Neumann committed
1372

1373 1374
	ncsa__init_buffer(YY_CURRENT_BUFFER,input_file );
	ncsa__load_buffer_state( );
1375
}
Sven Neumann's avatar
Sven Neumann committed
1376

1377 1378
/** Switch to a different input buffer.
 * @param new_buffer The new input buffer.
1379
 *
1380 1381 1382
 */
    void ncsa__switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
{
1383

1384 1385 1386 1387
	/* TODO. We should be able to replace this entire function body
	 * with
	 *		ncsa_pop_buffer_state();
	 *		ncsa_push_buffer_state(new_buffer);
1388
     */
1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409
	ncsa_ensure_buffer_stack ();
	if ( YY_CURRENT_BUFFER == new_buffer )
		return;

	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	YY_CURRENT_BUFFER_LVALUE = new_buffer;
	ncsa__load_buffer_state( );

	/* We don't actually know whether we did this switch during
	 * EOF (ncsa_wrap()) processing, but the only time this flag
	 * is looked at is after ncsa_wrap() is called, so it's safe
	 * to go ahead and always set it.
	 */
	(yy_did_buffer_switch_on_eof) = 1;
1410
}
Sven Neumann's avatar
Sven Neumann committed
1411

1412 1413
static void ncsa__load_buffer_state  (void)
{
1414 1415 1416 1417
    	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
	ncsa_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
	(yy_hold_char) = *(yy_c_buf_p);
1418 1419 1420 1421 1422
}

/** Allocate and initialize an input buffer state.
 * @param file A readable stream.
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1423
 *
1424 1425 1426 1427
 * @return the allocated buffer state.
 */
    YY_BUFFER_STATE ncsa__create_buffer  (FILE * file, int  size )
{
1428
	YY_BUFFER_STATE b;
1429

1430 1431 1432
	b = (YY_BUFFER_STATE) ncsa_alloc(sizeof( struct yy_buffer_state )  );
	if ( ! b )
		YY_FATAL_ERROR( "out of dynamic memory in ncsa__create_buffer()" );
Sven Neumann's avatar
Sven Neumann committed
1433

1434
	b->yy_buf_size = size;
Sven Neumann's avatar
Sven Neumann committed
1435

1436 1437 1438 1439 1440 1441
	/* yy_ch_buf has to be 2 characters longer than the size given because
	 * we need to put in 2 end-of-buffer characters.
	 */
	b->yy_ch_buf = (char *) ncsa_alloc(b->yy_buf_size + 2  );
	if ( ! b->yy_ch_buf )
		YY_FATAL_ERROR( "out of dynamic memory in ncsa__create_buffer()" );
Sven Neumann's avatar
Sven Neumann committed
1442

1443
	b->yy_is_our_buffer = 1;
Sven Neumann's avatar
Sven Neumann committed
1444

1445
	ncsa__init_buffer(b,file );
Sven Neumann's avatar
Sven Neumann committed
1446

1447
	return b;
1448
}
1449

1450 1451
/** Destroy the buffer.
 * @param b a buffer created with ncsa__create_buffer()
1452
 *
1453 1454 1455
 */
    void ncsa__delete_buffer (YY_BUFFER_STATE  b )
{
1456

1457 1458
	if ( ! b )
		return;
Sven Neumann's avatar
Sven Neumann committed
1459

1460 1461
	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
Sven Neumann's avatar
Sven Neumann committed
1462

1463 1464
	if ( b->yy_is_our_buffer )
		ncsa_free((void *) b->yy_ch_buf  );
Sven Neumann's avatar
Sven Neumann committed
1465

1466
	ncsa_free((void *) b  );
1467
}
Sven Neumann's avatar
Sven Neumann committed
1468

1469 1470 1471 1472 1473
/* Initializes or reinitializes a buffer.
 * This function is sometimes called more than once on the same buffer,
 * such as during a ncsa_restart() or at EOF.
 */
    static void ncsa__init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1474

1475
{
1476
	int oerrno = errno;
1477

1478
	ncsa__flush_buffer(b );
Sven Neumann's avatar
Sven Neumann committed
1479

1480 1481
	b->yy_input_file = file;
	b->yy_fill_buffer = 1;
Sven Neumann's avatar
Sven Neumann committed
1482

1483 1484 1485 1486 1487 1488 1489 1490 1491 1492
    /* If b is the current buffer, then ncsa__init_buffer was _probably_
     * called from ncsa_restart() or through yy_get_next_buffer.
     * In that case, we don't want to reset the lineno or column.
     */
    if (b != YY_CURRENT_BUFFER){
        b->yy_bs_lineno = 1;
        b->yy_bs_column = 0;
    }

        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1493

1494
	errno = oerrno;
1495 1496 1497 1498
}

/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1499
 *
1500 1501 1502
 */
    void ncsa__flush_buffer (YY_BUFFER_STATE  b )
{
1503 1504
    	if ( ! b )
		return;
Sven Neumann's avatar
Sven Neumann committed
1505

1506
	b->yy_n_chars = 0;
Sven Neumann's avatar
Sven Neumann committed
1507

1508 1509 1510 1511 1512 1513
	/* We always need two end-of-buffer characters.  The first causes
	 * a transition to the end-of-buffer state.  The second causes
	 * a jam in that state.
	 */
	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
Sven Neumann's avatar
Sven Neumann committed
1514

1515
	b->yy_buf_pos = &b->yy_ch_buf[0];
Sven Neumann's avatar
Sven Neumann committed
1516

1517 1518
	b->yy_at_bol = 1;
	b->yy_buffer_status = YY_BUFFER_NEW;
Sven Neumann's avatar
Sven Neumann committed
1519

1520 1521
	if ( b == YY_CURRENT_BUFFER )
		ncsa__load_buffer_state( );
1522 1523 1524 1525 1526 1527
}

/** Pushes the new state onto the stack. The new state becomes
 *  the current state. This function will allocate the stack
 *  if necessary.
 *  @param new_buffer The new state.
1528
 *
1529 1530 1531
 */
void ncsa_push_buffer_state (YY_BUFFER_STATE new_buffer )
{
1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553
    	if (new_buffer == NULL)
		return;

	ncsa_ensure_buffer_stack();

	/* This block is copied from ncsa__switch_to_buffer. */
	if ( YY_CURRENT_BUFFER )
		{
		/* Flush out information for old buffer. */
		*(yy_c_buf_p) = (yy_hold_char);
		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
		}

	/* Only push if top exists. Otherwise, replace top. */
	if (YY_CURRENT_BUFFER)
		(yy_buffer_stack_top)++;
	YY_CURRENT_BUFFER_LVALUE = new_buffer;

	/* copied from ncsa__switch_to_buffer. */
	ncsa__load_buffer_state( );
	(yy_did_buffer_switch_on_eof) = 1;
1554 1555 1556 1557
}

/** Removes and deletes the top of the stack, if present.
 *  The next element becomes the new top.
1558
 *
1559 1560 1561
 */
void ncsa_pop_buffer_state (void)
{
1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573
    	if (!YY_CURRENT_BUFFER)
		return;

	ncsa__delete_buffer(YY_CURRENT_BUFFER );
	YY_CURRENT_BUFFER_LVALUE = NULL;
	if ((yy_buffer_stack_top) > 0)
		--(yy_buffer_stack_top);

	if (YY_CURRENT_BUFFER) {
		ncsa__load_buffer_state( );
		(yy_did_buffer_switch_on_eof) = 1;
	}
1574
}
Sven Neumann's avatar
Sven Neumann committed
1575

1576 1577 1578 1579 1580
/* Allocates the stack if it does not exist.
 *  Guarantees space for at least one push.
 */
static void ncsa_ensure_buffer_stack (void)
{
1581
	yy_size_t num_to_alloc;