1
#line 2 "message_lexer.lex.c"
3
#line 4 "message_lexer.lex.c"
5
#define YY_INT_ALIGNED short int
7
/* A lexical scanner generated by flex */
9
#define yy_create_buffer message__create_buffer
10
#define yy_delete_buffer message__delete_buffer
11
#define yy_flex_debug message__flex_debug
12
#define yy_init_buffer message__init_buffer
13
#define yy_flush_buffer message__flush_buffer
14
#define yy_load_buffer_state message__load_buffer_state
15
#define yy_switch_to_buffer message__switch_to_buffer
16
#define yyin message_in
17
#define yyleng message_leng
18
#define yylex message_lex
19
#define yylineno message_lineno
20
#define yyout message_out
21
#define yyrestart message_restart
22
#define yytext message_text
23
#define yywrap message_wrap
24
#define yyalloc message_alloc
25
#define yyrealloc message_realloc
26
#define yyfree message_free
29
#define YY_FLEX_MAJOR_VERSION 2
30
#define YY_FLEX_MINOR_VERSION 5
31
#define YY_FLEX_SUBMINOR_VERSION 35
32
#if YY_FLEX_SUBMINOR_VERSION > 0
36
/* First, we deal with platform-specific or compiler-specific issues. */
38
/* begin standard C headers. */
44
/* end standard C headers. */
46
/* flex integer type definitions */
51
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
53
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
55
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
56
* if you want the limit (max/min) macros for int types.
58
#ifndef __STDC_LIMIT_MACROS
59
#define __STDC_LIMIT_MACROS 1
63
typedef int8_t flex_int8_t;
64
typedef uint8_t flex_uint8_t;
65
typedef int16_t flex_int16_t;
66
typedef uint16_t flex_uint16_t;
67
typedef int32_t flex_int32_t;
68
typedef uint32_t flex_uint32_t;
70
typedef signed char flex_int8_t;
71
typedef short int flex_int16_t;
72
typedef int flex_int32_t;
73
typedef unsigned char flex_uint8_t;
74
typedef unsigned short int flex_uint16_t;
75
typedef unsigned int flex_uint32_t;
77
/* Limits of integral types. */
79
#define INT8_MIN (-128)
82
#define INT16_MIN (-32767-1)
85
#define INT32_MIN (-2147483647-1)
88
#define INT8_MAX (127)
91
#define INT16_MAX (32767)
94
#define INT32_MAX (2147483647)
97
#define UINT8_MAX (255U)
100
#define UINT16_MAX (65535U)
103
#define UINT32_MAX (4294967295U)
108
#endif /* ! FLEXINT_H */
112
/* The "const" storage-class-modifier is valid. */
115
#else /* ! __cplusplus */
117
/* C99 requires __STDC__ to be defined as 1. */
118
#if defined (__STDC__)
122
#endif /* defined (__STDC__) */
123
#endif /* ! __cplusplus */
126
#define yyconst const
131
/* Returned upon end-of-file. */
134
/* Promotes a possibly negative, possibly signed char to an unsigned
135
* integer for use as an array index. If the signed char is negative,
136
* we want to instead treat it as an 8-bit unsigned char, hence the
139
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
141
/* Enter a start condition. This macro really ought to take a parameter,
142
* but we do it the disgusting crufty way forced on us by the ()-less
143
* definition of BEGIN.
145
#define BEGIN (yy_start) = 1 + 2 *
147
/* Translate the current start state into a value that can be later handed
148
* to BEGIN to return to the state. The YYSTATE alias is for lex
151
#define YY_START (((yy_start) - 1) / 2)
152
#define YYSTATE YY_START
154
/* Action number for EOF rule of a given start state. */
155
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
157
/* Special action meaning "start processing a new file". */
158
#define YY_NEW_FILE message_restart(message_in )
160
#define YY_END_OF_BUFFER_CHAR 0
162
/* Size of default input buffer. */
165
/* On IA-64, the buffer size is 16k, not 8k.
166
* Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
167
* Ditto for the __ia64__ case accordingly.
169
#define YY_BUF_SIZE 32768
171
#define YY_BUF_SIZE 16384
172
#endif /* __ia64__ */
175
/* The state buf must be large enough to hold one state per character in the main buffer.
177
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
179
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
180
#define YY_TYPEDEF_YY_BUFFER_STATE
181
typedef struct yy_buffer_state *YY_BUFFER_STATE;
184
extern int message_leng;
186
extern FILE *message_in, *message_out;
188
#define EOB_ACT_CONTINUE_SCAN 0
189
#define EOB_ACT_END_OF_FILE 1
190
#define EOB_ACT_LAST_MATCH 2
192
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
193
* access to the local variable yy_act. Since yyless() is a macro, it would break
194
* existing scanners that call yyless() from OUTSIDE message_lex.
195
* One obvious solution it to make yy_act a global. I tried that, and saw
196
* a 5% performance hit in a non-message_lineno scanner, because yy_act is
197
* normally declared as a register variable-- so it is not worth it.
199
#define YY_LESS_LINENO(n) \
202
for ( yyl = n; yyl < message_leng; ++yyl )\
203
if ( message_text[yyl] == '\n' )\
207
/* Return all but the first "n" matched characters back to the input stream. */
211
/* Undo effects of setting up message_text. */ \
212
int yyless_macro_arg = (n); \
213
YY_LESS_LINENO(yyless_macro_arg);\
214
*yy_cp = (yy_hold_char); \
215
YY_RESTORE_YY_MORE_OFFSET \
216
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
217
YY_DO_BEFORE_ACTION; /* set up message_text again */ \
221
#define unput(c) yyunput( c, (yytext_ptr) )
223
#ifndef YY_TYPEDEF_YY_SIZE_T
224
#define YY_TYPEDEF_YY_SIZE_T
225
typedef size_t yy_size_t;
228
#ifndef YY_STRUCT_YY_BUFFER_STATE
229
#define YY_STRUCT_YY_BUFFER_STATE
230
struct yy_buffer_state
234
char *yy_ch_buf; /* input buffer */
235
char *yy_buf_pos; /* current position in input buffer */
237
/* Size of input buffer in bytes, not including room for EOB
240
yy_size_t yy_buf_size;
242
/* Number of characters read into yy_ch_buf, not including EOB
247
/* Whether we "own" the buffer - i.e., we know we created it,
248
* and can realloc() it to grow it, and should free() it to
251
int yy_is_our_buffer;
253
/* Whether this is an "interactive" input source; if so, and
254
* if we're using stdio for input, then we want to use getc()
255
* instead of fread(), to make sure we stop fetching input after
258
int yy_is_interactive;
260
/* Whether we're considered to be at the beginning of a line.
261
* If so, '^' rules will be active on the next match, otherwise
266
int yy_bs_lineno; /**< The line count. */
267
int yy_bs_column; /**< The column count. */
269
/* Whether to try to fill the input buffer when we reach the
274
int yy_buffer_status;
276
#define YY_BUFFER_NEW 0
277
#define YY_BUFFER_NORMAL 1
278
/* When an EOF's been seen but there's still some text to process
279
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
280
* shouldn't try reading from the input source any more. We might
281
* still have a bunch of tokens to match, though, because of
282
* possible backing-up.
284
* When we actually see the EOF, we change the status to "new"
285
* (via message_restart()), so that the user can continue scanning by
286
* just pointing message_in at a new input file.
288
#define YY_BUFFER_EOF_PENDING 2
291
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
293
/* Stack of input buffers. */
294
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
295
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
296
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
298
/* We provide macros for accessing buffer states in case in the
299
* future we want to put the buffer states in a more general
302
* Returns the top of the stack, or NULL.
304
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
305
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
308
/* Same as previous macro, but useful when we know that the buffer stack is not
309
* NULL or when we need an lvalue. For internal use only.
311
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
313
/* yy_hold_char holds the character lost when message_text is formed. */
314
static char yy_hold_char;
315
static int yy_n_chars; /* number of characters read into yy_ch_buf */
318
/* Points to current character in buffer. */
319
static char *yy_c_buf_p = (char *) 0;
320
static int yy_init = 0; /* whether we need to initialize */
321
static int yy_start = 0; /* start state number */
323
/* Flag which is used to allow message_wrap()'s to do buffer switches
324
* instead of setting up a fresh message_in. A bit of a hack ...
326
static int yy_did_buffer_switch_on_eof;
328
void message_restart (FILE *input_file );
329
void message__switch_to_buffer (YY_BUFFER_STATE new_buffer );
330
YY_BUFFER_STATE message__create_buffer (FILE *file,int size );
331
void message__delete_buffer (YY_BUFFER_STATE b );
332
void message__flush_buffer (YY_BUFFER_STATE b );
333
void message_push_buffer_state (YY_BUFFER_STATE new_buffer );
334
void message_pop_buffer_state (void );
336
static void message_ensure_buffer_stack (void );
337
static void message__load_buffer_state (void );
338
static void message__init_buffer (YY_BUFFER_STATE b,FILE *file );
340
#define YY_FLUSH_BUFFER message__flush_buffer(YY_CURRENT_BUFFER )
342
YY_BUFFER_STATE message__scan_buffer (char *base,yy_size_t size );
343
YY_BUFFER_STATE message__scan_string (yyconst char *yy_str );
344
YY_BUFFER_STATE message__scan_bytes (yyconst char *bytes,int len );
346
void *message_alloc (yy_size_t );
347
void *message_realloc (void *,yy_size_t );
348
void message_free (void * );
350
#define yy_new_buffer message__create_buffer
352
#define yy_set_interactive(is_interactive) \
354
if ( ! YY_CURRENT_BUFFER ){ \
355
message_ensure_buffer_stack (); \
356
YY_CURRENT_BUFFER_LVALUE = \
357
message__create_buffer(message_in,YY_BUF_SIZE ); \
359
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
362
#define yy_set_bol(at_bol) \
364
if ( ! YY_CURRENT_BUFFER ){\
365
message_ensure_buffer_stack (); \
366
YY_CURRENT_BUFFER_LVALUE = \
367
message__create_buffer(message_in,YY_BUF_SIZE ); \
369
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
372
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
374
/* Begin user sect3 */
376
#define message_wrap(n) 1
377
#define YY_SKIP_YYWRAP
379
typedef unsigned char YY_CHAR;
381
FILE *message_in = (FILE *) 0, *message_out = (FILE *) 0;
383
typedef int yy_state_type;
385
extern int message_lineno;
387
int message_lineno = 1;
389
extern char *message_text;
390
#define yytext_ptr message_text
392
static yy_state_type yy_get_previous_state (void );
393
static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
394
static int yy_get_next_buffer (void );
395
static void yy_fatal_error (yyconst char msg[] );
397
/* Done after the current pattern has been matched and before the
398
* corresponding action - sets up message_text.
400
#define YY_DO_BEFORE_ACTION \
401
(yytext_ptr) = yy_bp; \
402
message_leng = (size_t) (yy_cp - yy_bp); \
403
(yy_hold_char) = *yy_cp; \
405
(yy_c_buf_p) = yy_cp;
407
#define YY_NUM_RULES 21
408
#define YY_END_OF_BUFFER 22
409
/* This struct is not used in this scanner,
410
but its presence is necessary. */
413
flex_int32_t yy_verify;
416
static yyconst flex_int16_t yy_accept[66] =
418
0, 0, 0, 0, 10, 10, 19, 19, 22, 20,
419
11, 11, 7, 20, 20, 6, 6, 15, 16, 15,
420
10, 9, 8, 19, 18, 0, 0, 0, 12, 17,
421
6, 6, 13, 10, 19, 0, 0, 0, 6, 14,
422
0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
423
0, 0, 0, 0, 4, 0, 0, 3, 0, 2,
427
static yyconst flex_int32_t yy_ec[256] =
429
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
430
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
431
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432
1, 2, 1, 4, 1, 1, 1, 1, 1, 1,
433
1, 5, 1, 1, 6, 7, 8, 6, 6, 9,
434
6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
435
1, 1, 1, 1, 10, 10, 10, 10, 10, 10,
436
10, 10, 10, 10, 10, 11, 10, 12, 10, 10,
437
10, 10, 10, 10, 13, 10, 10, 10, 10, 10,
438
1, 1, 1, 1, 6, 1, 14, 10, 15, 16,
440
17, 10, 10, 10, 18, 10, 10, 10, 19, 20,
441
21, 10, 22, 10, 23, 10, 24, 10, 10, 10,
442
10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
443
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
444
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
445
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
446
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
447
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
449
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
455
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
459
static yyconst flex_int32_t yy_meta[25] =
461
1, 1, 2, 3, 1, 4, 1, 1, 4, 4,
462
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
466
static yyconst flex_int16_t yy_base[72] =
468
0, 0, 22, 23, 26, 28, 86, 85, 87, 90,
469
90, 90, 90, 19, 30, 0, 73, 90, 90, 77,
470
0, 90, 90, 0, 90, 60, 64, 65, 90, 90,
471
0, 70, 77, 0, 0, 63, 62, 55, 65, 90,
472
57, 62, 49, 0, 51, 57, 53, 57, 49, 47,
473
52, 48, 49, 44, 51, 40, 39, 90, 29, 90,
474
26, 20, 19, 90, 90, 42, 46, 50, 30, 54,
478
static yyconst flex_int16_t yy_def[72] =
480
65, 1, 66, 66, 67, 67, 68, 68, 65, 65,
481
65, 65, 65, 65, 65, 69, 69, 65, 65, 65,
482
70, 65, 65, 71, 65, 65, 65, 65, 65, 65,
483
69, 69, 65, 70, 71, 65, 65, 65, 69, 65,
484
65, 65, 65, 69, 65, 65, 65, 65, 65, 65,
485
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
486
65, 65, 65, 65, 0, 65, 65, 65, 65, 65,
490
static yyconst flex_int16_t yy_nxt[115] =
492
10, 11, 12, 13, 10, 10, 14, 15, 10, 16,
493
16, 17, 16, 16, 16, 16, 16, 16, 16, 16,
494
16, 16, 16, 16, 19, 19, 20, 20, 22, 23,
495
22, 23, 26, 31, 29, 64, 27, 30, 63, 62,
496
61, 28, 18, 18, 18, 18, 21, 21, 21, 21,
497
24, 24, 24, 24, 34, 60, 59, 34, 35, 58,
498
35, 35, 57, 56, 55, 54, 53, 52, 51, 50,
499
49, 48, 47, 46, 45, 44, 43, 42, 41, 40,
500
39, 38, 37, 36, 33, 32, 65, 25, 25, 9,
501
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
503
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
507
static yyconst flex_int16_t yy_chk[115] =
509
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
510
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
511
1, 1, 1, 1, 3, 4, 3, 4, 5, 5,
512
6, 6, 14, 69, 15, 63, 14, 15, 62, 61,
513
59, 14, 66, 66, 66, 66, 67, 67, 67, 67,
514
68, 68, 68, 68, 70, 57, 56, 70, 71, 55,
515
71, 71, 54, 53, 52, 51, 50, 49, 48, 47,
516
46, 45, 43, 42, 41, 39, 38, 37, 36, 33,
517
32, 28, 27, 26, 20, 17, 9, 8, 7, 65,
518
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
520
65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
524
/* Table of booleans, true if rule could match eol. */
525
static yyconst flex_int32_t yy_rule_can_match_eol[22] =
527
0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0,
530
static yy_state_type yy_last_accepting_state;
531
static char *yy_last_accepting_cpos;
533
extern int message__flex_debug;
534
int message__flex_debug = 0;
536
/* The intent behind this definition is that it'll catch
537
* any uses of REJECT which flex missed.
539
#define REJECT reject_used_but_not_detected
540
#define yymore() yymore_used_but_not_detected
541
#define YY_MORE_ADJ 0
542
#define YY_RESTORE_YY_MORE_OFFSET
544
#line 1 "message_lexer.l"
546
This file is part of Warzone 2100.
547
Copyright (C) 1999-2004 Eidos Interactive
548
Copyright (C) 2008 Giel van Schijndel
549
Copyright (C) 2005-2009 Warzone Resurrection Project
551
Warzone 2100 is free software; you can redistribute it and/or modify
552
it under the terms of the GNU General Public License as published by
553
the Free Software Foundation; either version 2 of the License, or
554
(at your option) any later version.
556
Warzone 2100 is distributed in the hope that it will be useful,
557
but WITHOUT ANY WARRANTY; without even the implied warranty of
558
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
559
GNU General Public License for more details.
561
You should have received a copy of the GNU General Public License
562
along with Warzone 2100; if not, write to the Free Software
563
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
565
#line 22 "message_lexer.l"
568
* Lexical analyser for message data
571
#include "lib/framework/frame.h"
572
#include "messagedef.h"
574
/* Get the Yacc definitions */
575
#include "message_parser.tab.h"
577
#include "lib/framework/lexer_input.h"
578
#include "messagely.h"
581
# define yyextra message_get_extra()
584
/* Older GNU Flex versions don't define message_get_extra(), message_set_extra(),
585
* message_get_text() and message_get_lineno().
586
* (and neither define a subminor version)
588
#if !defined(YY_FLEX_SUBMINOR_VERSION) || (YY_FLEX_SUBMINOR_VERSION < 9)
589
# define message_get_extra message_get_extra
590
# define message_set_extra message_set_extra
591
# define message_get_lineno message_get_lineno
592
# define message_get_text message_get_text
593
extern void message_set_extra(YY_EXTRA_TYPE user_defined);
594
extern YY_EXTRA_TYPE message_get_extra(void);
595
extern int message_get_lineno(void);
596
int message_get_lineno()
598
return message_lineno;
601
extern char* message_get_text(void);
602
char* message_get_text()
606
#elif defined(YY_FLEX_SUBMINOR_VERSION) && YY_FLEX_SUBMINOR_VERSION == 33
607
extern YY_EXTRA_TYPE message_get_extra(void);
608
extern int message_get_lineno(void);
609
extern FILE *message_get_in(void);
610
extern FILE *message_get_out(void);
611
extern int message_get_leng(void);
612
extern char *message_get_text(void);
613
extern void message_set_lineno(int line_number);
614
extern void message_set_in(FILE* in_str);
615
extern void message_set_out(FILE* out_str);
616
extern int message_get_debug(void);
617
extern void message_set_debug(int bdebug);
623
#line 624 "message_lexer.lex.c"
630
#ifndef YY_NO_UNISTD_H
631
/* Special case for "unistd.h", since it is non-ANSI. We include it way
632
* down here because we want the user's section 1 to have been scanned first.
633
* The user has a chance to override it with an option.
638
#ifndef YY_EXTRA_TYPE
639
#define YY_EXTRA_TYPE void *
642
static int yy_init_globals (void );
644
/* Accessor methods to globals.
645
These are made visible to non-reentrant scanners for convenience. */
647
int message_lex_destroy (void );
649
int message_get_debug (void );
651
void message_set_debug (int debug_flag );
653
YY_EXTRA_TYPE message_get_extra (void );
655
void message_set_extra (YY_EXTRA_TYPE user_defined );
657
FILE *message_get_in (void );
659
void message_set_in (FILE * in_str );
661
FILE *message_get_out (void );
663
void message_set_out (FILE * out_str );
665
int message_get_leng (void );
667
char *message_get_text (void );
669
int message_get_lineno (void );
671
void message_set_lineno (int line_number );
673
/* Macros after this point can all be overridden by user definitions in
677
#ifndef YY_SKIP_YYWRAP
679
extern "C" int message_wrap (void );
681
extern int message_wrap (void );
686
static void yy_flex_strncpy (char *,yyconst char *,int );
689
#ifdef YY_NEED_STRLEN
690
static int yy_flex_strlen (yyconst char * );
696
static int yyinput (void );
698
static int input (void );
703
/* Amount of stuff to slurp up with each read. */
704
#ifndef YY_READ_BUF_SIZE
706
/* On IA-64, the buffer size is 16k, not 8k */
707
#define YY_READ_BUF_SIZE 16384
709
#define YY_READ_BUF_SIZE 8192
710
#endif /* __ia64__ */
713
/* Copy whatever the last rule matched to the standard output. */
715
/* This used to be an fputs(), but since the string might contain NUL's,
716
* we now use fwrite().
718
#define ECHO do { if (fwrite( message_text, message_leng, 1, message_out )) {} } while (0)
721
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
722
* is returned in "result".
725
#define YY_INPUT(buf,result,max_size) \
726
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
730
for ( n = 0; n < max_size && \
731
(c = getc( message_in )) != EOF && c != '\n'; ++n ) \
734
buf[n++] = (char) c; \
735
if ( c == EOF && ferror( message_in ) ) \
736
YY_FATAL_ERROR( "input in flex scanner failed" ); \
742
while ( (result = fread(buf, 1, max_size, message_in))==0 && ferror(message_in)) \
744
if( errno != EINTR) \
746
YY_FATAL_ERROR( "input in flex scanner failed" ); \
750
clearerr(message_in); \
757
/* No semi-colon after return; correct usage is to write "yyterminate();" -
758
* we don't want an extra ';' after the "return" because that will cause
759
* some compilers to complain about unreachable statements.
762
#define yyterminate() return YY_NULL
765
/* Number of entries by which start-condition stack grows. */
766
#ifndef YY_START_STACK_INCR
767
#define YY_START_STACK_INCR 25
770
/* Report a fatal error. */
771
#ifndef YY_FATAL_ERROR
772
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
775
/* end tables serialization structures and prototypes */
777
/* Default declaration of generated scanner - a define so the user can
778
* easily add parameters.
781
#define YY_DECL_IS_OURS 1
783
extern int message_lex (void);
785
#define YY_DECL int message_lex (void)
786
#endif /* !YY_DECL */
788
/* Code executed at the beginning of each rule, after message_text and message_leng
791
#ifndef YY_USER_ACTION
792
#define YY_USER_ACTION
795
/* Code executed at the end of each rule. */
797
#define YY_BREAK break;
800
#define YY_RULE_SETUP \
803
/** The main scanner function which does all the work.
807
register yy_state_type yy_current_state;
808
register char *yy_cp, *yy_bp;
811
#line 85 "message_lexer.l"
814
#line 815 "message_lexer.lex.c"
825
(yy_start) = 1; /* first start state */
831
message_out = stdout;
833
if ( ! YY_CURRENT_BUFFER ) {
834
message_ensure_buffer_stack ();
835
YY_CURRENT_BUFFER_LVALUE =
836
message__create_buffer(message_in,YY_BUF_SIZE );
839
message__load_buffer_state( );
842
while ( 1 ) /* loops until end-of-file is reached */
844
yy_cp = (yy_c_buf_p);
846
/* Support of message_text. */
847
*yy_cp = (yy_hold_char);
849
/* yy_bp points to the position in yy_ch_buf of the start of
854
yy_current_state = (yy_start);
858
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
859
if ( yy_accept[yy_current_state] )
861
(yy_last_accepting_state) = yy_current_state;
862
(yy_last_accepting_cpos) = yy_cp;
864
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
866
yy_current_state = (int) yy_def[yy_current_state];
867
if ( yy_current_state >= 66 )
868
yy_c = yy_meta[(unsigned int) yy_c];
870
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
873
while ( yy_base[yy_current_state] != 90 );
876
yy_act = yy_accept[yy_current_state];
878
{ /* have to back up */
879
yy_cp = (yy_last_accepting_cpos);
880
yy_current_state = (yy_last_accepting_state);
881
yy_act = yy_accept[yy_current_state];
886
if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
889
for ( yyl = 0; yyl < message_leng; ++yyl )
890
if ( message_text[yyl] == '\n' )
896
do_action: /* This label is used only to access EOF actions. */
899
{ /* beginning of action switch */
900
case 0: /* must back up */
901
/* undo the effects of YY_DO_BEFORE_ACTION */
902
*yy_cp = (yy_hold_char);
903
yy_cp = (yy_last_accepting_cpos);
904
yy_current_state = (yy_last_accepting_state);
909
#line 87 "message_lexer.l"
910
{ message_lval.sval = NULL; return NULL_T; }
914
#line 88 "message_lexer.l"
915
{ return AUDIO_NAME_T; }
919
#line 89 "message_lexer.l"
920
{ return IMD_NAME2_T; }
924
#line 90 "message_lexer.l"
925
{ return IMD_NAME_T; }
929
#line 91 "message_lexer.l"
930
{ return SEQUENCE_NAME_T; }
932
/* Match text values */
935
#line 94 "message_lexer.l"
937
message_lval.sval = strdup(message_text);
941
/* Match quoted text */
944
#line 100 "message_lexer.l"
949
#line 101 "message_lexer.l"
953
/* rule 9 can match eol */
955
#line 102 "message_lexer.l"
956
{ message_error("Unexpected end of line in string"); }
960
#line 103 "message_lexer.l"
962
message_lval.sval = strdup(message_text);
966
/* Skip white space */
968
/* rule 11 can match eol */
970
#line 109 "message_lexer.l"
976
#line 112 "message_lexer.l"
980
#line 114 "message_lexer.l"
982
/* rule 14 can match eol */
984
#line 114 "message_lexer.l"
988
#line 116 "message_lexer.l"
990
/* rule 16 can match eol */
992
#line 116 "message_lexer.l"
995
/* Strip single line comments */
998
#line 119 "message_lexer.l"
1002
/* rule 18 can match eol */
1004
#line 120 "message_lexer.l"
1009
#line 121 "message_lexer.l"
1012
/* Match anything that's been missed and pass it as a char */
1015
#line 124 "message_lexer.l"
1016
return message_text[0];
1020
#line 126 "message_lexer.l"
1023
#line 1024 "message_lexer.lex.c"
1024
case YY_STATE_EOF(INITIAL):
1025
case YY_STATE_EOF(COMMENT):
1026
case YY_STATE_EOF(QUOTE):
1027
case YY_STATE_EOF(SLCOMMENT):
1030
case YY_END_OF_BUFFER:
1032
/* Amount of text matched not including the EOB char. */
1033
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1035
/* Undo the effects of YY_DO_BEFORE_ACTION. */
1036
*yy_cp = (yy_hold_char);
1037
YY_RESTORE_YY_MORE_OFFSET
1039
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1041
/* We're scanning a new file or input source. It's
1042
* possible that this happened because the user
1043
* just pointed message_in at a new source and called
1044
* message_lex(). If so, then we have to assure
1045
* consistency between YY_CURRENT_BUFFER and our
1046
* globals. Here is the right place to do so, because
1047
* this is the first action (other than possibly a
1048
* back-up) that will match for the new input source.
1050
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1051
YY_CURRENT_BUFFER_LVALUE->yy_input_file = message_in;
1052
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1055
/* Note that here we test for yy_c_buf_p "<=" to the position
1056
* of the first EOB in the buffer, since yy_c_buf_p will
1057
* already have been incremented past the NUL character
1058
* (since all states make transitions on EOB to the
1059
* end-of-buffer state). Contrast this with the test
1062
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1063
{ /* This was really a NUL. */
1064
yy_state_type yy_next_state;
1066
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1068
yy_current_state = yy_get_previous_state( );
1070
/* Okay, we're now positioned to make the NUL
1071
* transition. We couldn't have
1072
* yy_get_previous_state() go ahead and do it
1073
* for us because it doesn't know how to deal
1074
* with the possibility of jamming (and we don't
1075
* want to build jamming into it because then it
1076
* will run more slowly).
1079
yy_next_state = yy_try_NUL_trans( yy_current_state );
1081
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1083
if ( yy_next_state )
1085
/* Consume the NUL. */
1086
yy_cp = ++(yy_c_buf_p);
1087
yy_current_state = yy_next_state;
1093
yy_cp = (yy_c_buf_p);
1094
goto yy_find_action;
1098
else switch ( yy_get_next_buffer( ) )
1100
case EOB_ACT_END_OF_FILE:
1102
(yy_did_buffer_switch_on_eof) = 0;
1104
if ( message_wrap( ) )
1106
/* Note: because we've taken care in
1107
* yy_get_next_buffer() to have set up
1108
* message_text, we can now set up
1109
* yy_c_buf_p so that if some total
1110
* hoser (like flex itself) wants to
1111
* call the scanner after we return the
1112
* YY_NULL, it'll still work - another
1113
* YY_NULL will get returned.
1115
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1117
yy_act = YY_STATE_EOF(YY_START);
1123
if ( ! (yy_did_buffer_switch_on_eof) )
1129
case EOB_ACT_CONTINUE_SCAN:
1131
(yytext_ptr) + yy_amount_of_matched_text;
1133
yy_current_state = yy_get_previous_state( );
1135
yy_cp = (yy_c_buf_p);
1136
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1139
case EOB_ACT_LAST_MATCH:
1141
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1143
yy_current_state = yy_get_previous_state( );
1145
yy_cp = (yy_c_buf_p);
1146
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1147
goto yy_find_action;
1154
"fatal flex scanner internal error--no action found" );
1155
} /* end of action switch */
1156
} /* end of scanning one token */
1157
} /* end of message_lex */
1159
/* yy_get_next_buffer - try to read in a new buffer
1161
* Returns a code representing an action:
1162
* EOB_ACT_LAST_MATCH -
1163
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1164
* EOB_ACT_END_OF_FILE - end of file
1166
static int yy_get_next_buffer (void)
1168
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1169
register char *source = (yytext_ptr);
1170
register int number_to_move, i;
1173
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1175
"fatal flex scanner internal error--end of buffer missed" );
1177
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1178
{ /* Don't try to fill the buffer, so this is an EOF. */
1179
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1181
/* We matched a single character, the EOB, so
1182
* treat this as a final EOF.
1184
return EOB_ACT_END_OF_FILE;
1189
/* We matched some text prior to the EOB, first
1192
return EOB_ACT_LAST_MATCH;
1196
/* Try to read more data. */
1198
/* First move last chars to start of buffer. */
1199
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1201
for ( i = 0; i < number_to_move; ++i )
1202
*(dest++) = *(source++);
1204
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1205
/* don't do the read, it's not guaranteed to return an EOF,
1208
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1213
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1215
while ( num_to_read <= 0 )
1216
{ /* Not enough room in the buffer - grow it. */
1218
/* just a shorter name for the current buffer */
1219
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1221
int yy_c_buf_p_offset =
1222
(int) ((yy_c_buf_p) - b->yy_ch_buf);
1224
if ( b->yy_is_our_buffer )
1226
int new_size = b->yy_buf_size * 2;
1228
if ( new_size <= 0 )
1229
b->yy_buf_size += b->yy_buf_size / 8;
1231
b->yy_buf_size *= 2;
1233
b->yy_ch_buf = (char *)
1234
/* Include room in for 2 EOB chars. */
1235
message_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1238
/* Can't grow it, we don't own it. */
1241
if ( ! b->yy_ch_buf )
1243
"fatal error - scanner input buffer overflow" );
1245
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1247
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1252
if ( num_to_read > YY_READ_BUF_SIZE )
1253
num_to_read = YY_READ_BUF_SIZE;
1255
/* Read in more data. */
1256
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1257
(yy_n_chars), (size_t) num_to_read );
1259
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1262
if ( (yy_n_chars) == 0 )
1264
if ( number_to_move == YY_MORE_ADJ )
1266
ret_val = EOB_ACT_END_OF_FILE;
1267
message_restart(message_in );
1272
ret_val = EOB_ACT_LAST_MATCH;
1273
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1274
YY_BUFFER_EOF_PENDING;
1279
ret_val = EOB_ACT_CONTINUE_SCAN;
1281
if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1282
/* Extend the array by 50%, plus the number we really need. */
1283
yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1284
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) message_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1285
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1286
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1289
(yy_n_chars) += number_to_move;
1290
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1291
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1293
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1298
/* yy_get_previous_state - get the state just before the EOB char was reached */
1300
static yy_state_type yy_get_previous_state (void)
1302
register yy_state_type yy_current_state;
1303
register char *yy_cp;
1305
yy_current_state = (yy_start);
1307
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1309
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1310
if ( yy_accept[yy_current_state] )
1312
(yy_last_accepting_state) = yy_current_state;
1313
(yy_last_accepting_cpos) = yy_cp;
1315
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1317
yy_current_state = (int) yy_def[yy_current_state];
1318
if ( yy_current_state >= 66 )
1319
yy_c = yy_meta[(unsigned int) yy_c];
1321
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1324
return yy_current_state;
1327
/* yy_try_NUL_trans - try to make a transition on the NUL character
1330
* next_state = yy_try_NUL_trans( current_state );
1332
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1334
register int yy_is_jam;
1335
register char *yy_cp = (yy_c_buf_p);
1337
register YY_CHAR yy_c = 1;
1338
if ( yy_accept[yy_current_state] )
1340
(yy_last_accepting_state) = yy_current_state;
1341
(yy_last_accepting_cpos) = yy_cp;
1343
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1345
yy_current_state = (int) yy_def[yy_current_state];
1346
if ( yy_current_state >= 66 )
1347
yy_c = yy_meta[(unsigned int) yy_c];
1349
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1350
yy_is_jam = (yy_current_state == 65);
1352
return yy_is_jam ? 0 : yy_current_state;
1357
static int yyinput (void)
1359
static int input (void)
1365
*(yy_c_buf_p) = (yy_hold_char);
1367
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1369
/* yy_c_buf_p now points to the character we want to return.
1370
* If this occurs *before* the EOB characters, then it's a
1371
* valid NUL; if not, then we've hit the end of the buffer.
1373
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1374
/* This was really a NUL. */
1375
*(yy_c_buf_p) = '\0';
1378
{ /* need more input */
1379
int offset = (yy_c_buf_p) - (yytext_ptr);
1382
switch ( yy_get_next_buffer( ) )
1384
case EOB_ACT_LAST_MATCH:
1385
/* This happens because yy_g_n_b()
1386
* sees that we've accumulated a
1387
* token and flags that we need to
1388
* try matching the token before
1389
* proceeding. But for input(),
1390
* there's no matching to consider.
1391
* So convert the EOB_ACT_LAST_MATCH
1392
* to EOB_ACT_END_OF_FILE.
1395
/* Reset buffer status. */
1396
message_restart(message_in );
1400
case EOB_ACT_END_OF_FILE:
1402
if ( message_wrap( ) )
1405
if ( ! (yy_did_buffer_switch_on_eof) )
1414
case EOB_ACT_CONTINUE_SCAN:
1415
(yy_c_buf_p) = (yytext_ptr) + offset;
1421
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1422
*(yy_c_buf_p) = '\0'; /* preserve message_text */
1423
(yy_hold_char) = *++(yy_c_buf_p);
1432
#endif /* ifndef YY_NO_INPUT */
1434
/** Immediately switch to a different input stream.
1435
* @param input_file A readable stream.
1437
* @note This function does not reset the start condition to @c INITIAL .
1439
void message_restart (FILE * input_file )
1442
if ( ! YY_CURRENT_BUFFER ){
1443
message_ensure_buffer_stack ();
1444
YY_CURRENT_BUFFER_LVALUE =
1445
message__create_buffer(message_in,YY_BUF_SIZE );
1448
message__init_buffer(YY_CURRENT_BUFFER,input_file );
1449
message__load_buffer_state( );
1452
/** Switch to a different input buffer.
1453
* @param new_buffer The new input buffer.
1456
void message__switch_to_buffer (YY_BUFFER_STATE new_buffer )
1459
/* TODO. We should be able to replace this entire function body
1461
* message_pop_buffer_state();
1462
* message_push_buffer_state(new_buffer);
1464
message_ensure_buffer_stack ();
1465
if ( YY_CURRENT_BUFFER == new_buffer )
1468
if ( YY_CURRENT_BUFFER )
1470
/* Flush out information for old buffer. */
1471
*(yy_c_buf_p) = (yy_hold_char);
1472
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1473
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1476
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1477
message__load_buffer_state( );
1479
/* We don't actually know whether we did this switch during
1480
* EOF (message_wrap()) processing, but the only time this flag
1481
* is looked at is after message_wrap() is called, so it's safe
1482
* to go ahead and always set it.
1484
(yy_did_buffer_switch_on_eof) = 1;
1487
static void message__load_buffer_state (void)
1489
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1490
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1491
message_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1492
(yy_hold_char) = *(yy_c_buf_p);
1495
/** Allocate and initialize an input buffer state.
1496
* @param file A readable stream.
1497
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1499
* @return the allocated buffer state.
1501
YY_BUFFER_STATE message__create_buffer (FILE * file, int size )
1505
b = (YY_BUFFER_STATE) message_alloc(sizeof( struct yy_buffer_state ) );
1507
YY_FATAL_ERROR( "out of dynamic memory in message__create_buffer()" );
1509
b->yy_buf_size = size;
1511
/* yy_ch_buf has to be 2 characters longer than the size given because
1512
* we need to put in 2 end-of-buffer characters.
1514
b->yy_ch_buf = (char *) message_alloc(b->yy_buf_size + 2 );
1515
if ( ! b->yy_ch_buf )
1516
YY_FATAL_ERROR( "out of dynamic memory in message__create_buffer()" );
1518
b->yy_is_our_buffer = 1;
1520
message__init_buffer(b,file );
1525
/** Destroy the buffer.
1526
* @param b a buffer created with message__create_buffer()
1529
void message__delete_buffer (YY_BUFFER_STATE b )
1535
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1536
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1538
if ( b->yy_is_our_buffer )
1539
message_free((void *) b->yy_ch_buf );
1541
message_free((void *) b );
1545
extern int isatty (int );
1546
#endif /* __cplusplus */
1548
/* Initializes or reinitializes a buffer.
1549
* This function is sometimes called more than once on the same buffer,
1550
* such as during a message_restart() or at EOF.
1552
static void message__init_buffer (YY_BUFFER_STATE b, FILE * file )
1557
message__flush_buffer(b );
1559
b->yy_input_file = file;
1560
b->yy_fill_buffer = 1;
1562
/* If b is the current buffer, then message__init_buffer was _probably_
1563
* called from message_restart() or through yy_get_next_buffer.
1564
* In that case, we don't want to reset the lineno or column.
1566
if (b != YY_CURRENT_BUFFER){
1567
b->yy_bs_lineno = 1;
1568
b->yy_bs_column = 0;
1571
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1576
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1577
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1580
void message__flush_buffer (YY_BUFFER_STATE b )
1587
/* We always need two end-of-buffer characters. The first causes
1588
* a transition to the end-of-buffer state. The second causes
1589
* a jam in that state.
1591
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1592
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1594
b->yy_buf_pos = &b->yy_ch_buf[0];
1597
b->yy_buffer_status = YY_BUFFER_NEW;
1599
if ( b == YY_CURRENT_BUFFER )
1600
message__load_buffer_state( );
1603
/** Pushes the new state onto the stack. The new state becomes
1604
* the current state. This function will allocate the stack
1606
* @param new_buffer The new state.
1609
void message_push_buffer_state (YY_BUFFER_STATE new_buffer )
1611
if (new_buffer == NULL)
1614
message_ensure_buffer_stack();
1616
/* This block is copied from message__switch_to_buffer. */
1617
if ( YY_CURRENT_BUFFER )
1619
/* Flush out information for old buffer. */
1620
*(yy_c_buf_p) = (yy_hold_char);
1621
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1622
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1625
/* Only push if top exists. Otherwise, replace top. */
1626
if (YY_CURRENT_BUFFER)
1627
(yy_buffer_stack_top)++;
1628
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1630
/* copied from message__switch_to_buffer. */
1631
message__load_buffer_state( );
1632
(yy_did_buffer_switch_on_eof) = 1;
1635
/** Removes and deletes the top of the stack, if present.
1636
* The next element becomes the new top.
1639
void message_pop_buffer_state (void)
1641
if (!YY_CURRENT_BUFFER)
1644
message__delete_buffer(YY_CURRENT_BUFFER );
1645
YY_CURRENT_BUFFER_LVALUE = NULL;
1646
if ((yy_buffer_stack_top) > 0)
1647
--(yy_buffer_stack_top);
1649
if (YY_CURRENT_BUFFER) {
1650
message__load_buffer_state( );
1651
(yy_did_buffer_switch_on_eof) = 1;
1655
/* Allocates the stack if it does not exist.
1656
* Guarantees space for at least one push.
1658
static void message_ensure_buffer_stack (void)
1662
if (!(yy_buffer_stack)) {
1664
/* First allocation is just for 2 elements, since we don't know if this
1665
* scanner will even need a stack. We use 2 instead of 1 to avoid an
1666
* immediate realloc on the next call.
1669
(yy_buffer_stack) = (struct yy_buffer_state**)message_alloc
1670
(num_to_alloc * sizeof(struct yy_buffer_state*)
1672
if ( ! (yy_buffer_stack) )
1673
YY_FATAL_ERROR( "out of dynamic memory in message_ensure_buffer_stack()" );
1675
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1677
(yy_buffer_stack_max) = num_to_alloc;
1678
(yy_buffer_stack_top) = 0;
1682
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1684
/* Increase the buffer to prepare for a possible push. */
1685
int grow_size = 8 /* arbitrary grow size */;
1687
num_to_alloc = (yy_buffer_stack_max) + grow_size;
1688
(yy_buffer_stack) = (struct yy_buffer_state**)message_realloc
1690
num_to_alloc * sizeof(struct yy_buffer_state*)
1692
if ( ! (yy_buffer_stack) )
1693
YY_FATAL_ERROR( "out of dynamic memory in message_ensure_buffer_stack()" );
1695
/* zero only the new slots.*/
1696
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1697
(yy_buffer_stack_max) = num_to_alloc;
1701
/** Setup the input buffer state to scan directly from a user-specified character buffer.
1702
* @param base the character buffer
1703
* @param size the size in bytes of the character buffer
1705
* @return the newly allocated buffer state object.
1707
YY_BUFFER_STATE message__scan_buffer (char * base, yy_size_t size )
1712
base[size-2] != YY_END_OF_BUFFER_CHAR ||
1713
base[size-1] != YY_END_OF_BUFFER_CHAR )
1714
/* They forgot to leave room for the EOB's. */
1717
b = (YY_BUFFER_STATE) message_alloc(sizeof( struct yy_buffer_state ) );
1719
YY_FATAL_ERROR( "out of dynamic memory in message__scan_buffer()" );
1721
b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1722
b->yy_buf_pos = b->yy_ch_buf = base;
1723
b->yy_is_our_buffer = 0;
1724
b->yy_input_file = 0;
1725
b->yy_n_chars = b->yy_buf_size;
1726
b->yy_is_interactive = 0;
1728
b->yy_fill_buffer = 0;
1729
b->yy_buffer_status = YY_BUFFER_NEW;
1731
message__switch_to_buffer(b );
1736
/** Setup the input buffer state to scan a string. The next call to message_lex() will
1737
* scan from a @e copy of @a str.
1738
* @param yystr a NUL-terminated string to scan
1740
* @return the newly allocated buffer state object.
1741
* @note If you want to scan bytes that may contain NUL values, then use
1742
* message__scan_bytes() instead.
1744
YY_BUFFER_STATE message__scan_string (yyconst char * yystr )
1747
return message__scan_bytes(yystr,strlen(yystr) );
1750
/** Setup the input buffer state to scan the given bytes. The next call to message_lex() will
1751
* scan from a @e copy of @a bytes.
1752
* @param yybytes the byte buffer to scan
1753
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1755
* @return the newly allocated buffer state object.
1757
YY_BUFFER_STATE message__scan_bytes (yyconst char * yybytes, int _yybytes_len )
1764
/* Get memory for full buffer, including space for trailing EOB's. */
1765
n = _yybytes_len + 2;
1766
buf = (char *) message_alloc(n );
1768
YY_FATAL_ERROR( "out of dynamic memory in message__scan_bytes()" );
1770
for ( i = 0; i < _yybytes_len; ++i )
1771
buf[i] = yybytes[i];
1773
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1775
b = message__scan_buffer(buf,n );
1777
YY_FATAL_ERROR( "bad buffer in message__scan_bytes()" );
1779
/* It's okay to grow etc. this buffer, and we should throw it
1780
* away when we're done.
1782
b->yy_is_our_buffer = 1;
1787
#ifndef YY_EXIT_FAILURE
1788
#define YY_EXIT_FAILURE 2
1791
static void yy_fatal_error (yyconst char* msg )
1793
(void) fprintf( stderr, "%s\n", msg );
1794
exit( YY_EXIT_FAILURE );
1797
/* Redefine yyless() so it works in section 3 code. */
1803
/* Undo effects of setting up message_text. */ \
1804
int yyless_macro_arg = (n); \
1805
YY_LESS_LINENO(yyless_macro_arg);\
1806
message_text[message_leng] = (yy_hold_char); \
1807
(yy_c_buf_p) = message_text + yyless_macro_arg; \
1808
(yy_hold_char) = *(yy_c_buf_p); \
1809
*(yy_c_buf_p) = '\0'; \
1810
message_leng = yyless_macro_arg; \
1814
/* Accessor methods (get/set functions) to struct members. */
1816
/** Get the current line number.
1819
int message_get_lineno (void)
1822
return message_lineno;
1825
/** Get the input stream.
1828
FILE *message_get_in (void)
1833
/** Get the output stream.
1836
FILE *message_get_out (void)
1841
/** Get the length of the current token.
1844
int message_get_leng (void)
1846
return message_leng;
1849
/** Get the current token.
1853
char *message_get_text (void)
1855
return message_text;
1858
/** Set the current line number.
1859
* @param line_number
1862
void message_set_lineno (int line_number )
1865
message_lineno = line_number;
1868
/** Set the input stream. This does not discard the current
1870
* @param in_str A readable stream.
1872
* @see message__switch_to_buffer
1874
void message_set_in (FILE * in_str )
1876
message_in = in_str ;
1879
void message_set_out (FILE * out_str )
1881
message_out = out_str ;
1884
int message_get_debug (void)
1886
return message__flex_debug;
1889
void message_set_debug (int bdebug )
1891
message__flex_debug = bdebug ;
1894
static int yy_init_globals (void)
1896
/* Initialization is the same as for the non-reentrant scanner.
1897
* This function is called from message_lex_destroy(), so don't allocate here.
1900
/* We do not touch message_lineno unless the option is enabled. */
1903
(yy_buffer_stack) = 0;
1904
(yy_buffer_stack_top) = 0;
1905
(yy_buffer_stack_max) = 0;
1906
(yy_c_buf_p) = (char *) 0;
1910
/* Defined in main.c */
1913
message_out = stdout;
1915
message_in = (FILE *) 0;
1916
message_out = (FILE *) 0;
1919
/* For future reference: Set errno on error, since we are called by
1920
* message_lex_init()
1925
/* message_lex_destroy is for both reentrant and non-reentrant scanners. */
1926
int message_lex_destroy (void)
1929
/* Pop the buffer stack, destroying each element. */
1930
while(YY_CURRENT_BUFFER){
1931
message__delete_buffer(YY_CURRENT_BUFFER );
1932
YY_CURRENT_BUFFER_LVALUE = NULL;
1933
message_pop_buffer_state();
1936
/* Destroy the stack itself. */
1937
message_free((yy_buffer_stack) );
1938
(yy_buffer_stack) = NULL;
1940
/* Reset the globals. This is important in a non-reentrant scanner so the next time
1941
* message_lex() is called, initialization will occur. */
1948
* Internal utility routines.
1952
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1955
for ( i = 0; i < n; ++i )
1960
#ifdef YY_NEED_STRLEN
1961
static int yy_flex_strlen (yyconst char * s )
1964
for ( n = 0; s[n]; ++n )
1971
void *message_alloc (yy_size_t size )
1973
return (void *) malloc( size );
1976
void *message_realloc (void * ptr, yy_size_t size )
1978
/* The cast to (char *) in the following accommodates both
1979
* implementations that use char* generic pointers, and those
1980
* that use void* generic pointers. It works with the latter
1981
* because both ANSI C and C++ allow castless assignment from
1982
* any pointer type to void*, and deal with argument conversions
1983
* as though doing an assignment.
1985
return (void *) realloc( (char *) ptr, size );
1988
void message_free (void * ptr )
1990
free( (char *) ptr ); /* see message_realloc() for (char *) cast */
1993
#define YYTABLES_NAME "yytables"
1995
#line 126 "message_lexer.l"
1999
static YY_EXTRA_TYPE pBuffer = NULL;
2001
void message_set_extra(YY_EXTRA_TYPE user_defined)
2003
pBuffer = user_defined;
2006
YY_EXTRA_TYPE message_get_extra()
2011
/* Older GNU Flex versions don't define message_lex_destroy()
2012
* (and neither define a subminor version)
2014
#if !defined(YY_FLEX_SUBMINOR_VERSION) || (YY_FLEX_SUBMINOR_VERSION < 9)
2015
int message_lex_destroy(void)
2017
/* For non-reentrant C scanner only. */
2018
message__delete_buffer(YY_CURRENT_BUFFER);