20221212
[devspec.git] / devspec.en_US / project / recutils / src / rec-sex-lex.c
bloba861edd8dfbfd05850842f339711a0b2a7a5ad93
1 #line 2 "rec-sex-lex.c"
2 /* This code goes at the "top" of the generated file. */
3 #include <config.h>
5 #line 6 "rec-sex-lex.c"
7 #define YY_INT_ALIGNED short int
9 /* A lexical scanner generated by flex */
11 /* %not-for-header */
13 /* %if-c-only */
14 /* %if-not-reentrant */
15 /* %endif */
16 /* %endif */
17 /* %ok-for-header */
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
27 /* %if-c++-only */
28 /* %endif */
30 /* %if-c-only */
32 /* %endif */
34 /* %if-c-only */
36 /* %endif */
38 /* First, we deal with platform-specific or compiler-specific issues. */
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 */
48 /* %if-tables-serialization */
49 /* %endif */
50 /* end standard C headers. */
52 /* %if-c-or-c++ */
53 /* flex integer type definitions */
55 #ifndef FLEXINT_H
56 #define FLEXINT_H
58 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
60 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
62 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
63 * if you want the limit (max/min) macros for int types.
65 #ifndef __STDC_LIMIT_MACROS
66 #define __STDC_LIMIT_MACROS 1
67 #endif
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;
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
113 #endif /* ! C99 */
115 #endif /* ! FLEXINT_H */
117 /* %endif */
119 /* %if-c++-only */
120 /* %endif */
122 /* TODO: this is always defined, so inline it */
123 #define yyconst const
125 #if defined(__GNUC__) && __GNUC__ >= 3
126 #define yynoreturn __attribute__((__noreturn__))
127 #else
128 #define yynoreturn
129 #endif
131 /* %not-for-header */
133 /* Returned upon end-of-file. */
134 #define YY_NULL 0
135 /* %ok-for-header */
137 /* %not-for-header */
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.
144 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
145 /* %ok-for-header */
147 /* %if-reentrant */
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
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
166 /* %endif */
168 /* %if-not-reentrant */
169 /* %endif */
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.
175 #define BEGIN yyg->yy_start = 1 + 2 *
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.
181 #define YY_START ((yyg->yy_start - 1) / 2)
182 #define YYSTATE YY_START
184 /* Action number for EOF rule of a given start state. */
185 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
187 /* Special action meaning "start processing a new file". */
188 #define YY_NEW_FILE sexrestart(yyin ,yyscanner )
190 #define YY_END_OF_BUFFER_CHAR 0
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.
199 #define YY_BUF_SIZE 32768
200 #else
201 #define YY_BUF_SIZE 16384
202 #endif /* __ia64__ */
203 #endif
205 /* The state buf must be large enough to hold one state per character in the main buffer.
207 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
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
214 #ifndef YY_TYPEDEF_YY_SIZE_T
215 #define YY_TYPEDEF_YY_SIZE_T
216 typedef size_t yy_size_t;
217 #endif
219 /* %if-not-reentrant */
220 /* %endif */
222 /* %if-c-only */
223 /* %if-not-reentrant */
224 /* %endif */
225 /* %endif */
227 #define EOB_ACT_CONTINUE_SCAN 0
228 #define EOB_ACT_END_OF_FILE 1
229 #define EOB_ACT_LAST_MATCH 2
231 #define YY_LESS_LINENO(n)
232 #define YY_LINENO_REWIND_TO(ptr)
234 /* Return all but the first "n" matched characters back to the input stream. */
235 #define yyless(n) \
236 do \
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 */ \
246 while ( 0 )
248 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
250 #ifndef YY_STRUCT_YY_BUFFER_STATE
251 #define YY_STRUCT_YY_BUFFER_STATE
252 struct yy_buffer_state
254 /* %if-c-only */
255 FILE *yy_input_file;
256 /* %endif */
258 /* %if-c++-only */
259 /* %endif */
261 char *yy_ch_buf; /* input buffer */
262 char *yy_buf_pos; /* current position in input buffer */
264 /* Size of input buffer in bytes, not including room for EOB
265 * characters.
267 int yy_buf_size;
269 /* Number of characters read into yy_ch_buf, not including EOB
270 * characters.
272 int yy_n_chars;
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.
278 int yy_is_our_buffer;
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.
285 int yy_is_interactive;
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.
291 int yy_at_bol;
293 int yy_bs_lineno; /**< The line count. */
294 int yy_bs_column; /**< The column count. */
296 /* Whether to try to fill the input buffer when we reach the
297 * end of it.
299 int yy_fill_buffer;
301 int yy_buffer_status;
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.
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.
315 #define YY_BUFFER_EOF_PENDING 2
318 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
320 /* %if-c-only Standard (non-C++) definition */
321 /* %not-for-header */
323 /* %if-not-reentrant */
324 /* %endif */
325 /* %ok-for-header */
327 /* %endif */
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".
333 * Returns the top of the stack, or NULL.
335 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
336 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
337 : NULL)
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.
342 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
344 /* %if-c-only Standard (non-C++) definition */
346 /* %if-not-reentrant */
347 /* %not-for-header */
349 /* %ok-for-header */
351 /* %endif */
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 );
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 );
365 #define YY_FLUSH_BUFFER sex_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
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 );
371 /* %endif */
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 );
377 #define yy_new_buffer sex_create_buffer
379 #define yy_set_interactive(is_interactive) \
381 if ( ! YY_CURRENT_BUFFER ){ \
382 sexensure_buffer_stack (yyscanner); \
383 YY_CURRENT_BUFFER_LVALUE = \
384 sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
386 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
389 #define yy_set_bol(at_bol) \
391 if ( ! YY_CURRENT_BUFFER ){\
392 sexensure_buffer_stack (yyscanner); \
393 YY_CURRENT_BUFFER_LVALUE = \
394 sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
396 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
399 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
401 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
402 /* Begin user sect3 */
404 #define sexwrap(yyscanner) (/*CONSTCOND*/1)
405 #define YY_SKIP_YYWRAP
407 #define FLEX_DEBUG
409 typedef unsigned char YY_CHAR;
411 typedef int yy_state_type;
413 #define yytext_ptr yytext_r
415 /* %% [1.5] DFA */
417 /* %if-c-only Standard (non-C++) definition */
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 );
424 /* %endif */
426 /* Done after the current pattern has been matched and before the
427 * corresponding action - sets up yytext.
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;
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
445 flex_int32_t yy_verify;
446 flex_int32_t yy_nxt;
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
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,
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,
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
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
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
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
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,
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
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,
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
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,
571 /* The intent behind this definition is that it'll catch
572 * any uses of REJECT which flex missed.
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 -*-
581 * File: rec-sex.l
582 * Date: Sat Jan 9 16:35:18 2010
584 * GNU recutils - Selection Expressions lexer
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.
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.
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/>.
601 /* Automake needs this. */
602 #define YY_NO_INPUT 1
604 #line 44 "../../src/rec-sex-lex.l"
605 #include <rec-utils.h>
607 #include <rec-sex-ast.h>
608 #include <rec-sex-parser.h>
609 #include <rec-sex-tab.h>
611 #define YY_INPUT(buf,result,max_size) \
613 int ci; \
614 if ((ci = rec_sex_parser_getc ((rec_sex_parser_t) yyextra)) == -1) \
616 result = YY_NULL; \
618 else \
620 buf[0] = (char) ci; \
621 result = 1; \
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);
630 /* Please do not touch this comment' */
631 #line 632 "rec-sex-lex.c"
633 #define INITIAL 0
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.
640 /* %if-c-only */
641 #include <unistd.h>
642 /* %endif */
643 /* %if-c++-only */
644 /* %endif */
645 #endif
647 #define YY_EXTRA_TYPE void *
649 /* %if-c-only Reentrant structure and macros (non-C++). */
650 /* %if-reentrant */
652 /* Holds the entire state of the reentrant scanner. */
653 struct yyguts_t
656 /* User-defined. Not touched by flex. */
657 YY_EXTRA_TYPE yyextra_r;
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;
677 int yylineno_r;
678 int yy_flex_debug_r;
680 char *yytext_r;
681 int yy_more_flag;
682 int yy_more_len;
684 YYSTYPE * yylval_r;
686 }; /* end struct yyguts_t */
688 /* %if-c-only */
690 static int yy_init_globals (yyscan_t yyscanner );
692 /* %endif */
694 /* %if-reentrant */
696 /* This must go here because YYSTYPE and YYLTYPE are included
697 * from bison output in section 1.*/
698 # define yylval yyg->yylval_r
700 int sexlex_init (yyscan_t* scanner);
702 int sexlex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
704 /* %endif */
706 /* %endif End reentrant structures and macros. */
708 /* Accessor methods to globals.
709 These are made visible to non-reentrant scanners for convenience. */
711 int sexlex_destroy (yyscan_t yyscanner );
713 int sexget_debug (yyscan_t yyscanner );
715 void sexset_debug (int debug_flag ,yyscan_t yyscanner );
717 YY_EXTRA_TYPE sexget_extra (yyscan_t yyscanner );
719 void sexset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
721 FILE *sexget_in (yyscan_t yyscanner );
723 void sexset_in (FILE * _in_str ,yyscan_t yyscanner );
725 FILE *sexget_out (yyscan_t yyscanner );
727 void sexset_out (FILE * _out_str ,yyscan_t yyscanner );
729 int sexget_leng (yyscan_t yyscanner );
731 char *sexget_text (yyscan_t yyscanner );
733 int sexget_lineno (yyscan_t yyscanner );
735 void sexset_lineno (int _line_number ,yyscan_t yyscanner );
737 int sexget_column (yyscan_t yyscanner );
739 void sexset_column (int _column_no ,yyscan_t yyscanner );
741 /* %if-bison-bridge */
743 YYSTYPE * sexget_lval (yyscan_t yyscanner );
745 void sexset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
747 /* %endif */
749 /* Macros after this point can all be overridden by user definitions in
750 * section 1.
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
761 /* %not-for-header */
763 #ifndef YY_NO_UNPUT
765 #endif
766 /* %ok-for-header */
768 /* %endif */
770 #ifndef yytext_ptr
771 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
772 #endif
774 #ifdef YY_NEED_STRLEN
775 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
776 #endif
778 #ifndef YY_NO_INPUT
779 /* %if-c-only Standard (non-C++) definition */
780 /* %not-for-header */
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 */
789 /* %endif */
790 #endif
792 /* %if-c-only */
794 /* %endif */
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
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().
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
818 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
819 * is returned in "result".
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 ) \
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; \
837 else \
839 errno=0; \
840 while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
842 if( errno != EINTR) \
844 YY_FATAL_ERROR( "input in flex scanner failed" ); \
845 break; \
847 errno=0; \
848 clearerr(yyin); \
852 /* %if-c++-only C++ definition \ */\
853 /* %endif */
855 #endif
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.
861 #ifndef yyterminate
862 #define yyterminate() return YY_NULL
863 #endif
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
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
879 /* %if-tables-serialization structures and prototypes */
880 /* %not-for-header */
882 /* %ok-for-header */
884 /* %not-for-header */
886 /* %tables-yydmap generated elements */
887 /* %endif */
888 /* end tables serialization structures and prototypes */
890 /* %ok-for-header */
892 /* Default declaration of generated scanner - a define so the user can
893 * easily add parameters.
895 #ifndef YY_DECL
896 #define YY_DECL_IS_OURS 1
897 /* %if-c-only Standard (non-C++) definition */
899 extern int sexlex \
900 (YYSTYPE * yylval_param ,yyscan_t yyscanner);
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 */
909 /* Code executed at the beginning of each rule, after yytext and yyleng
910 * have been set up.
912 #ifndef YY_USER_ACTION
913 #define YY_USER_ACTION
914 #endif
916 /* Code executed at the end of each rule. */
917 #ifndef YY_BREAK
918 #define YY_BREAK /*LINTED*/break;
919 #endif
921 /* %% [6.0] YY_RULE_SETUP definition goes here */
922 #define YY_RULE_SETUP \
923 YY_USER_ACTION
925 /* %not-for-header */
927 /** The main scanner function which does all the work.
929 YY_DECL
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;
936 yylval = yylval_param;
938 if ( !yyg->yy_init )
940 yyg->yy_init = 1;
942 #ifdef YY_USER_INIT
943 YY_USER_INIT;
944 #endif
946 if ( ! yyg->yy_start )
947 yyg->yy_start = 1; /* first start state */
949 if ( ! yyin )
950 /* %if-c-only */
951 yyin = stdin;
952 /* %endif */
953 /* %if-c++-only */
954 /* %endif */
956 if ( ! yyout )
957 /* %if-c-only */
958 yyout = stdout;
959 /* %endif */
960 /* %if-c++-only */
961 /* %endif */
963 if ( ! YY_CURRENT_BUFFER ) {
964 sexensure_buffer_stack (yyscanner);
965 YY_CURRENT_BUFFER_LVALUE =
966 sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
969 sex_load_buffer_state(yyscanner );
973 /* %% [7.0] user's declarations go here */
974 #line 80 "../../src/rec-sex-lex.l"
977 #line 978 "rec-sex-lex.c"
979 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
981 /* %% [8.0] yymore()-related code goes here */
982 yy_cp = yyg->yy_c_buf_p;
984 /* Support of yytext. */
985 *yy_cp = yyg->yy_hold_char;
987 /* yy_bp points to the position in yy_ch_buf of the start of
988 * the current run.
990 yy_bp = yy_cp;
992 /* %% [9.0] code to set up and find next match goes here */
993 yy_current_state = yyg->yy_start;
994 yy_match:
997 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
998 if ( yy_accept[yy_current_state] )
1000 yyg->yy_last_accepting_state = yy_current_state;
1001 yyg->yy_last_accepting_cpos = yy_cp;
1003 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1009 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1010 ++yy_cp;
1012 while ( yy_base[yy_current_state] != 127 );
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];
1024 YY_DO_BEFORE_ACTION;
1026 /* %% [11.0] code for yylineno update goes here */
1028 do_action: /* This label is used only to access EOF actions. */
1030 /* %% [12.0] debug code goes here */
1031 if ( yy_flex_debug )
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 );
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;
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"
1068 * Create a real node.
1070 double real_value;
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);
1076 return REC_SEX_TOK_REAL;
1078 YY_BREAK
1079 case 3:
1080 YY_RULE_SETUP
1081 #line 97 "../../src/rec-sex-lex.l"
1084 * Create an integer node.
1086 int integer_value;
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);
1092 return REC_SEX_TOK_INT;
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"
1224 int res;
1225 char *match;
1226 char *name, *subname;
1227 int index = -1;
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);
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;
1240 free (name);
1241 free (match);
1243 return res;
1245 YY_BREAK
1246 case 30:
1247 /* rule 30 can match eol */
1248 YY_RULE_SETUP
1249 #line 159 "../../src/rec-sex-lex.l"
1252 * Create a string node.
1255 /* Strip the quoting characters */
1256 yytext[strlen(yytext) - 1] = 0;
1258 yylval->node = rec_sex_ast_node_new ();
1259 rec_sex_ast_node_set_str (yylval->node, yytext + 1);
1261 return REC_SEX_TOK_STR;
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();
1278 case YY_END_OF_BUFFER:
1280 /* Amount of text matched not including the EOB char. */
1281 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1283 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1284 *yy_cp = yyg->yy_hold_char;
1285 YY_RESTORE_YY_MORE_OFFSET
1287 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
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.
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;
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().
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;
1318 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1320 yy_current_state = yy_get_previous_state( yyscanner );
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).
1331 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1333 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1335 if ( yy_next_state )
1337 /* Consume the NUL. */
1338 yy_cp = ++yyg->yy_c_buf_p;
1339 yy_current_state = yy_next_state;
1340 goto yy_match;
1343 else
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;
1351 else switch ( yy_get_next_buffer( yyscanner ) )
1353 case EOB_ACT_END_OF_FILE:
1355 yyg->yy_did_buffer_switch_on_eof = 0;
1357 if ( sexwrap(yyscanner ) )
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.
1368 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1370 yy_act = YY_STATE_EOF(YY_START);
1371 goto do_action;
1374 else
1376 if ( ! yyg->yy_did_buffer_switch_on_eof )
1377 YY_NEW_FILE;
1379 break;
1382 case EOB_ACT_CONTINUE_SCAN:
1383 yyg->yy_c_buf_p =
1384 yyg->yytext_ptr + yy_amount_of_matched_text;
1386 yy_current_state = yy_get_previous_state( yyscanner );
1388 yy_cp = yyg->yy_c_buf_p;
1389 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1390 goto yy_match;
1392 case EOB_ACT_LAST_MATCH:
1393 yyg->yy_c_buf_p =
1394 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1396 yy_current_state = yy_get_previous_state( yyscanner );
1398 yy_cp = yyg->yy_c_buf_p;
1399 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1400 goto yy_find_action;
1402 break;
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 */
1414 /* %if-c++-only */
1415 /* %not-for-header */
1417 /* %ok-for-header */
1419 /* %endif */
1421 /* yy_get_next_buffer - try to read in a new buffer
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
1428 /* %if-c-only */
1429 static int yy_get_next_buffer (yyscan_t yyscanner)
1430 /* %endif */
1431 /* %if-c++-only */
1432 /* %endif */
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;
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" );
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 )
1448 /* We matched a single character, the EOB, so
1449 * treat this as a final EOF.
1451 return EOB_ACT_END_OF_FILE;
1454 else
1456 /* We matched some text prior to the EOB, first
1457 * process it.
1459 return EOB_ACT_LAST_MATCH;
1463 /* Try to read more data. */
1465 /* First move last chars to start of buffer. */
1466 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
1468 for ( i = 0; i < number_to_move; ++i )
1469 *(dest++) = *(source++);
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
1475 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1477 else
1479 int num_to_read =
1480 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1482 while ( num_to_read <= 0 )
1483 { /* Not enough room in the buffer - grow it. */
1485 /* just a shorter name for the current buffer */
1486 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1488 int yy_c_buf_p_offset =
1489 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1491 if ( b->yy_is_our_buffer )
1493 int new_size = b->yy_buf_size * 2;
1495 if ( new_size <= 0 )
1496 b->yy_buf_size += b->yy_buf_size / 8;
1497 else
1498 b->yy_buf_size *= 2;
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 );
1504 else
1505 /* Can't grow it, we don't own it. */
1506 b->yy_ch_buf = NULL;
1508 if ( ! b->yy_ch_buf )
1509 YY_FATAL_ERROR(
1510 "fatal error - scanner input buffer overflow" );
1512 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1514 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1515 number_to_move - 1;
1519 if ( num_to_read > YY_READ_BUF_SIZE )
1520 num_to_read = YY_READ_BUF_SIZE;
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 );
1526 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1529 if ( yyg->yy_n_chars == 0 )
1531 if ( number_to_move == YY_MORE_ADJ )
1533 ret_val = EOB_ACT_END_OF_FILE;
1534 sexrestart(yyin ,yyscanner);
1537 else
1539 ret_val = EOB_ACT_LAST_MATCH;
1540 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1541 YY_BUFFER_EOF_PENDING;
1545 else
1546 ret_val = EOB_ACT_CONTINUE_SCAN;
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()" );
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;
1560 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1562 return ret_val;
1565 /* yy_get_previous_state - get the state just before the EOB char was reached */
1567 /* %if-c-only */
1568 /* %not-for-header */
1570 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1571 /* %endif */
1572 /* %if-c++-only */
1573 /* %endif */
1575 yy_state_type yy_current_state;
1576 char *yy_cp;
1577 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1579 /* %% [15.0] code to get the start state into yy_current_state goes here */
1580 yy_current_state = yyg->yy_start;
1582 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
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] )
1588 yyg->yy_last_accepting_state = yy_current_state;
1589 yyg->yy_last_accepting_cpos = yy_cp;
1591 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1597 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1600 return yy_current_state;
1603 /* yy_try_NUL_trans - try to make a transition on the NUL character
1605 * synopsis
1606 * next_state = yy_try_NUL_trans( current_state );
1608 /* %if-c-only */
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 */
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;
1619 YY_CHAR yy_c = 1;
1620 if ( yy_accept[yy_current_state] )
1622 yyg->yy_last_accepting_state = yy_current_state;
1623 yyg->yy_last_accepting_cpos = yy_cp;
1625 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
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];
1631 yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c];
1632 yy_is_jam = (yy_current_state == 63);
1634 (void)yyg;
1635 return yy_is_jam ? 0 : yy_current_state;
1638 #ifndef YY_NO_UNPUT
1639 /* %if-c-only */
1641 /* %endif */
1642 #endif
1644 /* %if-c-only */
1645 #ifndef YY_NO_INPUT
1646 #ifdef __cplusplus
1647 static int yyinput (yyscan_t yyscanner)
1648 #else
1649 static int input (yyscan_t yyscanner)
1650 #endif
1652 /* %endif */
1653 /* %if-c++-only */
1654 /* %endif */
1656 int c;
1657 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1659 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1661 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
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.
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';
1671 else
1672 { /* need more input */
1673 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1674 ++yyg->yy_c_buf_p;
1676 switch ( yy_get_next_buffer( yyscanner ) )
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.
1689 /* Reset buffer status. */
1690 sexrestart(yyin ,yyscanner);
1692 /*FALLTHROUGH*/
1694 case EOB_ACT_END_OF_FILE:
1696 if ( sexwrap(yyscanner ) )
1697 return 0;
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
1708 case EOB_ACT_CONTINUE_SCAN:
1709 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1710 break;
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;
1719 /* %% [19.0] update BOL and yylineno */
1721 return c;
1723 /* %if-c-only */
1724 #endif /* ifndef YY_NO_INPUT */
1725 /* %endif */
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 .
1732 /* %if-c-only */
1733 void sexrestart (FILE * input_file , yyscan_t yyscanner)
1734 /* %endif */
1735 /* %if-c++-only */
1736 /* %endif */
1738 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1740 if ( ! YY_CURRENT_BUFFER ){
1741 sexensure_buffer_stack (yyscanner);
1742 YY_CURRENT_BUFFER_LVALUE =
1743 sex_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1746 sex_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1747 sex_load_buffer_state(yyscanner );
1750 /* %if-c++-only */
1751 /* %endif */
1753 /** Switch to a different input buffer.
1754 * @param new_buffer The new input buffer.
1755 * @param yyscanner The scanner object.
1757 /* %if-c-only */
1758 void sex_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1759 /* %endif */
1760 /* %if-c++-only */
1761 /* %endif */
1763 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1765 /* TODO. We should be able to replace this entire function body
1766 * with
1767 * sexpop_buffer_state();
1768 * sexpush_buffer_state(new_buffer);
1770 sexensure_buffer_stack (yyscanner);
1771 if ( YY_CURRENT_BUFFER == new_buffer )
1772 return;
1774 if ( YY_CURRENT_BUFFER )
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;
1782 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1783 sex_load_buffer_state(yyscanner );
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.
1790 yyg->yy_did_buffer_switch_on_eof = 1;
1793 /* %if-c-only */
1794 static void sex_load_buffer_state (yyscan_t yyscanner)
1795 /* %endif */
1796 /* %if-c++-only */
1797 /* %endif */
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;
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.
1816 /* %if-c-only */
1817 YY_BUFFER_STATE sex_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1818 /* %endif */
1819 /* %if-c++-only */
1820 /* %endif */
1822 YY_BUFFER_STATE b;
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()" );
1828 b->yy_buf_size = (yy_size_t)size;
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.
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()" );
1837 b->yy_is_our_buffer = 1;
1839 sex_init_buffer(b,file ,yyscanner);
1841 return b;
1844 /* %if-c++-only */
1845 /* %endif */
1847 /** Destroy the buffer.
1848 * @param b a buffer created with sex_create_buffer()
1849 * @param yyscanner The scanner object.
1851 /* %if-c-only */
1852 void sex_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1853 /* %endif */
1854 /* %if-c++-only */
1855 /* %endif */
1857 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1859 if ( ! b )
1860 return;
1862 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1863 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1865 if ( b->yy_is_our_buffer )
1866 sexfree((void *) b->yy_ch_buf ,yyscanner );
1868 sexfree((void *) b ,yyscanner );
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.
1875 /* %if-c-only */
1876 static void sex_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1877 /* %endif */
1878 /* %if-c++-only */
1879 /* %endif */
1882 int oerrno = errno;
1883 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1885 sex_flush_buffer(b ,yyscanner);
1887 /* %if-c-only */
1888 b->yy_input_file = file;
1889 /* %endif */
1890 /* %if-c++-only */
1891 /* %endif */
1892 b->yy_fill_buffer = 1;
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.
1898 if (b != YY_CURRENT_BUFFER){
1899 b->yy_bs_lineno = 1;
1900 b->yy_bs_column = 0;
1903 /* %if-c-only */
1905 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1907 /* %endif */
1908 /* %if-c++-only */
1909 /* %endif */
1910 errno = oerrno;
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.
1917 /* %if-c-only */
1918 void sex_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1919 /* %endif */
1920 /* %if-c++-only */
1921 /* %endif */
1923 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1924 if ( ! b )
1925 return;
1927 b->yy_n_chars = 0;
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.
1933 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1934 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1936 b->yy_buf_pos = &b->yy_ch_buf[0];
1938 b->yy_at_bol = 1;
1939 b->yy_buffer_status = YY_BUFFER_NEW;
1941 if ( b == YY_CURRENT_BUFFER )
1942 sex_load_buffer_state(yyscanner );
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.
1952 /* %if-c-only */
1953 void sexpush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1954 /* %endif */
1955 /* %if-c++-only */
1956 /* %endif */
1958 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1959 if (new_buffer == NULL)
1960 return;
1962 sexensure_buffer_stack(yyscanner);
1964 /* This block is copied from sex_switch_to_buffer. */
1965 if ( YY_CURRENT_BUFFER )
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;
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;
1978 /* copied from sex_switch_to_buffer. */
1979 sex_load_buffer_state(yyscanner );
1980 yyg->yy_did_buffer_switch_on_eof = 1;
1982 /* %endif */
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.
1989 /* %if-c-only */
1990 void sexpop_buffer_state (yyscan_t yyscanner)
1991 /* %endif */
1992 /* %if-c++-only */
1993 /* %endif */
1995 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1996 if (!YY_CURRENT_BUFFER)
1997 return;
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;
2004 if (YY_CURRENT_BUFFER) {
2005 sex_load_buffer_state(yyscanner );
2006 yyg->yy_did_buffer_switch_on_eof = 1;
2009 /* %endif */
2011 /* %if-c-or-c++ */
2012 /* Allocates the stack if it does not exist.
2013 * Guarantees space for at least one push.
2015 /* %if-c-only */
2016 static void sexensure_buffer_stack (yyscan_t yyscanner)
2017 /* %endif */
2018 /* %if-c++-only */
2019 /* %endif */
2021 int num_to_alloc;
2022 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2024 if (!yyg->yy_buffer_stack) {
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.
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()" );
2037 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2039 yyg->yy_buffer_stack_max = num_to_alloc;
2040 yyg->yy_buffer_stack_top = 0;
2041 return;
2044 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2046 /* Increase the buffer to prepare for a possible push. */
2047 yy_size_t grow_size = 8 /* arbitrary grow size */;
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()" );
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;
2062 /* %endif */
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.
2071 YY_BUFFER_STATE sex_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2073 YY_BUFFER_STATE b;
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;
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()" );
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;
2095 sex_switch_to_buffer(b ,yyscanner );
2097 return b;
2099 /* %endif */
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.
2110 YY_BUFFER_STATE sex_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2113 return sex_scan_bytes(yystr,(int) strlen(yystr) ,yyscanner);
2115 /* %endif */
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.
2125 YY_BUFFER_STATE sex_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2127 YY_BUFFER_STATE b;
2128 char *buf;
2129 yy_size_t n;
2130 int i;
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()" );
2138 for ( i = 0; i < _yybytes_len; ++i )
2139 buf[i] = yybytes[i];
2141 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2143 b = sex_scan_buffer(buf,n ,yyscanner);
2144 if ( ! b )
2145 YY_FATAL_ERROR( "bad buffer in sex_scan_bytes()" );
2147 /* It's okay to grow etc. this buffer, and we should throw it
2148 * away when we're done.
2150 b->yy_is_our_buffer = 1;
2152 return b;
2154 /* %endif */
2156 #ifndef YY_EXIT_FAILURE
2157 #define YY_EXIT_FAILURE 2
2158 #endif
2160 /* %if-c-only */
2161 static void yynoreturn yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2163 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2164 (void)yyg;
2165 (void) fprintf( stderr, "%s\n", msg );
2166 exit( YY_EXIT_FAILURE );
2168 /* %endif */
2169 /* %if-c++-only */
2170 /* %endif */
2172 /* Redefine yyless() so it works in section 3 code. */
2174 #undef yyless
2175 #define yyless(n) \
2176 do \
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; \
2187 while ( 0 )
2189 /* Accessor methods (get/set functions) to struct members. */
2191 /* %if-c-only */
2192 /* %if-reentrant */
2194 /** Get the user-defined data for this scanner.
2195 * @param yyscanner The scanner object.
2197 YY_EXTRA_TYPE sexget_extra (yyscan_t yyscanner)
2199 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2200 return yyextra;
2203 /* %endif */
2205 /** Get the current line number.
2206 * @param yyscanner The scanner object.
2208 int sexget_lineno (yyscan_t yyscanner)
2210 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2212 if (! YY_CURRENT_BUFFER)
2213 return 0;
2215 return yylineno;
2218 /** Get the current column number.
2219 * @param yyscanner The scanner object.
2221 int sexget_column (yyscan_t yyscanner)
2223 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2225 if (! YY_CURRENT_BUFFER)
2226 return 0;
2228 return yycolumn;
2231 /** Get the input stream.
2232 * @param yyscanner The scanner object.
2234 FILE *sexget_in (yyscan_t yyscanner)
2236 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2237 return yyin;
2240 /** Get the output stream.
2241 * @param yyscanner The scanner object.
2243 FILE *sexget_out (yyscan_t yyscanner)
2245 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2246 return yyout;
2249 /** Get the length of the current token.
2250 * @param yyscanner The scanner object.
2252 int sexget_leng (yyscan_t yyscanner)
2254 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2255 return yyleng;
2258 /** Get the current token.
2259 * @param yyscanner The scanner object.
2262 char *sexget_text (yyscan_t yyscanner)
2264 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2265 return yytext;
2268 /* %if-reentrant */
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.
2274 void sexset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2276 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2277 yyextra = user_defined ;
2280 /* %endif */
2282 /** Set the current line number.
2283 * @param _line_number line number
2284 * @param yyscanner The scanner object.
2286 void sexset_lineno (int _line_number , yyscan_t yyscanner)
2288 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
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" );
2294 yylineno = _line_number;
2297 /** Set the current column.
2298 * @param _column_no column number
2299 * @param yyscanner The scanner object.
2301 void sexset_column (int _column_no , yyscan_t yyscanner)
2303 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
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" );
2309 yycolumn = _column_no;
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
2318 void sexset_in (FILE * _in_str , yyscan_t yyscanner)
2320 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2321 yyin = _in_str ;
2324 void sexset_out (FILE * _out_str , yyscan_t yyscanner)
2326 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2327 yyout = _out_str ;
2330 int sexget_debug (yyscan_t yyscanner)
2332 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2333 return yy_flex_debug;
2336 void sexset_debug (int _bdebug , yyscan_t yyscanner)
2338 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2339 yy_flex_debug = _bdebug ;
2342 /* %endif */
2344 /* %if-reentrant */
2345 /* Accessor methods for yylval and yylloc */
2347 /* %if-bison-bridge */
2349 YYSTYPE * sexget_lval (yyscan_t yyscanner)
2351 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2352 return yylval;
2355 void sexset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
2357 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2358 yylval = yylval_param;
2361 /* %endif */
2363 /* User-visible API */
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.
2370 int sexlex_init(yyscan_t* ptr_yy_globals)
2373 if (ptr_yy_globals == NULL){
2374 errno = EINVAL;
2375 return 1;
2378 *ptr_yy_globals = (yyscan_t) sexalloc ( sizeof( struct yyguts_t ), NULL );
2380 if (*ptr_yy_globals == NULL){
2381 errno = ENOMEM;
2382 return 1;
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));
2388 return yy_init_globals ( *ptr_yy_globals );
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.
2399 int sexlex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
2402 struct yyguts_t dummy_yyguts;
2404 sexset_extra (yy_user_defined, &dummy_yyguts);
2406 if (ptr_yy_globals == NULL){
2407 errno = EINVAL;
2408 return 1;
2411 *ptr_yy_globals = (yyscan_t) sexalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2413 if (*ptr_yy_globals == NULL){
2414 errno = ENOMEM;
2415 return 1;
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));
2422 sexset_extra (yy_user_defined, *ptr_yy_globals);
2424 return yy_init_globals ( *ptr_yy_globals );
2427 /* %endif if-c-only */
2429 /* %if-c-only */
2430 static int yy_init_globals (yyscan_t yyscanner)
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.
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;
2444 yyg->yy_start_stack_ptr = 0;
2445 yyg->yy_start_stack_depth = 0;
2446 yyg->yy_start_stack = NULL;
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
2457 /* For future reference: Set errno on error, since we are called by
2458 * sexlex_init()
2460 return 0;
2462 /* %endif */
2464 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
2465 /* sexlex_destroy is for both reentrant and non-reentrant scanners. */
2466 int sexlex_destroy (yyscan_t yyscanner)
2468 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
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);
2477 /* Destroy the stack itself. */
2478 sexfree(yyg->yy_buffer_stack ,yyscanner);
2479 yyg->yy_buffer_stack = NULL;
2481 /* Destroy the start condition stack. */
2482 sexfree(yyg->yy_start_stack ,yyscanner );
2483 yyg->yy_start_stack = NULL;
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);
2489 /* %if-reentrant */
2490 /* Destroy the main struct (reentrant only). */
2491 sexfree ( yyscanner , yyscanner );
2492 yyscanner = NULL;
2493 /* %endif */
2494 return 0;
2496 /* %endif */
2499 * Internal utility routines.
2502 #ifndef yytext_ptr
2503 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2505 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2506 (void)yyg;
2508 int i;
2509 for ( i = 0; i < n; ++i )
2510 s1[i] = s2[i];
2512 #endif
2514 #ifdef YY_NEED_STRLEN
2515 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2517 int n;
2518 for ( n = 0; s[n]; ++n )
2521 return n;
2523 #endif
2525 void *sexalloc (yy_size_t size , yyscan_t yyscanner)
2527 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2528 (void)yyg;
2529 return malloc(size);
2532 void *sexrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2534 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2535 (void)yyg;
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.
2544 return realloc(ptr, size);
2547 void sexfree (void * ptr , yyscan_t yyscanner)
2549 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2550 (void)yyg;
2551 free( (char *) ptr ); /* see sexrealloc() for (char *) cast */
2554 /* %if-tables-serialization definitions */
2555 /* %define-yytables The name for this specific scanner's tables. */
2556 #define YYTABLES_NAME "yytables"
2557 /* %endif */
2559 /* %ok-for-header */
2561 #line 175 "../../src/rec-sex-lex.l"
2565 char *
2566 rec_sex_lex_extract_name (char *str)
2568 size_t size;
2569 char *res;
2570 char *p;
2572 p = str;
2573 while ((*p != '[') && (*p != '.') && (*p != 0))
2575 p++;
2578 size = p - str;
2579 res = malloc (size + 1);
2580 memcpy (res, str, size);
2581 res[size] = 0;
2583 return res;
2586 char *
2587 rec_sex_lex_extract_subname (char *str)
2589 char *p;
2591 /* If there is not a subname denoted in STR then this function
2592 returns NULL. */
2594 p = str;
2595 while ((*p != '.') && (*p != '\0'))
2597 p++;
2600 if (*p == '\0')
2602 /* There is not a second name. */
2603 return NULL;
2606 p++; /* Skip the dot separator. */
2608 return rec_sex_lex_extract_name (p);
2611 bool
2612 rec_sex_lex_extract_index (char *str,
2613 int *num)
2615 bool res;
2616 char *p;
2617 char aux[100];
2618 int aux_size;
2620 /* Note that this function assumes syntax correctness in STR if a
2621 '[' is found. */
2623 aux_size = 0;
2624 p = str;
2625 while ((*p != 0) && (*p != '['))
2627 p++;
2630 if (*p == 0)
2632 res = false;
2634 else
2636 p++; /* Pass the [. */
2637 while (*p != ']')
2639 aux[aux_size++] = *p;
2640 p++;
2642 aux[aux_size] = 0;
2644 if (!rec_atoi (aux, num))
2646 res = false;
2649 res = true;
2652 return res;
2655 /* End of rec-sex.l */