5
#define YY_INT_ALIGNED short int
7
/* A lexical scanner generated by flex */
10
#define YY_FLEX_MAJOR_VERSION 2
11
#define YY_FLEX_MINOR_VERSION 5
12
#define YY_FLEX_SUBMINOR_VERSION 33
13
#if YY_FLEX_SUBMINOR_VERSION > 0
17
/* The c++ scanner is a mess. The FlexLexer.h header file relies on the
18
* following macro. This is required in order to pass the c++-multiple-scanners
19
* test in the regression suite. We get reports that it breaks inheritance.
20
* We will address this in a future release of flex, or omit the C++ scanner
23
#define yyFlexLexer yyFlexLexer
25
/* First, we deal with platform-specific or compiler-specific issues. */
27
/* begin standard C headers. */
29
/* end standard C headers. */
31
/* flex integer type definitions */
36
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
38
#if __STDC_VERSION__ >= 199901L
40
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
41
* if you want the limit (max/min) macros for int types.
43
#ifndef __STDC_LIMIT_MACROS
44
#define __STDC_LIMIT_MACROS 1
48
typedef int8_t flex_int8_t;
49
typedef uint8_t flex_uint8_t;
50
typedef int16_t flex_int16_t;
51
typedef uint16_t flex_uint16_t;
52
typedef int32_t flex_int32_t;
53
typedef uint32_t flex_uint32_t;
55
typedef signed char flex_int8_t;
56
typedef short int flex_int16_t;
57
typedef int flex_int32_t;
58
typedef unsigned char flex_uint8_t;
59
typedef unsigned short int flex_uint16_t;
60
typedef unsigned int flex_uint32_t;
63
/* Limits of integral types. */
65
#define INT8_MIN (-128)
68
#define INT16_MIN (-32767-1)
71
#define INT32_MIN (-2147483647-1)
74
#define INT8_MAX (127)
77
#define INT16_MAX (32767)
80
#define INT32_MAX (2147483647)
83
#define UINT8_MAX (255U)
86
#define UINT16_MAX (65535U)
89
#define UINT32_MAX (4294967295U)
92
#endif /* ! FLEXINT_H */
94
/* begin standard C++ headers. */
99
/* end standard C++ headers. */
103
/* The "const" storage-class-modifier is valid. */
106
#else /* ! __cplusplus */
112
#endif /* __STDC__ */
113
#endif /* ! __cplusplus */
116
#define yyconst const
121
/* Returned upon end-of-file. */
124
/* Promotes a possibly negative, possibly signed char to an unsigned
125
* integer for use as an array index. If the signed char is negative,
126
* we want to instead treat it as an 8-bit unsigned char, hence the
129
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
131
/* Enter a start condition. This macro really ought to take a parameter,
132
* but we do it the disgusting crufty way forced on us by the ()-less
133
* definition of BEGIN.
135
#define BEGIN (yy_start) = 1 + 2 *
137
/* Translate the current start state into a value that can be later handed
138
* to BEGIN to return to the state. The YYSTATE alias is for lex
141
#define YY_START (((yy_start) - 1) / 2)
142
#define YYSTATE YY_START
144
/* Action number for EOF rule of a given start state. */
145
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
147
/* Special action meaning "start processing a new file". */
148
#define YY_NEW_FILE yyrestart( yyin )
150
#define YY_END_OF_BUFFER_CHAR 0
152
/* Size of default input buffer. */
154
#define YY_BUF_SIZE 16384
157
/* The state buf must be large enough to hold one state per character in the main buffer.
159
#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
161
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
162
#define YY_TYPEDEF_YY_BUFFER_STATE
163
typedef struct yy_buffer_state *YY_BUFFER_STATE;
168
#define EOB_ACT_CONTINUE_SCAN 0
169
#define EOB_ACT_END_OF_FILE 1
170
#define EOB_ACT_LAST_MATCH 2
172
#define YY_LESS_LINENO(n)
174
/* Return all but the first "n" matched characters back to the input stream. */
178
/* Undo effects of setting up yytext. */ \
179
int yyless_macro_arg = (n); \
180
YY_LESS_LINENO(yyless_macro_arg);\
181
*yy_cp = (yy_hold_char); \
182
YY_RESTORE_YY_MORE_OFFSET \
183
(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
184
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
188
#define unput(c) yyunput( c, (yytext_ptr) )
190
/* The following is because we cannot portably get our hands on size_t
191
* (without autoconf's help, which isn't available because we want
192
* flex-generated scanners to compile on their own).
195
#ifndef YY_TYPEDEF_YY_SIZE_T
196
#define YY_TYPEDEF_YY_SIZE_T
197
typedef unsigned int yy_size_t;
200
#ifndef YY_STRUCT_YY_BUFFER_STATE
201
#define YY_STRUCT_YY_BUFFER_STATE
202
struct yy_buffer_state
205
std::istream* yy_input_file;
207
char *yy_ch_buf; /* input buffer */
208
char *yy_buf_pos; /* current position in input buffer */
210
/* Size of input buffer in bytes, not including room for EOB
213
yy_size_t yy_buf_size;
215
/* Number of characters read into yy_ch_buf, not including EOB
220
/* Whether we "own" the buffer - i.e., we know we created it,
221
* and can realloc() it to grow it, and should free() it to
224
int yy_is_our_buffer;
226
/* Whether this is an "interactive" input source; if so, and
227
* if we're using stdio for input, then we want to use getc()
228
* instead of fread(), to make sure we stop fetching input after
231
int yy_is_interactive;
233
/* Whether we're considered to be at the beginning of a line.
234
* If so, '^' rules will be active on the next match, otherwise
239
int yy_bs_lineno; /**< The line count. */
240
int yy_bs_column; /**< The column count. */
242
/* Whether to try to fill the input buffer when we reach the
247
int yy_buffer_status;
249
#define YY_BUFFER_NEW 0
250
#define YY_BUFFER_NORMAL 1
251
/* When an EOF's been seen but there's still some text to process
252
* then we mark the buffer as YY_EOF_PENDING, to indicate that we
253
* shouldn't try reading from the input source any more. We might
254
* still have a bunch of tokens to match, though, because of
255
* possible backing-up.
257
* When we actually see the EOF, we change the status to "new"
258
* (via yyrestart()), so that the user can continue scanning by
259
* just pointing yyin at a new input file.
261
#define YY_BUFFER_EOF_PENDING 2
264
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
266
/* We provide macros for accessing buffer states in case in the
267
* future we want to put the buffer states in a more general
270
* Returns the top of the stack, or NULL.
272
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
273
? (yy_buffer_stack)[(yy_buffer_stack_top)] \
276
/* Same as previous macro, but useful when we know that the buffer stack is not
277
* NULL or when we need an lvalue. For internal use only.
279
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
281
void *yyalloc (yy_size_t );
282
void *yyrealloc (void *,yy_size_t );
283
void yyfree (void * );
285
#define yy_new_buffer yy_create_buffer
287
#define yy_set_interactive(is_interactive) \
289
if ( ! YY_CURRENT_BUFFER ){ \
290
yyensure_buffer_stack (); \
291
YY_CURRENT_BUFFER_LVALUE = \
292
yy_create_buffer( yyin, YY_BUF_SIZE ); \
294
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
297
#define yy_set_bol(at_bol) \
299
if ( ! YY_CURRENT_BUFFER ){\
300
yyensure_buffer_stack (); \
301
YY_CURRENT_BUFFER_LVALUE = \
302
yy_create_buffer( yyin, YY_BUF_SIZE ); \
304
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
307
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
310
#define YY_SKIP_YYWRAP
312
typedef unsigned char YY_CHAR;
314
#define yytext_ptr yytext
315
#define YY_INTERACTIVE
317
#include <FlexLexer.h>
319
/* Done after the current pattern has been matched and before the
320
* corresponding action - sets up yytext.
322
#define YY_DO_BEFORE_ACTION \
323
(yytext_ptr) = yy_bp; \
324
yyleng = (size_t) (yy_cp - yy_bp); \
325
(yy_hold_char) = *yy_cp; \
327
(yy_c_buf_p) = yy_cp;
329
#define YY_NUM_RULES 31
330
#define YY_END_OF_BUFFER 32
331
/* This struct is not used in this scanner,
332
but its presence is necessary. */
335
flex_int32_t yy_verify;
338
static yyconst flex_int16_t yy_accept[54] =
340
0, 0, 32, 30, 21, 29, 27, 3, 4, 19,
341
18, 17, 8, 26, 1, 1, 6, 7, 22, 30,
342
30, 2, 24, 23, 28, 21, 5, 16, 29, 12,
343
11, 13, 9, 20, 0, 14, 15, 0, 0, 8,
344
0, 1, 1, 0, 24, 23, 25, 9, 0, 10,
348
static yyconst flex_int32_t yy_ec[256] =
350
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
351
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353
1, 2, 1, 1, 4, 1, 1, 1, 1, 5,
354
6, 7, 8, 1, 9, 10, 11, 12, 12, 12,
355
12, 12, 12, 12, 12, 12, 12, 1, 1, 1,
356
13, 14, 1, 1, 15, 15, 15, 15, 16, 15,
357
15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
358
15, 15, 15, 15, 17, 15, 15, 15, 15, 15,
359
18, 1, 19, 20, 21, 1, 22, 23, 23, 23,
361
24, 23, 25, 23, 23, 23, 23, 23, 23, 23,
362
23, 23, 26, 23, 27, 23, 28, 23, 23, 23,
363
23, 23, 1, 1, 1, 29, 1, 1, 1, 1,
364
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
365
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
366
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
367
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
368
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
369
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
370
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
372
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380
static yyconst flex_int32_t yy_meta[30] =
382
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
383
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384
1, 3, 3, 3, 3, 3, 3, 3, 1
387
static yyconst flex_int16_t yy_base[56] =
389
0, 0, 82, 83, 28, 0, 83, 83, 83, 83,
390
23, 25, 38, 83, 0, 53, 83, 83, 83, 16,
391
53, 83, 83, 83, 83, 50, 83, 83, 0, 67,
392
62, 42, 47, 83, 42, 83, 83, 61, 30, 0,
393
52, 83, 0, 47, 83, 83, 83, 53, 64, 58,
397
static yyconst flex_int16_t yy_def[56] =
399
53, 1, 53, 53, 53, 54, 53, 53, 53, 53,
400
53, 53, 53, 53, 55, 55, 53, 53, 53, 53,
401
53, 53, 53, 53, 53, 53, 53, 53, 54, 53,
402
53, 53, 53, 53, 53, 53, 53, 53, 53, 13,
403
53, 53, 55, 53, 53, 53, 53, 53, 53, 53,
407
static yyconst flex_int16_t yy_nxt[113] =
409
4, 5, 6, 7, 8, 9, 10, 11, 12, 4,
410
4, 13, 14, 4, 15, 15, 16, 17, 18, 19,
411
20, 21, 4, 22, 23, 4, 24, 4, 25, 26,
412
30, 49, 27, 32, 31, 28, 33, 44, 34, 35,
413
45, 50, 46, 35, 42, 36, 37, 38, 39, 40,
414
32, 26, 39, 41, 27, 34, 38, 28, 33, 51,
415
51, 41, 41, 52, 48, 49, 52, 52, 41, 50,
416
41, 47, 48, 31, 30, 50, 41, 29, 47, 29,
417
43, 53, 3, 53, 53, 53, 53, 53, 53, 53,
418
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
420
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
424
static yyconst flex_int16_t yy_chk[113] =
426
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428
1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
429
11, 39, 5, 12, 11, 5, 12, 20, 12, 13,
430
20, 39, 20, 35, 55, 13, 13, 13, 13, 13,
431
32, 26, 35, 13, 26, 32, 33, 26, 33, 41,
432
41, 13, 33, 41, 48, 49, 52, 51, 48, 50,
433
33, 44, 38, 31, 30, 49, 48, 54, 21, 54,
434
16, 3, 53, 53, 53, 53, 53, 53, 53, 53,
435
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
437
53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
441
/* The intent behind this definition is that it'll catch
442
* any uses of REJECT which flex missed.
444
#define REJECT reject_used_but_not_detected
445
#define yymore() yymore_used_but_not_detected
446
#define YY_MORE_ADJ 0
447
#define YY_RESTORE_YY_MORE_OFFSET
449
/* -*- coding: utf-8 -*- */
456
#line 457 "chemlex.cc"
460
#ifndef YY_NO_UNISTD_H
461
/* Special case for "unistd.h", since it is non-ANSI. We include it way
462
* down here because we want the user's section 1 to have been scanned first.
463
* The user has a chance to override it with an option.
468
#ifndef YY_EXTRA_TYPE
469
#define YY_EXTRA_TYPE void *
473
static void yy_flex_strncpy (char *,yyconst char *,int );
476
#ifdef YY_NEED_STRLEN
477
static int yy_flex_strlen (yyconst char * );
484
/* Amount of stuff to slurp up with each read. */
485
#ifndef YY_READ_BUF_SIZE
486
#define YY_READ_BUF_SIZE 8192
489
/* Copy whatever the last rule matched to the standard output. */
491
#define ECHO LexerOutput( yytext, yyleng )
494
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
495
* is returned in "result".
498
#define YY_INPUT(buf,result,max_size) \
500
if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
501
YY_FATAL_ERROR( "input in flex scanner failed" );
505
/* No semi-colon after return; correct usage is to write "yyterminate();" -
506
* we don't want an extra ';' after the "return" because that will cause
507
* some compilers to complain about unreachable statements.
510
#define yyterminate() return YY_NULL
513
/* Number of entries by which start-condition stack grows. */
514
#ifndef YY_START_STACK_INCR
515
#define YY_START_STACK_INCR 25
518
/* Report a fatal error. */
519
#ifndef YY_FATAL_ERROR
520
#define YY_FATAL_ERROR(msg) LexerError( msg )
523
/* end tables serialization structures and prototypes */
525
/* Default declaration of generated scanner - a define so the user can
526
* easily add parameters.
529
#define YY_DECL_IS_OURS 1
530
#define YY_DECL int yyFlexLexer::yylex()
531
#endif /* !YY_DECL */
533
/* Code executed at the beginning of each rule, after yytext and yyleng
536
#ifndef YY_USER_ACTION
537
#define YY_USER_ACTION
540
/* Code executed at the end of each rule. */
542
#define YY_BREAK break;
545
#define YY_RULE_SETUP \
548
/** The main scanner function which does all the work.
552
register yy_state_type yy_current_state;
553
register char *yy_cp, *yy_bp;
560
/* pour les atomes */
561
#line 562 "chemlex.cc"
572
(yy_start) = 1; /* first start state */
580
if ( ! YY_CURRENT_BUFFER ) {
581
yyensure_buffer_stack ();
582
YY_CURRENT_BUFFER_LVALUE =
583
yy_create_buffer( yyin, YY_BUF_SIZE );
586
yy_load_buffer_state( );
589
while ( 1 ) /* loops until end-of-file is reached */
591
yy_cp = (yy_c_buf_p);
593
/* Support of yytext. */
594
*yy_cp = (yy_hold_char);
596
/* yy_bp points to the position in yy_ch_buf of the start of
601
yy_current_state = (yy_start);
605
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
606
if ( yy_accept[yy_current_state] )
608
(yy_last_accepting_state) = yy_current_state;
609
(yy_last_accepting_cpos) = yy_cp;
611
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
613
yy_current_state = (int) yy_def[yy_current_state];
614
if ( yy_current_state >= 54 )
615
yy_c = yy_meta[(unsigned int) yy_c];
617
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
620
while ( yy_base[yy_current_state] != 83 );
623
yy_act = yy_accept[yy_current_state];
625
{ /* have to back up */
626
yy_cp = (yy_last_accepting_cpos);
627
yy_current_state = (yy_last_accepting_state);
628
yy_act = yy_accept[yy_current_state];
633
do_action: /* This label is used only to access EOF actions. */
636
{ /* beginning of action switch */
637
case 0: /* must back up */
638
/* undo the effects of YY_DO_BEFORE_ACTION */
639
*yy_cp = (yy_hold_char);
640
yy_cp = (yy_last_accepting_cpos);
641
yy_current_state = (yy_last_accepting_state);
647
{ /* éléments Uux : transuraniens après le N� 109
648
les autres sont les éléments ordinaires */
650
position += strlen(yytext);
651
while (lesatomes[i].Zed != 0 && strcmp(yytext, lesatomes[i].symb)) i++;
652
if (lesatomes[i].Zed == 0){
653
yylval.i=-2; /* -2 est le n° pour les éléments non définis */
654
strncpy(yylval.symb, yytext,3);
658
strcpy(yylval.symb, lesatomes[i].symb);
667
{position++; yylval.i=-1; strcpy(yylval.symb, "e");return Atome;}
672
{ position++; return Lpar;}
677
{ position++; return Rpar;}
682
{ position += strlen(yytext); return SpcLpar;}
687
{ position ++; return Lsq;}
692
{ position ++; return Rsq;}
697
{ position += strlen(yytext); yylval.i = atoi(yytext); return Int; }
702
{ position += strlen(yytext); yylval.r = atof(yytext); return Real;}
707
{ position += strlen(yytext); ind = index(yytext,'/'); *ind=0;
708
yylval.i = atoi(yytext); yylval.d = atoi(ind+1);
715
{ position += strlen(yytext); yylval.i = atoi(yytext+1);
722
{ position += strlen(yytext);
723
yylval.i = strlen(yytext); return Charge;
729
{ position += strlen(yytext); yylval.i = -strlen(yytext);
736
{ position += strlen(yytext); yytext[strlen(yytext)]=0;
737
yylval.i = atoi(yytext); return Charge;
743
{ position += strlen(yytext); yytext[strlen(yytext)]=0;
744
yylval.i = -atoi(yytext); return Charge;
750
{position += strlen(yytext); return SpcPlus;}
755
{position += strlen(yytext); return Moins;}
760
{position ++; return Plus;}
765
{position ++; return Mul;}
770
{position += strlen(yytext); return Fleche;}
775
{position += strlen(yytext); return Spc;}
780
{position ++; return Haut;}
785
{position += strlen(yytext); return Sol;}
790
{position += strlen(yytext); return Gas;}
795
{position += strlen(yytext); return Aqueous;}
800
{position ++; return Egal;}
805
{position ++; return Compose;}
810
{position+=2; return AntiCompose;}
813
/* rule 29 can match eol */
816
{/* rien c'est la fin des entrées */}
819
/* rule 30 can match eol */
822
{position += strlen(yytext); /* rien */}
829
#line 830 "chemlex.cc"
830
case YY_STATE_EOF(INITIAL):
833
case YY_END_OF_BUFFER:
835
/* Amount of text matched not including the EOB char. */
836
int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
838
/* Undo the effects of YY_DO_BEFORE_ACTION. */
839
*yy_cp = (yy_hold_char);
840
YY_RESTORE_YY_MORE_OFFSET
842
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
844
/* We're scanning a new file or input source. It's
845
* possible that this happened because the user
846
* just pointed yyin at a new source and called
847
* yylex(). If so, then we have to assure
848
* consistency between YY_CURRENT_BUFFER and our
849
* globals. Here is the right place to do so, because
850
* this is the first action (other than possibly a
851
* back-up) that will match for the new input source.
853
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
854
YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
855
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
858
/* Note that here we test for yy_c_buf_p "<=" to the position
859
* of the first EOB in the buffer, since yy_c_buf_p will
860
* already have been incremented past the NUL character
861
* (since all states make transitions on EOB to the
862
* end-of-buffer state). Contrast this with the test
865
if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
866
{ /* This was really a NUL. */
867
yy_state_type yy_next_state;
869
(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
871
yy_current_state = yy_get_previous_state( );
873
/* Okay, we're now positioned to make the NUL
874
* transition. We couldn't have
875
* yy_get_previous_state() go ahead and do it
876
* for us because it doesn't know how to deal
877
* with the possibility of jamming (and we don't
878
* want to build jamming into it because then it
879
* will run more slowly).
882
yy_next_state = yy_try_NUL_trans( yy_current_state );
884
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
888
/* Consume the NUL. */
889
yy_cp = ++(yy_c_buf_p);
890
yy_current_state = yy_next_state;
896
yy_cp = (yy_c_buf_p);
901
else switch ( yy_get_next_buffer( ) )
903
case EOB_ACT_END_OF_FILE:
905
(yy_did_buffer_switch_on_eof) = 0;
909
/* Note: because we've taken care in
910
* yy_get_next_buffer() to have set up
911
* yytext, we can now set up
912
* yy_c_buf_p so that if some total
913
* hoser (like flex itself) wants to
914
* call the scanner after we return the
915
* YY_NULL, it'll still work - another
916
* YY_NULL will get returned.
918
(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
920
yy_act = YY_STATE_EOF(YY_START);
926
if ( ! (yy_did_buffer_switch_on_eof) )
932
case EOB_ACT_CONTINUE_SCAN:
934
(yytext_ptr) + yy_amount_of_matched_text;
936
yy_current_state = yy_get_previous_state( );
938
yy_cp = (yy_c_buf_p);
939
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
942
case EOB_ACT_LAST_MATCH:
944
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
946
yy_current_state = yy_get_previous_state( );
948
yy_cp = (yy_c_buf_p);
949
yy_bp = (yytext_ptr) + YY_MORE_ADJ;
957
"fatal flex scanner internal error--no action found" );
958
} /* end of action switch */
959
} /* end of scanning one token */
962
yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
970
yylineno = 1; // this will only get updated if %option yylineno
972
yy_did_buffer_switch_on_eof = 0;
974
yy_looking_for_trail_begin = 0;
977
yy_more_offset = yy_prev_more_offset = 0;
979
yy_start_stack_ptr = yy_start_stack_depth = 0;
980
yy_start_stack = NULL;
982
(yy_buffer_stack) = 0;
983
(yy_buffer_stack_top) = 0;
984
(yy_buffer_stack_max) = 0;
990
void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
994
yy_delete_buffer( YY_CURRENT_BUFFER );
995
yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE ) );
1002
#ifdef YY_INTERACTIVE
1003
int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1005
int yyFlexLexer::LexerInput( char* buf, int max_size )
1008
if ( yyin->eof() || yyin->fail() )
1011
#ifdef YY_INTERACTIVE
1012
yyin->get( buf[0] );
1023
(void) yyin->read( buf, max_size );
1028
return yyin->gcount();
1032
void yyFlexLexer::LexerOutput( const char* buf, int size )
1034
(void) yyout->write( buf, size );
1037
/* yy_get_next_buffer - try to read in a new buffer
1039
* Returns a code representing an action:
1040
* EOB_ACT_LAST_MATCH -
1041
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1042
* EOB_ACT_END_OF_FILE - end of file
1044
int yyFlexLexer::yy_get_next_buffer()
1046
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1047
register char *source = (yytext_ptr);
1048
register int number_to_move, i;
1051
if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1053
"fatal flex scanner internal error--end of buffer missed" );
1055
if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1056
{ /* Don't try to fill the buffer, so this is an EOF. */
1057
if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1059
/* We matched a single character, the EOB, so
1060
* treat this as a final EOF.
1062
return EOB_ACT_END_OF_FILE;
1067
/* We matched some text prior to the EOB, first
1070
return EOB_ACT_LAST_MATCH;
1074
/* Try to read more data. */
1076
/* First move last chars to start of buffer. */
1077
number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1079
for ( i = 0; i < number_to_move; ++i )
1080
*(dest++) = *(source++);
1082
if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1083
/* don't do the read, it's not guaranteed to return an EOF,
1086
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1091
YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1093
while ( num_to_read <= 0 )
1094
{ /* Not enough room in the buffer - grow it. */
1096
/* just a shorter name for the current buffer */
1097
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1099
int yy_c_buf_p_offset =
1100
(int) ((yy_c_buf_p) - b->yy_ch_buf);
1102
if ( b->yy_is_our_buffer )
1104
int new_size = b->yy_buf_size * 2;
1106
if ( new_size <= 0 )
1107
b->yy_buf_size += b->yy_buf_size / 8;
1109
b->yy_buf_size *= 2;
1111
b->yy_ch_buf = (char *)
1112
/* Include room in for 2 EOB chars. */
1113
yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1116
/* Can't grow it, we don't own it. */
1119
if ( ! b->yy_ch_buf )
1121
"fatal error - scanner input buffer overflow" );
1123
(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1125
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1130
if ( num_to_read > YY_READ_BUF_SIZE )
1131
num_to_read = YY_READ_BUF_SIZE;
1133
/* Read in more data. */
1134
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1135
(yy_n_chars), (size_t) num_to_read );
1137
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1140
if ( (yy_n_chars) == 0 )
1142
if ( number_to_move == YY_MORE_ADJ )
1144
ret_val = EOB_ACT_END_OF_FILE;
1150
ret_val = EOB_ACT_LAST_MATCH;
1151
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1152
YY_BUFFER_EOF_PENDING;
1157
ret_val = EOB_ACT_CONTINUE_SCAN;
1159
(yy_n_chars) += number_to_move;
1160
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1161
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1163
(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1168
/* yy_get_previous_state - get the state just before the EOB char was reached */
1170
yy_state_type yyFlexLexer::yy_get_previous_state()
1172
register yy_state_type yy_current_state;
1173
register char *yy_cp;
1175
yy_current_state = (yy_start);
1177
for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1179
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1180
if ( yy_accept[yy_current_state] )
1182
(yy_last_accepting_state) = yy_current_state;
1183
(yy_last_accepting_cpos) = yy_cp;
1185
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1187
yy_current_state = (int) yy_def[yy_current_state];
1188
if ( yy_current_state >= 54 )
1189
yy_c = yy_meta[(unsigned int) yy_c];
1191
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1194
return yy_current_state;
1197
/* yy_try_NUL_trans - try to make a transition on the NUL character
1200
* next_state = yy_try_NUL_trans( current_state );
1202
yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1204
register int yy_is_jam;
1205
register char *yy_cp = (yy_c_buf_p);
1207
register YY_CHAR yy_c = 1;
1208
if ( yy_accept[yy_current_state] )
1210
(yy_last_accepting_state) = yy_current_state;
1211
(yy_last_accepting_cpos) = yy_cp;
1213
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1215
yy_current_state = (int) yy_def[yy_current_state];
1216
if ( yy_current_state >= 54 )
1217
yy_c = yy_meta[(unsigned int) yy_c];
1219
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1220
yy_is_jam = (yy_current_state == 53);
1222
return yy_is_jam ? 0 : yy_current_state;
1225
void yyFlexLexer::yyunput( int c, register char* yy_bp)
1227
register char *yy_cp;
1229
yy_cp = (yy_c_buf_p);
1231
/* undo effects of setting up yytext */
1232
*yy_cp = (yy_hold_char);
1234
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1235
{ /* need to shift things up to make room */
1236
/* +2 for EOB chars. */
1237
register int number_to_move = (yy_n_chars) + 2;
1238
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1239
YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1240
register char *source =
1241
&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1243
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1244
*--dest = *--source;
1246
yy_cp += (int) (dest - source);
1247
yy_bp += (int) (dest - source);
1248
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1249
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1251
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1252
YY_FATAL_ERROR( "flex scanner push-back overflow" );
1255
*--yy_cp = (char) c;
1257
(yytext_ptr) = yy_bp;
1258
(yy_hold_char) = *yy_cp;
1259
(yy_c_buf_p) = yy_cp;
1262
int yyFlexLexer::yyinput()
1266
*(yy_c_buf_p) = (yy_hold_char);
1268
if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1270
/* yy_c_buf_p now points to the character we want to return.
1271
* If this occurs *before* the EOB characters, then it's a
1272
* valid NUL; if not, then we've hit the end of the buffer.
1274
if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1275
/* This was really a NUL. */
1276
*(yy_c_buf_p) = '\0';
1279
{ /* need more input */
1280
int offset = (yy_c_buf_p) - (yytext_ptr);
1283
switch ( yy_get_next_buffer( ) )
1285
case EOB_ACT_LAST_MATCH:
1286
/* This happens because yy_g_n_b()
1287
* sees that we've accumulated a
1288
* token and flags that we need to
1289
* try matching the token before
1290
* proceeding. But for input(),
1291
* there's no matching to consider.
1292
* So convert the EOB_ACT_LAST_MATCH
1293
* to EOB_ACT_END_OF_FILE.
1296
/* Reset buffer status. */
1301
case EOB_ACT_END_OF_FILE:
1306
if ( ! (yy_did_buffer_switch_on_eof) )
1315
case EOB_ACT_CONTINUE_SCAN:
1316
(yy_c_buf_p) = (yytext_ptr) + offset;
1322
c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1323
*(yy_c_buf_p) = '\0'; /* preserve yytext */
1324
(yy_hold_char) = *++(yy_c_buf_p);
1329
/** Immediately switch to a different input stream.
1330
* @param input_file A readable stream.
1332
* @note This function does not reset the start condition to @c INITIAL .
1334
void yyFlexLexer::yyrestart( std::istream* input_file )
1337
if ( ! YY_CURRENT_BUFFER ){
1338
yyensure_buffer_stack ();
1339
YY_CURRENT_BUFFER_LVALUE =
1340
yy_create_buffer( yyin, YY_BUF_SIZE );
1343
yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1344
yy_load_buffer_state( );
1347
/** Switch to a different input buffer.
1348
* @param new_buffer The new input buffer.
1351
void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1354
/* TODO. We should be able to replace this entire function body
1356
* yypop_buffer_state();
1357
* yypush_buffer_state(new_buffer);
1359
yyensure_buffer_stack ();
1360
if ( YY_CURRENT_BUFFER == new_buffer )
1363
if ( YY_CURRENT_BUFFER )
1365
/* Flush out information for old buffer. */
1366
*(yy_c_buf_p) = (yy_hold_char);
1367
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1368
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1371
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1372
yy_load_buffer_state( );
1374
/* We don't actually know whether we did this switch during
1375
* EOF (yywrap()) processing, but the only time this flag
1376
* is looked at is after yywrap() is called, so it's safe
1377
* to go ahead and always set it.
1379
(yy_did_buffer_switch_on_eof) = 1;
1382
void yyFlexLexer::yy_load_buffer_state()
1384
(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1385
(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1386
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1387
(yy_hold_char) = *(yy_c_buf_p);
1390
/** Allocate and initialize an input buffer state.
1391
* @param file A readable stream.
1392
* @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1394
* @return the allocated buffer state.
1396
YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1400
b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1402
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1404
b->yy_buf_size = size;
1406
/* yy_ch_buf has to be 2 characters longer than the size given because
1407
* we need to put in 2 end-of-buffer characters.
1409
b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1410
if ( ! b->yy_ch_buf )
1411
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1413
b->yy_is_our_buffer = 1;
1415
yy_init_buffer( b, file );
1420
/** Destroy the buffer.
1421
* @param b a buffer created with yy_create_buffer()
1424
void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1430
if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1431
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1433
if ( b->yy_is_our_buffer )
1434
yyfree((void *) b->yy_ch_buf );
1436
yyfree((void *) b );
1439
extern "C" int isatty (int );
1441
/* Initializes or reinitializes a buffer.
1442
* This function is sometimes called more than once on the same buffer,
1443
* such as during a yyrestart() or at EOF.
1445
void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
1450
yy_flush_buffer( b );
1452
b->yy_input_file = file;
1453
b->yy_fill_buffer = 1;
1455
/* If b is the current buffer, then yy_init_buffer was _probably_
1456
* called from yyrestart() or through yy_get_next_buffer.
1457
* In that case, we don't want to reset the lineno or column.
1459
if (b != YY_CURRENT_BUFFER){
1460
b->yy_bs_lineno = 1;
1461
b->yy_bs_column = 0;
1464
b->yy_is_interactive = 0;
1468
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1469
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1472
void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
1479
/* We always need two end-of-buffer characters. The first causes
1480
* a transition to the end-of-buffer state. The second causes
1481
* a jam in that state.
1483
b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1484
b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1486
b->yy_buf_pos = &b->yy_ch_buf[0];
1489
b->yy_buffer_status = YY_BUFFER_NEW;
1491
if ( b == YY_CURRENT_BUFFER )
1492
yy_load_buffer_state( );
1495
/** Pushes the new state onto the stack. The new state becomes
1496
* the current state. This function will allocate the stack
1498
* @param new_buffer The new state.
1501
void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
1503
if (new_buffer == NULL)
1506
yyensure_buffer_stack();
1508
/* This block is copied from yy_switch_to_buffer. */
1509
if ( YY_CURRENT_BUFFER )
1511
/* Flush out information for old buffer. */
1512
*(yy_c_buf_p) = (yy_hold_char);
1513
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1514
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1517
/* Only push if top exists. Otherwise, replace top. */
1518
if (YY_CURRENT_BUFFER)
1519
(yy_buffer_stack_top)++;
1520
YY_CURRENT_BUFFER_LVALUE = new_buffer;
1522
/* copied from yy_switch_to_buffer. */
1523
yy_load_buffer_state( );
1524
(yy_did_buffer_switch_on_eof) = 1;
1527
/** Removes and deletes the top of the stack, if present.
1528
* The next element becomes the new top.
1531
void yyFlexLexer::yypop_buffer_state (void)
1533
if (!YY_CURRENT_BUFFER)
1536
yy_delete_buffer(YY_CURRENT_BUFFER );
1537
YY_CURRENT_BUFFER_LVALUE = NULL;
1538
if ((yy_buffer_stack_top) > 0)
1539
--(yy_buffer_stack_top);
1541
if (YY_CURRENT_BUFFER) {
1542
yy_load_buffer_state( );
1543
(yy_did_buffer_switch_on_eof) = 1;
1547
/* Allocates the stack if it does not exist.
1548
* Guarantees space for at least one push.
1550
void yyFlexLexer::yyensure_buffer_stack(void)
1554
if (!(yy_buffer_stack)) {
1556
/* First allocation is just for 2 elements, since we don't know if this
1557
* scanner will even need a stack. We use 2 instead of 1 to avoid an
1558
* immediate realloc on the next call.
1561
(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1562
(num_to_alloc * sizeof(struct yy_buffer_state*)
1565
memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1567
(yy_buffer_stack_max) = num_to_alloc;
1568
(yy_buffer_stack_top) = 0;
1572
if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1574
/* Increase the buffer to prepare for a possible push. */
1575
int grow_size = 8 /* arbitrary grow size */;
1577
num_to_alloc = (yy_buffer_stack_max) + grow_size;
1578
(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1580
num_to_alloc * sizeof(struct yy_buffer_state*)
1583
/* zero only the new slots.*/
1584
memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1585
(yy_buffer_stack_max) = num_to_alloc;
1589
void yyFlexLexer::yy_push_state( int new_state )
1591
if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
1595
(yy_start_stack_depth) += YY_START_STACK_INCR;
1596
new_size = (yy_start_stack_depth) * sizeof( int );
1598
if ( ! (yy_start_stack) )
1599
(yy_start_stack) = (int *) yyalloc(new_size );
1602
(yy_start_stack) = (int *) yyrealloc((void *) (yy_start_stack),new_size );
1604
if ( ! (yy_start_stack) )
1606
"out of memory expanding start-condition stack" );
1609
(yy_start_stack)[(yy_start_stack_ptr)++] = YY_START;
1614
void yyFlexLexer::yy_pop_state()
1616
if ( --(yy_start_stack_ptr) < 0 )
1617
YY_FATAL_ERROR( "start-condition stack underflow" );
1619
BEGIN((yy_start_stack)[(yy_start_stack_ptr)]);
1622
int yyFlexLexer::yy_top_state()
1624
return (yy_start_stack)[(yy_start_stack_ptr) - 1];
1627
#ifndef YY_EXIT_FAILURE
1628
#define YY_EXIT_FAILURE 2
1631
void yyFlexLexer::LexerError( yyconst char msg[] )
1633
std::cerr << msg << std::endl;
1634
exit( YY_EXIT_FAILURE );
1637
/* Redefine yyless() so it works in section 3 code. */
1643
/* Undo effects of setting up yytext. */ \
1644
int yyless_macro_arg = (n); \
1645
YY_LESS_LINENO(yyless_macro_arg);\
1646
yytext[yyleng] = (yy_hold_char); \
1647
(yy_c_buf_p) = yytext + yyless_macro_arg; \
1648
(yy_hold_char) = *(yy_c_buf_p); \
1649
*(yy_c_buf_p) = '\0'; \
1650
yyleng = yyless_macro_arg; \
1654
/* Accessor methods (get/set functions) to struct members. */
1656
yyFlexLexer::~yyFlexLexer()
1659
/* Pop the buffer stack, destroying each element. */
1660
while(YY_CURRENT_BUFFER){
1661
yy_delete_buffer( YY_CURRENT_BUFFER );
1662
YY_CURRENT_BUFFER_LVALUE = NULL;
1663
yypop_buffer_state();
1666
/* Destroy the stack itself. */
1667
yyfree((yy_buffer_stack) );
1668
(yy_buffer_stack) = NULL;
1670
delete [] (yy_state_buf);
1671
yyfree((yy_start_stack) );
1676
* Internal utility routines.
1680
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1683
for ( i = 0; i < n; ++i )
1688
#ifdef YY_NEED_STRLEN
1689
static int yy_flex_strlen (yyconst char * s )
1692
for ( n = 0; s[n]; ++n )
1699
void *yyalloc (yy_size_t size )
1701
return (void *) malloc( size );
1704
void *yyrealloc (void * ptr, yy_size_t size )
1706
/* The cast to (char *) in the following accommodates both
1707
* implementations that use char* generic pointers, and those
1708
* that use void* generic pointers. It works with the latter
1709
* because both ANSI C and C++ allow castless assignment from
1710
* any pointer type to void*, and deal with argument conversions
1711
* as though doing an assignment.
1713
return (void *) realloc( (char *) ptr, size );
1716
void yyfree (void * ptr )
1718
free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1721
#define YYTABLES_NAME "yytables"