1 #line 2 "rec-sex-lex.c"
2    /* This code goes at the "top" of the generated file.  */
3    #include <config.h>
4 
5 #line 6 "rec-sex-lex.c"
6 
7 #define  YY_INT_ALIGNED short int
8 
9 /* A lexical scanner generated by flex */
10 
11 /* %not-for-header */
12 
13 /* %if-c-only */
14 /* %if-not-reentrant */
15 /* %endif */
16 /* %endif */
17 /* %ok-for-header */
18 
19 #define FLEX_SCANNER
20 #define YY_FLEX_MAJOR_VERSION 2
21 #define YY_FLEX_MINOR_VERSION 6
22 #define YY_FLEX_SUBMINOR_VERSION 1
23 #if YY_FLEX_SUBMINOR_VERSION > 0
24 #define FLEX_BETA
25 #endif
26 
27 /* %if-c++-only */
28 /* %endif */
29 
30 /* %if-c-only */
31 
32 /* %endif */
33 
34 /* %if-c-only */
35 
36 /* %endif */
37 
38 /* First, we deal with  platform-specific or compiler-specific issues. */
39 
40 /* begin standard C headers. */
41 /* %if-c-only */
42 #include <stdio.h>
43 #include <string.h>
44 #include <errno.h>
45 #include <stdlib.h>
46 /* %endif */
47 
48 /* %if-tables-serialization */
49 /* %endif */
50 /* end standard C headers. */
51 
52 /* %if-c-or-c++ */
53 /* flex integer type definitions */
54 
55 #ifndef FLEXINT_H
56 #define FLEXINT_H
57 
58 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
59 
60 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
61 
62 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
63  * if you want the limit (max/min) macros for int types.
64  */
65 #ifndef __STDC_LIMIT_MACROS
66 #define __STDC_LIMIT_MACROS 1
67 #endif
68 
69 #include <inttypes.h>
70 typedef int8_t flex_int8_t;
71 typedef uint8_t flex_uint8_t;
72 typedef int16_t flex_int16_t;
73 typedef uint16_t flex_uint16_t;
74 typedef int32_t flex_int32_t;
75 typedef uint32_t flex_uint32_t;
76 #else
77 typedef signed char flex_int8_t;
78 typedef short int flex_int16_t;
79 typedef int flex_int32_t;
80 typedef unsigned char flex_uint8_t;
81 typedef unsigned short int flex_uint16_t;
82 typedef unsigned int flex_uint32_t;
83 
84 /* Limits of integral types. */
85 #ifndef INT8_MIN
86 #define INT8_MIN               (-128)
87 #endif
88 #ifndef INT16_MIN
89 #define INT16_MIN              (-32767-1)
90 #endif
91 #ifndef INT32_MIN
92 #define INT32_MIN              (-2147483647-1)
93 #endif
94 #ifndef INT8_MAX
95 #define INT8_MAX               (127)
96 #endif
97 #ifndef INT16_MAX
98 #define INT16_MAX              (32767)
99 #endif
100 #ifndef INT32_MAX
101 #define INT32_MAX              (2147483647)
102 #endif
103 #ifndef UINT8_MAX
104 #define UINT8_MAX              (255U)
105 #endif
106 #ifndef UINT16_MAX
107 #define UINT16_MAX             (65535U)
108 #endif
109 #ifndef UINT32_MAX
110 #define UINT32_MAX             (4294967295U)
111 #endif
112 
113 #endif /* ! C99 */
114 
115 #endif /* ! FLEXINT_H */
116 
117 /* %endif */
118 
119 /* %if-c++-only */
120 /* %endif */
121 
122 /* TODO: this is always defined, so inline it */
123 #define yyconst const
124 
125 #if defined(__GNUC__) && __GNUC__ >= 3
126 #define yynoreturn __attribute__((__noreturn__))
127 #else
128 #define yynoreturn
129 #endif
130 
131 /* %not-for-header */
132 
133 /* Returned upon end-of-file. */
134 #define YY_NULL 0
135 /* %ok-for-header */
136 
137 /* %not-for-header */
138 
139 /* Promotes a possibly negative, possibly signed char to an unsigned
140  * integer for use as an array index.  If the signed char is negative,
141  * we want to instead treat it as an 8-bit unsigned char, hence the
142  * double cast.
143  */
144 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
145 /* %ok-for-header */
146 
147 /* %if-reentrant */
148 
149 /* An opaque pointer. */
150 #ifndef YY_TYPEDEF_YY_SCANNER_T
151 #define YY_TYPEDEF_YY_SCANNER_T
152 typedef void* yyscan_t;
153 #endif
154 
155 /* For convenience, these vars (plus the bison vars far below)
156    are macros in the reentrant scanner. */
157 #define yyin yyg->yyin_r
158 #define yyout yyg->yyout_r
159 #define yyextra yyg->yyextra_r
160 #define yyleng yyg->yyleng_r
161 #define yytext yyg->yytext_r
162 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
163 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
164 #define yy_flex_debug yyg->yy_flex_debug_r
165 
166 /* %endif */
167 
168 /* %if-not-reentrant */
169 /* %endif */
170 
171 /* Enter a start condition.  This macro really ought to take a parameter,
172  * but we do it the disgusting crufty way forced on us by the ()-less
173  * definition of BEGIN.
174  */
175 #define BEGIN yyg->yy_start = 1 + 2 *
176 
177 /* Translate the current start state into a value that can be later handed
178  * to BEGIN to return to the state.  The YYSTATE alias is for lex
179  * compatibility.
180  */
181 #define YY_START ((yyg->yy_start - 1) / 2)
182 #define YYSTATE YY_START
183 
184 /* Action number for EOF rule of a given start state. */
185 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
186 
187 /* Special action meaning "start processing a new file". */
188 #define YY_NEW_FILE sexrestart(yyin ,yyscanner )
189 
190 #define YY_END_OF_BUFFER_CHAR 0
191 
192 /* Size of default input buffer. */
193 #ifndef YY_BUF_SIZE
194 #ifdef __ia64__
195 /* On IA-64, the buffer size is 16k, not 8k.
196  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
197  * Ditto for the __ia64__ case accordingly.
198  */
199 #define YY_BUF_SIZE 32768
200 #else
201 #define YY_BUF_SIZE 16384
202 #endif /* __ia64__ */
203 #endif
204 
205 /* The state buf must be large enough to hold one state per character in the main buffer.
206  */
207 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
208 
209 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
210 #define YY_TYPEDEF_YY_BUFFER_STATE
211 typedef struct yy_buffer_state *YY_BUFFER_STATE;
212 #endif
213 
214 #ifndef YY_TYPEDEF_YY_SIZE_T
215 #define YY_TYPEDEF_YY_SIZE_T
216 typedef size_t yy_size_t;
217 #endif
218 
219 /* %if-not-reentrant */
220 /* %endif */
221 
222 /* %if-c-only */
223 /* %if-not-reentrant */
224 /* %endif */
225 /* %endif */
226 
227 #define EOB_ACT_CONTINUE_SCAN 0
228 #define EOB_ACT_END_OF_FILE 1
229 #define EOB_ACT_LAST_MATCH 2
230 
231     #define YY_LESS_LINENO(n)
232     #define YY_LINENO_REWIND_TO(ptr)
233 
234 /* Return all but the first "n" matched characters back to the input stream. */
235 #define yyless(n) \
236 	do \
237 		{ \
238 		/* Undo effects of setting up yytext. */ \
239         int yyless_macro_arg = (n); \
240         YY_LESS_LINENO(yyless_macro_arg);\
241 		*yy_cp = yyg->yy_hold_char; \
242 		YY_RESTORE_YY_MORE_OFFSET \
243 		yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
244 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
245 		} \
246 	while ( 0 )
247 
248 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
249 
250 #ifndef YY_STRUCT_YY_BUFFER_STATE
251 #define YY_STRUCT_YY_BUFFER_STATE
252 struct yy_buffer_state
253 	{
254 /* %if-c-only */
255 	FILE *yy_input_file;
256 /* %endif */
257 
258 /* %if-c++-only */
259 /* %endif */
260 
261 	char *yy_ch_buf;		/* input buffer */
262 	char *yy_buf_pos;		/* current position in input buffer */
263 
264 	/* Size of input buffer in bytes, not including room for EOB
265 	 * characters.
266 	 */
267 	int yy_buf_size;
268 
269 	/* Number of characters read into yy_ch_buf, not including EOB
270 	 * characters.
271 	 */
272 	int yy_n_chars;
273 
274 	/* Whether we "own" the buffer - i.e., we know we created it,
275 	 * and can realloc() it to grow it, and should free() it to
276 	 * delete it.
277 	 */
278 	int yy_is_our_buffer;
279 
280 	/* Whether this is an "interactive" input source; if so, and
281 	 * if we're using stdio for input, then we want to use getc()
282 	 * instead of fread(), to make sure we stop fetching input after
283 	 * each newline.
284 	 */
285 	int yy_is_interactive;
286 
287 	/* Whether we're considered to be at the beginning of a line.
288 	 * If so, '^' rules will be active on the next match, otherwise
289 	 * not.
290 	 */
291 	int yy_at_bol;
292 
293     int yy_bs_lineno; /**< The line count. */
294     int yy_bs_column; /**< The column count. */
295 
296 	/* Whether to try to fill the input buffer when we reach the
297 	 * end of it.
298 	 */
299 	int yy_fill_buffer;
300 
301 	int yy_buffer_status;
302 
303 #define YY_BUFFER_NEW 0
304 #define YY_BUFFER_NORMAL 1
305 	/* When an EOF's been seen but there's still some text to process
306 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
307 	 * shouldn't try reading from the input source any more.  We might
308 	 * still have a bunch of tokens to match, though, because of
309 	 * possible backing-up.
310 	 *
311 	 * When we actually see the EOF, we change the status to "new"
312 	 * (via sexrestart()), so that the user can continue scanning by
313 	 * just pointing yyin at a new input file.
314 	 */
315 #define YY_BUFFER_EOF_PENDING 2
316 
317 	};
318 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
319 
320 /* %if-c-only Standard (non-C++) definition */
321 /* %not-for-header */
322 
323 /* %if-not-reentrant */
324 /* %endif */
325 /* %ok-for-header */
326 
327 /* %endif */
328 
329 /* We provide macros for accessing buffer states in case in the
330  * future we want to put the buffer states in a more general
331  * "scanner state".
332  *
333  * Returns the top of the stack, or NULL.
334  */
335 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
336                           ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
337                           : NULL)
338 
339 /* Same as previous macro, but useful when we know that the buffer stack is not
340  * NULL or when we need an lvalue. For internal use only.
341  */
342 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
343 
344 /* %if-c-only Standard (non-C++) definition */
345 
346 /* %if-not-reentrant */
347 /* %not-for-header */
348 
349 /* %ok-for-header */
350 
351 /* %endif */
352 
353 void sexrestart (FILE *input_file ,yyscan_t yyscanner );
354 void sex_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
355 YY_BUFFER_STATE sex_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
356 void sex_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
357 void sex_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
358 void sexpush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
359 void sexpop_buffer_state (yyscan_t yyscanner );
360 
361 static void sexensure_buffer_stack (yyscan_t yyscanner );
362 static void sex_load_buffer_state (yyscan_t yyscanner );
363 static void sex_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
364 
365 #define YY_FLUSH_BUFFER sex_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
366 
367 YY_BUFFER_STATE sex_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
368 YY_BUFFER_STATE sex_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
369 YY_BUFFER_STATE sex_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
370 
371 /* %endif */
372 
373 void *sexalloc (yy_size_t ,yyscan_t yyscanner );
374 void *sexrealloc (void *,yy_size_t ,yyscan_t yyscanner );
375 void sexfree (void * ,yyscan_t yyscanner );
376 
377 #define yy_new_buffer sex_create_buffer
378 
379 #define yy_set_interactive(is_interactive) \
380 	{ \
381 	if ( ! YY_CURRENT_BUFFER ){ \
382         sexensure_buffer_stack (yyscanner); \
383 		YY_CURRENT_BUFFER_LVALUE =    \
384             sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
385 	} \
386 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
387 	}
388 
389 #define yy_set_bol(at_bol) \
390 	{ \
391 	if ( ! YY_CURRENT_BUFFER ){\
392         sexensure_buffer_stack (yyscanner); \
393 		YY_CURRENT_BUFFER_LVALUE =    \
394             sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
395 	} \
396 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
397 	}
398 
399 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
400 
401 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
402 /* Begin user sect3 */
403 
404 #define sexwrap(yyscanner) (/*CONSTCOND*/1)
405 #define YY_SKIP_YYWRAP
406 
407 #define FLEX_DEBUG
408 
409 typedef unsigned char YY_CHAR;
410 
411 typedef int yy_state_type;
412 
413 #define yytext_ptr yytext_r
414 
415 /* %% [1.5] DFA */
416 
417 /* %if-c-only Standard (non-C++) definition */
418 
419 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
420 static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
421 static int yy_get_next_buffer (yyscan_t yyscanner );
422 static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner );
423 
424 /* %endif */
425 
426 /* Done after the current pattern has been matched and before the
427  * corresponding action - sets up yytext.
428  */
429 #define YY_DO_BEFORE_ACTION \
430 	yyg->yytext_ptr = yy_bp; \
431 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
432 	yyleng = (int) (yy_cp - yy_bp); \
433 	yyg->yy_hold_char = *yy_cp; \
434 	*yy_cp = '\0'; \
435 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
436 	yyg->yy_c_buf_p = yy_cp;
437 
438 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
439 #define YY_NUM_RULES 32
440 #define YY_END_OF_BUFFER 33
441 /* This struct is not used in this scanner,
442    but its presence is necessary. */
443 struct yy_trans_info
444 	{
445 	flex_int32_t yy_verify;
446 	flex_int32_t yy_nxt;
447 	};
448 static yyconst flex_int16_t yy_accept[64] =
449     {   0,
450         0,    0,   33,   31,    1,    1,   17,   31,   25,    7,
451        28,   31,   21,   22,   14,    4,    5,   31,    6,    3,
452         3,   27,   20,   15,   19,   26,   29,   31,   18,   16,
453         0,   30,    0,   23,    0,    0,    0,    3,    3,    2,
454         0,    9,   10,   12,   13,   11,    8,    0,   29,    0,
455        24,    0,   30,    0,    0,   30,    0,    3,   29,    0,
456        29,   29,    0
457     } ;
458 
459 static yyconst YY_CHAR yy_ec[256] =
460     {   0,
461         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
462         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
463         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
464         1,    2,    4,    5,    6,    1,    7,    8,    9,   10,
465        11,   12,   13,    1,   14,   15,   16,   17,   18,   18,
466        18,   18,   18,   18,   18,   18,   18,   19,    1,   20,
467        21,   22,   23,    1,   24,   24,   24,   24,   24,   24,
468        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
469        25,   25,   25,   25,   25,   25,   25,   25,   25,   25,
470        26,   27,   28,    1,   29,    1,   24,   24,   24,   24,
471 
472        24,   24,   25,   25,   25,   25,   25,   25,   25,   25,
473        25,   25,   25,   25,   25,   25,   25,   25,   25,   30,
474        25,   25,    1,   31,    1,   32,    1,    1,    1,    1,
475         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
476         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
477         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
478         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
479         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
480         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
481         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
482 
483         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
484         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
485         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
486         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
487         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
488         1,    1,    1,    1,    1
489     } ;
490 
491 static yyconst YY_CHAR yy_meta[33] =
492     {   0,
493         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
494         1,    1,    1,    1,    2,    1,    3,    3,    1,    1,
495         1,    1,    1,    3,    3,    3,    1,    1,    3,    3,
496         1,    1
497     } ;
498 
499 static yyconst flex_uint16_t yy_base[70] =
500     {   0,
501         0,    0,  105,  127,  127,  127,   83,   28,  127,  127,
502        94,   25,  127,  127,  127,  127,   20,   22,  127,   26,
503        30,  127,   29,   32,   36,  127,   36,   69,  127,  127,
504        37,  127,   41,  127,   50,   51,   48,   52,   56,   58,
505        62,  127,  127,  127,  127,  127,  127,   59,   46,   70,
506       127,   58,   76,   85,   82,   83,   84,   77,   73,   79,
507        72,  127,  127,  112,  115,  117,  120,  123,   33
508     } ;
509 
510 static yyconst flex_int16_t yy_def[70] =
511     {   0,
512        63,    1,   63,   63,   63,   63,   63,   64,   63,   63,
513        63,   65,   63,   63,   63,   63,   63,   63,   63,   63,
514        63,   63,   63,   63,   63,   63,   66,   63,   63,   63,
515        64,   63,   67,   63,   65,   68,   63,   63,   63,   63,
516        63,   63,   63,   63,   63,   63,   63,   63,   66,   63,
517        63,   64,   64,   67,   65,   65,   68,   63,   69,   63,
518        69,   63,    0,   63,   63,   63,   63,   63,   63
519     } ;
520 
521 static yyconst flex_uint16_t yy_nxt[160] =
522     {   0,
523         4,    5,    6,    7,    8,    9,   10,   11,   12,   13,
524        14,   15,   16,   17,   18,   19,   20,   21,   22,   23,
525        24,   25,   26,   27,   27,    4,    4,    4,    4,   27,
526        28,   29,   32,   32,   37,   61,   38,   39,   40,   40,
527        37,   32,   39,   39,   37,   53,   39,   39,   42,   43,
528        48,   36,   44,   45,   33,   41,   46,   47,   32,   56,
529        48,   50,   32,   33,   40,   40,   37,   54,   39,   39,
530        37,   50,   39,   39,   40,   40,   36,   57,   58,   58,
531        32,   41,   59,   59,   33,   58,   60,   60,   59,   53,
532        32,   32,   56,   58,   58,   60,   60,   50,   50,   51,
533 
534        58,   34,   33,   30,   63,   63,   62,   63,   36,   36,
535        57,   54,   31,   31,   31,   35,   35,   35,   49,   49,
536        52,   52,   52,   55,   55,   55,    3,   63,   63,   63,
537        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
538        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
539        63,   63,   63,   63,   63,   63,   63,   63,   63
540     } ;
541 
542 static yyconst flex_int16_t yy_chk[160] =
543     {   0,
544         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
545         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
546         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
547         1,    1,    8,   12,   17,   69,   17,   17,   18,   18,
548        20,   31,   20,   20,   21,   33,   21,   21,   23,   23,
549        27,   12,   24,   24,    8,   20,   25,   25,   35,   36,
550        49,   27,   52,   31,   37,   37,   38,   33,   38,   38,
551        39,   49,   39,   39,   40,   40,   35,   36,   41,   41,
552        53,   38,   48,   48,   52,   41,   50,   50,   48,   54,
553        55,   56,   57,   58,   58,   60,   60,   61,   59,   28,
554 
555        58,   11,   53,    7,    3,    0,   60,    0,   55,   56,
556        57,   54,   64,   64,   64,   65,   65,   65,   66,   66,
557        67,   67,   67,   68,   68,   68,   63,   63,   63,   63,
558        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
559        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
560        63,   63,   63,   63,   63,   63,   63,   63,   63
561     } ;
562 
563 static yyconst flex_int16_t yy_rule_linenum[32] =
564     {   0,
565        82,   84,   97,  110,  111,  112,  113,  114,  115,  116,
566       117,  118,  119,  120,  121,  122,  123,  124,  125,  126,
567       127,  128,  129,  130,  131,  132,  133,  134,  136,  159,
568       173
569     } ;
570 
571 /* The intent behind this definition is that it'll catch
572  * any uses of REJECT which flex missed.
573  */
574 #define REJECT reject_used_but_not_detected
575 #define yymore() yymore_used_but_not_detected
576 #define YY_MORE_ADJ 0
577 #define YY_RESTORE_YY_MORE_OFFSET
578 #line 1 "../../src/rec-sex-lex.l"
579 /* -*- mode: C -*-
580  *
581  *       File:         rec-sex.l
582  *       Date:         Sat Jan  9 16:35:18 2010
583  *
584  *       GNU recutils - Selection Expressions lexer
585  *
586  */
587 /* Copyright (C) 2010-2019 Jose E. Marchesi */
588 /* This program is free software: you can redistribute it and/or modify
589  * it under the terms of the GNU General Public License as published by
590  * the Free Software Foundation, either version 3 of the License, or
591  * (at your option) any later version.
592  *
593  * This program is distributed in the hope that it will be useful,
594  * but WITHOUT ANY WARRANTY; without even the implied warranty of
595  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
596  * GNU General Public License for more details.
597  *
598  * You should have received a copy of the GNU General Public License
599  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
600  */
601 /* Automake needs this.  */
602 #define YY_NO_INPUT 1
603 
604 #line 44 "../../src/rec-sex-lex.l"
605 #include <rec-utils.h>
606 
607 #include <rec-sex-ast.h>
608 #include <rec-sex-parser.h>
609 #include <rec-sex-tab.h>
610 
611 #define YY_INPUT(buf,result,max_size)                                   \
612    {                                                                    \
613      int ci;                                                            \
614      if ((ci = rec_sex_parser_getc ((rec_sex_parser_t) yyextra)) == -1)     \
615        {                                                                \
616          result = YY_NULL;                                              \
617        }                                                                \
618      else                                                               \
619        {                                                                \
620          buf[0] = (char) ci;                                            \
621          result = 1;                                                    \
622      }                                                                  \
623    }
624 
625    /* Forward prototypes for functions defined below.  */
626    char *rec_sex_lex_extract_name (char *str);
627    char *rec_sex_lex_extract_subname (char *str);
628    bool rec_sex_lex_extract_index (char *str, int *num);
629 
630 /* Please do not touch this comment' */
631 #line 632 "rec-sex-lex.c"
632 
633 #define INITIAL 0
634 
635 #ifndef YY_NO_UNISTD_H
636 /* Special case for "unistd.h", since it is non-ANSI. We include it way
637  * down here because we want the user's section 1 to have been scanned first.
638  * The user has a chance to override it with an option.
639  */
640 /* %if-c-only */
641 #include <unistd.h>
642 /* %endif */
643 /* %if-c++-only */
644 /* %endif */
645 #endif
646 
647 #define YY_EXTRA_TYPE void *
648 
649 /* %if-c-only Reentrant structure and macros (non-C++). */
650 /* %if-reentrant */
651 
652 /* Holds the entire state of the reentrant scanner. */
653 struct yyguts_t
654     {
655 
656     /* User-defined. Not touched by flex. */
657     YY_EXTRA_TYPE yyextra_r;
658 
659     /* The rest are the same as the globals declared in the non-reentrant scanner. */
660     FILE *yyin_r, *yyout_r;
661     size_t yy_buffer_stack_top; /**< index of top of stack. */
662     size_t yy_buffer_stack_max; /**< capacity of stack. */
663     YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
664     char yy_hold_char;
665     int yy_n_chars;
666     int yyleng_r;
667     char *yy_c_buf_p;
668     int yy_init;
669     int yy_start;
670     int yy_did_buffer_switch_on_eof;
671     int yy_start_stack_ptr;
672     int yy_start_stack_depth;
673     int *yy_start_stack;
674     yy_state_type yy_last_accepting_state;
675     char* yy_last_accepting_cpos;
676 
677     int yylineno_r;
678     int yy_flex_debug_r;
679 
680     char *yytext_r;
681     int yy_more_flag;
682     int yy_more_len;
683 
684     YYSTYPE * yylval_r;
685 
686     }; /* end struct yyguts_t */
687 
688 /* %if-c-only */
689 
690 static int yy_init_globals (yyscan_t yyscanner );
691 
692 /* %endif */
693 
694 /* %if-reentrant */
695 
696     /* This must go here because YYSTYPE and YYLTYPE are included
697      * from bison output in section 1.*/
698     #    define yylval yyg->yylval_r
699 
700 int sexlex_init (yyscan_t* scanner);
701 
702 int sexlex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
703 
704 /* %endif */
705 
706 /* %endif End reentrant structures and macros. */
707 
708 /* Accessor methods to globals.
709    These are made visible to non-reentrant scanners for convenience. */
710 
711 int sexlex_destroy (yyscan_t yyscanner );
712 
713 int sexget_debug (yyscan_t yyscanner );
714 
715 void sexset_debug (int debug_flag ,yyscan_t yyscanner );
716 
717 YY_EXTRA_TYPE sexget_extra (yyscan_t yyscanner );
718 
719 void sexset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
720 
721 FILE *sexget_in (yyscan_t yyscanner );
722 
723 void sexset_in  (FILE * _in_str ,yyscan_t yyscanner );
724 
725 FILE *sexget_out (yyscan_t yyscanner );
726 
727 void sexset_out  (FILE * _out_str ,yyscan_t yyscanner );
728 
729 			int sexget_leng (yyscan_t yyscanner );
730 
731 char *sexget_text (yyscan_t yyscanner );
732 
733 int sexget_lineno (yyscan_t yyscanner );
734 
735 void sexset_lineno (int _line_number ,yyscan_t yyscanner );
736 
737 int sexget_column  (yyscan_t yyscanner );
738 
739 void sexset_column (int _column_no ,yyscan_t yyscanner );
740 
741 /* %if-bison-bridge */
742 
743 YYSTYPE * sexget_lval (yyscan_t yyscanner );
744 
745 void sexset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
746 
747 /* %endif */
748 
749 /* Macros after this point can all be overridden by user definitions in
750  * section 1.
751  */
752 
753 #ifndef YY_SKIP_YYWRAP
754 #ifdef __cplusplus
755 extern "C" int sexwrap (yyscan_t yyscanner );
756 #else
757 extern int sexwrap (yyscan_t yyscanner );
758 #endif
759 #endif
760 
761 /* %not-for-header */
762 
763 #ifndef YY_NO_UNPUT
764 
765 #endif
766 /* %ok-for-header */
767 
768 /* %endif */
769 
770 #ifndef yytext_ptr
771 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
772 #endif
773 
774 #ifdef YY_NEED_STRLEN
775 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
776 #endif
777 
778 #ifndef YY_NO_INPUT
779 /* %if-c-only Standard (non-C++) definition */
780 /* %not-for-header */
781 
782 #ifdef __cplusplus
783 static int yyinput (yyscan_t yyscanner );
784 #else
785 static int input (yyscan_t yyscanner );
786 #endif
787 /* %ok-for-header */
788 
789 /* %endif */
790 #endif
791 
792 /* %if-c-only */
793 
794 /* %endif */
795 
796 /* Amount of stuff to slurp up with each read. */
797 #ifndef YY_READ_BUF_SIZE
798 #ifdef __ia64__
799 /* On IA-64, the buffer size is 16k, not 8k */
800 #define YY_READ_BUF_SIZE 16384
801 #else
802 #define YY_READ_BUF_SIZE 8192
803 #endif /* __ia64__ */
804 #endif
805 
806 /* Copy whatever the last rule matched to the standard output. */
807 #ifndef ECHO
808 /* %if-c-only Standard (non-C++) definition */
809 /* This used to be an fputs(), but since the string might contain NUL's,
810  * we now use fwrite().
811  */
812 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
813 /* %endif */
814 /* %if-c++-only C++ definition */
815 /* %endif */
816 #endif
817 
818 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
819  * is returned in "result".
820  */
821 #ifndef YY_INPUT
822 #define YY_INPUT(buf,result,max_size) \
823 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
824 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
825 		{ \
826 		int c = '*'; \
827 		size_t n; \
828 		for ( n = 0; n < max_size && \
829 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
830 			buf[n] = (char) c; \
831 		if ( c == '\n' ) \
832 			buf[n++] = (char) c; \
833 		if ( c == EOF && ferror( yyin ) ) \
834 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
835 		result = n; \
836 		} \
837 	else \
838 		{ \
839 		errno=0; \
840 		while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
841 			{ \
842 			if( errno != EINTR) \
843 				{ \
844 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
845 				break; \
846 				} \
847 			errno=0; \
848 			clearerr(yyin); \
849 			} \
850 		}\
851 \
852 /* %if-c++-only C++ definition \ */\
853 /* %endif */
854 
855 #endif
856 
857 /* No semi-colon after return; correct usage is to write "yyterminate();" -
858  * we don't want an extra ';' after the "return" because that will cause
859  * some compilers to complain about unreachable statements.
860  */
861 #ifndef yyterminate
862 #define yyterminate() return YY_NULL
863 #endif
864 
865 /* Number of entries by which start-condition stack grows. */
866 #ifndef YY_START_STACK_INCR
867 #define YY_START_STACK_INCR 25
868 #endif
869 
870 /* Report a fatal error. */
871 #ifndef YY_FATAL_ERROR
872 /* %if-c-only */
873 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
874 /* %endif */
875 /* %if-c++-only */
876 /* %endif */
877 #endif
878 
879 /* %if-tables-serialization structures and prototypes */
880 /* %not-for-header */
881 
882 /* %ok-for-header */
883 
884 /* %not-for-header */
885 
886 /* %tables-yydmap generated elements */
887 /* %endif */
888 /* end tables serialization structures and prototypes */
889 
890 /* %ok-for-header */
891 
892 /* Default declaration of generated scanner - a define so the user can
893  * easily add parameters.
894  */
895 #ifndef YY_DECL
896 #define YY_DECL_IS_OURS 1
897 /* %if-c-only Standard (non-C++) definition */
898 
899 extern int sexlex \
900                (YYSTYPE * yylval_param ,yyscan_t yyscanner);
901 
902 #define YY_DECL int sexlex \
903                (YYSTYPE * yylval_param , yyscan_t yyscanner)
904 /* %endif */
905 /* %if-c++-only C++ definition */
906 /* %endif */
907 #endif /* !YY_DECL */
908 
909 /* Code executed at the beginning of each rule, after yytext and yyleng
910  * have been set up.
911  */
912 #ifndef YY_USER_ACTION
913 #define YY_USER_ACTION
914 #endif
915 
916 /* Code executed at the end of each rule. */
917 #ifndef YY_BREAK
918 #define YY_BREAK /*LINTED*/break;
919 #endif
920 
921 /* %% [6.0] YY_RULE_SETUP definition goes here */
922 #define YY_RULE_SETUP \
923 	YY_USER_ACTION
924 
925 /* %not-for-header */
926 
927 /** The main scanner function which does all the work.
928  */
929 YY_DECL
930 {
931 	yy_state_type yy_current_state;
932 	char *yy_cp, *yy_bp;
933 	int yy_act;
934     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
935 
936     yylval = yylval_param;
937 
938 	if ( !yyg->yy_init )
939 		{
940 		yyg->yy_init = 1;
941 
942 #ifdef YY_USER_INIT
943 		YY_USER_INIT;
944 #endif
945 
946 		if ( ! yyg->yy_start )
947 			yyg->yy_start = 1;	/* first start state */
948 
949 		if ( ! yyin )
950 /* %if-c-only */
951 			yyin = stdin;
952 /* %endif */
953 /* %if-c++-only */
954 /* %endif */
955 
956 		if ( ! yyout )
957 /* %if-c-only */
958 			yyout = stdout;
959 /* %endif */
960 /* %if-c++-only */
961 /* %endif */
962 
963 		if ( ! YY_CURRENT_BUFFER ) {
964 			sexensure_buffer_stack (yyscanner);
965 			YY_CURRENT_BUFFER_LVALUE =
966 				sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
967 		}
968 
969 		sex_load_buffer_state(yyscanner );
970 		}
971 
972 	{
973 /* %% [7.0] user's declarations go here */
974 #line 80 "../../src/rec-sex-lex.l"
975 
976 
977 #line 978 "rec-sex-lex.c"
978 
979 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
980 		{
981 /* %% [8.0] yymore()-related code goes here */
982 		yy_cp = yyg->yy_c_buf_p;
983 
984 		/* Support of yytext. */
985 		*yy_cp = yyg->yy_hold_char;
986 
987 		/* yy_bp points to the position in yy_ch_buf of the start of
988 		 * the current run.
989 		 */
990 		yy_bp = yy_cp;
991 
992 /* %% [9.0] code to set up and find next match goes here */
993 		yy_current_state = yyg->yy_start;
994 yy_match:
995 		do
996 			{
997 			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
998 			if ( yy_accept[yy_current_state] )
999 				{
1000 				yyg->yy_last_accepting_state = yy_current_state;
1001 				yyg->yy_last_accepting_cpos = yy_cp;
1002 				}
1003 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1004 				{
1005 				yy_current_state = (int) yy_def[yy_current_state];
1006 				if ( yy_current_state >= 64 )
1007 					yy_c = yy_meta[(unsigned int) yy_c];
1008 				}
1009 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1010 			++yy_cp;
1011 			}
1012 		while ( yy_base[yy_current_state] != 127 );
1013 
1014 yy_find_action:
1015 /* %% [10.0] code to find the action number goes here */
1016 		yy_act = yy_accept[yy_current_state];
1017 		if ( yy_act == 0 )
1018 			{ /* have to back up */
1019 			yy_cp = yyg->yy_last_accepting_cpos;
1020 			yy_current_state = yyg->yy_last_accepting_state;
1021 			yy_act = yy_accept[yy_current_state];
1022 			}
1023 
1024 		YY_DO_BEFORE_ACTION;
1025 
1026 /* %% [11.0] code for yylineno update goes here */
1027 
1028 do_action:	/* This label is used only to access EOF actions. */
1029 
1030 /* %% [12.0] debug code goes here */
1031 		if ( yy_flex_debug )
1032 			{
1033 			if ( yy_act == 0 )
1034 				fprintf( stderr, "--scanner backing up\n" );
1035 			else if ( yy_act < 32 )
1036 				fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
1037 				         (long)yy_rule_linenum[yy_act], yytext );
1038 			else if ( yy_act == 32 )
1039 				fprintf( stderr, "--accepting default rule (\"%s\")\n",
1040 				         yytext );
1041 			else if ( yy_act == 33 )
1042 				fprintf( stderr, "--(end of buffer or a NUL)\n" );
1043 			else
1044 				fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1045 			}
1046 
1047 		switch ( yy_act )
1048 	{ /* beginning of action switch */
1049 /* %% [13.0] actions go here */
1050 			case 0: /* must back up */
1051 			/* undo the effects of YY_DO_BEFORE_ACTION */
1052 			*yy_cp = yyg->yy_hold_char;
1053 			yy_cp = yyg->yy_last_accepting_cpos;
1054 			yy_current_state = yyg->yy_last_accepting_state;
1055 			goto yy_find_action;
1056 
1057 case 1:
1058 /* rule 1 can match eol */
1059 YY_RULE_SETUP
1060 #line 82 "../../src/rec-sex-lex.l"
1061 { /* Ignore whitespace */ }
1062 	YY_BREAK
1063 case 2:
1064 YY_RULE_SETUP
1065 #line 84 "../../src/rec-sex-lex.l"
1066 {
1067   /*
1068    * Create a real node.
1069    */
1070   double real_value;
1071 
1072   yylval->node = rec_sex_ast_node_new ();
1073   rec_atod (yytext, &real_value);
1074   rec_sex_ast_node_set_real (yylval->node, real_value);
1075 
1076   return REC_SEX_TOK_REAL;
1077 }
1078 	YY_BREAK
1079 case 3:
1080 YY_RULE_SETUP
1081 #line 97 "../../src/rec-sex-lex.l"
1082 {
1083   /*
1084    * Create an integer node.
1085    */
1086   int integer_value;
1087 
1088   yylval->node = rec_sex_ast_node_new ();
1089   rec_atoi (yytext, &integer_value);
1090   rec_sex_ast_node_set_int (yylval->node, integer_value);
1091 
1092   return REC_SEX_TOK_INT;
1093 }
1094 	YY_BREAK
1095 case 4:
1096 YY_RULE_SETUP
1097 #line 110 "../../src/rec-sex-lex.l"
1098 { return REC_SEX_TOK_ADD; }
1099 	YY_BREAK
1100 case 5:
1101 YY_RULE_SETUP
1102 #line 111 "../../src/rec-sex-lex.l"
1103 { return REC_SEX_TOK_SUB; }
1104 	YY_BREAK
1105 case 6:
1106 YY_RULE_SETUP
1107 #line 112 "../../src/rec-sex-lex.l"
1108 { return REC_SEX_TOK_DIV; }
1109 	YY_BREAK
1110 case 7:
1111 YY_RULE_SETUP
1112 #line 113 "../../src/rec-sex-lex.l"
1113 { return REC_SEX_TOK_MOD; }
1114 	YY_BREAK
1115 case 8:
1116 YY_RULE_SETUP
1117 #line 114 "../../src/rec-sex-lex.l"
1118 { return REC_SEX_TOK_AFTER; }
1119 	YY_BREAK
1120 case 9:
1121 YY_RULE_SETUP
1122 #line 115 "../../src/rec-sex-lex.l"
1123 { return REC_SEX_TOK_BEFORE; }
1124 	YY_BREAK
1125 case 10:
1126 YY_RULE_SETUP
1127 #line 116 "../../src/rec-sex-lex.l"
1128 { return REC_SEX_TOK_LTE; }
1129 	YY_BREAK
1130 case 11:
1131 YY_RULE_SETUP
1132 #line 117 "../../src/rec-sex-lex.l"
1133 { return REC_SEX_TOK_GTE; }
1134 	YY_BREAK
1135 case 12:
1136 YY_RULE_SETUP
1137 #line 118 "../../src/rec-sex-lex.l"
1138 { return REC_SEX_TOK_SAMETIME; }
1139 	YY_BREAK
1140 case 13:
1141 YY_RULE_SETUP
1142 #line 119 "../../src/rec-sex-lex.l"
1143 { return REC_SEX_TOK_IMPLIES; }
1144 	YY_BREAK
1145 case 14:
1146 YY_RULE_SETUP
1147 #line 120 "../../src/rec-sex-lex.l"
1148 { return REC_SEX_TOK_MUL; }
1149 	YY_BREAK
1150 case 15:
1151 YY_RULE_SETUP
1152 #line 121 "../../src/rec-sex-lex.l"
1153 { return REC_SEX_TOK_EQL; }
1154 	YY_BREAK
1155 case 16:
1156 YY_RULE_SETUP
1157 #line 122 "../../src/rec-sex-lex.l"
1158 { return REC_SEX_TOK_NEQ; }
1159 	YY_BREAK
1160 case 17:
1161 YY_RULE_SETUP
1162 #line 123 "../../src/rec-sex-lex.l"
1163 { return REC_SEX_TOK_NOT; }
1164 	YY_BREAK
1165 case 18:
1166 YY_RULE_SETUP
1167 #line 124 "../../src/rec-sex-lex.l"
1168 { return REC_SEX_TOK_MAT; }
1169 	YY_BREAK
1170 case 19:
1171 YY_RULE_SETUP
1172 #line 125 "../../src/rec-sex-lex.l"
1173 { return REC_SEX_TOK_GT; }
1174 	YY_BREAK
1175 case 20:
1176 YY_RULE_SETUP
1177 #line 126 "../../src/rec-sex-lex.l"
1178 { return REC_SEX_TOK_LT; }
1179 	YY_BREAK
1180 case 21:
1181 YY_RULE_SETUP
1182 #line 127 "../../src/rec-sex-lex.l"
1183 { return REC_SEX_TOK_BP; }
1184 	YY_BREAK
1185 case 22:
1186 YY_RULE_SETUP
1187 #line 128 "../../src/rec-sex-lex.l"
1188 { return REC_SEX_TOK_EP; }
1189 	YY_BREAK
1190 case 23:
1191 YY_RULE_SETUP
1192 #line 129 "../../src/rec-sex-lex.l"
1193 { return REC_SEX_TOK_AND; }
1194 	YY_BREAK
1195 case 24:
1196 YY_RULE_SETUP
1197 #line 130 "../../src/rec-sex-lex.l"
1198 { return REC_SEX_TOK_OR; }
1199 	YY_BREAK
1200 case 25:
1201 YY_RULE_SETUP
1202 #line 131 "../../src/rec-sex-lex.l"
1203 { return REC_SEX_TOK_SHARP; }
1204 	YY_BREAK
1205 case 26:
1206 YY_RULE_SETUP
1207 #line 132 "../../src/rec-sex-lex.l"
1208 { return REC_SEX_TOK_QM; }
1209 	YY_BREAK
1210 case 27:
1211 YY_RULE_SETUP
1212 #line 133 "../../src/rec-sex-lex.l"
1213 { return REC_SEX_TOK_COLON; }
1214 	YY_BREAK
1215 case 28:
1216 YY_RULE_SETUP
1217 #line 134 "../../src/rec-sex-lex.l"
1218 { return REC_SEX_TOK_AMP; }
1219 	YY_BREAK
1220 case 29:
1221 YY_RULE_SETUP
1222 #line 136 "../../src/rec-sex-lex.l"
1223 {
1224   int res;
1225   char *match;
1226   char *name, *subname;
1227   int index = -1;
1228 
1229   match = strdup (yytext);
1230   rec_sex_lex_extract_index (match, &index);
1231   name = rec_sex_lex_extract_name (match);
1232   subname = rec_sex_lex_extract_subname (match);
1233 
1234   /* Create a name node.  */
1235   yylval->node = rec_sex_ast_node_new ();
1236   rec_sex_ast_node_set_name (yylval->node, name, subname);
1237   rec_sex_ast_node_set_index (yylval->node, index);
1238   res = REC_SEX_TOK_NAM;
1239 
1240   free (name);
1241   free (match);
1242 
1243   return res;
1244 }
1245 	YY_BREAK
1246 case 30:
1247 /* rule 30 can match eol */
1248 YY_RULE_SETUP
1249 #line 159 "../../src/rec-sex-lex.l"
1250 {
1251   /*
1252    * Create a string node.
1253    */
1254 
1255   /* Strip the quoting characters */
1256   yytext[strlen(yytext) - 1] = 0;
1257 
1258   yylval->node = rec_sex_ast_node_new ();
1259   rec_sex_ast_node_set_str (yylval->node, yytext + 1);
1260 
1261   return REC_SEX_TOK_STR;
1262 }
1263 	YY_BREAK
1264 case 31:
1265 YY_RULE_SETUP
1266 #line 173 "../../src/rec-sex-lex.l"
1267 { return REC_SEX_TOK_ERR; }
1268 	YY_BREAK
1269 case 32:
1270 YY_RULE_SETUP
1271 #line 175 "../../src/rec-sex-lex.l"
1272 ECHO;
1273 	YY_BREAK
1274 #line 1275 "rec-sex-lex.c"
1275 case YY_STATE_EOF(INITIAL):
1276 	yyterminate();
1277 
1278 	case YY_END_OF_BUFFER:
1279 		{
1280 		/* Amount of text matched not including the EOB char. */
1281 		int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1282 
1283 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1284 		*yy_cp = yyg->yy_hold_char;
1285 		YY_RESTORE_YY_MORE_OFFSET
1286 
1287 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1288 			{
1289 			/* We're scanning a new file or input source.  It's
1290 			 * possible that this happened because the user
1291 			 * just pointed yyin at a new source and called
1292 			 * sexlex().  If so, then we have to assure
1293 			 * consistency between YY_CURRENT_BUFFER and our
1294 			 * globals.  Here is the right place to do so, because
1295 			 * this is the first action (other than possibly a
1296 			 * back-up) that will match for the new input source.
1297 			 */
1298 			yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1299 /* %if-c-only */
1300 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1301 /* %endif */
1302 /* %if-c++-only */
1303 /* %endif */
1304 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1305 			}
1306 
1307 		/* Note that here we test for yy_c_buf_p "<=" to the position
1308 		 * of the first EOB in the buffer, since yy_c_buf_p will
1309 		 * already have been incremented past the NUL character
1310 		 * (since all states make transitions on EOB to the
1311 		 * end-of-buffer state).  Contrast this with the test
1312 		 * in input().
1313 		 */
1314 		if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1315 			{ /* This was really a NUL. */
1316 			yy_state_type yy_next_state;
1317 
1318 			yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1319 
1320 			yy_current_state = yy_get_previous_state( yyscanner );
1321 
1322 			/* Okay, we're now positioned to make the NUL
1323 			 * transition.  We couldn't have
1324 			 * yy_get_previous_state() go ahead and do it
1325 			 * for us because it doesn't know how to deal
1326 			 * with the possibility of jamming (and we don't
1327 			 * want to build jamming into it because then it
1328 			 * will run more slowly).
1329 			 */
1330 
1331 			yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1332 
1333 			yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1334 
1335 			if ( yy_next_state )
1336 				{
1337 				/* Consume the NUL. */
1338 				yy_cp = ++yyg->yy_c_buf_p;
1339 				yy_current_state = yy_next_state;
1340 				goto yy_match;
1341 				}
1342 
1343 			else
1344 				{
1345 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
1346 				yy_cp = yyg->yy_c_buf_p;
1347 				goto yy_find_action;
1348 				}
1349 			}
1350 
1351 		else switch ( yy_get_next_buffer( yyscanner ) )
1352 			{
1353 			case EOB_ACT_END_OF_FILE:
1354 				{
1355 				yyg->yy_did_buffer_switch_on_eof = 0;
1356 
1357 				if ( sexwrap(yyscanner ) )
1358 					{
1359 					/* Note: because we've taken care in
1360 					 * yy_get_next_buffer() to have set up
1361 					 * yytext, we can now set up
1362 					 * yy_c_buf_p so that if some total
1363 					 * hoser (like flex itself) wants to
1364 					 * call the scanner after we return the
1365 					 * YY_NULL, it'll still work - another
1366 					 * YY_NULL will get returned.
1367 					 */
1368 					yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1369 
1370 					yy_act = YY_STATE_EOF(YY_START);
1371 					goto do_action;
1372 					}
1373 
1374 				else
1375 					{
1376 					if ( ! yyg->yy_did_buffer_switch_on_eof )
1377 						YY_NEW_FILE;
1378 					}
1379 				break;
1380 				}
1381 
1382 			case EOB_ACT_CONTINUE_SCAN:
1383 				yyg->yy_c_buf_p =
1384 					yyg->yytext_ptr + yy_amount_of_matched_text;
1385 
1386 				yy_current_state = yy_get_previous_state( yyscanner );
1387 
1388 				yy_cp = yyg->yy_c_buf_p;
1389 				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1390 				goto yy_match;
1391 
1392 			case EOB_ACT_LAST_MATCH:
1393 				yyg->yy_c_buf_p =
1394 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1395 
1396 				yy_current_state = yy_get_previous_state( yyscanner );
1397 
1398 				yy_cp = yyg->yy_c_buf_p;
1399 				yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1400 				goto yy_find_action;
1401 			}
1402 		break;
1403 		}
1404 
1405 	default:
1406 		YY_FATAL_ERROR(
1407 			"fatal flex scanner internal error--no action found" );
1408 	} /* end of action switch */
1409 		} /* end of scanning one token */
1410 	} /* end of user's declarations */
1411 } /* end of sexlex */
1412 /* %ok-for-header */
1413 
1414 /* %if-c++-only */
1415 /* %not-for-header */
1416 
1417 /* %ok-for-header */
1418 
1419 /* %endif */
1420 
1421 /* yy_get_next_buffer - try to read in a new buffer
1422  *
1423  * Returns a code representing an action:
1424  *	EOB_ACT_LAST_MATCH -
1425  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1426  *	EOB_ACT_END_OF_FILE - end of file
1427  */
1428 /* %if-c-only */
yy_get_next_buffer(yyscan_t yyscanner)1429 static int yy_get_next_buffer (yyscan_t yyscanner)
1430 /* %endif */
1431 /* %if-c++-only */
1432 /* %endif */
1433 {
1434     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1435 	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1436 	char *source = yyg->yytext_ptr;
1437 	int number_to_move, i;
1438 	int ret_val;
1439 
1440 	if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1441 		YY_FATAL_ERROR(
1442 		"fatal flex scanner internal error--end of buffer missed" );
1443 
1444 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1445 		{ /* Don't try to fill the buffer, so this is an EOF. */
1446 		if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1447 			{
1448 			/* We matched a single character, the EOB, so
1449 			 * treat this as a final EOF.
1450 			 */
1451 			return EOB_ACT_END_OF_FILE;
1452 			}
1453 
1454 		else
1455 			{
1456 			/* We matched some text prior to the EOB, first
1457 			 * process it.
1458 			 */
1459 			return EOB_ACT_LAST_MATCH;
1460 			}
1461 		}
1462 
1463 	/* Try to read more data. */
1464 
1465 	/* First move last chars to start of buffer. */
1466 	number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1467 
1468 	for ( i = 0; i < number_to_move; ++i )
1469 		*(dest++) = *(source++);
1470 
1471 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1472 		/* don't do the read, it's not guaranteed to return an EOF,
1473 		 * just force an EOF
1474 		 */
1475 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1476 
1477 	else
1478 		{
1479 			int num_to_read =
1480 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1481 
1482 		while ( num_to_read <= 0 )
1483 			{ /* Not enough room in the buffer - grow it. */
1484 
1485 			/* just a shorter name for the current buffer */
1486 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1487 
1488 			int yy_c_buf_p_offset =
1489 				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1490 
1491 			if ( b->yy_is_our_buffer )
1492 				{
1493 				int new_size = b->yy_buf_size * 2;
1494 
1495 				if ( new_size <= 0 )
1496 					b->yy_buf_size += b->yy_buf_size / 8;
1497 				else
1498 					b->yy_buf_size *= 2;
1499 
1500 				b->yy_ch_buf = (char *)
1501 					/* Include room in for 2 EOB chars. */
1502 					sexrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1503 				}
1504 			else
1505 				/* Can't grow it, we don't own it. */
1506 				b->yy_ch_buf = NULL;
1507 
1508 			if ( ! b->yy_ch_buf )
1509 				YY_FATAL_ERROR(
1510 				"fatal error - scanner input buffer overflow" );
1511 
1512 			yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1513 
1514 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1515 						number_to_move - 1;
1516 
1517 			}
1518 
1519 		if ( num_to_read > YY_READ_BUF_SIZE )
1520 			num_to_read = YY_READ_BUF_SIZE;
1521 
1522 		/* Read in more data. */
1523 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1524 			yyg->yy_n_chars, num_to_read );
1525 
1526 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1527 		}
1528 
1529 	if ( yyg->yy_n_chars == 0 )
1530 		{
1531 		if ( number_to_move == YY_MORE_ADJ )
1532 			{
1533 			ret_val = EOB_ACT_END_OF_FILE;
1534 			sexrestart(yyin  ,yyscanner);
1535 			}
1536 
1537 		else
1538 			{
1539 			ret_val = EOB_ACT_LAST_MATCH;
1540 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1541 				YY_BUFFER_EOF_PENDING;
1542 			}
1543 		}
1544 
1545 	else
1546 		ret_val = EOB_ACT_CONTINUE_SCAN;
1547 
1548 	if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1549 		/* Extend the array by 50%, plus the number we really need. */
1550 		int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1551 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) sexrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1552 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1553 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1554 	}
1555 
1556 	yyg->yy_n_chars += number_to_move;
1557 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1558 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1559 
1560 	yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1561 
1562 	return ret_val;
1563 }
1564 
1565 /* yy_get_previous_state - get the state just before the EOB char was reached */
1566 
1567 /* %if-c-only */
1568 /* %not-for-header */
1569 
yy_get_previous_state(yyscan_t yyscanner)1570     static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1571 /* %endif */
1572 /* %if-c++-only */
1573 /* %endif */
1574 {
1575 	yy_state_type yy_current_state;
1576 	char *yy_cp;
1577     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1578 
1579 /* %% [15.0] code to get the start state into yy_current_state goes here */
1580 	yy_current_state = yyg->yy_start;
1581 
1582 	for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1583 		{
1584 /* %% [16.0] code to find the next state goes here */
1585 		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1586 		if ( yy_accept[yy_current_state] )
1587 			{
1588 			yyg->yy_last_accepting_state = yy_current_state;
1589 			yyg->yy_last_accepting_cpos = yy_cp;
1590 			}
1591 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1592 			{
1593 			yy_current_state = (int) yy_def[yy_current_state];
1594 			if ( yy_current_state >= 64 )
1595 				yy_c = yy_meta[(unsigned int) yy_c];
1596 			}
1597 		yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1598 		}
1599 
1600 	return yy_current_state;
1601 }
1602 
1603 /* yy_try_NUL_trans - try to make a transition on the NUL character
1604  *
1605  * synopsis
1606  *	next_state = yy_try_NUL_trans( current_state );
1607  */
1608 /* %if-c-only */
yy_try_NUL_trans(yy_state_type yy_current_state,yyscan_t yyscanner)1609     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
1610 /* %endif */
1611 /* %if-c++-only */
1612 /* %endif */
1613 {
1614 	int yy_is_jam;
1615     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1616 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
1617 	char *yy_cp = yyg->yy_c_buf_p;
1618 
1619 	YY_CHAR yy_c = 1;
1620 	if ( yy_accept[yy_current_state] )
1621 		{
1622 		yyg->yy_last_accepting_state = yy_current_state;
1623 		yyg->yy_last_accepting_cpos = yy_cp;
1624 		}
1625 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1626 		{
1627 		yy_current_state = (int) yy_def[yy_current_state];
1628 		if ( yy_current_state >= 64 )
1629 			yy_c = yy_meta[(unsigned int) yy_c];
1630 		}
1631 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1632 	yy_is_jam = (yy_current_state == 63);
1633 
1634 	(void)yyg;
1635 	return yy_is_jam ? 0 : yy_current_state;
1636 }
1637 
1638 #ifndef YY_NO_UNPUT
1639 /* %if-c-only */
1640 
1641 /* %endif */
1642 #endif
1643 
1644 /* %if-c-only */
1645 #ifndef YY_NO_INPUT
1646 #ifdef __cplusplus
yyinput(yyscan_t yyscanner)1647     static int yyinput (yyscan_t yyscanner)
1648 #else
1649     static int input  (yyscan_t yyscanner)
1650 #endif
1651 
1652 /* %endif */
1653 /* %if-c++-only */
1654 /* %endif */
1655 {
1656 	int c;
1657     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1658 
1659 	*yyg->yy_c_buf_p = yyg->yy_hold_char;
1660 
1661 	if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1662 		{
1663 		/* yy_c_buf_p now points to the character we want to return.
1664 		 * If this occurs *before* the EOB characters, then it's a
1665 		 * valid NUL; if not, then we've hit the end of the buffer.
1666 		 */
1667 		if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1668 			/* This was really a NUL. */
1669 			*yyg->yy_c_buf_p = '\0';
1670 
1671 		else
1672 			{ /* need more input */
1673 			int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1674 			++yyg->yy_c_buf_p;
1675 
1676 			switch ( yy_get_next_buffer( yyscanner ) )
1677 				{
1678 				case EOB_ACT_LAST_MATCH:
1679 					/* This happens because yy_g_n_b()
1680 					 * sees that we've accumulated a
1681 					 * token and flags that we need to
1682 					 * try matching the token before
1683 					 * proceeding.  But for input(),
1684 					 * there's no matching to consider.
1685 					 * So convert the EOB_ACT_LAST_MATCH
1686 					 * to EOB_ACT_END_OF_FILE.
1687 					 */
1688 
1689 					/* Reset buffer status. */
1690 					sexrestart(yyin ,yyscanner);
1691 
1692 					/*FALLTHROUGH*/
1693 
1694 				case EOB_ACT_END_OF_FILE:
1695 					{
1696 					if ( sexwrap(yyscanner ) )
1697 						return 0;
1698 
1699 					if ( ! yyg->yy_did_buffer_switch_on_eof )
1700 						YY_NEW_FILE;
1701 #ifdef __cplusplus
1702 					return yyinput(yyscanner);
1703 #else
1704 					return input(yyscanner);
1705 #endif
1706 					}
1707 
1708 				case EOB_ACT_CONTINUE_SCAN:
1709 					yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1710 					break;
1711 				}
1712 			}
1713 		}
1714 
1715 	c = *(unsigned char *) yyg->yy_c_buf_p;	/* cast for 8-bit char's */
1716 	*yyg->yy_c_buf_p = '\0';	/* preserve yytext */
1717 	yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1718 
1719 /* %% [19.0] update BOL and yylineno */
1720 
1721 	return c;
1722 }
1723 /* %if-c-only */
1724 #endif	/* ifndef YY_NO_INPUT */
1725 /* %endif */
1726 
1727 /** Immediately switch to a different input stream.
1728  * @param input_file A readable stream.
1729  * @param yyscanner The scanner object.
1730  * @note This function does not reset the start condition to @c INITIAL .
1731  */
1732 /* %if-c-only */
sexrestart(FILE * input_file,yyscan_t yyscanner)1733     void sexrestart  (FILE * input_file , yyscan_t yyscanner)
1734 /* %endif */
1735 /* %if-c++-only */
1736 /* %endif */
1737 {
1738     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1739 
1740 	if ( ! YY_CURRENT_BUFFER ){
1741         sexensure_buffer_stack (yyscanner);
1742 		YY_CURRENT_BUFFER_LVALUE =
1743             sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1744 	}
1745 
1746 	sex_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1747 	sex_load_buffer_state(yyscanner );
1748 }
1749 
1750 /* %if-c++-only */
1751 /* %endif */
1752 
1753 /** Switch to a different input buffer.
1754  * @param new_buffer The new input buffer.
1755  * @param yyscanner The scanner object.
1756  */
1757 /* %if-c-only */
sex_switch_to_buffer(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)1758     void sex_switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
1759 /* %endif */
1760 /* %if-c++-only */
1761 /* %endif */
1762 {
1763     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1764 
1765 	/* TODO. We should be able to replace this entire function body
1766 	 * with
1767 	 *		sexpop_buffer_state();
1768 	 *		sexpush_buffer_state(new_buffer);
1769      */
1770 	sexensure_buffer_stack (yyscanner);
1771 	if ( YY_CURRENT_BUFFER == new_buffer )
1772 		return;
1773 
1774 	if ( YY_CURRENT_BUFFER )
1775 		{
1776 		/* Flush out information for old buffer. */
1777 		*yyg->yy_c_buf_p = yyg->yy_hold_char;
1778 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1779 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1780 		}
1781 
1782 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1783 	sex_load_buffer_state(yyscanner );
1784 
1785 	/* We don't actually know whether we did this switch during
1786 	 * EOF (sexwrap()) processing, but the only time this flag
1787 	 * is looked at is after sexwrap() is called, so it's safe
1788 	 * to go ahead and always set it.
1789 	 */
1790 	yyg->yy_did_buffer_switch_on_eof = 1;
1791 }
1792 
1793 /* %if-c-only */
sex_load_buffer_state(yyscan_t yyscanner)1794 static void sex_load_buffer_state  (yyscan_t yyscanner)
1795 /* %endif */
1796 /* %if-c++-only */
1797 /* %endif */
1798 {
1799     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1800 	yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1801 	yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1802 /* %if-c-only */
1803 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1804 /* %endif */
1805 /* %if-c++-only */
1806 /* %endif */
1807 	yyg->yy_hold_char = *yyg->yy_c_buf_p;
1808 }
1809 
1810 /** Allocate and initialize an input buffer state.
1811  * @param file A readable stream.
1812  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1813  * @param yyscanner The scanner object.
1814  * @return the allocated buffer state.
1815  */
1816 /* %if-c-only */
sex_create_buffer(FILE * file,int size,yyscan_t yyscanner)1817     YY_BUFFER_STATE sex_create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
1818 /* %endif */
1819 /* %if-c++-only */
1820 /* %endif */
1821 {
1822 	YY_BUFFER_STATE b;
1823 
1824 	b = (YY_BUFFER_STATE) sexalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1825 	if ( ! b )
1826 		YY_FATAL_ERROR( "out of dynamic memory in sex_create_buffer()" );
1827 
1828 	b->yy_buf_size = (yy_size_t)size;
1829 
1830 	/* yy_ch_buf has to be 2 characters longer than the size given because
1831 	 * we need to put in 2 end-of-buffer characters.
1832 	 */
1833 	b->yy_ch_buf = (char *) sexalloc(b->yy_buf_size + 2 ,yyscanner );
1834 	if ( ! b->yy_ch_buf )
1835 		YY_FATAL_ERROR( "out of dynamic memory in sex_create_buffer()" );
1836 
1837 	b->yy_is_our_buffer = 1;
1838 
1839 	sex_init_buffer(b,file ,yyscanner);
1840 
1841 	return b;
1842 }
1843 
1844 /* %if-c++-only */
1845 /* %endif */
1846 
1847 /** Destroy the buffer.
1848  * @param b a buffer created with sex_create_buffer()
1849  * @param yyscanner The scanner object.
1850  */
1851 /* %if-c-only */
sex_delete_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)1852     void sex_delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1853 /* %endif */
1854 /* %if-c++-only */
1855 /* %endif */
1856 {
1857     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1858 
1859 	if ( ! b )
1860 		return;
1861 
1862 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1863 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1864 
1865 	if ( b->yy_is_our_buffer )
1866 		sexfree((void *) b->yy_ch_buf ,yyscanner );
1867 
1868 	sexfree((void *) b ,yyscanner );
1869 }
1870 
1871 /* Initializes or reinitializes a buffer.
1872  * This function is sometimes called more than once on the same buffer,
1873  * such as during a sexrestart() or at EOF.
1874  */
1875 /* %if-c-only */
sex_init_buffer(YY_BUFFER_STATE b,FILE * file,yyscan_t yyscanner)1876     static void sex_init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
1877 /* %endif */
1878 /* %if-c++-only */
1879 /* %endif */
1880 
1881 {
1882 	int oerrno = errno;
1883     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1884 
1885 	sex_flush_buffer(b ,yyscanner);
1886 
1887 /* %if-c-only */
1888 	b->yy_input_file = file;
1889 /* %endif */
1890 /* %if-c++-only */
1891 /* %endif */
1892 	b->yy_fill_buffer = 1;
1893 
1894     /* If b is the current buffer, then sex_init_buffer was _probably_
1895      * called from sexrestart() or through yy_get_next_buffer.
1896      * In that case, we don't want to reset the lineno or column.
1897      */
1898     if (b != YY_CURRENT_BUFFER){
1899         b->yy_bs_lineno = 1;
1900         b->yy_bs_column = 0;
1901     }
1902 
1903 /* %if-c-only */
1904 
1905         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1906 
1907 /* %endif */
1908 /* %if-c++-only */
1909 /* %endif */
1910 	errno = oerrno;
1911 }
1912 
1913 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1914  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1915  * @param yyscanner The scanner object.
1916  */
1917 /* %if-c-only */
sex_flush_buffer(YY_BUFFER_STATE b,yyscan_t yyscanner)1918     void sex_flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
1919 /* %endif */
1920 /* %if-c++-only */
1921 /* %endif */
1922 {
1923     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1924 	if ( ! b )
1925 		return;
1926 
1927 	b->yy_n_chars = 0;
1928 
1929 	/* We always need two end-of-buffer characters.  The first causes
1930 	 * a transition to the end-of-buffer state.  The second causes
1931 	 * a jam in that state.
1932 	 */
1933 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1934 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1935 
1936 	b->yy_buf_pos = &b->yy_ch_buf[0];
1937 
1938 	b->yy_at_bol = 1;
1939 	b->yy_buffer_status = YY_BUFFER_NEW;
1940 
1941 	if ( b == YY_CURRENT_BUFFER )
1942 		sex_load_buffer_state(yyscanner );
1943 }
1944 
1945 /* %if-c-or-c++ */
1946 /** Pushes the new state onto the stack. The new state becomes
1947  *  the current state. This function will allocate the stack
1948  *  if necessary.
1949  *  @param new_buffer The new state.
1950  *  @param yyscanner The scanner object.
1951  */
1952 /* %if-c-only */
sexpush_buffer_state(YY_BUFFER_STATE new_buffer,yyscan_t yyscanner)1953 void sexpush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1954 /* %endif */
1955 /* %if-c++-only */
1956 /* %endif */
1957 {
1958     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1959 	if (new_buffer == NULL)
1960 		return;
1961 
1962 	sexensure_buffer_stack(yyscanner);
1963 
1964 	/* This block is copied from sex_switch_to_buffer. */
1965 	if ( YY_CURRENT_BUFFER )
1966 		{
1967 		/* Flush out information for old buffer. */
1968 		*yyg->yy_c_buf_p = yyg->yy_hold_char;
1969 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1970 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1971 		}
1972 
1973 	/* Only push if top exists. Otherwise, replace top. */
1974 	if (YY_CURRENT_BUFFER)
1975 		yyg->yy_buffer_stack_top++;
1976 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1977 
1978 	/* copied from sex_switch_to_buffer. */
1979 	sex_load_buffer_state(yyscanner );
1980 	yyg->yy_did_buffer_switch_on_eof = 1;
1981 }
1982 /* %endif */
1983 
1984 /* %if-c-or-c++ */
1985 /** Removes and deletes the top of the stack, if present.
1986  *  The next element becomes the new top.
1987  *  @param yyscanner The scanner object.
1988  */
1989 /* %if-c-only */
sexpop_buffer_state(yyscan_t yyscanner)1990 void sexpop_buffer_state (yyscan_t yyscanner)
1991 /* %endif */
1992 /* %if-c++-only */
1993 /* %endif */
1994 {
1995     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1996 	if (!YY_CURRENT_BUFFER)
1997 		return;
1998 
1999 	sex_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2000 	YY_CURRENT_BUFFER_LVALUE = NULL;
2001 	if (yyg->yy_buffer_stack_top > 0)
2002 		--yyg->yy_buffer_stack_top;
2003 
2004 	if (YY_CURRENT_BUFFER) {
2005 		sex_load_buffer_state(yyscanner );
2006 		yyg->yy_did_buffer_switch_on_eof = 1;
2007 	}
2008 }
2009 /* %endif */
2010 
2011 /* %if-c-or-c++ */
2012 /* Allocates the stack if it does not exist.
2013  *  Guarantees space for at least one push.
2014  */
2015 /* %if-c-only */
sexensure_buffer_stack(yyscan_t yyscanner)2016 static void sexensure_buffer_stack (yyscan_t yyscanner)
2017 /* %endif */
2018 /* %if-c++-only */
2019 /* %endif */
2020 {
2021 	int num_to_alloc;
2022     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2023 
2024 	if (!yyg->yy_buffer_stack) {
2025 
2026 		/* First allocation is just for 2 elements, since we don't know if this
2027 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2028 		 * immediate realloc on the next call.
2029          */
2030       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2031 		yyg->yy_buffer_stack = (struct yy_buffer_state**)sexalloc
2032 								(num_to_alloc * sizeof(struct yy_buffer_state*)
2033 								, yyscanner);
2034 		if ( ! yyg->yy_buffer_stack )
2035 			YY_FATAL_ERROR( "out of dynamic memory in sexensure_buffer_stack()" );
2036 
2037 		memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2038 
2039 		yyg->yy_buffer_stack_max = num_to_alloc;
2040 		yyg->yy_buffer_stack_top = 0;
2041 		return;
2042 	}
2043 
2044 	if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2045 
2046 		/* Increase the buffer to prepare for a possible push. */
2047 		yy_size_t grow_size = 8 /* arbitrary grow size */;
2048 
2049 		num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2050 		yyg->yy_buffer_stack = (struct yy_buffer_state**)sexrealloc
2051 								(yyg->yy_buffer_stack,
2052 								num_to_alloc * sizeof(struct yy_buffer_state*)
2053 								, yyscanner);
2054 		if ( ! yyg->yy_buffer_stack )
2055 			YY_FATAL_ERROR( "out of dynamic memory in sexensure_buffer_stack()" );
2056 
2057 		/* zero only the new slots.*/
2058 		memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2059 		yyg->yy_buffer_stack_max = num_to_alloc;
2060 	}
2061 }
2062 /* %endif */
2063 
2064 /* %if-c-only */
2065 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2066  * @param base the character buffer
2067  * @param size the size in bytes of the character buffer
2068  * @param yyscanner The scanner object.
2069  * @return the newly allocated buffer state object.
2070  */
sex_scan_buffer(char * base,yy_size_t size,yyscan_t yyscanner)2071 YY_BUFFER_STATE sex_scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
2072 {
2073 	YY_BUFFER_STATE b;
2074 
2075 	if ( size < 2 ||
2076 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2077 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2078 		/* They forgot to leave room for the EOB's. */
2079 		return NULL;
2080 
2081 	b = (YY_BUFFER_STATE) sexalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2082 	if ( ! b )
2083 		YY_FATAL_ERROR( "out of dynamic memory in sex_scan_buffer()" );
2084 
2085 	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
2086 	b->yy_buf_pos = b->yy_ch_buf = base;
2087 	b->yy_is_our_buffer = 0;
2088 	b->yy_input_file = NULL;
2089 	b->yy_n_chars = b->yy_buf_size;
2090 	b->yy_is_interactive = 0;
2091 	b->yy_at_bol = 1;
2092 	b->yy_fill_buffer = 0;
2093 	b->yy_buffer_status = YY_BUFFER_NEW;
2094 
2095 	sex_switch_to_buffer(b ,yyscanner );
2096 
2097 	return b;
2098 }
2099 /* %endif */
2100 
2101 /* %if-c-only */
2102 /** Setup the input buffer state to scan a string. The next call to sexlex() will
2103  * scan from a @e copy of @a str.
2104  * @param yystr a NUL-terminated string to scan
2105  * @param yyscanner The scanner object.
2106  * @return the newly allocated buffer state object.
2107  * @note If you want to scan bytes that may contain NUL values, then use
2108  *       sex_scan_bytes() instead.
2109  */
sex_scan_string(yyconst char * yystr,yyscan_t yyscanner)2110 YY_BUFFER_STATE sex_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2111 {
2112 
2113 	return sex_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
2114 }
2115 /* %endif */
2116 
2117 /* %if-c-only */
2118 /** Setup the input buffer state to scan the given bytes. The next call to sexlex() will
2119  * scan from a @e copy of @a bytes.
2120  * @param yybytes the byte buffer to scan
2121  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2122  * @param yyscanner The scanner object.
2123  * @return the newly allocated buffer state object.
2124  */
sex_scan_bytes(yyconst char * yybytes,int _yybytes_len,yyscan_t yyscanner)2125 YY_BUFFER_STATE sex_scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
2126 {
2127 	YY_BUFFER_STATE b;
2128 	char *buf;
2129 	yy_size_t n;
2130 	int i;
2131 
2132 	/* Get memory for full buffer, including space for trailing EOB's. */
2133 	n = (yy_size_t) (_yybytes_len + 2);
2134 	buf = (char *) sexalloc(n ,yyscanner );
2135 	if ( ! buf )
2136 		YY_FATAL_ERROR( "out of dynamic memory in sex_scan_bytes()" );
2137 
2138 	for ( i = 0; i < _yybytes_len; ++i )
2139 		buf[i] = yybytes[i];
2140 
2141 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2142 
2143 	b = sex_scan_buffer(buf,n ,yyscanner);
2144 	if ( ! b )
2145 		YY_FATAL_ERROR( "bad buffer in sex_scan_bytes()" );
2146 
2147 	/* It's okay to grow etc. this buffer, and we should throw it
2148 	 * away when we're done.
2149 	 */
2150 	b->yy_is_our_buffer = 1;
2151 
2152 	return b;
2153 }
2154 /* %endif */
2155 
2156 #ifndef YY_EXIT_FAILURE
2157 #define YY_EXIT_FAILURE 2
2158 #endif
2159 
2160 /* %if-c-only */
yy_fatal_error(yyconst char * msg,yyscan_t yyscanner)2161 static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2162 {
2163 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2164 	(void)yyg;
2165 	(void) fprintf( stderr, "%s\n", msg );
2166 	exit( YY_EXIT_FAILURE );
2167 }
2168 /* %endif */
2169 /* %if-c++-only */
2170 /* %endif */
2171 
2172 /* Redefine yyless() so it works in section 3 code. */
2173 
2174 #undef yyless
2175 #define yyless(n) \
2176 	do \
2177 		{ \
2178 		/* Undo effects of setting up yytext. */ \
2179         int yyless_macro_arg = (n); \
2180         YY_LESS_LINENO(yyless_macro_arg);\
2181 		yytext[yyleng] = yyg->yy_hold_char; \
2182 		yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2183 		yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2184 		*yyg->yy_c_buf_p = '\0'; \
2185 		yyleng = yyless_macro_arg; \
2186 		} \
2187 	while ( 0 )
2188 
2189 /* Accessor  methods (get/set functions) to struct members. */
2190 
2191 /* %if-c-only */
2192 /* %if-reentrant */
2193 
2194 /** Get the user-defined data for this scanner.
2195  * @param yyscanner The scanner object.
2196  */
sexget_extra(yyscan_t yyscanner)2197 YY_EXTRA_TYPE sexget_extra  (yyscan_t yyscanner)
2198 {
2199     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2200     return yyextra;
2201 }
2202 
2203 /* %endif */
2204 
2205 /** Get the current line number.
2206  * @param yyscanner The scanner object.
2207  */
sexget_lineno(yyscan_t yyscanner)2208 int sexget_lineno  (yyscan_t yyscanner)
2209 {
2210     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2211 
2212         if (! YY_CURRENT_BUFFER)
2213             return 0;
2214 
2215     return yylineno;
2216 }
2217 
2218 /** Get the current column number.
2219  * @param yyscanner The scanner object.
2220  */
sexget_column(yyscan_t yyscanner)2221 int sexget_column  (yyscan_t yyscanner)
2222 {
2223     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2224 
2225         if (! YY_CURRENT_BUFFER)
2226             return 0;
2227 
2228     return yycolumn;
2229 }
2230 
2231 /** Get the input stream.
2232  * @param yyscanner The scanner object.
2233  */
sexget_in(yyscan_t yyscanner)2234 FILE *sexget_in  (yyscan_t yyscanner)
2235 {
2236     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2237     return yyin;
2238 }
2239 
2240 /** Get the output stream.
2241  * @param yyscanner The scanner object.
2242  */
sexget_out(yyscan_t yyscanner)2243 FILE *sexget_out  (yyscan_t yyscanner)
2244 {
2245     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2246     return yyout;
2247 }
2248 
2249 /** Get the length of the current token.
2250  * @param yyscanner The scanner object.
2251  */
sexget_leng(yyscan_t yyscanner)2252 int sexget_leng  (yyscan_t yyscanner)
2253 {
2254     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2255     return yyleng;
2256 }
2257 
2258 /** Get the current token.
2259  * @param yyscanner The scanner object.
2260  */
2261 
sexget_text(yyscan_t yyscanner)2262 char *sexget_text  (yyscan_t yyscanner)
2263 {
2264     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2265     return yytext;
2266 }
2267 
2268 /* %if-reentrant */
2269 
2270 /** Set the user-defined data. This data is never touched by the scanner.
2271  * @param user_defined The data to be associated with this scanner.
2272  * @param yyscanner The scanner object.
2273  */
sexset_extra(YY_EXTRA_TYPE user_defined,yyscan_t yyscanner)2274 void sexset_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
2275 {
2276     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2277     yyextra = user_defined ;
2278 }
2279 
2280 /* %endif */
2281 
2282 /** Set the current line number.
2283  * @param _line_number line number
2284  * @param yyscanner The scanner object.
2285  */
sexset_lineno(int _line_number,yyscan_t yyscanner)2286 void sexset_lineno (int  _line_number , yyscan_t yyscanner)
2287 {
2288     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2289 
2290         /* lineno is only valid if an input buffer exists. */
2291         if (! YY_CURRENT_BUFFER )
2292            YY_FATAL_ERROR( "sexset_lineno called with no buffer" );
2293 
2294     yylineno = _line_number;
2295 }
2296 
2297 /** Set the current column.
2298  * @param _column_no column number
2299  * @param yyscanner The scanner object.
2300  */
sexset_column(int _column_no,yyscan_t yyscanner)2301 void sexset_column (int  _column_no , yyscan_t yyscanner)
2302 {
2303     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2304 
2305         /* column is only valid if an input buffer exists. */
2306         if (! YY_CURRENT_BUFFER )
2307            YY_FATAL_ERROR( "sexset_column called with no buffer" );
2308 
2309     yycolumn = _column_no;
2310 }
2311 
2312 /** Set the input stream. This does not discard the current
2313  * input buffer.
2314  * @param _in_str A readable stream.
2315  * @param yyscanner The scanner object.
2316  * @see sex_switch_to_buffer
2317  */
sexset_in(FILE * _in_str,yyscan_t yyscanner)2318 void sexset_in (FILE *  _in_str , yyscan_t yyscanner)
2319 {
2320     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2321     yyin = _in_str ;
2322 }
2323 
sexset_out(FILE * _out_str,yyscan_t yyscanner)2324 void sexset_out (FILE *  _out_str , yyscan_t yyscanner)
2325 {
2326     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2327     yyout = _out_str ;
2328 }
2329 
sexget_debug(yyscan_t yyscanner)2330 int sexget_debug  (yyscan_t yyscanner)
2331 {
2332     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2333     return yy_flex_debug;
2334 }
2335 
sexset_debug(int _bdebug,yyscan_t yyscanner)2336 void sexset_debug (int  _bdebug , yyscan_t yyscanner)
2337 {
2338     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2339     yy_flex_debug = _bdebug ;
2340 }
2341 
2342 /* %endif */
2343 
2344 /* %if-reentrant */
2345 /* Accessor methods for yylval and yylloc */
2346 
2347 /* %if-bison-bridge */
2348 
sexget_lval(yyscan_t yyscanner)2349 YYSTYPE * sexget_lval  (yyscan_t yyscanner)
2350 {
2351     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2352     return yylval;
2353 }
2354 
sexset_lval(YYSTYPE * yylval_param,yyscan_t yyscanner)2355 void sexset_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
2356 {
2357     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2358     yylval = yylval_param;
2359 }
2360 
2361 /* %endif */
2362 
2363 /* User-visible API */
2364 
2365 /* sexlex_init is special because it creates the scanner itself, so it is
2366  * the ONLY reentrant function that doesn't take the scanner as the last argument.
2367  * That's why we explicitly handle the declaration, instead of using our macros.
2368  */
2369 
sexlex_init(yyscan_t * ptr_yy_globals)2370 int sexlex_init(yyscan_t* ptr_yy_globals)
2371 
2372 {
2373     if (ptr_yy_globals == NULL){
2374         errno = EINVAL;
2375         return 1;
2376     }
2377 
2378     *ptr_yy_globals = (yyscan_t) sexalloc ( sizeof( struct yyguts_t ), NULL );
2379 
2380     if (*ptr_yy_globals == NULL){
2381         errno = ENOMEM;
2382         return 1;
2383     }
2384 
2385     /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2386     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2387 
2388     return yy_init_globals ( *ptr_yy_globals );
2389 }
2390 
2391 /* sexlex_init_extra has the same functionality as sexlex_init, but follows the
2392  * convention of taking the scanner as the last argument. Note however, that
2393  * this is a *pointer* to a scanner, as it will be allocated by this call (and
2394  * is the reason, too, why this function also must handle its own declaration).
2395  * The user defined value in the first argument will be available to sexalloc in
2396  * the yyextra field.
2397  */
2398 
sexlex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t * ptr_yy_globals)2399 int sexlex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2400 
2401 {
2402     struct yyguts_t dummy_yyguts;
2403 
2404     sexset_extra (yy_user_defined, &dummy_yyguts);
2405 
2406     if (ptr_yy_globals == NULL){
2407         errno = EINVAL;
2408         return 1;
2409     }
2410 
2411     *ptr_yy_globals = (yyscan_t) sexalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2412 
2413     if (*ptr_yy_globals == NULL){
2414         errno = ENOMEM;
2415         return 1;
2416     }
2417 
2418     /* By setting to 0xAA, we expose bugs in
2419     yy_init_globals. Leave at 0x00 for releases. */
2420     memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2421 
2422     sexset_extra (yy_user_defined, *ptr_yy_globals);
2423 
2424     return yy_init_globals ( *ptr_yy_globals );
2425 }
2426 
2427 /* %endif if-c-only */
2428 
2429 /* %if-c-only */
yy_init_globals(yyscan_t yyscanner)2430 static int yy_init_globals (yyscan_t yyscanner)
2431 {
2432     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2433     /* Initialization is the same as for the non-reentrant scanner.
2434      * This function is called from sexlex_destroy(), so don't allocate here.
2435      */
2436 
2437     yyg->yy_buffer_stack = NULL;
2438     yyg->yy_buffer_stack_top = 0;
2439     yyg->yy_buffer_stack_max = 0;
2440     yyg->yy_c_buf_p = NULL;
2441     yyg->yy_init = 0;
2442     yyg->yy_start = 0;
2443 
2444     yyg->yy_start_stack_ptr = 0;
2445     yyg->yy_start_stack_depth = 0;
2446     yyg->yy_start_stack =  NULL;
2447 
2448 /* Defined in main.c */
2449 #ifdef YY_STDINIT
2450     yyin = stdin;
2451     yyout = stdout;
2452 #else
2453     yyin = NULL;
2454     yyout = NULL;
2455 #endif
2456 
2457     /* For future reference: Set errno on error, since we are called by
2458      * sexlex_init()
2459      */
2460     return 0;
2461 }
2462 /* %endif */
2463 
2464 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2465 /* sexlex_destroy is for both reentrant and non-reentrant scanners. */
sexlex_destroy(yyscan_t yyscanner)2466 int sexlex_destroy  (yyscan_t yyscanner)
2467 {
2468     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2469 
2470     /* Pop the buffer stack, destroying each element. */
2471 	while(YY_CURRENT_BUFFER){
2472 		sex_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2473 		YY_CURRENT_BUFFER_LVALUE = NULL;
2474 		sexpop_buffer_state(yyscanner);
2475 	}
2476 
2477 	/* Destroy the stack itself. */
2478 	sexfree(yyg->yy_buffer_stack ,yyscanner);
2479 	yyg->yy_buffer_stack = NULL;
2480 
2481     /* Destroy the start condition stack. */
2482         sexfree(yyg->yy_start_stack ,yyscanner );
2483         yyg->yy_start_stack = NULL;
2484 
2485     /* Reset the globals. This is important in a non-reentrant scanner so the next time
2486      * sexlex() is called, initialization will occur. */
2487     yy_init_globals( yyscanner);
2488 
2489 /* %if-reentrant */
2490     /* Destroy the main struct (reentrant only). */
2491     sexfree ( yyscanner , yyscanner );
2492     yyscanner = NULL;
2493 /* %endif */
2494     return 0;
2495 }
2496 /* %endif */
2497 
2498 /*
2499  * Internal utility routines.
2500  */
2501 
2502 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,yyconst char * s2,int n,yyscan_t yyscanner)2503 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2504 {
2505 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2506 	(void)yyg;
2507 
2508 	int i;
2509 	for ( i = 0; i < n; ++i )
2510 		s1[i] = s2[i];
2511 }
2512 #endif
2513 
2514 #ifdef YY_NEED_STRLEN
yy_flex_strlen(yyconst char * s,yyscan_t yyscanner)2515 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2516 {
2517 	int n;
2518 	for ( n = 0; s[n]; ++n )
2519 		;
2520 
2521 	return n;
2522 }
2523 #endif
2524 
sexalloc(yy_size_t size,yyscan_t yyscanner)2525 void *sexalloc (yy_size_t  size , yyscan_t yyscanner)
2526 {
2527 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2528 	(void)yyg;
2529 	return malloc(size);
2530 }
2531 
sexrealloc(void * ptr,yy_size_t size,yyscan_t yyscanner)2532 void *sexrealloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
2533 {
2534 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2535 	(void)yyg;
2536 
2537 	/* The cast to (char *) in the following accommodates both
2538 	 * implementations that use char* generic pointers, and those
2539 	 * that use void* generic pointers.  It works with the latter
2540 	 * because both ANSI C and C++ allow castless assignment from
2541 	 * any pointer type to void*, and deal with argument conversions
2542 	 * as though doing an assignment.
2543 	 */
2544 	return realloc(ptr, size);
2545 }
2546 
sexfree(void * ptr,yyscan_t yyscanner)2547 void sexfree (void * ptr , yyscan_t yyscanner)
2548 {
2549 	struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2550 	(void)yyg;
2551 	free( (char *) ptr );	/* see sexrealloc() for (char *) cast */
2552 }
2553 
2554 /* %if-tables-serialization definitions */
2555 /* %define-yytables   The name for this specific scanner's tables. */
2556 #define YYTABLES_NAME "yytables"
2557 /* %endif */
2558 
2559 /* %ok-for-header */
2560 
2561 #line 175 "../../src/rec-sex-lex.l"
2562 
2563 
2564 
2565 char *
rec_sex_lex_extract_name(char * str)2566 rec_sex_lex_extract_name (char *str)
2567 {
2568   size_t size;
2569   char *res;
2570   char *p;
2571 
2572   p = str;
2573   while ((*p != '[') && (*p != '.') && (*p != 0))
2574     {
2575       p++;
2576     }
2577 
2578   size = p - str;
2579   res = malloc (size + 1);
2580   memcpy (res, str, size);
2581   res[size] = 0;
2582 
2583   return res;
2584 }
2585 
2586 char *
rec_sex_lex_extract_subname(char * str)2587 rec_sex_lex_extract_subname (char *str)
2588 {
2589   char *p;
2590 
2591   /* If there is not a subname denoted in STR then this function
2592      returns NULL.  */
2593 
2594   p = str;
2595   while ((*p != '.') && (*p != '\0'))
2596     {
2597       p++;
2598     }
2599 
2600   if (*p == '\0')
2601     {
2602       /* There is not a second name.  */
2603       return NULL;
2604     }
2605 
2606   p++;  /* Skip the dot separator.  */
2607 
2608   return rec_sex_lex_extract_name (p);
2609 }
2610 
2611 bool
rec_sex_lex_extract_index(char * str,int * num)2612 rec_sex_lex_extract_index (char *str,
2613                            int *num)
2614 {
2615   bool res;
2616   char *p;
2617   char aux[100];
2618   int aux_size;
2619 
2620   /* Note that this function assumes syntax correctness in STR if a
2621      '[' is found.  */
2622 
2623   aux_size = 0;
2624   p = str;
2625   while ((*p != 0) && (*p != '['))
2626     {
2627       p++;
2628     }
2629 
2630   if (*p == 0)
2631     {
2632       res = false;
2633     }
2634   else
2635     {
2636       p++; /* Pass the [.  */
2637       while (*p != ']')
2638         {
2639           aux[aux_size++] = *p;
2640           p++;
2641         }
2642       aux[aux_size] = 0;
2643 
2644       if (!rec_atoi (aux, num))
2645         {
2646           res = false;
2647         }
2648 
2649       res = true;
2650     }
2651 
2652   return res;
2653 }
2654 
2655 /* End of rec-sex.l */
2656 
2657