Graphviz  2.41.20171026.1811
scan.c
Go to the documentation of this file.
1 
2 #line 3 "lex.aag.c"
3 
4 #define YY_INT_ALIGNED short int
5 
6 /* A lexical scanner generated by flex */
7 
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 37
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
15 
16 /* First, we deal with platform-specific or compiler-specific issues. */
17 
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
23 
24 /* end standard C headers. */
25 
26 /* flex integer type definitions */
27 
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
30 
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32 
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34 
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36  * if you want the limit (max/min) macros for int types.
37  */
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
41 
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
56 
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX (4294967295U)
84 #endif
85 
86 #endif /* ! C99 */
87 
88 #endif /* ! FLEXINT_H */
89 
90 #ifdef __cplusplus
91 
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
94 
95 #else /* ! __cplusplus */
96 
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
99 
100 #define YY_USE_CONST
101 
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
104 
105 #ifdef YY_USE_CONST
106 #define aagconst const
107 #else
108 #define aagconst
109 #endif
110 
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
113 
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115  * integer for use as an array index. If the signed char is negative,
116  * we want to instead treat it as an 8-bit unsigned char, hence the
117  * double cast.
118  */
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120 
121 /* Enter a start condition. This macro really ought to take a parameter,
122  * but we do it the disgusting crufty way forced on us by the ()-less
123  * definition of BEGIN.
124  */
125 #define BEGIN (aag_start) = 1 + 2 *
126 
127 /* Translate the current start state into a value that can be later handed
128  * to BEGIN to return to the state. The YYSTATE alias is for lex
129  * compatibility.
130  */
131 #define YY_START (((aag_start) - 1) / 2)
132 #define YYSTATE YY_START
133 
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
136 
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE aagrestart(aagin )
139 
140 #define YY_END_OF_BUFFER_CHAR 0
141 
142 /* Size of default input buffer. */
143 #ifndef YY_BUF_SIZE
144 #define YY_BUF_SIZE 16384
145 #endif
146 
147 /* The state buf must be large enough to hold one state per character in the main buffer.
148  */
149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(aag_state_type))
150 
151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
152 #define YY_TYPEDEF_YY_BUFFER_STATE
154 #endif
155 
156 #ifndef YY_TYPEDEF_YY_SIZE_T
157 #define YY_TYPEDEF_YY_SIZE_T
158 typedef size_t aag_size_t;
159 #endif
160 
161 extern aag_size_t aagleng;
162 
163 extern FILE *aagin, *aagout;
164 
165 #define EOB_ACT_CONTINUE_SCAN 0
166 #define EOB_ACT_END_OF_FILE 1
167 #define EOB_ACT_LAST_MATCH 2
168 
169  #define YY_LESS_LINENO(n)
170 
171 /* Return all but the first "n" matched characters back to the input stream. */
172 #define aagless(n) \
173  do \
174  { \
175  /* Undo effects of setting up aagtext. */ \
176  int aagless_macro_arg = (n); \
177  YY_LESS_LINENO(aagless_macro_arg);\
178  *aag_cp = (aag_hold_char); \
179  YY_RESTORE_YY_MORE_OFFSET \
180  (aag_c_buf_p) = aag_cp = aag_bp + aagless_macro_arg - YY_MORE_ADJ; \
181  YY_DO_BEFORE_ACTION; /* set up aagtext again */ \
182  } \
183  while ( 0 )
184 
185 #define unput(c) aagunput( c, (aagtext_ptr) )
186 
187 #ifndef YY_STRUCT_YY_BUFFER_STATE
188 #define YY_STRUCT_YY_BUFFER_STATE
190  {
192 
193  char *aag_ch_buf; /* input buffer */
194  char *aag_buf_pos; /* current position in input buffer */
195 
196  /* Size of input buffer in bytes, not including room for EOB
197  * characters.
198  */
200 
201  /* Number of characters read into aag_ch_buf, not including EOB
202  * characters.
203  */
205 
206  /* Whether we "own" the buffer - i.e., we know we created it,
207  * and can realloc() it to grow it, and should free() it to
208  * delete it.
209  */
211 
212  /* Whether this is an "interactive" input source; if so, and
213  * if we're using stdio for input, then we want to use getc()
214  * instead of fread(), to make sure we stop fetching input after
215  * each newline.
216  */
218 
219  /* Whether we're considered to be at the beginning of a line.
220  * If so, '^' rules will be active on the next match, otherwise
221  * not.
222  */
224 
228  /* Whether to try to fill the input buffer when we reach the
229  * end of it.
230  */
232 
234 
235 #define YY_BUFFER_NEW 0
236 #define YY_BUFFER_NORMAL 1
237  /* When an EOF's been seen but there's still some text to process
238  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
239  * shouldn't try reading from the input source any more. We might
240  * still have a bunch of tokens to match, though, because of
241  * possible backing-up.
242  *
243  * When we actually see the EOF, we change the status to "new"
244  * (via aagrestart()), so that the user can continue scanning by
245  * just pointing aagin at a new input file.
246  */
247 #define YY_BUFFER_EOF_PENDING 2
248 
249  };
250 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
251 
252 /* Stack of input buffers. */
253 static size_t aag_buffer_stack_top = 0;
254 static size_t aag_buffer_stack_max = 0;
255 static YY_BUFFER_STATE * aag_buffer_stack = 0;
257 /* We provide macros for accessing buffer states in case in the
258  * future we want to put the buffer states in a more general
259  * "scanner state".
260  *
261  * Returns the top of the stack, or NULL.
262  */
263 #define YY_CURRENT_BUFFER ( (aag_buffer_stack) \
264  ? (aag_buffer_stack)[(aag_buffer_stack_top)] \
265  : NULL)
266 
267 /* Same as previous macro, but useful when we know that the buffer stack is not
268  * NULL or when we need an lvalue. For internal use only.
269  */
270 #define YY_CURRENT_BUFFER_LVALUE (aag_buffer_stack)[(aag_buffer_stack_top)]
271 
272 /* aag_hold_char holds the character lost when aagtext is formed. */
273 static char aag_hold_char;
274 static aag_size_t aag_n_chars; /* number of characters read into aag_ch_buf */
276 
277 /* Points to current character in buffer. */
278 static char *aag_c_buf_p = (char *) 0;
279 static int aag_init = 0; /* whether we need to initialize */
280 static int aag_start = 0; /* start state number */
281 
282 /* Flag which is used to allow aagwrap()'s to do buffer switches
283  * instead of setting up a fresh aagin. A bit of a hack ...
284  */
285 static int aag_did_buffer_switch_on_eof;
286 
287 void aagrestart (FILE *input_file );
288 void aag_switch_to_buffer (YY_BUFFER_STATE new_buffer );
289 YY_BUFFER_STATE aag_create_buffer (FILE *file,int size );
290 void aag_delete_buffer (YY_BUFFER_STATE b );
291 void aag_flush_buffer (YY_BUFFER_STATE b );
292 void aagpush_buffer_state (YY_BUFFER_STATE new_buffer );
293 void aagpop_buffer_state (void );
294 
295 static void aagensure_buffer_stack (void );
296 static void aag_load_buffer_state (void );
297 static void aag_init_buffer (YY_BUFFER_STATE b,FILE *file );
298 
299 #define YY_FLUSH_BUFFER aag_flush_buffer(YY_CURRENT_BUFFER )
300 
301 YY_BUFFER_STATE aag_scan_buffer (char *base,aag_size_t size );
302 YY_BUFFER_STATE aag_scan_string (aagconst char *aag_str );
303 YY_BUFFER_STATE aag_scan_bytes (aagconst char *bytes,aag_size_t len );
304 
305 void *aagalloc (aag_size_t );
306 void *aagrealloc (void *,aag_size_t );
307 void aagfree (void * );
308 
309 #define aag_new_buffer aag_create_buffer
310 
311 #define aag_set_interactive(is_interactive) \
312  { \
313  if ( ! YY_CURRENT_BUFFER ){ \
314  aagensure_buffer_stack (); \
315  YY_CURRENT_BUFFER_LVALUE = \
316  aag_create_buffer(aagin,YY_BUF_SIZE ); \
317  } \
318  YY_CURRENT_BUFFER_LVALUE->aag_is_interactive = is_interactive; \
319  }
320 
321 #define aag_set_bol(at_bol) \
322  { \
323  if ( ! YY_CURRENT_BUFFER ){\
324  aagensure_buffer_stack (); \
325  YY_CURRENT_BUFFER_LVALUE = \
326  aag_create_buffer(aagin,YY_BUF_SIZE ); \
327  } \
328  YY_CURRENT_BUFFER_LVALUE->aag_at_bol = at_bol; \
329  }
330 
331 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->aag_at_bol)
332 
333 /* Begin user sect3 */
334 
335 typedef unsigned char YY_CHAR;
336 
337 FILE *aagin = (FILE *) 0, *aagout = (FILE *) 0;
338 
339 typedef int aag_state_type;
340 
341 extern int aaglineno;
342 
343 int aaglineno = 1;
344 
345 extern char *aagtext;
346 #define aagtext_ptr aagtext
347 
348 static aag_state_type aag_get_previous_state (void );
349 static aag_state_type aag_try_NUL_trans (aag_state_type current_state );
350 static int aag_get_next_buffer (void );
351 static void aag_fatal_error (aagconst char msg[] );
352 
353 /* Done after the current pattern has been matched and before the
354  * corresponding action - sets up aagtext.
355  */
356 #define YY_DO_BEFORE_ACTION \
357  (aagtext_ptr) = aag_bp; \
358  aagleng = (size_t) (aag_cp - aag_bp); \
359  (aag_hold_char) = *aag_cp; \
360  *aag_cp = '\0'; \
361  (aag_c_buf_p) = aag_cp;
362 
363 #define YY_NUM_RULES 34
364 #define YY_END_OF_BUFFER 35
365 /* This struct is not used in this scanner,
366  but its presence is necessary. */
368  {
371  };
372 static aagconst flex_int16_t aag_accept[93] =
373  { 0,
374  0, 0, 4, 4, 27, 27, 32, 32, 35, 33,
375  10, 2, 22, 9, 33, 33, 33, 21, 28, 1,
376  20, 20, 20, 20, 20, 20, 20, 8, 4, 5,
377  27, 2, 23, 27, 32, 31, 30, 29, 9, 19,
378  0, 21, 18, 21, 3, 7, 21, 21, 20, 20,
379  20, 20, 20, 20, 20, 20, 8, 4, 5, 5,
380  6, 27, 26, 24, 25, 32, 7, 21, 20, 20,
381  20, 20, 20, 20, 11, 20, 13, 20, 12, 20,
382  20, 20, 14, 20, 20, 20, 16, 20, 15, 20,
383  17, 0
384 
385  } ;
386 
387 static aagconst flex_int32_t aag_ec[256] =
388  { 0,
389  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
390  1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
391  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392  1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
393  1, 6, 1, 1, 7, 8, 9, 10, 10, 10,
394  10, 10, 10, 10, 10, 10, 10, 1, 1, 11,
395  1, 12, 1, 13, 14, 15, 16, 17, 18, 19,
396  20, 21, 22, 19, 19, 19, 19, 23, 24, 25,
397  19, 26, 27, 28, 29, 19, 19, 19, 19, 19,
398  1, 30, 1, 1, 19, 1, 31, 32, 33, 34,
399 
400  35, 19, 36, 37, 38, 19, 19, 19, 19, 39,
401  40, 41, 19, 42, 43, 44, 45, 19, 19, 19,
402  19, 19, 1, 1, 1, 1, 1, 19, 19, 19,
403  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
404  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
405  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
406  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
407  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
408  19, 19, 19, 19, 19, 19, 46, 19, 19, 19,
409  47, 19, 19, 19, 19, 19, 19, 19, 19, 19,
410 
411  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
412  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
413  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
414  19, 19, 19, 19, 19, 19, 19, 19, 48, 19,
415  19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
416  19, 19, 19, 19, 19
417  } ;
418 
419 static aagconst flex_int32_t aag_meta[49] =
420  { 0,
421  1, 1, 2, 3, 1, 4, 1, 5, 1, 6,
422  7, 7, 1, 6, 6, 6, 6, 6, 6, 6,
423  6, 6, 6, 6, 6, 6, 6, 6, 6, 3,
424  6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
425  6, 6, 6, 6, 6, 6, 6, 6
426  } ;
427 
428 static aagconst flex_int16_t aag_base[105] =
429  { 0,
430  0, 174, 46, 47, 51, 53, 48, 55, 170, 219,
431  219, 219, 219, 0, 61, 135, 55, 55, 219, 219,
432  0, 40, 53, 46, 50, 47, 98, 0, 0, 71,
433  0, 0, 219, 81, 0, 219, 219, 219, 0, 219,
434  132, 85, 219, 130, 219, 0, 129, 219, 0, 62,
435  66, 65, 72, 68, 82, 91, 0, 0, 94, 95,
436  219, 0, 219, 219, 219, 0, 0, 123, 73, 87,
437  82, 90, 90, 93, 0, 95, 0, 95, 0, 101,
438  93, 95, 0, 93, 110, 106, 0, 105, 0, 110,
439  0, 219, 147, 154, 161, 168, 171, 112, 177, 184,
440 
441  191, 198, 205, 211
442  } ;
443 
444 static aagconst flex_int16_t aag_def[105] =
445  { 0,
446  92, 1, 93, 93, 94, 94, 95, 95, 92, 92,
447  92, 92, 92, 96, 92, 92, 92, 97, 92, 92,
448  98, 98, 98, 98, 98, 98, 98, 99, 100, 101,
449  102, 102, 92, 92, 103, 92, 92, 92, 96, 92,
450  92, 97, 92, 97, 92, 104, 97, 92, 98, 98,
451  98, 98, 98, 98, 98, 98, 99, 100, 101, 101,
452  92, 102, 92, 92, 92, 103, 104, 97, 98, 98,
453  98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
454  98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
455  98, 0, 92, 92, 92, 92, 92, 92, 92, 92,
456 
457  92, 92, 92, 92
458  } ;
459 
460 static aagconst flex_int16_t aag_nxt[268] =
461  { 0,
462  10, 11, 12, 13, 14, 10, 15, 16, 17, 18,
463  19, 10, 20, 21, 21, 21, 22, 23, 21, 24,
464  21, 21, 25, 21, 21, 21, 26, 21, 21, 10,
465  21, 21, 21, 22, 23, 24, 21, 21, 25, 21,
466  21, 21, 26, 21, 21, 21, 21, 27, 12, 12,
467  36, 30, 30, 32, 33, 32, 33, 36, 37, 38,
468  45, 50, 47, 46, 42, 37, 38, 40, 41, 51,
469  42, 52, 43, 53, 54, 55, 60, 50, 71, 61,
470  34, 69, 34, 63, 64, 70, 51, 52, 72, 53,
471  54, 55, 47, 73, 42, 71, 74, 69, 76, 92,
472 
473  60, 70, 92, 61, 77, 72, 78, 79, 82, 73,
474  65, 80, 81, 74, 76, 83, 84, 49, 85, 86,
475  87, 77, 78, 88, 79, 82, 89, 80, 81, 90,
476  91, 83, 68, 84, 85, 86, 87, 75, 68, 44,
477  88, 44, 89, 56, 44, 90, 91, 29, 29, 29,
478  29, 29, 29, 29, 31, 31, 31, 31, 31, 31,
479  31, 35, 35, 35, 35, 35, 35, 35, 39, 92,
480  39, 39, 39, 39, 39, 48, 48, 57, 28, 57,
481  57, 57, 57, 57, 58, 92, 58, 92, 58, 58,
482  58, 59, 92, 59, 59, 59, 59, 59, 62, 62,
483 
484  92, 62, 62, 62, 62, 66, 92, 66, 66, 66,
485  66, 67, 92, 67, 67, 67, 67, 67, 9, 92,
486  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
487  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
488  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
489  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
490  92, 92, 92, 92, 92, 92, 92
491  } ;
492 
493 static aagconst flex_int16_t aag_chk[268] =
494  { 0,
495  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
496  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499  1, 1, 1, 1, 1, 1, 1, 1, 3, 4,
500  7, 3, 4, 5, 5, 6, 6, 8, 7, 7,
501  17, 22, 18, 17, 18, 8, 8, 15, 15, 23,
502  15, 24, 15, 25, 26, 26, 30, 22, 52, 30,
503  5, 50, 6, 34, 34, 51, 23, 24, 53, 25,
504  26, 26, 42, 54, 42, 52, 55, 50, 69, 59,
505 
506  60, 51, 59, 60, 70, 53, 71, 72, 76, 54,
507  34, 73, 74, 55, 69, 78, 80, 98, 81, 82,
508  84, 70, 71, 85, 72, 76, 86, 73, 74, 88,
509  90, 78, 68, 80, 81, 82, 84, 56, 47, 44,
510  85, 41, 86, 27, 16, 88, 90, 93, 93, 93,
511  93, 93, 93, 93, 94, 94, 94, 94, 94, 94,
512  94, 95, 95, 95, 95, 95, 95, 95, 96, 9,
513  96, 96, 96, 96, 96, 97, 97, 99, 2, 99,
514  99, 99, 99, 99, 100, 0, 100, 0, 100, 100,
515  100, 101, 0, 101, 101, 101, 101, 101, 102, 102,
516 
517  0, 102, 102, 102, 102, 103, 0, 103, 103, 103,
518  103, 104, 0, 104, 104, 104, 104, 104, 92, 92,
519  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
520  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
521  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
522  92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
523  92, 92, 92, 92, 92, 92, 92
524  } ;
525 
526 static aag_state_type aag_last_accepting_state;
527 static char *aag_last_accepting_cpos;
528 
529 extern int aag_flex_debug;
530 int aag_flex_debug = 0;
531 
532 /* The intent behind this definition is that it'll catch
533  * any uses of REJECT which flex missed.
534  */
535 #define REJECT reject_used_but_not_detected
536 #define aagmore() aagmore_used_but_not_detected
537 #define YY_MORE_ADJ 0
538 #define YY_RESTORE_YY_MORE_OFFSET
539 char *aagtext;
540 #line 1 "../../lib/cgraph/scan.l"
541 /* $Id$ $Revision$ */
542 /* vim:set shiftwidth=4 ts=8: */
543 /*************************************************************************
544  * Copyright (c) 2011 AT&T Intellectual Property
545  * All rights reserved. This program and the accompanying materials
546  * are made available under the terms of the Eclipse Public License v1.0
547  * which accompanies this distribution, and is available at
548  * http://www.eclipse.org/legal/epl-v10.html
549  *
550  * Contributors: See CVS logs. Details at http://www.graphviz.org/
551  *************************************************************************/
552 /* requires flex (i.e. not lex) */
553 #line 17 "../../lib/cgraph/scan.l"
554 #include <grammar.h>
555 #include <cghdr.h>
556 #include <agxbuf.h>
557 #include <ctype.h>
558 // #define YY_BUF_SIZE 128000
559 #define GRAPH_EOF_TOKEN '@' /* lex class must be defined below */
560  /* this is a workaround for linux flex */
561 static int line_num = 1;
562 static int html_nest = 0; /* nesting level for html strings */
563 static char* InputFile;
564 static Agdisc_t *Disc;
565 static void *Ifile;
566 static int graphType;
567 
568  /* Reset line number */
569 void agreadline(int n) { line_num = n; }
570 
571  /* (Re)set file:
572  */
573 void agsetfile(char* f) { InputFile = f; line_num = 1; }
574 
575 /* There is a hole here, because switching channels
576  * requires pushing back whatever was previously read.
577  * There probably is a right way of doing this.
578  */
579 void aglexinit(Agdisc_t *disc, void *ifile) { Disc = disc; Ifile = ifile; graphType = 0;}
580 
581 #define isatty(x) 0
582 #ifndef YY_INPUT
583 #define YY_INPUT(buf,result,max_size) \
584  if ((result = Disc->io->afread(Ifile, buf, max_size)) < 0) \
585  YY_FATAL_ERROR( "input in flex scanner failed" )
586 #endif
587 
588 /* buffer for arbitrary length strings (longer than BUFSIZ) */
589 static char *Sbuf,*Sptr,*Send;
590 static void beginstr(void) {
591  if (Sbuf == NIL(char*)) {
592  Sbuf = malloc(BUFSIZ);
593  Send = Sbuf + BUFSIZ;
594  }
595  Sptr = Sbuf;
596  *Sptr = 0;
597 }
598 
599 static void addstr(char *src) {
600  char c;
601  if (Sptr > Sbuf) Sptr--;
602  do {
603  do {c = *Sptr++ = *src++;} while (c && (Sptr < Send));
604  if (c) {
605  long sz = Send - Sbuf;
606  long off = Sptr - Sbuf;
607  sz *= 2;
608  Sbuf = (char*)realloc(Sbuf,sz);
609  Send = Sbuf + sz;
610  Sptr = Sbuf + off;
611  }
612  } while (c);
613 }
614 
615 static void endstr(void) {
616  aaglval.str = (char*)agstrdup(Ag_G_global,Sbuf);
617  *Sbuf = 0;
618 }
619 
620 static void endstr_html(void) {
621  aaglval.str = (char*)agstrdup_html(Ag_G_global,Sbuf);
622  *Sbuf = 0;
623 }
624 
625 static void
626 storeFileName (char* fname, int len)
627 {
628  static int cnt;
629  static char* buf;
630 
631  if (len > cnt) {
632  if (cnt) buf = (char*)realloc (buf, len+1);
633  else buf = (char*)malloc (len+1);
634  cnt = len;
635  }
636  strcpy (buf, fname);
637  InputFile = buf;
638 }
639 
640 /* ppDirective:
641  * Process a possible preprocessor line directive.
642  * aagtext = #.*
643  */
644 static void ppDirective (void)
645 {
646  int r, cnt, lineno;
647  char buf[2];
648  char* s = aagtext + 1; /* skip initial # */
649 
650  if (strncmp(s, "line", 4) == 0) s += 4;
651  r = sscanf(s, "%d %1[\"]%n", &lineno, buf, &cnt);
652  if (r > 0) { /* got line number */
653  line_num = lineno - 1;
654  if (r > 1) { /* saw quote */
655  char* p = s + cnt;
656  char* e = p;
657  while (*e && (*e != '"')) e++;
658  if (e != p && *e == '"') {
659  *e = '\0';
660  storeFileName (p, e-p);
661  }
662  }
663  }
664 }
665 
666 /* twoDots:
667  * Return true if token has more than one '.';
668  * we know the last character is a '.'.
669  */
670 static int twoDots(void)
671 {
672  int i;
673  for (i = aagleng-2; i >= 0; i--) {
674  if (((unsigned char)aagtext[i]) == '.')
675  return 1;
676  }
677  return 0;
678 }
679 
680 /* chkNum:
681  * The regexp for NUMBER allows a terminating letter or '.'.
682  * This way we can catch a number immediately followed by a name
683  * or something like 123.456.78, and report this to the user.
684  */
685 static int chkNum(void) {
686  unsigned char c = (unsigned char)aagtext[aagleng-1]; /* last character */
687  if ((!isdigit(c) && (c != '.')) || ((c == '.') && twoDots())) { /* c is letter */
688  unsigned char xbuf[BUFSIZ];
689  char buf[BUFSIZ];
690  agxbuf xb;
691  char* fname;
692 
693  if (InputFile)
694  fname = InputFile;
695  else
696  fname = "input";
697 
698  agxbinit(&xb, BUFSIZ, xbuf);
699 
700  agxbput(&xb,"syntax ambiguity - badly delimited number '");
701  agxbput(&xb,aagtext);
702  sprintf(buf,"' in line %d of ", line_num);
703  agxbput(&xb,buf);
704  agxbput(&xb,fname);
705  agxbput(&xb, " splits into two tokens\n");
706  agerr(AGWARN, "%s", agxbuse(&xb));
707 
708  agxbfree(&xb);
709  return 1;
710  }
711  else return 0;
712 }
713 
714 /* The LETTER class below consists of ascii letters, underscore, all non-ascii
715  * characters. This allows identifiers to have characters from any
716  * character set independent of locale. The downside is that, for certain
717  * character sets, non-letter and, in fact, undefined characters will be
718  * accepted. This is not likely and, from dot's stand, shouldn't do any
719  * harm. (Presumably undefined characters will be ignored in display.) And,
720  * it allows a greater wealth of names. */
721 
722 
723 
724 #line 725 "lex.aag.c"
725 
726 #define INITIAL 0
727 #define comment 1
728 #define qstring 2
729 #define hstring 3
730 
731 #ifndef YY_NO_UNISTD_H
732 /* Special case for "unistd.h", since it is non-ANSI. We include it way
733  * down here because we want the user's section 1 to have been scanned first.
734  * The user has a chance to override it with an option.
735  */
736 #include <unistd.h>
737 #endif
738 
739 #ifndef YY_EXTRA_TYPE
740 #define YY_EXTRA_TYPE void *
741 #endif
742 
743 static int aag_init_globals (void );
744 
745 /* Accessor methods to globals.
746  These are made visible to non-reentrant scanners for convenience. */
747 
748 int aaglex_destroy (void );
749 
750 int aagget_debug (void );
751 
752 void aagset_debug (int debug_flag );
753 
755 
756 void aagset_extra (YY_EXTRA_TYPE user_defined );
757 
758 FILE *aagget_in (void );
759 
760 void aagset_in (FILE * in_str );
761 
762 FILE *aagget_out (void );
763 
764 void aagset_out (FILE * out_str );
765 
766 aag_size_t aagget_leng (void );
767 
768 char *aagget_text (void );
769 
770 int aagget_lineno (void );
771 
772 void aagset_lineno (int line_number );
773 
774 /* Macros after this point can all be overridden by user definitions in
775  * section 1.
776  */
777 
778 #ifndef YY_SKIP_YYWRAP
779 #ifdef __cplusplus
780 extern "C" int aagwrap (void );
781 #else
782 extern int aagwrap (void );
783 #endif
784 #endif
785 
786  static void aagunput (int c,char *buf_ptr );
787 
788 #ifndef aagtext_ptr
789 static void aag_flex_strncpy (char *,aagconst char *,int );
790 #endif
791 
792 #ifdef YY_NEED_STRLEN
793 static int aag_flex_strlen (aagconst char * );
794 #endif
795 
796 #ifndef YY_NO_INPUT
797 
798 #ifdef __cplusplus
799 static int aaginput (void );
800 #else
801 static int input (void );
802 #endif
803 
804 #endif
805 
806 /* Amount of stuff to slurp up with each read. */
807 #ifndef YY_READ_BUF_SIZE
808 #define YY_READ_BUF_SIZE 8192
809 #endif
810 
811 /* Copy whatever the last rule matched to the standard output. */
812 #ifndef ECHO
813 /* This used to be an fputs(), but since the string might contain NUL's,
814  * we now use fwrite().
815  */
816 #define ECHO do { if (fwrite( aagtext, aagleng, 1, aagout )) {} } while (0)
817 #endif
818 
819 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
820  * is returned in "result".
821  */
822 #ifndef YY_INPUT
823 #define YY_INPUT(buf,result,max_size) \
824  if ( YY_CURRENT_BUFFER_LVALUE->aag_is_interactive ) \
825  { \
826  int c = '*'; \
827  size_t n; \
828  for ( n = 0; n < max_size && \
829  (c = getc( aagin )) != EOF && c != '\n'; ++n ) \
830  buf[n] = (char) c; \
831  if ( c == '\n' ) \
832  buf[n++] = (char) c; \
833  if ( c == EOF && ferror( aagin ) ) \
834  YY_FATAL_ERROR( "input in flex scanner failed" ); \
835  result = n; \
836  } \
837  else \
838  { \
839  errno=0; \
840  while ( (result = fread(buf, 1, max_size, aagin))==0 && ferror(aagin)) \
841  { \
842  if( errno != EINTR) \
843  { \
844  YY_FATAL_ERROR( "input in flex scanner failed" ); \
845  break; \
846  } \
847  errno=0; \
848  clearerr(aagin); \
849  } \
850  }\
851 \
852 
853 #endif
854 
855 /* No semi-colon after return; correct usage is to write "aagterminate();" -
856  * we don't want an extra ';' after the "return" because that will cause
857  * some compilers to complain about unreachable statements.
858  */
859 #ifndef aagterminate
860 #define aagterminate() return YY_NULL
861 #endif
862 
863 /* Number of entries by which start-condition stack grows. */
864 #ifndef YY_START_STACK_INCR
865 #define YY_START_STACK_INCR 25
866 #endif
867 
868 /* Report a fatal error. */
869 #ifndef YY_FATAL_ERROR
870 #define YY_FATAL_ERROR(msg) aag_fatal_error( msg )
871 #endif
872 
873 /* end tables serialization structures and prototypes */
874 
875 /* Default declaration of generated scanner - a define so the user can
876  * easily add parameters.
877  */
878 #ifndef YY_DECL
879 #define YY_DECL_IS_OURS 1
880 
881 extern int aaglex (void);
882 
883 #define YY_DECL int aaglex (void)
884 #endif /* !YY_DECL */
885 
886 /* Code executed at the beginning of each rule, after aagtext and aagleng
887  * have been set up.
888  */
889 #ifndef YY_USER_ACTION
890 #define YY_USER_ACTION
891 #endif
892 
893 /* Code executed at the end of each rule. */
894 #ifndef YY_BREAK
895 #define YY_BREAK break;
896 #endif
897 
898 #define YY_RULE_SETUP \
899  if ( aagleng > 0 ) \
900  YY_CURRENT_BUFFER_LVALUE->aag_at_bol = \
901  (aagtext[aagleng - 1] == '\n'); \
902  YY_USER_ACTION
903 
906 YY_DECL
907 {
908  register aag_state_type aag_current_state;
909  register char *aag_cp, *aag_bp;
910  register int aag_act;
911 
912 #line 194 "../../lib/cgraph/scan.l"
913 
914 #line 915 "lex.aag.c"
915 
916  if ( !(aag_init) )
917  {
918  (aag_init) = 1;
919 
920 #ifdef YY_USER_INIT
921  YY_USER_INIT;
922 #endif
923 
924  if ( ! (aag_start) )
925  (aag_start) = 1; /* first start state */
926 
927  if ( ! aagin )
928  aagin = stdin;
929 
930  if ( ! aagout )
931  aagout = stdout;
932 
933  if ( ! YY_CURRENT_BUFFER ) {
934  aagensure_buffer_stack ();
937  }
938 
939  aag_load_buffer_state( );
940  }
941 
942  while ( 1 ) /* loops until end-of-file is reached */
943  {
944  aag_cp = (aag_c_buf_p);
945 
946  /* Support of aagtext. */
947  *aag_cp = (aag_hold_char);
948 
949  /* aag_bp points to the position in aag_ch_buf of the start of
950  * the current run.
951  */
952  aag_bp = aag_cp;
953 
954  aag_current_state = (aag_start);
955  aag_current_state += YY_AT_BOL();
956 aag_match:
957  do
958  {
959  register YY_CHAR aag_c = aag_ec[YY_SC_TO_UI(*aag_cp)];
960  if ( aag_accept[aag_current_state] )
961  {
962  (aag_last_accepting_state) = aag_current_state;
963  (aag_last_accepting_cpos) = aag_cp;
964  }
965  while ( aag_chk[aag_base[aag_current_state] + aag_c] != aag_current_state )
966  {
967  aag_current_state = (int) aag_def[aag_current_state];
968  if ( aag_current_state >= 93 )
969  aag_c = aag_meta[(unsigned int) aag_c];
970  }
971  aag_current_state = aag_nxt[aag_base[aag_current_state] + (unsigned int) aag_c];
972  ++aag_cp;
973  }
974  while ( aag_base[aag_current_state] != 219 );
975 
976 aag_find_action:
977  aag_act = aag_accept[aag_current_state];
978  if ( aag_act == 0 )
979  { /* have to back up */
980  aag_cp = (aag_last_accepting_cpos);
981  aag_current_state = (aag_last_accepting_state);
982  aag_act = aag_accept[aag_current_state];
983  }
984 
986 
987 do_action: /* This label is used only to access EOF actions. */
988 
989  switch ( aag_act )
990  { /* beginning of action switch */
991  case 0: /* must back up */
992  /* undo the effects of YY_DO_BEFORE_ACTION */
993  *aag_cp = (aag_hold_char);
994  aag_cp = (aag_last_accepting_cpos);
995  aag_current_state = (aag_last_accepting_state);
996  goto aag_find_action;
997 
998 case 1:
1000 #line 195 "../../lib/cgraph/scan.l"
1001 return(EOF);
1002  YY_BREAK
1003 case 2:
1004 /* rule 2 can match eol */
1006 #line 196 "../../lib/cgraph/scan.l"
1007 line_num++;
1008  YY_BREAK
1009 case 3:
1011 #line 197 "../../lib/cgraph/scan.l"
1012 BEGIN(comment);
1013  YY_BREAK
1014 case 4:
1016 #line 198 "../../lib/cgraph/scan.l"
1017 /* eat anything not a '*' */
1018  YY_BREAK
1019 case 5:
1021 #line 199 "../../lib/cgraph/scan.l"
1022 /* eat up '*'s not followed by '/'s */
1023  YY_BREAK
1024 case 6:
1026 #line 200 "../../lib/cgraph/scan.l"
1027 BEGIN(INITIAL);
1028  YY_BREAK
1029 case 7:
1031 #line 201 "../../lib/cgraph/scan.l"
1032 /* ignore C++-style comments */
1033  YY_BREAK
1034 case 8:
1036 #line 202 "../../lib/cgraph/scan.l"
1037 ppDirective ();
1038  YY_BREAK
1039 case 9:
1041 #line 203 "../../lib/cgraph/scan.l"
1042 /* ignore shell-like comments */
1043  YY_BREAK
1044 case 10:
1046 #line 204 "../../lib/cgraph/scan.l"
1047 /* ignore whitespace */
1048  YY_BREAK
1049 case 11:
1051 #line 205 "../../lib/cgraph/scan.l"
1052 /* ignore BOM */
1053  YY_BREAK
1054 case 12:
1056 #line 206 "../../lib/cgraph/scan.l"
1057 return(T_node); /* see tokens in agcanonstr */
1058  YY_BREAK
1059 case 13:
1061 #line 207 "../../lib/cgraph/scan.l"
1062 return(T_edge);
1063  YY_BREAK
1064 case 14:
1066 #line 208 "../../lib/cgraph/scan.l"
1067 if (!graphType) graphType = T_graph; return(T_graph);
1068  YY_BREAK
1069 case 15:
1071 #line 209 "../../lib/cgraph/scan.l"
1072 if (!graphType) graphType = T_digraph; return(T_digraph);
1073  YY_BREAK
1074 case 16:
1076 #line 210 "../../lib/cgraph/scan.l"
1077 return(T_strict);
1078  YY_BREAK
1079 case 17:
1081 #line 211 "../../lib/cgraph/scan.l"
1082 return(T_subgraph);
1083  YY_BREAK
1084 case 18:
1086 #line 212 "../../lib/cgraph/scan.l"
1087 if (graphType == T_digraph) return(T_edgeop); else return('-');
1088  YY_BREAK
1089 case 19:
1091 #line 213 "../../lib/cgraph/scan.l"
1092 if (graphType == T_graph) return(T_edgeop); else return('-');
1093  YY_BREAK
1094 case 20:
1096 #line 214 "../../lib/cgraph/scan.l"
1097 { aaglval.str = (char*)agstrdup(Ag_G_global,aagtext); return(T_atom); }
1098  YY_BREAK
1099 case 21:
1101 #line 215 "../../lib/cgraph/scan.l"
1102 { if (chkNum()) aagless(aagleng-1); aaglval.str = (char*)agstrdup(Ag_G_global,aagtext); return(T_atom); }
1103  YY_BREAK
1104 case 22:
1106 #line 216 "../../lib/cgraph/scan.l"
1107 BEGIN(qstring); beginstr();
1108  YY_BREAK
1109 case 23:
1111 #line 217 "../../lib/cgraph/scan.l"
1112 BEGIN(INITIAL); endstr(); return (T_qatom);
1113  YY_BREAK
1114 case 24:
1116 #line 218 "../../lib/cgraph/scan.l"
1117 addstr ("\"");
1118  YY_BREAK
1119 case 25:
1121 #line 219 "../../lib/cgraph/scan.l"
1122 addstr ("\\\\");
1123  YY_BREAK
1124 case 26:
1125 /* rule 26 can match eol */
1127 #line 220 "../../lib/cgraph/scan.l"
1128 line_num++; /* ignore escaped newlines */
1129  YY_BREAK
1130 case 27:
1131 /* rule 27 can match eol */
1133 #line 221 "../../lib/cgraph/scan.l"
1134 addstr(aagtext);
1135  YY_BREAK
1136 case 28:
1138 #line 222 "../../lib/cgraph/scan.l"
1139 BEGIN(hstring); html_nest = 1; beginstr();
1140  YY_BREAK
1141 case 29:
1143 #line 223 "../../lib/cgraph/scan.l"
1144 html_nest--; if (html_nest) addstr(aagtext); else {BEGIN(INITIAL); endstr_html(); return (T_qatom);}
1145  YY_BREAK
1146 case 30:
1148 #line 224 "../../lib/cgraph/scan.l"
1149 html_nest++; addstr(aagtext);
1150  YY_BREAK
1151 case 31:
1152 /* rule 31 can match eol */
1154 #line 225 "../../lib/cgraph/scan.l"
1155 addstr(aagtext); line_num++; /* add newlines */
1156  YY_BREAK
1157 case 32:
1159 #line 226 "../../lib/cgraph/scan.l"
1160 addstr(aagtext);
1161  YY_BREAK
1162 case 33:
1164 #line 227 "../../lib/cgraph/scan.l"
1165 return (aagtext[0]);
1166  YY_BREAK
1167 case 34:
1169 #line 228 "../../lib/cgraph/scan.l"
1170 ECHO;
1171  YY_BREAK
1172 #line 1173 "lex.aag.c"
1173 case YY_STATE_EOF(INITIAL):
1174 case YY_STATE_EOF(comment):
1175 case YY_STATE_EOF(qstring):
1176 case YY_STATE_EOF(hstring):
1177  aagterminate();
1178 
1179  case YY_END_OF_BUFFER:
1180  {
1181  /* Amount of text matched not including the EOB char. */
1182  int aag_amount_of_matched_text = (int) (aag_cp - (aagtext_ptr)) - 1;
1183 
1184  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1185  *aag_cp = (aag_hold_char);
1187 
1188  if ( YY_CURRENT_BUFFER_LVALUE->aag_buffer_status == YY_BUFFER_NEW )
1189  {
1190  /* We're scanning a new file or input source. It's
1191  * possible that this happened because the user
1192  * just pointed aagin at a new source and called
1193  * aaglex(). If so, then we have to assure
1194  * consistency between YY_CURRENT_BUFFER and our
1195  * globals. Here is the right place to do so, because
1196  * this is the first action (other than possibly a
1197  * back-up) that will match for the new input source.
1198  */
1199  (aag_n_chars) = YY_CURRENT_BUFFER_LVALUE->aag_n_chars;
1200  YY_CURRENT_BUFFER_LVALUE->aag_input_file = aagin;
1201  YY_CURRENT_BUFFER_LVALUE->aag_buffer_status = YY_BUFFER_NORMAL;
1202  }
1203 
1204  /* Note that here we test for aag_c_buf_p "<=" to the position
1205  * of the first EOB in the buffer, since aag_c_buf_p will
1206  * already have been incremented past the NUL character
1207  * (since all states make transitions on EOB to the
1208  * end-of-buffer state). Contrast this with the test
1209  * in input().
1210  */
1211  if ( (aag_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars)] )
1212  { /* This was really a NUL. */
1213  aag_state_type aag_next_state;
1214 
1215  (aag_c_buf_p) = (aagtext_ptr) + aag_amount_of_matched_text;
1216 
1217  aag_current_state = aag_get_previous_state( );
1218 
1219  /* Okay, we're now positioned to make the NUL
1220  * transition. We couldn't have
1221  * aag_get_previous_state() go ahead and do it
1222  * for us because it doesn't know how to deal
1223  * with the possibility of jamming (and we don't
1224  * want to build jamming into it because then it
1225  * will run more slowly).
1226  */
1227 
1228  aag_next_state = aag_try_NUL_trans( aag_current_state );
1229 
1230  aag_bp = (aagtext_ptr) + YY_MORE_ADJ;
1231 
1232  if ( aag_next_state )
1233  {
1234  /* Consume the NUL. */
1235  aag_cp = ++(aag_c_buf_p);
1236  aag_current_state = aag_next_state;
1237  goto aag_match;
1238  }
1239 
1240  else
1241  {
1242  aag_cp = (aag_c_buf_p);
1243  goto aag_find_action;
1244  }
1245  }
1246 
1247  else switch ( aag_get_next_buffer( ) )
1248  {
1249  case EOB_ACT_END_OF_FILE:
1250  {
1251  (aag_did_buffer_switch_on_eof) = 0;
1252 
1253  if ( aagwrap( ) )
1254  {
1255  /* Note: because we've taken care in
1256  * aag_get_next_buffer() to have set up
1257  * aagtext, we can now set up
1258  * aag_c_buf_p so that if some total
1259  * hoser (like flex itself) wants to
1260  * call the scanner after we return the
1261  * YY_NULL, it'll still work - another
1262  * YY_NULL will get returned.
1263  */
1264  (aag_c_buf_p) = (aagtext_ptr) + YY_MORE_ADJ;
1265 
1266  aag_act = YY_STATE_EOF(YY_START);
1267  goto do_action;
1268  }
1269 
1270  else
1271  {
1272  if ( ! (aag_did_buffer_switch_on_eof) )
1273  YY_NEW_FILE;
1274  }
1275  break;
1276  }
1277 
1278  case EOB_ACT_CONTINUE_SCAN:
1279  (aag_c_buf_p) =
1280  (aagtext_ptr) + aag_amount_of_matched_text;
1281 
1282  aag_current_state = aag_get_previous_state( );
1283 
1284  aag_cp = (aag_c_buf_p);
1285  aag_bp = (aagtext_ptr) + YY_MORE_ADJ;
1286  goto aag_match;
1287 
1288  case EOB_ACT_LAST_MATCH:
1289  (aag_c_buf_p) =
1290  &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars)];
1291 
1292  aag_current_state = aag_get_previous_state( );
1293 
1294  aag_cp = (aag_c_buf_p);
1295  aag_bp = (aagtext_ptr) + YY_MORE_ADJ;
1296  goto aag_find_action;
1297  }
1298  break;
1299  }
1300 
1301  default:
1303  "fatal flex scanner internal error--no action found" );
1304  } /* end of action switch */
1305  } /* end of scanning one token */
1306 } /* end of aaglex */
1307 
1308 /* aag_get_next_buffer - try to read in a new buffer
1309  *
1310  * Returns a code representing an action:
1311  * EOB_ACT_LAST_MATCH -
1312  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1313  * EOB_ACT_END_OF_FILE - end of file
1314  */
1315 static int aag_get_next_buffer (void)
1316 {
1317  register char *dest = YY_CURRENT_BUFFER_LVALUE->aag_ch_buf;
1318  register char *source = (aagtext_ptr);
1319  register int number_to_move, i;
1320  int ret_val;
1321 
1322  if ( (aag_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars) + 1] )
1324  "fatal flex scanner internal error--end of buffer missed" );
1325 
1326  if ( YY_CURRENT_BUFFER_LVALUE->aag_fill_buffer == 0 )
1327  { /* Don't try to fill the buffer, so this is an EOF. */
1328  if ( (aag_c_buf_p) - (aagtext_ptr) - YY_MORE_ADJ == 1 )
1329  {
1330  /* We matched a single character, the EOB, so
1331  * treat this as a final EOF.
1332  */
1333  return EOB_ACT_END_OF_FILE;
1334  }
1335 
1336  else
1337  {
1338  /* We matched some text prior to the EOB, first
1339  * process it.
1340  */
1341  return EOB_ACT_LAST_MATCH;
1342  }
1343  }
1344 
1345  /* Try to read more data. */
1346 
1347  /* First move last chars to start of buffer. */
1348  number_to_move = (int) ((aag_c_buf_p) - (aagtext_ptr)) - 1;
1349 
1350  for ( i = 0; i < number_to_move; ++i )
1351  *(dest++) = *(source++);
1352 
1353  if ( YY_CURRENT_BUFFER_LVALUE->aag_buffer_status == YY_BUFFER_EOF_PENDING )
1354  /* don't do the read, it's not guaranteed to return an EOF,
1355  * just force an EOF
1356  */
1357  YY_CURRENT_BUFFER_LVALUE->aag_n_chars = (aag_n_chars) = 0;
1358 
1359  else
1360  {
1361  aag_size_t num_to_read =
1362  YY_CURRENT_BUFFER_LVALUE->aag_buf_size - number_to_move - 1;
1363 
1364  while ( num_to_read <= 0 )
1365  { /* Not enough room in the buffer - grow it. */
1366 
1367  /* just a shorter name for the current buffer */
1368  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1369 
1370  int aag_c_buf_p_offset =
1371  (int) ((aag_c_buf_p) - b->aag_ch_buf);
1372 
1373  if ( b->aag_is_our_buffer )
1374  {
1375  aag_size_t new_size = b->aag_buf_size * 2;
1376 
1377  if ( new_size <= 0 )
1378  b->aag_buf_size += b->aag_buf_size / 8;
1379  else
1380  b->aag_buf_size *= 2;
1381 
1382  b->aag_ch_buf = (char *)
1383  /* Include room in for 2 EOB chars. */
1384  aagrealloc((void *) b->aag_ch_buf,b->aag_buf_size + 2 );
1385  }
1386  else
1387  /* Can't grow it, we don't own it. */
1388  b->aag_ch_buf = 0;
1389 
1390  if ( ! b->aag_ch_buf )
1392  "fatal error - scanner input buffer overflow" );
1393 
1394  (aag_c_buf_p) = &b->aag_ch_buf[aag_c_buf_p_offset];
1395 
1396  num_to_read = YY_CURRENT_BUFFER_LVALUE->aag_buf_size -
1397  number_to_move - 1;
1398 
1399  }
1400 
1401  if ( num_to_read > YY_READ_BUF_SIZE )
1402  num_to_read = YY_READ_BUF_SIZE;
1403 
1404  /* Read in more data. */
1405  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[number_to_move]),
1406  (aag_n_chars), num_to_read );
1407 
1408  YY_CURRENT_BUFFER_LVALUE->aag_n_chars = (aag_n_chars);
1409  }
1410 
1411  if ( (aag_n_chars) == 0 )
1412  {
1413  if ( number_to_move == YY_MORE_ADJ )
1414  {
1415  ret_val = EOB_ACT_END_OF_FILE;
1416  aagrestart(aagin );
1417  }
1418 
1419  else
1420  {
1421  ret_val = EOB_ACT_LAST_MATCH;
1422  YY_CURRENT_BUFFER_LVALUE->aag_buffer_status =
1424  }
1425  }
1426 
1427  else
1428  ret_val = EOB_ACT_CONTINUE_SCAN;
1429 
1430  if ((aag_size_t) ((aag_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->aag_buf_size) {
1431  /* Extend the array by 50%, plus the number we really need. */
1432  aag_size_t new_size = (aag_n_chars) + number_to_move + ((aag_n_chars) >> 1);
1433  YY_CURRENT_BUFFER_LVALUE->aag_ch_buf = (char *) aagrealloc((void *) YY_CURRENT_BUFFER_LVALUE->aag_ch_buf,new_size );
1434  if ( ! YY_CURRENT_BUFFER_LVALUE->aag_ch_buf )
1435  YY_FATAL_ERROR( "out of dynamic memory in aag_get_next_buffer()" );
1436  }
1437 
1438  (aag_n_chars) += number_to_move;
1439  YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars)] = YY_END_OF_BUFFER_CHAR;
1440  YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1441 
1442  (aagtext_ptr) = &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[0];
1443 
1444  return ret_val;
1445 }
1446 
1447 /* aag_get_previous_state - get the state just before the EOB char was reached */
1448 
1449  static aag_state_type aag_get_previous_state (void)
1450 {
1451  register aag_state_type aag_current_state;
1452  register char *aag_cp;
1453 
1454  aag_current_state = (aag_start);
1455  aag_current_state += YY_AT_BOL();
1456 
1457  for ( aag_cp = (aagtext_ptr) + YY_MORE_ADJ; aag_cp < (aag_c_buf_p); ++aag_cp )
1458  {
1459  register YY_CHAR aag_c = (*aag_cp ? aag_ec[YY_SC_TO_UI(*aag_cp)] : 1);
1460  if ( aag_accept[aag_current_state] )
1461  {
1462  (aag_last_accepting_state) = aag_current_state;
1463  (aag_last_accepting_cpos) = aag_cp;
1464  }
1465  while ( aag_chk[aag_base[aag_current_state] + aag_c] != aag_current_state )
1466  {
1467  aag_current_state = (int) aag_def[aag_current_state];
1468  if ( aag_current_state >= 93 )
1469  aag_c = aag_meta[(unsigned int) aag_c];
1470  }
1471  aag_current_state = aag_nxt[aag_base[aag_current_state] + (unsigned int) aag_c];
1472  }
1473 
1474  return aag_current_state;
1475 }
1476 
1477 /* aag_try_NUL_trans - try to make a transition on the NUL character
1478  *
1479  * synopsis
1480  * next_state = aag_try_NUL_trans( current_state );
1481  */
1482  static aag_state_type aag_try_NUL_trans (aag_state_type aag_current_state )
1483 {
1484  register int aag_is_jam;
1485  register char *aag_cp = (aag_c_buf_p);
1486 
1487  register YY_CHAR aag_c = 1;
1488  if ( aag_accept[aag_current_state] )
1489  {
1490  (aag_last_accepting_state) = aag_current_state;
1491  (aag_last_accepting_cpos) = aag_cp;
1492  }
1493  while ( aag_chk[aag_base[aag_current_state] + aag_c] != aag_current_state )
1494  {
1495  aag_current_state = (int) aag_def[aag_current_state];
1496  if ( aag_current_state >= 93 )
1497  aag_c = aag_meta[(unsigned int) aag_c];
1498  }
1499  aag_current_state = aag_nxt[aag_base[aag_current_state] + (unsigned int) aag_c];
1500  aag_is_jam = (aag_current_state == 92);
1501 
1502  return aag_is_jam ? 0 : aag_current_state;
1503 }
1504 
1505  static void aagunput (int c, register char * aag_bp )
1506 {
1507  register char *aag_cp;
1508 
1509  aag_cp = (aag_c_buf_p);
1510 
1511  /* undo effects of setting up aagtext */
1512  *aag_cp = (aag_hold_char);
1513 
1514  if ( aag_cp < YY_CURRENT_BUFFER_LVALUE->aag_ch_buf + 2 )
1515  { /* need to shift things up to make room */
1516  /* +2 for EOB chars. */
1517  register aag_size_t number_to_move = (aag_n_chars) + 2;
1518  register char *dest = &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[
1519  YY_CURRENT_BUFFER_LVALUE->aag_buf_size + 2];
1520  register char *source =
1521  &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[number_to_move];
1522 
1523  while ( source > YY_CURRENT_BUFFER_LVALUE->aag_ch_buf )
1524  *--dest = *--source;
1525 
1526  aag_cp += (int) (dest - source);
1527  aag_bp += (int) (dest - source);
1528  YY_CURRENT_BUFFER_LVALUE->aag_n_chars =
1529  (aag_n_chars) = YY_CURRENT_BUFFER_LVALUE->aag_buf_size;
1530 
1531  if ( aag_cp < YY_CURRENT_BUFFER_LVALUE->aag_ch_buf + 2 )
1532  YY_FATAL_ERROR( "flex scanner push-back overflow" );
1533  }
1534 
1535  *--aag_cp = (char) c;
1536 
1537  (aagtext_ptr) = aag_bp;
1538  (aag_hold_char) = *aag_cp;
1539  (aag_c_buf_p) = aag_cp;
1540 }
1541 
1542 #ifndef YY_NO_INPUT
1543 #ifdef __cplusplus
1544  static int aaginput (void)
1545 #else
1546  static int input (void)
1547 #endif
1548 
1549 {
1550  int c;
1551 
1552  *(aag_c_buf_p) = (aag_hold_char);
1553 
1554  if ( *(aag_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1555  {
1556  /* aag_c_buf_p now points to the character we want to return.
1557  * If this occurs *before* the EOB characters, then it's a
1558  * valid NUL; if not, then we've hit the end of the buffer.
1559  */
1560  if ( (aag_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->aag_ch_buf[(aag_n_chars)] )
1561  /* This was really a NUL. */
1562  *(aag_c_buf_p) = '\0';
1563 
1564  else
1565  { /* need more input */
1566  aag_size_t offset = (aag_c_buf_p) - (aagtext_ptr);
1567  ++(aag_c_buf_p);
1568 
1569  switch ( aag_get_next_buffer( ) )
1570  {
1571  case EOB_ACT_LAST_MATCH:
1572  /* This happens because aag_g_n_b()
1573  * sees that we've accumulated a
1574  * token and flags that we need to
1575  * try matching the token before
1576  * proceeding. But for input(),
1577  * there's no matching to consider.
1578  * So convert the EOB_ACT_LAST_MATCH
1579  * to EOB_ACT_END_OF_FILE.
1580  */
1581 
1582  /* Reset buffer status. */
1583  aagrestart(aagin );
1584 
1585  /*FALLTHROUGH*/
1586 
1587  case EOB_ACT_END_OF_FILE:
1588  {
1589  if ( aagwrap( ) )
1590  return EOF;
1591 
1592  if ( ! (aag_did_buffer_switch_on_eof) )
1593  YY_NEW_FILE;
1594 #ifdef __cplusplus
1595  return aaginput();
1596 #else
1597  return input();
1598 #endif
1599  }
1600 
1601  case EOB_ACT_CONTINUE_SCAN:
1602  (aag_c_buf_p) = (aagtext_ptr) + offset;
1603  break;
1604  }
1605  }
1606  }
1607 
1608  c = *(unsigned char *) (aag_c_buf_p); /* cast for 8-bit char's */
1609  *(aag_c_buf_p) = '\0'; /* preserve aagtext */
1610  (aag_hold_char) = *++(aag_c_buf_p);
1611 
1612  YY_CURRENT_BUFFER_LVALUE->aag_at_bol = (c == '\n');
1613 
1614  return c;
1615 }
1616 #endif /* ifndef YY_NO_INPUT */
1617 
1623  void aagrestart (FILE * input_file )
1624 {
1625 
1626  if ( ! YY_CURRENT_BUFFER ){
1627  aagensure_buffer_stack ();
1630  }
1631 
1632  aag_init_buffer(YY_CURRENT_BUFFER,input_file );
1633  aag_load_buffer_state( );
1634 }
1635 
1640  void aag_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1641 {
1642 
1643  /* TODO. We should be able to replace this entire function body
1644  * with
1645  * aagpop_buffer_state();
1646  * aagpush_buffer_state(new_buffer);
1647  */
1648  aagensure_buffer_stack ();
1649  if ( YY_CURRENT_BUFFER == new_buffer )
1650  return;
1651 
1652  if ( YY_CURRENT_BUFFER )
1653  {
1654  /* Flush out information for old buffer. */
1655  *(aag_c_buf_p) = (aag_hold_char);
1656  YY_CURRENT_BUFFER_LVALUE->aag_buf_pos = (aag_c_buf_p);
1657  YY_CURRENT_BUFFER_LVALUE->aag_n_chars = (aag_n_chars);
1658  }
1659 
1660  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1661  aag_load_buffer_state( );
1662 
1663  /* We don't actually know whether we did this switch during
1664  * EOF (aagwrap()) processing, but the only time this flag
1665  * is looked at is after aagwrap() is called, so it's safe
1666  * to go ahead and always set it.
1667  */
1668  (aag_did_buffer_switch_on_eof) = 1;
1669 }
1670 
1671 static void aag_load_buffer_state (void)
1672 {
1673  (aag_n_chars) = YY_CURRENT_BUFFER_LVALUE->aag_n_chars;
1674  (aagtext_ptr) = (aag_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->aag_buf_pos;
1675  aagin = YY_CURRENT_BUFFER_LVALUE->aag_input_file;
1676  (aag_hold_char) = *(aag_c_buf_p);
1677 }
1678 
1685  YY_BUFFER_STATE aag_create_buffer (FILE * file, int size )
1686 {
1687  YY_BUFFER_STATE b;
1688 
1689  b = (YY_BUFFER_STATE) aagalloc(sizeof( struct aag_buffer_state ) );
1690  if ( ! b )
1691  YY_FATAL_ERROR( "out of dynamic memory in aag_create_buffer()" );
1692 
1693  b->aag_buf_size = size;
1694 
1695  /* aag_ch_buf has to be 2 characters longer than the size given because
1696  * we need to put in 2 end-of-buffer characters.
1697  */
1698  b->aag_ch_buf = (char *) aagalloc(b->aag_buf_size + 2 );
1699  if ( ! b->aag_ch_buf )
1700  YY_FATAL_ERROR( "out of dynamic memory in aag_create_buffer()" );
1701 
1702  b->aag_is_our_buffer = 1;
1703 
1704  aag_init_buffer(b,file );
1705 
1706  return b;
1707 }
1708 
1713  void aag_delete_buffer (YY_BUFFER_STATE b )
1714 {
1715 
1716  if ( ! b )
1717  return;
1718 
1719  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1721 
1722  if ( b->aag_is_our_buffer )
1723  aagfree((void *) b->aag_ch_buf );
1724 
1725  aagfree((void *) b );
1726 }
1727 
1728 /* Initializes or reinitializes a buffer.
1729  * This function is sometimes called more than once on the same buffer,
1730  * such as during a aagrestart() or at EOF.
1731  */
1732  static void aag_init_buffer (YY_BUFFER_STATE b, FILE * file )
1733 
1734 {
1735  int oerrno = errno;
1736 
1737  aag_flush_buffer(b );
1738 
1739  b->aag_input_file = file;
1740  b->aag_fill_buffer = 1;
1741 
1742  /* If b is the current buffer, then aag_init_buffer was _probably_
1743  * called from aagrestart() or through aag_get_next_buffer.
1744  * In that case, we don't want to reset the lineno or column.
1745  */
1746  if (b != YY_CURRENT_BUFFER){
1747  b->aag_bs_lineno = 1;
1748  b->aag_bs_column = 0;
1749  }
1750 
1751  b->aag_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1752 
1753  errno = oerrno;
1754 }
1755 
1760  void aag_flush_buffer (YY_BUFFER_STATE b )
1761 {
1762  if ( ! b )
1763  return;
1764 
1765  b->aag_n_chars = 0;
1766 
1767  /* We always need two end-of-buffer characters. The first causes
1768  * a transition to the end-of-buffer state. The second causes
1769  * a jam in that state.
1770  */
1773 
1774  b->aag_buf_pos = &b->aag_ch_buf[0];
1775 
1776  b->aag_at_bol = 1;
1778 
1779  if ( b == YY_CURRENT_BUFFER )
1780  aag_load_buffer_state( );
1781 }
1782 
1789 void aagpush_buffer_state (YY_BUFFER_STATE new_buffer )
1790 {
1791  if (new_buffer == NULL)
1792  return;
1793 
1794  aagensure_buffer_stack();
1795 
1796  /* This block is copied from aag_switch_to_buffer. */
1797  if ( YY_CURRENT_BUFFER )
1798  {
1799  /* Flush out information for old buffer. */
1800  *(aag_c_buf_p) = (aag_hold_char);
1801  YY_CURRENT_BUFFER_LVALUE->aag_buf_pos = (aag_c_buf_p);
1802  YY_CURRENT_BUFFER_LVALUE->aag_n_chars = (aag_n_chars);
1803  }
1804 
1805  /* Only push if top exists. Otherwise, replace top. */
1806  if (YY_CURRENT_BUFFER)
1807  (aag_buffer_stack_top)++;
1808  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1809 
1810  /* copied from aag_switch_to_buffer. */
1811  aag_load_buffer_state( );
1812  (aag_did_buffer_switch_on_eof) = 1;
1813 }
1814 
1820 {
1821  if (!YY_CURRENT_BUFFER)
1822  return;
1823 
1826  if ((aag_buffer_stack_top) > 0)
1827  --(aag_buffer_stack_top);
1828 
1829  if (YY_CURRENT_BUFFER) {
1830  aag_load_buffer_state( );
1831  (aag_did_buffer_switch_on_eof) = 1;
1832  }
1833 }
1834 
1835 /* Allocates the stack if it does not exist.
1836  * Guarantees space for at least one push.
1837  */
1838 static void aagensure_buffer_stack (void)
1839 {
1840  aag_size_t num_to_alloc;
1841 
1842  if (!(aag_buffer_stack)) {
1843 
1844  /* First allocation is just for 2 elements, since we don't know if this
1845  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1846  * immediate realloc on the next call.
1847  */
1848  num_to_alloc = 1;
1849  (aag_buffer_stack) = (struct aag_buffer_state**)aagalloc
1850  (num_to_alloc * sizeof(struct aag_buffer_state*)
1851  );
1852  if ( ! (aag_buffer_stack) )
1853  YY_FATAL_ERROR( "out of dynamic memory in aagensure_buffer_stack()" );
1854 
1855  memset((aag_buffer_stack), 0, num_to_alloc * sizeof(struct aag_buffer_state*));
1856 
1857  (aag_buffer_stack_max) = num_to_alloc;
1858  (aag_buffer_stack_top) = 0;
1859  return;
1860  }
1861 
1862  if ((aag_buffer_stack_top) >= ((aag_buffer_stack_max)) - 1){
1863 
1864  /* Increase the buffer to prepare for a possible push. */
1865  int grow_size = 8 /* arbitrary grow size */;
1866 
1867  num_to_alloc = (aag_buffer_stack_max) + grow_size;
1868  (aag_buffer_stack) = (struct aag_buffer_state**)aagrealloc
1869  ((aag_buffer_stack),
1870  num_to_alloc * sizeof(struct aag_buffer_state*)
1871  );
1872  if ( ! (aag_buffer_stack) )
1873  YY_FATAL_ERROR( "out of dynamic memory in aagensure_buffer_stack()" );
1874 
1875  /* zero only the new slots.*/
1876  memset((aag_buffer_stack) + (aag_buffer_stack_max), 0, grow_size * sizeof(struct aag_buffer_state*));
1877  (aag_buffer_stack_max) = num_to_alloc;
1878  }
1879 }
1880 
1887 YY_BUFFER_STATE aag_scan_buffer (char * base, aag_size_t size )
1888 {
1889  YY_BUFFER_STATE b;
1890 
1891  if ( size < 2 ||
1892  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1893  base[size-1] != YY_END_OF_BUFFER_CHAR )
1894  /* They forgot to leave room for the EOB's. */
1895  return 0;
1896 
1897  b = (YY_BUFFER_STATE) aagalloc(sizeof( struct aag_buffer_state ) );
1898  if ( ! b )
1899  YY_FATAL_ERROR( "out of dynamic memory in aag_scan_buffer()" );
1900 
1901  b->aag_buf_size = size - 2; /* "- 2" to take care of EOB's */
1902  b->aag_buf_pos = b->aag_ch_buf = base;
1903  b->aag_is_our_buffer = 0;
1904  b->aag_input_file = 0;
1905  b->aag_n_chars = b->aag_buf_size;
1906  b->aag_is_interactive = 0;
1907  b->aag_at_bol = 1;
1908  b->aag_fill_buffer = 0;
1910 
1912 
1913  return b;
1914 }
1915 
1924 YY_BUFFER_STATE aag_scan_string (aagconst char * aagstr )
1925 {
1926 
1927  return aag_scan_bytes(aagstr,strlen(aagstr) );
1928 }
1929 
1937 YY_BUFFER_STATE aag_scan_bytes (aagconst char * aagbytes, aag_size_t _aagbytes_len )
1938 {
1939  YY_BUFFER_STATE b;
1940  char *buf;
1941  aag_size_t n;
1942  int i;
1943 
1944  /* Get memory for full buffer, including space for trailing EOB's. */
1945  n = _aagbytes_len + 2;
1946  buf = (char *) aagalloc(n );
1947  if ( ! buf )
1948  YY_FATAL_ERROR( "out of dynamic memory in aag_scan_bytes()" );
1949 
1950  for ( i = 0; i < _aagbytes_len; ++i )
1951  buf[i] = aagbytes[i];
1952 
1953  buf[_aagbytes_len] = buf[_aagbytes_len+1] = YY_END_OF_BUFFER_CHAR;
1954 
1955  b = aag_scan_buffer(buf,n );
1956  if ( ! b )
1957  YY_FATAL_ERROR( "bad buffer in aag_scan_bytes()" );
1958 
1959  /* It's okay to grow etc. this buffer, and we should throw it
1960  * away when we're done.
1961  */
1962  b->aag_is_our_buffer = 1;
1963 
1964  return b;
1965 }
1966 
1967 #ifndef YY_EXIT_FAILURE
1968 #define YY_EXIT_FAILURE 2
1969 #endif
1970 
1971 static void aag_fatal_error (aagconst char* msg )
1972 {
1973  (void) fprintf( stderr, "%s\n", msg );
1974  exit( YY_EXIT_FAILURE );
1975 }
1976 
1977 /* Redefine aagless() so it works in section 3 code. */
1978 
1979 #undef aagless
1980 #define aagless(n) \
1981  do \
1982  { \
1983  /* Undo effects of setting up aagtext. */ \
1984  int aagless_macro_arg = (n); \
1985  YY_LESS_LINENO(aagless_macro_arg);\
1986  aagtext[aagleng] = (aag_hold_char); \
1987  (aag_c_buf_p) = aagtext + aagless_macro_arg; \
1988  (aag_hold_char) = *(aag_c_buf_p); \
1989  *(aag_c_buf_p) = '\0'; \
1990  aagleng = aagless_macro_arg; \
1991  } \
1992  while ( 0 )
1993 
1994 /* Accessor methods (get/set functions) to struct members. */
1995 
1999 int aagget_lineno (void)
2000 {
2001 
2002  return aaglineno;
2003 }
2004 
2008 FILE *aagget_in (void)
2009 {
2010  return aagin;
2011 }
2012 
2016 FILE *aagget_out (void)
2017 {
2018  return aagout;
2019 }
2020 
2025 {
2026  return aagleng;
2027 }
2028 
2033 char *aagget_text (void)
2034 {
2035  return aagtext;
2036 }
2037 
2042 void aagset_lineno (int line_number )
2043 {
2044 
2045  aaglineno = line_number;
2046 }
2047 
2054 void aagset_in (FILE * in_str )
2055 {
2056  aagin = in_str ;
2057 }
2058 
2059 void aagset_out (FILE * out_str )
2060 {
2061  aagout = out_str ;
2062 }
2063 
2064 int aagget_debug (void)
2065 {
2066  return aag_flex_debug;
2067 }
2068 
2069 void aagset_debug (int bdebug )
2070 {
2071  aag_flex_debug = bdebug ;
2072 }
2073 
2074 static int aag_init_globals (void)
2075 {
2076  /* Initialization is the same as for the non-reentrant scanner.
2077  * This function is called from aaglex_destroy(), so don't allocate here.
2078  */
2079 
2080  (aag_buffer_stack) = 0;
2081  (aag_buffer_stack_top) = 0;
2082  (aag_buffer_stack_max) = 0;
2083  (aag_c_buf_p) = (char *) 0;
2084  (aag_init) = 0;
2085  (aag_start) = 0;
2086 
2087 /* Defined in main.c */
2088 #ifdef YY_STDINIT
2089  aagin = stdin;
2090  aagout = stdout;
2091 #else
2092  aagin = (FILE *) 0;
2093  aagout = (FILE *) 0;
2094 #endif
2095 
2096  /* For future reference: Set errno on error, since we are called by
2097  * aaglex_init()
2098  */
2099  return 0;
2100 }
2101 
2102 /* aaglex_destroy is for both reentrant and non-reentrant scanners. */
2103 int aaglex_destroy (void)
2104 {
2105 
2106  /* Pop the buffer stack, destroying each element. */
2107  while(YY_CURRENT_BUFFER){
2111  }
2112 
2113  /* Destroy the stack itself. */
2114  aagfree((aag_buffer_stack) );
2115  (aag_buffer_stack) = NULL;
2116 
2117  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2118  * aaglex() is called, initialization will occur. */
2119  aag_init_globals( );
2120 
2121  return 0;
2122 }
2123 
2124 /*
2125  * Internal utility routines.
2126  */
2127 
2128 #ifndef aagtext_ptr
2129 static void aag_flex_strncpy (char* s1, aagconst char * s2, int n )
2130 {
2131  register int i;
2132  for ( i = 0; i < n; ++i )
2133  s1[i] = s2[i];
2134 }
2135 #endif
2136 
2137 #ifdef YY_NEED_STRLEN
2138 static int aag_flex_strlen (aagconst char * s )
2139 {
2140  register int n;
2141  for ( n = 0; s[n]; ++n )
2142  ;
2143 
2144  return n;
2145 }
2146 #endif
2147 
2148 void *aagalloc (aag_size_t size )
2149 {
2150  return (void *) malloc( size );
2151 }
2152 
2153 void *aagrealloc (void * ptr, aag_size_t size )
2154 {
2155  /* The cast to (char *) in the following accommodates both
2156  * implementations that use char* generic pointers, and those
2157  * that use void* generic pointers. It works with the latter
2158  * because both ANSI C and C++ allow castless assignment from
2159  * any pointer type to void*, and deal with argument conversions
2160  * as though doing an assignment.
2161  */
2162  return (void *) realloc( (char *) ptr, size );
2163 }
2164 
2165 void aagfree (void * ptr )
2166 {
2167  free( (char *) ptr ); /* see aagrealloc() for (char *) cast */
2168 }
2169 
2170 #define YYTABLES_NAME "aagtables"
2171 
2172 #line 228 "../../lib/cgraph/scan.l"
2173 
2174 
2175 
2176 void aagerror(char *str)
2177 {
2178  unsigned char xbuf[BUFSIZ];
2179  char buf[BUFSIZ];
2180  agxbuf xb;
2181 
2182  agxbinit(&xb, BUFSIZ, xbuf);
2183  if (InputFile) {
2184  agxbput (&xb, InputFile);
2185  agxbput (&xb, ": ");
2186  }
2187  agxbput (&xb, str);
2188  sprintf(buf," in line %d", line_num);
2189  agxbput (&xb, buf);
2190  if (*aagtext) {
2191  agxbput(&xb," near '");
2192  agxbput (&xb, aagtext);
2193  agxbputc (&xb, '\'');
2194  }
2195  else switch (YYSTATE) {
2196  case qstring :
2197  sprintf(buf, " scanning a quoted string (missing endquote? longer than %d?)", YY_BUF_SIZE);
2198  agxbput (&xb, buf);
2199  if (*Sbuf) {
2200  int len = strlen(Sbuf);
2201  agxbput (&xb, "\nString starting:\"");
2202  if (len > 80)
2203  Sbuf[80] = '\0';
2204  agxbput (&xb, Sbuf);
2205  }
2206  break;
2207  case hstring :
2208  sprintf(buf, " scanning a HTML string (missing '>'? bad nesting? longer than %d?)", YY_BUF_SIZE);
2209  agxbput (&xb, buf);
2210  if (*Sbuf) {
2211  int len = strlen(Sbuf);
2212  agxbput (&xb, "\nString starting:<");
2213  if (len > 80)
2214  Sbuf[80] = '\0';
2215  agxbput (&xb, Sbuf);
2216  }
2217  break;
2218  case comment :
2219  sprintf(buf, " scanning a /*...*/ comment (missing '*/? longer than %d?)", YY_BUF_SIZE);
2220  agxbput (&xb, buf);
2221  break;
2222  }
2223  agxbputc (&xb, '\n');
2224  agerr(AGERR, "%s", agxbuse(&xb));
2225  agxbfree(&xb);
2226  BEGIN(INITIAL);
2227 }
2228 /* must be here to see flex's macro defns */
2230 
2232 
2233 #ifndef YY_CALL_ONLY_ARG
2234 # define YY_CALL_ONLY_ARG void
2235 #endif
2236 
2238 {
2239  return 1;
2240 }
2241 
2242 
void aagpush_buffer_state(YY_BUFFER_STATE new_buffer)
Definition: scan.c:1789
void s1(graph_t *, node_t *)
Definition: stuff.c:686
int aag_bs_column
Definition: scan.c:226
#define YY_END_OF_BUFFER_CHAR
Definition: scan.c:140
Definition: cgraph.h:388
void aag_switch_to_buffer(YY_BUFFER_STATE new_buffer)
Definition: scan.c:1640
char * aagget_text(void)
Definition: scan.c:2033
FILE * aag_input_file
Definition: scan.c:191
register char * aag_cp
Definition: scan.c:909
#define T_strict
Definition: grammar.c:189
#define INITIAL
Definition: scan.c:726
#define agxbuse(X)
Definition: agxbuf.h:83
#define T_edge
Definition: grammar.c:186
#define YY_INPUT(buf, result, max_size)
Definition: scan.c:583
#define YY_AT_BOL()
Definition: scan.c:331
CGRAPH_API void agsetfile(char *)
Definition: scan.c:573
int aag_state_type
Definition: scan.c:339
#define T_subgraph
Definition: grammar.c:188
#define aagless(n)
Definition: scan.c:1980
#define YY_FATAL_ERROR(msg)
Definition: scan.c:870
int aag_fill_buffer
Definition: scan.c:231
size_t agxbput(agxbuf *xb, const char *s)
Definition: agxbuf.c:84
void aagset_debug(int debug_flag)
Definition: scan.c:2069
#define YY_READ_BUF_SIZE
Definition: scan.c:808
void aglexinit(Agdisc_t *disc, void *ifile)
Definition: scan.c:579
#define YY_STATE_EOF(state)
Definition: scan.c:135
size_t aag_size_t
Definition: scan.c:158
YY_BUFFER_STATE aag_scan_string(aagconst char *aag_str)
Definition: scan.c:1924
flex_int32_t aag_nxt
Definition: scan.c:370
aag_size_t aag_n_chars
Definition: scan.c:204
FILE * aagget_out(void)
Definition: scan.c:2016
int aagget_debug(void)
Definition: scan.c:2064
int aaglex(void)
int agerr(agerrlevel_t level, const char *fmt,...)
Definition: agerror.c:141
int aag_at_bol
Definition: scan.c:223
#define YY_RULE_SETUP
Definition: scan.c:898
#define YY_EXTRA_TYPE
Definition: scan.c:740
CGRAPH_API void agreadline(int)
Definition: scan.c:569
aag_size_t aag_buf_size
Definition: scan.c:199
short int flex_int16_t
Definition: scan.c:51
char * str
Definition: grammar.c:205
void * aagrealloc(void *, aag_size_t)
Definition: scan.c:2153
#define comment
Definition: scan.c:727
CGRAPH_API char * agstrdup_html(Agraph_t *, char *)
Definition: refstr.c:123
int flex_int32_t
Definition: scan.c:52
#define EOB_ACT_END_OF_FILE
Definition: scan.c:166
void aagset_lineno(int line_number)
Definition: scan.c:2042
#define YY_BUFFER_NORMAL
Definition: scan.c:236
Definition: cgraph.h:388
#define agxbputc(X, C)
Definition: agxbuf.h:77
#define YY_RESTORE_YY_MORE_OFFSET
Definition: scan.c:538
void * aagalloc(aag_size_t)
Definition: scan.c:2148
#define T_node
Definition: grammar.c:185
void aagpop_buffer_state(void)
Definition: scan.c:1819
void aag_delete_buffer(YY_BUFFER_STATE b)
Definition: scan.c:1713
aag_size_t aagleng
Definition: scan.c:275
signed char flex_int8_t
Definition: scan.c:50
unsigned char flex_uint8_t
Definition: scan.c:53
#define YY_DO_BEFORE_ACTION
Definition: scan.c:356
int aag_is_interactive
Definition: scan.c:217
#define NIL(t)
Definition: dthdr.h:13
int
Definition: grammar.c:1264
flex_int32_t aag_verify
Definition: scan.c:369
int aag_flex_debug
Definition: scan.c:530
#define T_graph
Definition: grammar.c:184
#define EOB_ACT_CONTINUE_SCAN
Definition: scan.c:165
aag_size_t aagget_leng(void)
Definition: scan.c:2024
#define isatty(x)
Definition: scan.c:581
int aag_is_our_buffer
Definition: scan.c:210
#define aagconst
Definition: scan.c:108
#define YY_BUF_SIZE
Definition: scan.c:144
#define T_digraph
Definition: grammar.c:187
#define YY_SC_TO_UI(c)
Definition: scan.c:119
#define YY_CALL_ONLY_ARG
Definition: scan.c:2234
int aaglex_destroy(void)
Definition: scan.c:2103
#define YY_FLUSH_BUFFER
Definition: scan.c:299
struct aag_buffer_state * YY_BUFFER_STATE
Definition: scan.c:153
#define qstring
Definition: scan.c:728
CGRAPH_API char * agstrdup(Agraph_t *, char *)
Definition: refstr.c:97
EXTERN Agraph_t * Ag_G_global
Definition: cghdr.h:78
#define EOB_ACT_LAST_MATCH
Definition: scan.c:167
void agxbinit(agxbuf *xb, unsigned int hint, unsigned char *init)
Definition: agxbuf.c:25
#define unput(c)
Definition: scan.c:185
int aag_bs_lineno
Definition: scan.c:225
void aag_flush_buffer(YY_BUFFER_STATE b)
Definition: scan.c:1760
Definition: grammar.c:79
#define YY_START
Definition: scan.c:131
#define aagtext_ptr
Definition: scan.c:346
void aagset_in(FILE *in_str)
Definition: scan.c:2054
YY_BUFFER_STATE aag_scan_bytes(aagconst char *bytes, aag_size_t len)
Definition: scan.c:1937
#define hstring
Definition: scan.c:729
unsigned short int flex_uint16_t
Definition: scan.c:54
#define YY_CURRENT_BUFFER
Definition: scan.c:263
if(aagss+aagstacksize-1<=aagssp)
Definition: grammar.c:1332
register int aag_act
Definition: scan.c:910
int aaglineno
Definition: scan.c:343
#define NULL
Definition: logic.h:39
YYSTYPE aaglval
void aagerror(char *)
Definition: scan.c:2176
#define T_qatom
Definition: grammar.c:194
#define aagterminate()
Definition: scan.c:860
#define YY_BUFFER_NEW
Definition: scan.c:235
YY_EXTRA_TYPE aagget_extra(void)
void aglexbad(void)
Definition: scan.c:2231
#define BEGIN
Definition: scan.c:125
#define T_atom
Definition: grammar.c:193
#define T_edgeop
Definition: grammar.c:190
void aglexeof(void)
Definition: scan.c:2229
char * aag_ch_buf
Definition: scan.c:193
unsigned char YY_CHAR
Definition: scan.c:335
#define YY_MORE_ADJ
Definition: scan.c:537
#define YYSTATE
Definition: scan.c:132
void aagset_extra(YY_EXTRA_TYPE user_defined)
#define YY_CURRENT_BUFFER_LVALUE
Definition: scan.c:270
#define YY_NEW_FILE
Definition: scan.c:138
#define YY_EXIT_FAILURE
Definition: scan.c:1968
void aagfree(void *)
Definition: scan.c:2165
FILE * aagget_in(void)
Definition: scan.c:2008
void aagrestart(FILE *input_file)
Definition: scan.c:1623
FILE * aagin
Definition: scan.c:337
agxbuf * str
Definition: htmlparse.c:85
#define YY_END_OF_BUFFER
Definition: scan.c:364
#define GRAPH_EOF_TOKEN
Definition: scan.c:559
char * aagtext
Definition: scan.c:539
FILE * aagout
Definition: scan.c:337
char * aag_buf_pos
Definition: scan.c:194
Definition: agxbuf.h:34
#define YY_DECL
Definition: scan.c:883
register char * aag_bp
Definition: scan.c:909
#define ECHO
Definition: scan.c:816
#define YY_BREAK
Definition: scan.c:895
int aagget_lineno(void)
Definition: scan.c:1999
void aagset_out(FILE *out_str)
Definition: scan.c:2059
int aag_buffer_status
Definition: scan.c:233
YY_BUFFER_STATE aag_create_buffer(FILE *file, int size)
Definition: scan.c:1685
void agxbfree(agxbuf *xb)
Definition: agxbuf.c:94
YY_BUFFER_STATE aag_scan_buffer(char *base, aag_size_t size)
Definition: scan.c:1887
unsigned int flex_uint32_t
Definition: scan.c:55
#define YY_BUFFER_EOF_PENDING
Definition: scan.c:247
int aagwrap(void)