~ubuntu-branches/ubuntu/lucid/igraph/lucid

« back to all changes in this revision

Viewing changes to src/foreign-gml-lexer.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Malaterre
  • Date: 2009-11-16 18:12:42 UTC
  • Revision ID: james.westby@ubuntu.com-20091116181242-mzv9p5fz9uj57xd1
Tags: upstream-0.5.3
ImportĀ upstreamĀ versionĀ 0.5.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#line 2 "foreign-gml-lexer.c"
 
2
 
 
3
#line 4 "foreign-gml-lexer.c"
 
4
 
 
5
#define  YY_INT_ALIGNED short int
 
6
 
 
7
/* A lexical scanner generated by flex */
 
8
 
 
9
#define yy_create_buffer igraph_gml_yy_create_buffer
 
10
#define yy_delete_buffer igraph_gml_yy_delete_buffer
 
11
#define yy_flex_debug igraph_gml_yy_flex_debug
 
12
#define yy_init_buffer igraph_gml_yy_init_buffer
 
13
#define yy_flush_buffer igraph_gml_yy_flush_buffer
 
14
#define yy_load_buffer_state igraph_gml_yy_load_buffer_state
 
15
#define yy_switch_to_buffer igraph_gml_yy_switch_to_buffer
 
16
#define yyin igraph_gml_yyin
 
17
#define yyleng igraph_gml_yyleng
 
18
#define yylex igraph_gml_yylex
 
19
#define yylineno igraph_gml_yylineno
 
20
#define yyout igraph_gml_yyout
 
21
#define yyrestart igraph_gml_yyrestart
 
22
#define yytext igraph_gml_yytext
 
23
#define yywrap igraph_gml_yywrap
 
24
#define yyalloc igraph_gml_yyalloc
 
25
#define yyrealloc igraph_gml_yyrealloc
 
26
#define yyfree igraph_gml_yyfree
 
27
 
 
28
#define FLEX_SCANNER
 
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
 
33
#define FLEX_BETA
 
34
#endif
 
35
 
 
36
/* First, we deal with  platform-specific or compiler-specific issues. */
 
37
 
 
38
/* begin standard C headers. */
 
39
#include <stdio.h>
 
40
#include <string.h>
 
41
#include <errno.h>
 
42
#include <stdlib.h>
 
43
 
 
44
/* end standard C headers. */
 
45
 
 
46
/* flex integer type definitions */
 
47
 
 
48
#ifndef FLEXINT_H
 
49
#define FLEXINT_H
 
50
 
 
51
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
52
 
 
53
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
54
 
 
55
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 
56
 * if you want the limit (max/min) macros for int types. 
 
57
 */
 
58
#ifndef __STDC_LIMIT_MACROS
 
59
#define __STDC_LIMIT_MACROS 1
 
60
#endif
 
61
 
 
62
#include <inttypes.h>
 
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;
 
69
#else
 
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;
 
76
 
 
77
/* Limits of integral types. */
 
78
#ifndef INT8_MIN
 
79
#define INT8_MIN               (-128)
 
80
#endif
 
81
#ifndef INT16_MIN
 
82
#define INT16_MIN              (-32767-1)
 
83
#endif
 
84
#ifndef INT32_MIN
 
85
#define INT32_MIN              (-2147483647-1)
 
86
#endif
 
87
#ifndef INT8_MAX
 
88
#define INT8_MAX               (127)
 
89
#endif
 
90
#ifndef INT16_MAX
 
91
#define INT16_MAX              (32767)
 
92
#endif
 
93
#ifndef INT32_MAX
 
94
#define INT32_MAX              (2147483647)
 
95
#endif
 
96
#ifndef UINT8_MAX
 
97
#define UINT8_MAX              (255U)
 
98
#endif
 
99
#ifndef UINT16_MAX
 
100
#define UINT16_MAX             (65535U)
 
101
#endif
 
102
#ifndef UINT32_MAX
 
103
#define UINT32_MAX             (4294967295U)
 
104
#endif
 
105
 
 
106
#endif /* ! C99 */
 
107
 
 
108
#endif /* ! FLEXINT_H */
 
109
 
 
110
#ifdef __cplusplus
 
111
 
 
112
/* The "const" storage-class-modifier is valid. */
 
113
#define YY_USE_CONST
 
114
 
 
115
#else   /* ! __cplusplus */
 
116
 
 
117
/* C99 requires __STDC__ to be defined as 1. */
 
118
#if defined (__STDC__)
 
119
 
 
120
#define YY_USE_CONST
 
121
 
 
122
#endif  /* defined (__STDC__) */
 
123
#endif  /* ! __cplusplus */
 
124
 
 
125
#ifdef YY_USE_CONST
 
126
#define yyconst const
 
127
#else
 
128
#define yyconst
 
129
#endif
 
130
 
 
131
/* Returned upon end-of-file. */
 
132
#define YY_NULL 0
 
133
 
 
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
 
137
 * double cast.
 
138
 */
 
139
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
 
140
 
 
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.
 
144
 */
 
145
#define BEGIN (yy_start) = 1 + 2 *
 
146
 
 
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
 
149
 * compatibility.
 
150
 */
 
151
#define YY_START (((yy_start) - 1) / 2)
 
152
#define YYSTATE YY_START
 
153
 
 
154
/* Action number for EOF rule of a given start state. */
 
155
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
156
 
 
157
/* Special action meaning "start processing a new file". */
 
158
#define YY_NEW_FILE igraph_gml_yyrestart(igraph_gml_yyin  )
 
159
 
 
160
#define YY_END_OF_BUFFER_CHAR 0
 
161
 
 
162
/* Size of default input buffer. */
 
163
#ifndef YY_BUF_SIZE
 
164
#define YY_BUF_SIZE 16384
 
165
#endif
 
166
 
 
167
/* The state buf must be large enough to hold one state per character in the main buffer.
 
168
 */
 
169
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
170
 
 
171
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
 
172
#define YY_TYPEDEF_YY_BUFFER_STATE
 
173
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
174
#endif
 
175
 
 
176
extern int igraph_gml_yyleng;
 
177
 
 
178
extern FILE *igraph_gml_yyin, *igraph_gml_yyout;
 
179
 
 
180
#define EOB_ACT_CONTINUE_SCAN 0
 
181
#define EOB_ACT_END_OF_FILE 1
 
182
#define EOB_ACT_LAST_MATCH 2
 
183
 
 
184
    #define YY_LESS_LINENO(n)
 
185
    
 
186
/* Return all but the first "n" matched characters back to the input stream. */
 
187
#define yyless(n) \
 
188
        do \
 
189
                { \
 
190
                /* Undo effects of setting up igraph_gml_yytext. */ \
 
191
        int yyless_macro_arg = (n); \
 
192
        YY_LESS_LINENO(yyless_macro_arg);\
 
193
                *yy_cp = (yy_hold_char); \
 
194
                YY_RESTORE_YY_MORE_OFFSET \
 
195
                (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
 
196
                YY_DO_BEFORE_ACTION; /* set up igraph_gml_yytext again */ \
 
197
                } \
 
198
        while ( 0 )
 
199
 
 
200
#define unput(c) yyunput( c, (yytext_ptr)  )
 
201
 
 
202
#ifndef YY_TYPEDEF_YY_SIZE_T
 
203
#define YY_TYPEDEF_YY_SIZE_T
 
204
typedef size_t yy_size_t;
 
205
#endif
 
206
 
 
207
#ifndef YY_STRUCT_YY_BUFFER_STATE
 
208
#define YY_STRUCT_YY_BUFFER_STATE
 
209
struct yy_buffer_state
 
210
        {
 
211
        FILE *yy_input_file;
 
212
 
 
213
        char *yy_ch_buf;                /* input buffer */
 
214
        char *yy_buf_pos;               /* current position in input buffer */
 
215
 
 
216
        /* Size of input buffer in bytes, not including room for EOB
 
217
         * characters.
 
218
         */
 
219
        yy_size_t yy_buf_size;
 
220
 
 
221
        /* Number of characters read into yy_ch_buf, not including EOB
 
222
         * characters.
 
223
         */
 
224
        int yy_n_chars;
 
225
 
 
226
        /* Whether we "own" the buffer - i.e., we know we created it,
 
227
         * and can realloc() it to grow it, and should free() it to
 
228
         * delete it.
 
229
         */
 
230
        int yy_is_our_buffer;
 
231
 
 
232
        /* Whether this is an "interactive" input source; if so, and
 
233
         * if we're using stdio for input, then we want to use getc()
 
234
         * instead of fread(), to make sure we stop fetching input after
 
235
         * each newline.
 
236
         */
 
237
        int yy_is_interactive;
 
238
 
 
239
        /* Whether we're considered to be at the beginning of a line.
 
240
         * If so, '^' rules will be active on the next match, otherwise
 
241
         * not.
 
242
         */
 
243
        int yy_at_bol;
 
244
 
 
245
    int yy_bs_lineno; /**< The line count. */
 
246
    int yy_bs_column; /**< The column count. */
 
247
    
 
248
        /* Whether to try to fill the input buffer when we reach the
 
249
         * end of it.
 
250
         */
 
251
        int yy_fill_buffer;
 
252
 
 
253
        int yy_buffer_status;
 
254
 
 
255
#define YY_BUFFER_NEW 0
 
256
#define YY_BUFFER_NORMAL 1
 
257
        /* When an EOF's been seen but there's still some text to process
 
258
         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
 
259
         * shouldn't try reading from the input source any more.  We might
 
260
         * still have a bunch of tokens to match, though, because of
 
261
         * possible backing-up.
 
262
         *
 
263
         * When we actually see the EOF, we change the status to "new"
 
264
         * (via igraph_gml_yyrestart()), so that the user can continue scanning by
 
265
         * just pointing igraph_gml_yyin at a new input file.
 
266
         */
 
267
#define YY_BUFFER_EOF_PENDING 2
 
268
 
 
269
        };
 
270
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
271
 
 
272
/* Stack of input buffers. */
 
273
static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
 
274
static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
 
275
static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
 
276
 
 
277
/* We provide macros for accessing buffer states in case in the
 
278
 * future we want to put the buffer states in a more general
 
279
 * "scanner state".
 
280
 *
 
281
 * Returns the top of the stack, or NULL.
 
282
 */
 
283
#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
 
284
                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
 
285
                          : NULL)
 
286
 
 
287
/* Same as previous macro, but useful when we know that the buffer stack is not
 
288
 * NULL or when we need an lvalue. For internal use only.
 
289
 */
 
290
#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
 
291
 
 
292
/* yy_hold_char holds the character lost when igraph_gml_yytext is formed. */
 
293
static char yy_hold_char;
 
294
static int yy_n_chars;          /* number of characters read into yy_ch_buf */
 
295
int igraph_gml_yyleng;
 
296
 
 
297
/* Points to current character in buffer. */
 
298
static char *yy_c_buf_p = (char *) 0;
 
299
static int yy_init = 0;         /* whether we need to initialize */
 
300
static int yy_start = 0;        /* start state number */
 
301
 
 
302
/* Flag which is used to allow igraph_gml_yywrap()'s to do buffer switches
 
303
 * instead of setting up a fresh igraph_gml_yyin.  A bit of a hack ...
 
304
 */
 
305
static int yy_did_buffer_switch_on_eof;
 
306
 
 
307
void igraph_gml_yyrestart (FILE *input_file  );
 
308
void igraph_gml_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
 
309
YY_BUFFER_STATE igraph_gml_yy_create_buffer (FILE *file,int size  );
 
310
void igraph_gml_yy_delete_buffer (YY_BUFFER_STATE b  );
 
311
void igraph_gml_yy_flush_buffer (YY_BUFFER_STATE b  );
 
312
void igraph_gml_yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
 
313
void igraph_gml_yypop_buffer_state (void );
 
314
 
 
315
static void igraph_gml_yyensure_buffer_stack (void );
 
316
static void igraph_gml_yy_load_buffer_state (void );
 
317
static void igraph_gml_yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
 
318
 
 
319
#define YY_FLUSH_BUFFER igraph_gml_yy_flush_buffer(YY_CURRENT_BUFFER )
 
320
 
 
321
YY_BUFFER_STATE igraph_gml_yy_scan_buffer (char *base,yy_size_t size  );
 
322
YY_BUFFER_STATE igraph_gml_yy_scan_string (yyconst char *yy_str  );
 
323
YY_BUFFER_STATE igraph_gml_yy_scan_bytes (yyconst char *bytes,int len  );
 
324
 
 
325
void *igraph_gml_yyalloc (yy_size_t  );
 
326
void *igraph_gml_yyrealloc (void *,yy_size_t  );
 
327
void igraph_gml_yyfree (void *  );
 
328
 
 
329
#define yy_new_buffer igraph_gml_yy_create_buffer
 
330
 
 
331
#define yy_set_interactive(is_interactive) \
 
332
        { \
 
333
        if ( ! YY_CURRENT_BUFFER ){ \
 
334
        igraph_gml_yyensure_buffer_stack (); \
 
335
                YY_CURRENT_BUFFER_LVALUE =    \
 
336
            igraph_gml_yy_create_buffer(igraph_gml_yyin,YY_BUF_SIZE ); \
 
337
        } \
 
338
        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 
339
        }
 
340
 
 
341
#define yy_set_bol(at_bol) \
 
342
        { \
 
343
        if ( ! YY_CURRENT_BUFFER ){\
 
344
        igraph_gml_yyensure_buffer_stack (); \
 
345
                YY_CURRENT_BUFFER_LVALUE =    \
 
346
            igraph_gml_yy_create_buffer(igraph_gml_yyin,YY_BUF_SIZE ); \
 
347
        } \
 
348
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 
349
        }
 
350
 
 
351
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
352
 
 
353
/* Begin user sect3 */
 
354
 
 
355
#define igraph_gml_yywrap(n) 1
 
356
#define YY_SKIP_YYWRAP
 
357
 
 
358
typedef unsigned char YY_CHAR;
 
359
 
 
360
FILE *igraph_gml_yyin = (FILE *) 0, *igraph_gml_yyout = (FILE *) 0;
 
361
 
 
362
typedef int yy_state_type;
 
363
 
 
364
extern int igraph_gml_yylineno;
 
365
 
 
366
int igraph_gml_yylineno = 1;
 
367
 
 
368
extern char *igraph_gml_yytext;
 
369
#define yytext_ptr igraph_gml_yytext
 
370
 
 
371
static yy_state_type yy_get_previous_state (void );
 
372
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
 
373
static int yy_get_next_buffer (void );
 
374
static void yy_fatal_error (yyconst char msg[]  );
 
375
 
 
376
/* Done after the current pattern has been matched and before the
 
377
 * corresponding action - sets up igraph_gml_yytext.
 
378
 */
 
379
#define YY_DO_BEFORE_ACTION \
 
380
        (yytext_ptr) = yy_bp; \
 
381
        igraph_gml_yyleng = (size_t) (yy_cp - yy_bp); \
 
382
        (yy_hold_char) = *yy_cp; \
 
383
        *yy_cp = '\0'; \
 
384
        (yy_c_buf_p) = yy_cp;
 
385
 
 
386
#define YY_NUM_RULES 9
 
387
#define YY_END_OF_BUFFER 10
 
388
/* This struct is not used in this scanner,
 
389
   but its presence is necessary. */
 
390
struct yy_trans_info
 
391
        {
 
392
        flex_int32_t yy_verify;
 
393
        flex_int32_t yy_nxt;
 
394
        };
 
395
static yyconst flex_int16_t yy_accept[29] =
 
396
    {   0,
 
397
        0,    0,   10,    9,    8,    7,    7,    9,    9,    3,
 
398
        4,    5,    6,    1,    9,    7,    0,    2,    3,    0,
 
399
        0,    4,    0,    1,    3,    0,    3,    0
 
400
    } ;
 
401
 
 
402
static yyconst flex_int32_t yy_ec[256] =
 
403
    {   0,
 
404
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
 
405
        1,    1,    4,    1,    1,    1,    1,    1,    1,    1,
 
406
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
407
        1,    2,    1,    5,    6,    1,    1,    1,    1,    1,
 
408
        1,    1,    7,    1,    8,    9,    1,   10,   10,   10,
 
409
       10,   10,   10,   10,   10,   10,   10,    1,    1,    1,
 
410
        1,    1,    1,    1,   11,   11,   11,   11,   12,   11,
 
411
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
 
412
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
 
413
       13,    1,   14,    1,   11,    1,   11,   11,   11,   11,
 
414
 
 
415
       12,   11,   11,   11,   11,   11,   11,   11,   11,   11,
 
416
       11,   11,   11,   11,   11,   11,   11,   11,   11,   11,
 
417
       11,   11,    1,    1,    1,    1,    1,    1,    1,    1,
 
418
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
419
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
420
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
421
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
422
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
423
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
424
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
425
 
 
426
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
427
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
428
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
429
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
430
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
431
        1,    1,    1,    1,    1
 
432
    } ;
 
433
 
 
434
static yyconst flex_int32_t yy_meta[15] =
 
435
    {   0,
 
436
        1,    1,    1,    2,    1,    1,    1,    1,    1,    3,
 
437
        3,    3,    1,    1
 
438
    } ;
 
439
 
 
440
static yyconst flex_int16_t yy_base[32] =
 
441
    {   0,
 
442
        0,   11,   42,   43,   43,   37,   37,   34,   28,    9,
 
443
        0,   43,   43,   34,   33,   43,   30,   43,    0,   24,
 
444
       15,    0,   30,   43,   14,   21,   10,   43,   26,   13,
 
445
       29
 
446
    } ;
 
447
 
 
448
static yyconst flex_int16_t yy_def[32] =
 
449
    {   0,
 
450
       28,    1,   28,   28,   28,   28,   28,   29,   28,   28,
 
451
       30,   28,   28,   28,   31,   28,   29,   28,   10,   28,
 
452
       28,   30,   31,   28,   28,   28,   28,    0,   28,   28,
 
453
       28
 
454
    } ;
 
455
 
 
456
static yyconst flex_int16_t yy_nxt[58] =
 
457
    {   0,
 
458
        4,    5,    6,    7,    8,    4,    4,    9,    4,   10,
 
459
       11,   11,   12,   13,   14,   22,   15,   20,   19,   27,
 
460
       21,   26,   26,   25,   27,   21,   17,   17,   17,   23,
 
461
       27,   23,   24,   25,   18,   24,   16,   19,   18,   16,
 
462
       16,   28,    3,   28,   28,   28,   28,   28,   28,   28,
 
463
       28,   28,   28,   28,   28,   28,   28
 
464
    } ;
 
465
 
 
466
static yyconst flex_int16_t yy_chk[58] =
 
467
    {   0,
 
468
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
469
        1,    1,    1,    1,    2,   30,    2,   10,   10,   27,
 
470
       10,   21,   21,   25,   21,   25,   29,   29,   29,   31,
 
471
       26,   31,   23,   20,   17,   15,   14,    9,    8,    7,
 
472
        6,    3,   28,   28,   28,   28,   28,   28,   28,   28,
 
473
       28,   28,   28,   28,   28,   28,   28
 
474
    } ;
 
475
 
 
476
static yy_state_type yy_last_accepting_state;
 
477
static char *yy_last_accepting_cpos;
 
478
 
 
479
extern int igraph_gml_yy_flex_debug;
 
480
int igraph_gml_yy_flex_debug = 0;
 
481
 
 
482
/* The intent behind this definition is that it'll catch
 
483
 * any uses of REJECT which flex missed.
 
484
 */
 
485
#define REJECT reject_used_but_not_detected
 
486
#define yymore() yymore_used_but_not_detected
 
487
#define YY_MORE_ADJ 0
 
488
#define YY_RESTORE_YY_MORE_OFFSET
 
489
char *igraph_gml_yytext;
 
490
#line 1 "foreign-gml-lexer.l"
 
491
/* 
 
492
   IGraph library.
 
493
   Copyright (C) 2007  Gabor Csardi <csardi@rmki.kfki.hu>
 
494
   MTA RMKI, Konkoly-Thege Miklos st. 29-33, Budapest 1121, Hungary
 
495
   
 
496
   This program is free software; you can redistribute it and/or modify
 
497
   it under the terms of the GNU General Public License as published by
 
498
   the Free Software Foundation; either version 2 of the License, or
 
499
   (at your option) any later version.
 
500
   
 
501
   This program is distributed in the hope that it will be useful,
 
502
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
503
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
504
   GNU General Public License for more details.
 
505
   
 
506
   You should have received a copy of the GNU General Public License
 
507
   along with this program; if not, write to the Free Software
 
508
   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA 
 
509
   02110-1301 USA
 
510
 
 
511
*/
 
512
#line 24 "foreign-gml-lexer.l"
 
513
 
 
514
/* 
 
515
   IGraph library.
 
516
   Copyright (C) 2007  Gabor Csardi <csardi@rmki.kfki.hu>
 
517
   MTA RMKI, Konkoly-Thege Miklos st. 29-33, Budapest 1121, Hungary
 
518
   
 
519
   This program is free software; you can redistribute it and/or modify
 
520
   it under the terms of the GNU General Public License as published by
 
521
   the Free Software Foundation; either version 2 of the License, or
 
522
   (at your option) any later version.
 
523
   
 
524
   This program is distributed in the hope that it will be useful,
 
525
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
526
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
527
   GNU General Public License for more details.
 
528
   
 
529
   You should have received a copy of the GNU General Public License
 
530
   along with this program; if not, write to the Free Software
 
531
   Foundation, Inc.,  51 Franklin Street, Fifth Floor, Boston, MA 
 
532
   02110-1301 USA
 
533
 
 
534
*/
 
535
 
 
536
#include "config.h"
 
537
#include <stdlib.h>
 
538
#include "foreign-gml-parser.h"
 
539
extern long int igraph_gml_mylineno;
 
540
extern int igraph_gml_mode;
 
541
int igraph_gml_eof;
 
542
void igraph_i_gml_reset_scanner() {
 
543
  YY_FLUSH_BUFFER;
 
544
}
 
545
#define YY_NO_INPUT 1
 
546
#line 547 "foreign-gml-lexer.c"
 
547
 
 
548
#define INITIAL 0
 
549
 
 
550
#ifndef YY_NO_UNISTD_H
 
551
/* Special case for "unistd.h", since it is non-ANSI. We include it way
 
552
 * down here because we want the user's section 1 to have been scanned first.
 
553
 * The user has a chance to override it with an option.
 
554
 */
 
555
#include <unistd.h>
 
556
#endif
 
557
 
 
558
#ifndef YY_EXTRA_TYPE
 
559
#define YY_EXTRA_TYPE void *
 
560
#endif
 
561
 
 
562
static int yy_init_globals (void );
 
563
 
 
564
/* Accessor methods to globals.
 
565
   These are made visible to non-reentrant scanners for convenience. */
 
566
 
 
567
int igraph_gml_yylex_destroy (void );
 
568
 
 
569
int igraph_gml_yyget_debug (void );
 
570
 
 
571
void igraph_gml_yyset_debug (int debug_flag  );
 
572
 
 
573
YY_EXTRA_TYPE igraph_gml_yyget_extra (void );
 
574
 
 
575
void igraph_gml_yyset_extra (YY_EXTRA_TYPE user_defined  );
 
576
 
 
577
FILE *igraph_gml_yyget_in (void );
 
578
 
 
579
void igraph_gml_yyset_in  (FILE * in_str  );
 
580
 
 
581
FILE *igraph_gml_yyget_out (void );
 
582
 
 
583
void igraph_gml_yyset_out  (FILE * out_str  );
 
584
 
 
585
int igraph_gml_yyget_leng (void );
 
586
 
 
587
char *igraph_gml_yyget_text (void );
 
588
 
 
589
int igraph_gml_yyget_lineno (void );
 
590
 
 
591
void igraph_gml_yyset_lineno (int line_number  );
 
592
 
 
593
/* Macros after this point can all be overridden by user definitions in
 
594
 * section 1.
 
595
 */
 
596
 
 
597
#ifndef YY_SKIP_YYWRAP
 
598
#ifdef __cplusplus
 
599
extern "C" int igraph_gml_yywrap (void );
 
600
#else
 
601
extern int igraph_gml_yywrap (void );
 
602
#endif
 
603
#endif
 
604
 
 
605
#ifndef yytext_ptr
 
606
static void yy_flex_strncpy (char *,yyconst char *,int );
 
607
#endif
 
608
 
 
609
#ifdef YY_NEED_STRLEN
 
610
static int yy_flex_strlen (yyconst char * );
 
611
#endif
 
612
 
 
613
#ifndef YY_NO_INPUT
 
614
 
 
615
#ifdef __cplusplus
 
616
static int yyinput (void );
 
617
#else
 
618
static int input (void );
 
619
#endif
 
620
 
 
621
#endif
 
622
 
 
623
/* Amount of stuff to slurp up with each read. */
 
624
#ifndef YY_READ_BUF_SIZE
 
625
#define YY_READ_BUF_SIZE 8192
 
626
#endif
 
627
 
 
628
/* Copy whatever the last rule matched to the standard output. */
 
629
#ifndef ECHO
 
630
/* This used to be an fputs(), but since the string might contain NUL's,
 
631
 * we now use fwrite().
 
632
 */
 
633
#define ECHO do { if (fwrite( igraph_gml_yytext, igraph_gml_yyleng, 1, igraph_gml_yyout )) {} } while (0)
 
634
#endif
 
635
 
 
636
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 
637
 * is returned in "result".
 
638
 */
 
639
#ifndef YY_INPUT
 
640
#define YY_INPUT(buf,result,max_size) \
 
641
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 
642
                { \
 
643
                int c = '*'; \
 
644
                size_t n; \
 
645
                for ( n = 0; n < max_size && \
 
646
                             (c = getc( igraph_gml_yyin )) != EOF && c != '\n'; ++n ) \
 
647
                        buf[n] = (char) c; \
 
648
                if ( c == '\n' ) \
 
649
                        buf[n++] = (char) c; \
 
650
                if ( c == EOF && ferror( igraph_gml_yyin ) ) \
 
651
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
652
                result = n; \
 
653
                } \
 
654
        else \
 
655
                { \
 
656
                errno=0; \
 
657
                while ( (result = fread(buf, 1, max_size, igraph_gml_yyin))==0 && ferror(igraph_gml_yyin)) \
 
658
                        { \
 
659
                        if( errno != EINTR) \
 
660
                                { \
 
661
                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
662
                                break; \
 
663
                                } \
 
664
                        errno=0; \
 
665
                        clearerr(igraph_gml_yyin); \
 
666
                        } \
 
667
                }\
 
668
\
 
669
 
 
670
#endif
 
671
 
 
672
/* No semi-colon after return; correct usage is to write "yyterminate();" -
 
673
 * we don't want an extra ';' after the "return" because that will cause
 
674
 * some compilers to complain about unreachable statements.
 
675
 */
 
676
#ifndef yyterminate
 
677
#define yyterminate() return YY_NULL
 
678
#endif
 
679
 
 
680
/* Number of entries by which start-condition stack grows. */
 
681
#ifndef YY_START_STACK_INCR
 
682
#define YY_START_STACK_INCR 25
 
683
#endif
 
684
 
 
685
/* Report a fatal error. */
 
686
#ifndef YY_FATAL_ERROR
 
687
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
 
688
#endif
 
689
 
 
690
/* end tables serialization structures and prototypes */
 
691
 
 
692
/* Default declaration of generated scanner - a define so the user can
 
693
 * easily add parameters.
 
694
 */
 
695
#ifndef YY_DECL
 
696
#define YY_DECL_IS_OURS 1
 
697
 
 
698
extern int igraph_gml_yylex (void);
 
699
 
 
700
#define YY_DECL int igraph_gml_yylex (void)
 
701
#endif /* !YY_DECL */
 
702
 
 
703
/* Code executed at the beginning of each rule, after igraph_gml_yytext and igraph_gml_yyleng
 
704
 * have been set up.
 
705
 */
 
706
#ifndef YY_USER_ACTION
 
707
#define YY_USER_ACTION
 
708
#endif
 
709
 
 
710
/* Code executed at the end of each rule. */
 
711
#ifndef YY_BREAK
 
712
#define YY_BREAK break;
 
713
#endif
 
714
 
 
715
#define YY_RULE_SETUP \
 
716
        if ( igraph_gml_yyleng > 0 ) \
 
717
                YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
 
718
                                (igraph_gml_yytext[igraph_gml_yyleng - 1] == '\n'); \
 
719
        YY_USER_ACTION
 
720
 
 
721
/** The main scanner function which does all the work.
 
722
 */
 
723
YY_DECL
 
724
{
 
725
        register yy_state_type yy_current_state;
 
726
        register char *yy_cp, *yy_bp;
 
727
        register int yy_act;
 
728
    
 
729
#line 67 "foreign-gml-lexer.l"
 
730
 
 
731
 
 
732
#line 733 "foreign-gml-lexer.c"
 
733
 
 
734
        if ( !(yy_init) )
 
735
                {
 
736
                (yy_init) = 1;
 
737
 
 
738
#ifdef YY_USER_INIT
 
739
                YY_USER_INIT;
 
740
#endif
 
741
 
 
742
                if ( ! (yy_start) )
 
743
                        (yy_start) = 1; /* first start state */
 
744
 
 
745
                if ( ! igraph_gml_yyin )
 
746
                        igraph_gml_yyin = stdin;
 
747
 
 
748
                if ( ! igraph_gml_yyout )
 
749
                        igraph_gml_yyout = stdout;
 
750
 
 
751
                if ( ! YY_CURRENT_BUFFER ) {
 
752
                        igraph_gml_yyensure_buffer_stack ();
 
753
                        YY_CURRENT_BUFFER_LVALUE =
 
754
                                igraph_gml_yy_create_buffer(igraph_gml_yyin,YY_BUF_SIZE );
 
755
                }
 
756
 
 
757
                igraph_gml_yy_load_buffer_state( );
 
758
                }
 
759
 
 
760
        while ( 1 )             /* loops until end-of-file is reached */
 
761
                {
 
762
                yy_cp = (yy_c_buf_p);
 
763
 
 
764
                /* Support of igraph_gml_yytext. */
 
765
                *yy_cp = (yy_hold_char);
 
766
 
 
767
                /* yy_bp points to the position in yy_ch_buf of the start of
 
768
                 * the current run.
 
769
                 */
 
770
                yy_bp = yy_cp;
 
771
 
 
772
                yy_current_state = (yy_start);
 
773
                yy_current_state += YY_AT_BOL();
 
774
yy_match:
 
775
                do
 
776
                        {
 
777
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 
778
                        if ( yy_accept[yy_current_state] )
 
779
                                {
 
780
                                (yy_last_accepting_state) = yy_current_state;
 
781
                                (yy_last_accepting_cpos) = yy_cp;
 
782
                                }
 
783
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
784
                                {
 
785
                                yy_current_state = (int) yy_def[yy_current_state];
 
786
                                if ( yy_current_state >= 29 )
 
787
                                        yy_c = yy_meta[(unsigned int) yy_c];
 
788
                                }
 
789
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
790
                        ++yy_cp;
 
791
                        }
 
792
                while ( yy_base[yy_current_state] != 43 );
 
793
 
 
794
yy_find_action:
 
795
                yy_act = yy_accept[yy_current_state];
 
796
                if ( yy_act == 0 )
 
797
                        { /* have to back up */
 
798
                        yy_cp = (yy_last_accepting_cpos);
 
799
                        yy_current_state = (yy_last_accepting_state);
 
800
                        yy_act = yy_accept[yy_current_state];
 
801
                        }
 
802
 
 
803
                YY_DO_BEFORE_ACTION;
 
804
 
 
805
do_action:      /* This label is used only to access EOF actions. */
 
806
 
 
807
                switch ( yy_act )
 
808
        { /* beginning of action switch */
 
809
                        case 0: /* must back up */
 
810
                        /* undo the effects of YY_DO_BEFORE_ACTION */
 
811
                        *yy_cp = (yy_hold_char);
 
812
                        yy_cp = (yy_last_accepting_cpos);
 
813
                        yy_current_state = (yy_last_accepting_state);
 
814
                        goto yy_find_action;
 
815
 
 
816
case 1:
 
817
/* rule 1 can match eol */
 
818
YY_RULE_SETUP
 
819
#line 69 "foreign-gml-lexer.l"
 
820
{ igraph_gml_mylineno++; /* comments ignored */ }
 
821
        YY_BREAK
 
822
case 2:
 
823
/* rule 2 can match eol */
 
824
YY_RULE_SETUP
 
825
#line 71 "foreign-gml-lexer.l"
 
826
{ return STRING; }
 
827
        YY_BREAK
 
828
case 3:
 
829
YY_RULE_SETUP
 
830
#line 72 "foreign-gml-lexer.l"
 
831
{ return NUM; }
 
832
        YY_BREAK
 
833
case 4:
 
834
YY_RULE_SETUP
 
835
#line 73 "foreign-gml-lexer.l"
 
836
{ return KEYWORD; }
 
837
        YY_BREAK
 
838
case 5:
 
839
YY_RULE_SETUP
 
840
#line 74 "foreign-gml-lexer.l"
 
841
{ return LISTOPEN; }
 
842
        YY_BREAK
 
843
case 6:
 
844
YY_RULE_SETUP
 
845
#line 75 "foreign-gml-lexer.l"
 
846
{ return LISTCLOSE; }
 
847
        YY_BREAK
 
848
case 7:
 
849
/* rule 7 can match eol */
 
850
YY_RULE_SETUP
 
851
#line 76 "foreign-gml-lexer.l"
 
852
{ igraph_gml_mylineno++; }
 
853
        YY_BREAK
 
854
case 8:
 
855
/* rule 8 can match eol */
 
856
YY_RULE_SETUP
 
857
#line 77 "foreign-gml-lexer.l"
 
858
{ /* other whitespace ignored */ }
 
859
        YY_BREAK
 
860
case YY_STATE_EOF(INITIAL):
 
861
#line 79 "foreign-gml-lexer.l"
 
862
 
863
                          if (igraph_gml_eof) {
 
864
                            yyterminate();
 
865
                          } else {
 
866
                            igraph_gml_eof=1;
 
867
                            return EOFF;
 
868
                          }                       
 
869
                        }
 
870
        YY_BREAK
 
871
case 9:
 
872
YY_RULE_SETUP
 
873
#line 88 "foreign-gml-lexer.l"
 
874
ECHO;
 
875
        YY_BREAK
 
876
#line 877 "foreign-gml-lexer.c"
 
877
 
 
878
        case YY_END_OF_BUFFER:
 
879
                {
 
880
                /* Amount of text matched not including the EOB char. */
 
881
                int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
 
882
 
 
883
                /* Undo the effects of YY_DO_BEFORE_ACTION. */
 
884
                *yy_cp = (yy_hold_char);
 
885
                YY_RESTORE_YY_MORE_OFFSET
 
886
 
 
887
                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
 
888
                        {
 
889
                        /* We're scanning a new file or input source.  It's
 
890
                         * possible that this happened because the user
 
891
                         * just pointed igraph_gml_yyin at a new source and called
 
892
                         * igraph_gml_yylex().  If so, then we have to assure
 
893
                         * consistency between YY_CURRENT_BUFFER and our
 
894
                         * globals.  Here is the right place to do so, because
 
895
                         * this is the first action (other than possibly a
 
896
                         * back-up) that will match for the new input source.
 
897
                         */
 
898
                        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
899
                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = igraph_gml_yyin;
 
900
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
 
901
                        }
 
902
 
 
903
                /* Note that here we test for yy_c_buf_p "<=" to the position
 
904
                 * of the first EOB in the buffer, since yy_c_buf_p will
 
905
                 * already have been incremented past the NUL character
 
906
                 * (since all states make transitions on EOB to the
 
907
                 * end-of-buffer state).  Contrast this with the test
 
908
                 * in input().
 
909
                 */
 
910
                if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
911
                        { /* This was really a NUL. */
 
912
                        yy_state_type yy_next_state;
 
913
 
 
914
                        (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
 
915
 
 
916
                        yy_current_state = yy_get_previous_state(  );
 
917
 
 
918
                        /* Okay, we're now positioned to make the NUL
 
919
                         * transition.  We couldn't have
 
920
                         * yy_get_previous_state() go ahead and do it
 
921
                         * for us because it doesn't know how to deal
 
922
                         * with the possibility of jamming (and we don't
 
923
                         * want to build jamming into it because then it
 
924
                         * will run more slowly).
 
925
                         */
 
926
 
 
927
                        yy_next_state = yy_try_NUL_trans( yy_current_state );
 
928
 
 
929
                        yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
930
 
 
931
                        if ( yy_next_state )
 
932
                                {
 
933
                                /* Consume the NUL. */
 
934
                                yy_cp = ++(yy_c_buf_p);
 
935
                                yy_current_state = yy_next_state;
 
936
                                goto yy_match;
 
937
                                }
 
938
 
 
939
                        else
 
940
                                {
 
941
                                yy_cp = (yy_c_buf_p);
 
942
                                goto yy_find_action;
 
943
                                }
 
944
                        }
 
945
 
 
946
                else switch ( yy_get_next_buffer(  ) )
 
947
                        {
 
948
                        case EOB_ACT_END_OF_FILE:
 
949
                                {
 
950
                                (yy_did_buffer_switch_on_eof) = 0;
 
951
 
 
952
                                if ( igraph_gml_yywrap( ) )
 
953
                                        {
 
954
                                        /* Note: because we've taken care in
 
955
                                         * yy_get_next_buffer() to have set up
 
956
                                         * igraph_gml_yytext, we can now set up
 
957
                                         * yy_c_buf_p so that if some total
 
958
                                         * hoser (like flex itself) wants to
 
959
                                         * call the scanner after we return the
 
960
                                         * YY_NULL, it'll still work - another
 
961
                                         * YY_NULL will get returned.
 
962
                                         */
 
963
                                        (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
 
964
 
 
965
                                        yy_act = YY_STATE_EOF(YY_START);
 
966
                                        goto do_action;
 
967
                                        }
 
968
 
 
969
                                else
 
970
                                        {
 
971
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
972
                                                YY_NEW_FILE;
 
973
                                        }
 
974
                                break;
 
975
                                }
 
976
 
 
977
                        case EOB_ACT_CONTINUE_SCAN:
 
978
                                (yy_c_buf_p) =
 
979
                                        (yytext_ptr) + yy_amount_of_matched_text;
 
980
 
 
981
                                yy_current_state = yy_get_previous_state(  );
 
982
 
 
983
                                yy_cp = (yy_c_buf_p);
 
984
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
985
                                goto yy_match;
 
986
 
 
987
                        case EOB_ACT_LAST_MATCH:
 
988
                                (yy_c_buf_p) =
 
989
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
 
990
 
 
991
                                yy_current_state = yy_get_previous_state(  );
 
992
 
 
993
                                yy_cp = (yy_c_buf_p);
 
994
                                yy_bp = (yytext_ptr) + YY_MORE_ADJ;
 
995
                                goto yy_find_action;
 
996
                        }
 
997
                break;
 
998
                }
 
999
 
 
1000
        default:
 
1001
                YY_FATAL_ERROR(
 
1002
                        "fatal flex scanner internal error--no action found" );
 
1003
        } /* end of action switch */
 
1004
                } /* end of scanning one token */
 
1005
} /* end of igraph_gml_yylex */
 
1006
 
 
1007
/* yy_get_next_buffer - try to read in a new buffer
 
1008
 *
 
1009
 * Returns a code representing an action:
 
1010
 *      EOB_ACT_LAST_MATCH -
 
1011
 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 
1012
 *      EOB_ACT_END_OF_FILE - end of file
 
1013
 */
 
1014
static int yy_get_next_buffer (void)
 
1015
{
 
1016
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 
1017
        register char *source = (yytext_ptr);
 
1018
        register int number_to_move, i;
 
1019
        int ret_val;
 
1020
 
 
1021
        if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
 
1022
                YY_FATAL_ERROR(
 
1023
                "fatal flex scanner internal error--end of buffer missed" );
 
1024
 
 
1025
        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 
1026
                { /* Don't try to fill the buffer, so this is an EOF. */
 
1027
                if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
 
1028
                        {
 
1029
                        /* We matched a single character, the EOB, so
 
1030
                         * treat this as a final EOF.
 
1031
                         */
 
1032
                        return EOB_ACT_END_OF_FILE;
 
1033
                        }
 
1034
 
 
1035
                else
 
1036
                        {
 
1037
                        /* We matched some text prior to the EOB, first
 
1038
                         * process it.
 
1039
                         */
 
1040
                        return EOB_ACT_LAST_MATCH;
 
1041
                        }
 
1042
                }
 
1043
 
 
1044
        /* Try to read more data. */
 
1045
 
 
1046
        /* First move last chars to start of buffer. */
 
1047
        number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
 
1048
 
 
1049
        for ( i = 0; i < number_to_move; ++i )
 
1050
                *(dest++) = *(source++);
 
1051
 
 
1052
        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 
1053
                /* don't do the read, it's not guaranteed to return an EOF,
 
1054
                 * just force an EOF
 
1055
                 */
 
1056
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
 
1057
 
 
1058
        else
 
1059
                {
 
1060
                        int num_to_read =
 
1061
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
1062
 
 
1063
                while ( num_to_read <= 0 )
 
1064
                        { /* Not enough room in the buffer - grow it. */
 
1065
 
 
1066
                        /* just a shorter name for the current buffer */
 
1067
                        YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
 
1068
 
 
1069
                        int yy_c_buf_p_offset =
 
1070
                                (int) ((yy_c_buf_p) - b->yy_ch_buf);
 
1071
 
 
1072
                        if ( b->yy_is_our_buffer )
 
1073
                                {
 
1074
                                int new_size = b->yy_buf_size * 2;
 
1075
 
 
1076
                                if ( new_size <= 0 )
 
1077
                                        b->yy_buf_size += b->yy_buf_size / 8;
 
1078
                                else
 
1079
                                        b->yy_buf_size *= 2;
 
1080
 
 
1081
                                b->yy_ch_buf = (char *)
 
1082
                                        /* Include room in for 2 EOB chars. */
 
1083
                                        igraph_gml_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
 
1084
                                }
 
1085
                        else
 
1086
                                /* Can't grow it, we don't own it. */
 
1087
                                b->yy_ch_buf = 0;
 
1088
 
 
1089
                        if ( ! b->yy_ch_buf )
 
1090
                                YY_FATAL_ERROR(
 
1091
                                "fatal error - scanner input buffer overflow" );
 
1092
 
 
1093
                        (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
 
1094
 
 
1095
                        num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
 
1096
                                                number_to_move - 1;
 
1097
 
 
1098
                        }
 
1099
 
 
1100
                if ( num_to_read > YY_READ_BUF_SIZE )
 
1101
                        num_to_read = YY_READ_BUF_SIZE;
 
1102
 
 
1103
                /* Read in more data. */
 
1104
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
 
1105
                        (yy_n_chars), (size_t) num_to_read );
 
1106
 
 
1107
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1108
                }
 
1109
 
 
1110
        if ( (yy_n_chars) == 0 )
 
1111
                {
 
1112
                if ( number_to_move == YY_MORE_ADJ )
 
1113
                        {
 
1114
                        ret_val = EOB_ACT_END_OF_FILE;
 
1115
                        igraph_gml_yyrestart(igraph_gml_yyin  );
 
1116
                        }
 
1117
 
 
1118
                else
 
1119
                        {
 
1120
                        ret_val = EOB_ACT_LAST_MATCH;
 
1121
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
 
1122
                                YY_BUFFER_EOF_PENDING;
 
1123
                        }
 
1124
                }
 
1125
 
 
1126
        else
 
1127
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
1128
 
 
1129
        if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 
1130
                /* Extend the array by 50%, plus the number we really need. */
 
1131
                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
 
1132
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) igraph_gml_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
 
1133
                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 
1134
                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
 
1135
        }
 
1136
 
 
1137
        (yy_n_chars) += number_to_move;
 
1138
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
 
1139
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
 
1140
 
 
1141
        (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
1142
 
 
1143
        return ret_val;
 
1144
}
 
1145
 
 
1146
/* yy_get_previous_state - get the state just before the EOB char was reached */
 
1147
 
 
1148
    static yy_state_type yy_get_previous_state (void)
 
1149
{
 
1150
        register yy_state_type yy_current_state;
 
1151
        register char *yy_cp;
 
1152
    
 
1153
        yy_current_state = (yy_start);
 
1154
        yy_current_state += YY_AT_BOL();
 
1155
 
 
1156
        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
 
1157
                {
 
1158
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 
1159
                if ( yy_accept[yy_current_state] )
 
1160
                        {
 
1161
                        (yy_last_accepting_state) = yy_current_state;
 
1162
                        (yy_last_accepting_cpos) = yy_cp;
 
1163
                        }
 
1164
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1165
                        {
 
1166
                        yy_current_state = (int) yy_def[yy_current_state];
 
1167
                        if ( yy_current_state >= 29 )
 
1168
                                yy_c = yy_meta[(unsigned int) yy_c];
 
1169
                        }
 
1170
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1171
                }
 
1172
 
 
1173
        return yy_current_state;
 
1174
}
 
1175
 
 
1176
/* yy_try_NUL_trans - try to make a transition on the NUL character
 
1177
 *
 
1178
 * synopsis
 
1179
 *      next_state = yy_try_NUL_trans( current_state );
 
1180
 */
 
1181
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
 
1182
{
 
1183
        register int yy_is_jam;
 
1184
        register char *yy_cp = (yy_c_buf_p);
 
1185
 
 
1186
        register YY_CHAR yy_c = 1;
 
1187
        if ( yy_accept[yy_current_state] )
 
1188
                {
 
1189
                (yy_last_accepting_state) = yy_current_state;
 
1190
                (yy_last_accepting_cpos) = yy_cp;
 
1191
                }
 
1192
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1193
                {
 
1194
                yy_current_state = (int) yy_def[yy_current_state];
 
1195
                if ( yy_current_state >= 29 )
 
1196
                        yy_c = yy_meta[(unsigned int) yy_c];
 
1197
                }
 
1198
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1199
        yy_is_jam = (yy_current_state == 28);
 
1200
 
 
1201
        return yy_is_jam ? 0 : yy_current_state;
 
1202
}
 
1203
 
 
1204
#ifndef YY_NO_INPUT
 
1205
#ifdef __cplusplus
 
1206
    static int yyinput (void)
 
1207
#else
 
1208
    static int input  (void)
 
1209
#endif
 
1210
 
 
1211
{
 
1212
        int c;
 
1213
    
 
1214
        *(yy_c_buf_p) = (yy_hold_char);
 
1215
 
 
1216
        if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
 
1217
                {
 
1218
                /* yy_c_buf_p now points to the character we want to return.
 
1219
                 * If this occurs *before* the EOB characters, then it's a
 
1220
                 * valid NUL; if not, then we've hit the end of the buffer.
 
1221
                 */
 
1222
                if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
 
1223
                        /* This was really a NUL. */
 
1224
                        *(yy_c_buf_p) = '\0';
 
1225
 
 
1226
                else
 
1227
                        { /* need more input */
 
1228
                        int offset = (yy_c_buf_p) - (yytext_ptr);
 
1229
                        ++(yy_c_buf_p);
 
1230
 
 
1231
                        switch ( yy_get_next_buffer(  ) )
 
1232
                                {
 
1233
                                case EOB_ACT_LAST_MATCH:
 
1234
                                        /* This happens because yy_g_n_b()
 
1235
                                         * sees that we've accumulated a
 
1236
                                         * token and flags that we need to
 
1237
                                         * try matching the token before
 
1238
                                         * proceeding.  But for input(),
 
1239
                                         * there's no matching to consider.
 
1240
                                         * So convert the EOB_ACT_LAST_MATCH
 
1241
                                         * to EOB_ACT_END_OF_FILE.
 
1242
                                         */
 
1243
 
 
1244
                                        /* Reset buffer status. */
 
1245
                                        igraph_gml_yyrestart(igraph_gml_yyin );
 
1246
 
 
1247
                                        /*FALLTHROUGH*/
 
1248
 
 
1249
                                case EOB_ACT_END_OF_FILE:
 
1250
                                        {
 
1251
                                        if ( igraph_gml_yywrap( ) )
 
1252
                                                return EOF;
 
1253
 
 
1254
                                        if ( ! (yy_did_buffer_switch_on_eof) )
 
1255
                                                YY_NEW_FILE;
 
1256
#ifdef __cplusplus
 
1257
                                        return yyinput();
 
1258
#else
 
1259
                                        return input();
 
1260
#endif
 
1261
                                        }
 
1262
 
 
1263
                                case EOB_ACT_CONTINUE_SCAN:
 
1264
                                        (yy_c_buf_p) = (yytext_ptr) + offset;
 
1265
                                        break;
 
1266
                                }
 
1267
                        }
 
1268
                }
 
1269
 
 
1270
        c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
 
1271
        *(yy_c_buf_p) = '\0';   /* preserve igraph_gml_yytext */
 
1272
        (yy_hold_char) = *++(yy_c_buf_p);
 
1273
 
 
1274
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
 
1275
 
 
1276
        return c;
 
1277
}
 
1278
#endif  /* ifndef YY_NO_INPUT */
 
1279
 
 
1280
/** Immediately switch to a different input stream.
 
1281
 * @param input_file A readable stream.
 
1282
 * 
 
1283
 * @note This function does not reset the start condition to @c INITIAL .
 
1284
 */
 
1285
    void igraph_gml_yyrestart  (FILE * input_file )
 
1286
{
 
1287
    
 
1288
        if ( ! YY_CURRENT_BUFFER ){
 
1289
        igraph_gml_yyensure_buffer_stack ();
 
1290
                YY_CURRENT_BUFFER_LVALUE =
 
1291
            igraph_gml_yy_create_buffer(igraph_gml_yyin,YY_BUF_SIZE );
 
1292
        }
 
1293
 
 
1294
        igraph_gml_yy_init_buffer(YY_CURRENT_BUFFER,input_file );
 
1295
        igraph_gml_yy_load_buffer_state( );
 
1296
}
 
1297
 
 
1298
/** Switch to a different input buffer.
 
1299
 * @param new_buffer The new input buffer.
 
1300
 * 
 
1301
 */
 
1302
    void igraph_gml_yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
 
1303
{
 
1304
    
 
1305
        /* TODO. We should be able to replace this entire function body
 
1306
         * with
 
1307
         *              igraph_gml_yypop_buffer_state();
 
1308
         *              igraph_gml_yypush_buffer_state(new_buffer);
 
1309
     */
 
1310
        igraph_gml_yyensure_buffer_stack ();
 
1311
        if ( YY_CURRENT_BUFFER == new_buffer )
 
1312
                return;
 
1313
 
 
1314
        if ( YY_CURRENT_BUFFER )
 
1315
                {
 
1316
                /* Flush out information for old buffer. */
 
1317
                *(yy_c_buf_p) = (yy_hold_char);
 
1318
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
1319
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1320
                }
 
1321
 
 
1322
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
1323
        igraph_gml_yy_load_buffer_state( );
 
1324
 
 
1325
        /* We don't actually know whether we did this switch during
 
1326
         * EOF (igraph_gml_yywrap()) processing, but the only time this flag
 
1327
         * is looked at is after igraph_gml_yywrap() is called, so it's safe
 
1328
         * to go ahead and always set it.
 
1329
         */
 
1330
        (yy_did_buffer_switch_on_eof) = 1;
 
1331
}
 
1332
 
 
1333
static void igraph_gml_yy_load_buffer_state  (void)
 
1334
{
 
1335
        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
1336
        (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
 
1337
        igraph_gml_yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
 
1338
        (yy_hold_char) = *(yy_c_buf_p);
 
1339
}
 
1340
 
 
1341
/** Allocate and initialize an input buffer state.
 
1342
 * @param file A readable stream.
 
1343
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 
1344
 * 
 
1345
 * @return the allocated buffer state.
 
1346
 */
 
1347
    YY_BUFFER_STATE igraph_gml_yy_create_buffer  (FILE * file, int  size )
 
1348
{
 
1349
        YY_BUFFER_STATE b;
 
1350
    
 
1351
        b = (YY_BUFFER_STATE) igraph_gml_yyalloc(sizeof( struct yy_buffer_state )  );
 
1352
        if ( ! b )
 
1353
                YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yy_create_buffer()" );
 
1354
 
 
1355
        b->yy_buf_size = size;
 
1356
 
 
1357
        /* yy_ch_buf has to be 2 characters longer than the size given because
 
1358
         * we need to put in 2 end-of-buffer characters.
 
1359
         */
 
1360
        b->yy_ch_buf = (char *) igraph_gml_yyalloc(b->yy_buf_size + 2  );
 
1361
        if ( ! b->yy_ch_buf )
 
1362
                YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yy_create_buffer()" );
 
1363
 
 
1364
        b->yy_is_our_buffer = 1;
 
1365
 
 
1366
        igraph_gml_yy_init_buffer(b,file );
 
1367
 
 
1368
        return b;
 
1369
}
 
1370
 
 
1371
/** Destroy the buffer.
 
1372
 * @param b a buffer created with igraph_gml_yy_create_buffer()
 
1373
 * 
 
1374
 */
 
1375
    void igraph_gml_yy_delete_buffer (YY_BUFFER_STATE  b )
 
1376
{
 
1377
    
 
1378
        if ( ! b )
 
1379
                return;
 
1380
 
 
1381
        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
 
1382
                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
1383
 
 
1384
        if ( b->yy_is_our_buffer )
 
1385
                igraph_gml_yyfree((void *) b->yy_ch_buf  );
 
1386
 
 
1387
        igraph_gml_yyfree((void *) b  );
 
1388
}
 
1389
 
 
1390
#ifndef __cplusplus
 
1391
extern int isatty (int );
 
1392
#endif /* __cplusplus */
 
1393
    
 
1394
/* Initializes or reinitializes a buffer.
 
1395
 * This function is sometimes called more than once on the same buffer,
 
1396
 * such as during a igraph_gml_yyrestart() or at EOF.
 
1397
 */
 
1398
    static void igraph_gml_yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
 
1399
 
 
1400
{
 
1401
        int oerrno = errno;
 
1402
    
 
1403
        igraph_gml_yy_flush_buffer(b );
 
1404
 
 
1405
        b->yy_input_file = file;
 
1406
        b->yy_fill_buffer = 1;
 
1407
 
 
1408
    /* If b is the current buffer, then igraph_gml_yy_init_buffer was _probably_
 
1409
     * called from igraph_gml_yyrestart() or through yy_get_next_buffer.
 
1410
     * In that case, we don't want to reset the lineno or column.
 
1411
     */
 
1412
    if (b != YY_CURRENT_BUFFER){
 
1413
        b->yy_bs_lineno = 1;
 
1414
        b->yy_bs_column = 0;
 
1415
    }
 
1416
 
 
1417
        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
 
1418
    
 
1419
        errno = oerrno;
 
1420
}
 
1421
 
 
1422
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 
1423
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 
1424
 * 
 
1425
 */
 
1426
    void igraph_gml_yy_flush_buffer (YY_BUFFER_STATE  b )
 
1427
{
 
1428
        if ( ! b )
 
1429
                return;
 
1430
 
 
1431
        b->yy_n_chars = 0;
 
1432
 
 
1433
        /* We always need two end-of-buffer characters.  The first causes
 
1434
         * a transition to the end-of-buffer state.  The second causes
 
1435
         * a jam in that state.
 
1436
         */
 
1437
        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
 
1438
        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
1439
 
 
1440
        b->yy_buf_pos = &b->yy_ch_buf[0];
 
1441
 
 
1442
        b->yy_at_bol = 1;
 
1443
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1444
 
 
1445
        if ( b == YY_CURRENT_BUFFER )
 
1446
                igraph_gml_yy_load_buffer_state( );
 
1447
}
 
1448
 
 
1449
/** Pushes the new state onto the stack. The new state becomes
 
1450
 *  the current state. This function will allocate the stack
 
1451
 *  if necessary.
 
1452
 *  @param new_buffer The new state.
 
1453
 *  
 
1454
 */
 
1455
void igraph_gml_yypush_buffer_state (YY_BUFFER_STATE new_buffer )
 
1456
{
 
1457
        if (new_buffer == NULL)
 
1458
                return;
 
1459
 
 
1460
        igraph_gml_yyensure_buffer_stack();
 
1461
 
 
1462
        /* This block is copied from igraph_gml_yy_switch_to_buffer. */
 
1463
        if ( YY_CURRENT_BUFFER )
 
1464
                {
 
1465
                /* Flush out information for old buffer. */
 
1466
                *(yy_c_buf_p) = (yy_hold_char);
 
1467
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
 
1468
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 
1469
                }
 
1470
 
 
1471
        /* Only push if top exists. Otherwise, replace top. */
 
1472
        if (YY_CURRENT_BUFFER)
 
1473
                (yy_buffer_stack_top)++;
 
1474
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
1475
 
 
1476
        /* copied from igraph_gml_yy_switch_to_buffer. */
 
1477
        igraph_gml_yy_load_buffer_state( );
 
1478
        (yy_did_buffer_switch_on_eof) = 1;
 
1479
}
 
1480
 
 
1481
/** Removes and deletes the top of the stack, if present.
 
1482
 *  The next element becomes the new top.
 
1483
 *  
 
1484
 */
 
1485
void igraph_gml_yypop_buffer_state (void)
 
1486
{
 
1487
        if (!YY_CURRENT_BUFFER)
 
1488
                return;
 
1489
 
 
1490
        igraph_gml_yy_delete_buffer(YY_CURRENT_BUFFER );
 
1491
        YY_CURRENT_BUFFER_LVALUE = NULL;
 
1492
        if ((yy_buffer_stack_top) > 0)
 
1493
                --(yy_buffer_stack_top);
 
1494
 
 
1495
        if (YY_CURRENT_BUFFER) {
 
1496
                igraph_gml_yy_load_buffer_state( );
 
1497
                (yy_did_buffer_switch_on_eof) = 1;
 
1498
        }
 
1499
}
 
1500
 
 
1501
/* Allocates the stack if it does not exist.
 
1502
 *  Guarantees space for at least one push.
 
1503
 */
 
1504
static void igraph_gml_yyensure_buffer_stack (void)
 
1505
{
 
1506
        int num_to_alloc;
 
1507
    
 
1508
        if (!(yy_buffer_stack)) {
 
1509
 
 
1510
                /* First allocation is just for 2 elements, since we don't know if this
 
1511
                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 
1512
                 * immediate realloc on the next call.
 
1513
         */
 
1514
                num_to_alloc = 1;
 
1515
                (yy_buffer_stack) = (struct yy_buffer_state**)igraph_gml_yyalloc
 
1516
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
 
1517
                                                                );
 
1518
                if ( ! (yy_buffer_stack) )
 
1519
                        YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yyensure_buffer_stack()" );
 
1520
                                                                  
 
1521
                memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
1522
                                
 
1523
                (yy_buffer_stack_max) = num_to_alloc;
 
1524
                (yy_buffer_stack_top) = 0;
 
1525
                return;
 
1526
        }
 
1527
 
 
1528
        if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
 
1529
 
 
1530
                /* Increase the buffer to prepare for a possible push. */
 
1531
                int grow_size = 8 /* arbitrary grow size */;
 
1532
 
 
1533
                num_to_alloc = (yy_buffer_stack_max) + grow_size;
 
1534
                (yy_buffer_stack) = (struct yy_buffer_state**)igraph_gml_yyrealloc
 
1535
                                                                ((yy_buffer_stack),
 
1536
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
 
1537
                                                                );
 
1538
                if ( ! (yy_buffer_stack) )
 
1539
                        YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yyensure_buffer_stack()" );
 
1540
 
 
1541
                /* zero only the new slots.*/
 
1542
                memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
 
1543
                (yy_buffer_stack_max) = num_to_alloc;
 
1544
        }
 
1545
}
 
1546
 
 
1547
/** Setup the input buffer state to scan directly from a user-specified character buffer.
 
1548
 * @param base the character buffer
 
1549
 * @param size the size in bytes of the character buffer
 
1550
 * 
 
1551
 * @return the newly allocated buffer state object. 
 
1552
 */
 
1553
YY_BUFFER_STATE igraph_gml_yy_scan_buffer  (char * base, yy_size_t  size )
 
1554
{
 
1555
        YY_BUFFER_STATE b;
 
1556
    
 
1557
        if ( size < 2 ||
 
1558
             base[size-2] != YY_END_OF_BUFFER_CHAR ||
 
1559
             base[size-1] != YY_END_OF_BUFFER_CHAR )
 
1560
                /* They forgot to leave room for the EOB's. */
 
1561
                return 0;
 
1562
 
 
1563
        b = (YY_BUFFER_STATE) igraph_gml_yyalloc(sizeof( struct yy_buffer_state )  );
 
1564
        if ( ! b )
 
1565
                YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yy_scan_buffer()" );
 
1566
 
 
1567
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
 
1568
        b->yy_buf_pos = b->yy_ch_buf = base;
 
1569
        b->yy_is_our_buffer = 0;
 
1570
        b->yy_input_file = 0;
 
1571
        b->yy_n_chars = b->yy_buf_size;
 
1572
        b->yy_is_interactive = 0;
 
1573
        b->yy_at_bol = 1;
 
1574
        b->yy_fill_buffer = 0;
 
1575
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1576
 
 
1577
        igraph_gml_yy_switch_to_buffer(b  );
 
1578
 
 
1579
        return b;
 
1580
}
 
1581
 
 
1582
/** Setup the input buffer state to scan a string. The next call to igraph_gml_yylex() will
 
1583
 * scan from a @e copy of @a str.
 
1584
 * @param yystr a NUL-terminated string to scan
 
1585
 * 
 
1586
 * @return the newly allocated buffer state object.
 
1587
 * @note If you want to scan bytes that may contain NUL values, then use
 
1588
 *       igraph_gml_yy_scan_bytes() instead.
 
1589
 */
 
1590
YY_BUFFER_STATE igraph_gml_yy_scan_string (yyconst char * yystr )
 
1591
{
 
1592
    
 
1593
        return igraph_gml_yy_scan_bytes(yystr,strlen(yystr) );
 
1594
}
 
1595
 
 
1596
/** Setup the input buffer state to scan the given bytes. The next call to igraph_gml_yylex() will
 
1597
 * scan from a @e copy of @a bytes.
 
1598
 * @param bytes the byte buffer to scan
 
1599
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 
1600
 * 
 
1601
 * @return the newly allocated buffer state object.
 
1602
 */
 
1603
YY_BUFFER_STATE igraph_gml_yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
 
1604
{
 
1605
        YY_BUFFER_STATE b;
 
1606
        char *buf;
 
1607
        yy_size_t n;
 
1608
        int i;
 
1609
    
 
1610
        /* Get memory for full buffer, including space for trailing EOB's. */
 
1611
        n = _yybytes_len + 2;
 
1612
        buf = (char *) igraph_gml_yyalloc(n  );
 
1613
        if ( ! buf )
 
1614
                YY_FATAL_ERROR( "out of dynamic memory in igraph_gml_yy_scan_bytes()" );
 
1615
 
 
1616
        for ( i = 0; i < _yybytes_len; ++i )
 
1617
                buf[i] = yybytes[i];
 
1618
 
 
1619
        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
1620
 
 
1621
        b = igraph_gml_yy_scan_buffer(buf,n );
 
1622
        if ( ! b )
 
1623
                YY_FATAL_ERROR( "bad buffer in igraph_gml_yy_scan_bytes()" );
 
1624
 
 
1625
        /* It's okay to grow etc. this buffer, and we should throw it
 
1626
         * away when we're done.
 
1627
         */
 
1628
        b->yy_is_our_buffer = 1;
 
1629
 
 
1630
        return b;
 
1631
}
 
1632
 
 
1633
#ifndef YY_EXIT_FAILURE
 
1634
#define YY_EXIT_FAILURE 2
 
1635
#endif
 
1636
 
 
1637
static void yy_fatal_error (yyconst char* msg )
 
1638
{
 
1639
        (void) fprintf( stderr, "%s\n", msg );
 
1640
        exit( YY_EXIT_FAILURE );
 
1641
}
 
1642
 
 
1643
/* Redefine yyless() so it works in section 3 code. */
 
1644
 
 
1645
#undef yyless
 
1646
#define yyless(n) \
 
1647
        do \
 
1648
                { \
 
1649
                /* Undo effects of setting up igraph_gml_yytext. */ \
 
1650
        int yyless_macro_arg = (n); \
 
1651
        YY_LESS_LINENO(yyless_macro_arg);\
 
1652
                igraph_gml_yytext[igraph_gml_yyleng] = (yy_hold_char); \
 
1653
                (yy_c_buf_p) = igraph_gml_yytext + yyless_macro_arg; \
 
1654
                (yy_hold_char) = *(yy_c_buf_p); \
 
1655
                *(yy_c_buf_p) = '\0'; \
 
1656
                igraph_gml_yyleng = yyless_macro_arg; \
 
1657
                } \
 
1658
        while ( 0 )
 
1659
 
 
1660
/* Accessor  methods (get/set functions) to struct members. */
 
1661
 
 
1662
/** Get the current line number.
 
1663
 * 
 
1664
 */
 
1665
int igraph_gml_yyget_lineno  (void)
 
1666
{
 
1667
        
 
1668
    return igraph_gml_yylineno;
 
1669
}
 
1670
 
 
1671
/** Get the input stream.
 
1672
 * 
 
1673
 */
 
1674
FILE *igraph_gml_yyget_in  (void)
 
1675
{
 
1676
        return igraph_gml_yyin;
 
1677
}
 
1678
 
 
1679
/** Get the output stream.
 
1680
 * 
 
1681
 */
 
1682
FILE *igraph_gml_yyget_out  (void)
 
1683
{
 
1684
        return igraph_gml_yyout;
 
1685
}
 
1686
 
 
1687
/** Get the length of the current token.
 
1688
 * 
 
1689
 */
 
1690
int igraph_gml_yyget_leng  (void)
 
1691
{
 
1692
        return igraph_gml_yyleng;
 
1693
}
 
1694
 
 
1695
/** Get the current token.
 
1696
 * 
 
1697
 */
 
1698
 
 
1699
char *igraph_gml_yyget_text  (void)
 
1700
{
 
1701
        return igraph_gml_yytext;
 
1702
}
 
1703
 
 
1704
/** Set the current line number.
 
1705
 * @param line_number
 
1706
 * 
 
1707
 */
 
1708
void igraph_gml_yyset_lineno (int  line_number )
 
1709
{
 
1710
    
 
1711
    igraph_gml_yylineno = line_number;
 
1712
}
 
1713
 
 
1714
/** Set the input stream. This does not discard the current
 
1715
 * input buffer.
 
1716
 * @param in_str A readable stream.
 
1717
 * 
 
1718
 * @see igraph_gml_yy_switch_to_buffer
 
1719
 */
 
1720
void igraph_gml_yyset_in (FILE *  in_str )
 
1721
{
 
1722
        igraph_gml_yyin = in_str ;
 
1723
}
 
1724
 
 
1725
void igraph_gml_yyset_out (FILE *  out_str )
 
1726
{
 
1727
        igraph_gml_yyout = out_str ;
 
1728
}
 
1729
 
 
1730
int igraph_gml_yyget_debug  (void)
 
1731
{
 
1732
        return igraph_gml_yy_flex_debug;
 
1733
}
 
1734
 
 
1735
void igraph_gml_yyset_debug (int  bdebug )
 
1736
{
 
1737
        igraph_gml_yy_flex_debug = bdebug ;
 
1738
}
 
1739
 
 
1740
static int yy_init_globals (void)
 
1741
{
 
1742
        /* Initialization is the same as for the non-reentrant scanner.
 
1743
     * This function is called from igraph_gml_yylex_destroy(), so don't allocate here.
 
1744
     */
 
1745
 
 
1746
    (yy_buffer_stack) = 0;
 
1747
    (yy_buffer_stack_top) = 0;
 
1748
    (yy_buffer_stack_max) = 0;
 
1749
    (yy_c_buf_p) = (char *) 0;
 
1750
    (yy_init) = 0;
 
1751
    (yy_start) = 0;
 
1752
 
 
1753
/* Defined in main.c */
 
1754
#ifdef YY_STDINIT
 
1755
    igraph_gml_yyin = stdin;
 
1756
    igraph_gml_yyout = stdout;
 
1757
#else
 
1758
    igraph_gml_yyin = (FILE *) 0;
 
1759
    igraph_gml_yyout = (FILE *) 0;
 
1760
#endif
 
1761
 
 
1762
    /* For future reference: Set errno on error, since we are called by
 
1763
     * igraph_gml_yylex_init()
 
1764
     */
 
1765
    return 0;
 
1766
}
 
1767
 
 
1768
/* igraph_gml_yylex_destroy is for both reentrant and non-reentrant scanners. */
 
1769
int igraph_gml_yylex_destroy  (void)
 
1770
{
 
1771
    
 
1772
    /* Pop the buffer stack, destroying each element. */
 
1773
        while(YY_CURRENT_BUFFER){
 
1774
                igraph_gml_yy_delete_buffer(YY_CURRENT_BUFFER  );
 
1775
                YY_CURRENT_BUFFER_LVALUE = NULL;
 
1776
                igraph_gml_yypop_buffer_state();
 
1777
        }
 
1778
 
 
1779
        /* Destroy the stack itself. */
 
1780
        igraph_gml_yyfree((yy_buffer_stack) );
 
1781
        (yy_buffer_stack) = NULL;
 
1782
 
 
1783
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
 
1784
     * igraph_gml_yylex() is called, initialization will occur. */
 
1785
    yy_init_globals( );
 
1786
 
 
1787
    return 0;
 
1788
}
 
1789
 
 
1790
/*
 
1791
 * Internal utility routines.
 
1792
 */
 
1793
 
 
1794
#ifndef yytext_ptr
 
1795
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
 
1796
{
 
1797
        register int i;
 
1798
        for ( i = 0; i < n; ++i )
 
1799
                s1[i] = s2[i];
 
1800
}
 
1801
#endif
 
1802
 
 
1803
#ifdef YY_NEED_STRLEN
 
1804
static int yy_flex_strlen (yyconst char * s )
 
1805
{
 
1806
        register int n;
 
1807
        for ( n = 0; s[n]; ++n )
 
1808
                ;
 
1809
 
 
1810
        return n;
 
1811
}
 
1812
#endif
 
1813
 
 
1814
void *igraph_gml_yyalloc (yy_size_t  size )
 
1815
{
 
1816
        return (void *) malloc( size );
 
1817
}
 
1818
 
 
1819
void *igraph_gml_yyrealloc  (void * ptr, yy_size_t  size )
 
1820
{
 
1821
        /* The cast to (char *) in the following accommodates both
 
1822
         * implementations that use char* generic pointers, and those
 
1823
         * that use void* generic pointers.  It works with the latter
 
1824
         * because both ANSI C and C++ allow castless assignment from
 
1825
         * any pointer type to void*, and deal with argument conversions
 
1826
         * as though doing an assignment.
 
1827
         */
 
1828
        return (void *) realloc( (char *) ptr, size );
 
1829
}
 
1830
 
 
1831
void igraph_gml_yyfree (void * ptr )
 
1832
{
 
1833
        free( (char *) ptr );   /* see igraph_gml_yyrealloc() for (char *) cast */
 
1834
}
 
1835
 
 
1836
#define YYTABLES_NAME "yytables"
 
1837
 
 
1838
#line 88 "foreign-gml-lexer.l"
 
1839
 
 
1840
 
 
1841