1 #line 2 "rec-sex-lex.c"
2 /* This code goes at the "top" of the generated file. */
5 #line 6 "rec-sex-lex.c"
7 #define YY_INT_ALIGNED short int
9 /* A lexical scanner generated by flex */
14 /* %if-not-reentrant */
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
38 /* First, we deal with platform-specific or compiler-specific issues. */
40 /* begin standard C headers. */
48 /* %if-tables-serialization */
50 /* end standard C headers. */
53 /* flex integer type definitions */
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
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
;
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. */
86 #define INT8_MIN (-128)
89 #define INT16_MIN (-32767-1)
92 #define INT32_MIN (-2147483647-1)
95 #define INT8_MAX (127)
98 #define INT16_MAX (32767)
101 #define INT32_MAX (2147483647)
104 #define UINT8_MAX (255U)
107 #define UINT16_MAX (65535U)
110 #define UINT32_MAX (4294967295U)
115 #endif /* ! FLEXINT_H */
122 /* TODO: this is always defined, so inline it */
123 #define yyconst const
125 #if defined(__GNUC__) && __GNUC__ >= 3
126 #define yynoreturn __attribute__((__noreturn__))
131 /* %not-for-header */
133 /* Returned upon end-of-file. */
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
144 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
149 /* An opaque pointer. */
150 #ifndef YY_TYPEDEF_YY_SCANNER_T
151 #define YY_TYPEDEF_YY_SCANNER_T
152 typedef void* yyscan_t
;
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
168 /* %if-not-reentrant */
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
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. */
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
201 #define YY_BUF_SIZE 16384
202 #endif /* __ia64__ */
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
;
214 #ifndef YY_TYPEDEF_YY_SIZE_T
215 #define YY_TYPEDEF_YY_SIZE_T
216 typedef size_t yy_size_t
;
219 /* %if-not-reentrant */
223 /* %if-not-reentrant */
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. */
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 */ \
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
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
269 /* Number of characters read into yy_ch_buf, not including EOB
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
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
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
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
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 */
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
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] \
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 */
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
);
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
409 typedef unsigned char YY_CHAR
;
411 typedef int yy_state_type
;
413 #define yytext_ptr yytext_r
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
);
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; \
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. */
445 flex_int32_t yy_verify
;
448 static yyconst flex_int16_t yy_accept
[64] =
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,
459 static yyconst YY_CHAR yy_ec
[256] =
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,
491 static yyconst YY_CHAR yy_meta
[33] =
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,
499 static yyconst flex_uint16_t yy_base
[70] =
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] =
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] =
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] =
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] =
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"
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) \
614 if ((ci = rec_sex_parser_getc ((rec_sex_parser_t) yyextra)) == -1) \
620 buf[0] = (char) ci; \
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"
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.
647 #define YY_EXTRA_TYPE void *
649 /* %if-c-only Reentrant structure and macros (non-C++). */
652 /* Holds the entire state of the reentrant scanner. */
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. */
670 int yy_did_buffer_switch_on_eof
;
671 int yy_start_stack_ptr
;
672 int yy_start_stack_depth
;
674 yy_state_type yy_last_accepting_state
;
675 char* yy_last_accepting_cpos
;
686 }; /* end struct yyguts_t */
690 static int yy_init_globals (yyscan_t yyscanner
);
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
);
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
);
749 /* Macros after this point can all be overridden by user definitions in
753 #ifndef YY_SKIP_YYWRAP
755 extern "C" int sexwrap (yyscan_t yyscanner
);
757 extern int sexwrap (yyscan_t yyscanner
);
761 /* %not-for-header */
771 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
774 #ifdef YY_NEED_STRLEN
775 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
779 /* %if-c-only Standard (non-C++) definition */
780 /* %not-for-header */
783 static int yyinput (yyscan_t yyscanner
);
785 static int input (yyscan_t yyscanner
);
796 /* Amount of stuff to slurp up with each read. */
797 #ifndef YY_READ_BUF_SIZE
799 /* On IA-64, the buffer size is 16k, not 8k */
800 #define YY_READ_BUF_SIZE 16384
802 #define YY_READ_BUF_SIZE 8192
803 #endif /* __ia64__ */
806 /* Copy whatever the last rule matched to the standard output. */
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)
814 /* %if-c++-only C++ definition */
818 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
819 * is returned in "result".
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 ) \
828 for ( n = 0; n < max_size && \
829 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
832 buf[n++] = (char) c; \
833 if ( c == EOF && ferror( yyin ) ) \
834 YY_FATAL_ERROR( "input in flex scanner failed" ); \
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" ); \
852 /* %if-c++-only C++ definition \ */\
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.
862 #define yyterminate() return YY_NULL
865 /* Number of entries by which start-condition stack grows. */
866 #ifndef YY_START_STACK_INCR
867 #define YY_START_STACK_INCR 25
870 /* Report a fatal error. */
871 #ifndef YY_FATAL_ERROR
873 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
879 /* %if-tables-serialization structures and prototypes */
880 /* %not-for-header */
884 /* %not-for-header */
886 /* %tables-yydmap generated elements */
888 /* end tables serialization structures and prototypes */
892 /* Default declaration of generated scanner - a define so the user can
893 * easily add parameters.
896 #define YY_DECL_IS_OURS 1
897 /* %if-c-only Standard (non-C++) definition */
900 (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
902 #define YY_DECL int sexlex \
903 (YYSTYPE * yylval_param , yyscan_t yyscanner)
905 /* %if-c++-only C++ definition */
907 #endif /* !YY_DECL */
909 /* Code executed at the beginning of each rule, after yytext and yyleng
912 #ifndef YY_USER_ACTION
913 #define YY_USER_ACTION
916 /* Code executed at the end of each rule. */
918 #define YY_BREAK /*LINTED*/break;
921 /* %% [6.0] YY_RULE_SETUP definition goes here */
922 #define YY_RULE_SETUP \
925 /* %not-for-header */
927 /** The main scanner function which does all the work.
931 yy_state_type yy_current_state
;
934 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
936 yylval
= yylval_param
;
946 if ( ! yyg
->yy_start
)
947 yyg
->yy_start
= 1; /* first start state */
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
992 /* %% [9.0] code to set up and find next match goes here */
993 yy_current_state
= yyg
->yy_start
;
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
];
1012 while ( yy_base
[yy_current_state
] != 127 );
1015 /* %% [10.0] code to find the action number goes here */
1016 yy_act
= yy_accept
[yy_current_state
];
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
)
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",
1041 else if ( yy_act
== 33 )
1042 fprintf( stderr
, "--(end of buffer or a NUL)\n" );
1044 fprintf( stderr
, "--EOF (start condition %d)\n", YY_START
);
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
;
1058 /* rule 1 can match eol */
1060 #line 82 "../../src/rec-sex-lex.l"
1061 { /* Ignore whitespace */ }
1065 #line 84 "../../src/rec-sex-lex.l"
1068 * Create a real node.
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
;
1081 #line 97 "../../src/rec-sex-lex.l"
1084 * Create an integer node.
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
;
1097 #line 110 "../../src/rec-sex-lex.l"
1098 { return REC_SEX_TOK_ADD
; }
1102 #line 111 "../../src/rec-sex-lex.l"
1103 { return REC_SEX_TOK_SUB
; }
1107 #line 112 "../../src/rec-sex-lex.l"
1108 { return REC_SEX_TOK_DIV
; }
1112 #line 113 "../../src/rec-sex-lex.l"
1113 { return REC_SEX_TOK_MOD
; }
1117 #line 114 "../../src/rec-sex-lex.l"
1118 { return REC_SEX_TOK_AFTER
; }
1122 #line 115 "../../src/rec-sex-lex.l"
1123 { return REC_SEX_TOK_BEFORE
; }
1127 #line 116 "../../src/rec-sex-lex.l"
1128 { return REC_SEX_TOK_LTE
; }
1132 #line 117 "../../src/rec-sex-lex.l"
1133 { return REC_SEX_TOK_GTE
; }
1137 #line 118 "../../src/rec-sex-lex.l"
1138 { return REC_SEX_TOK_SAMETIME
; }
1142 #line 119 "../../src/rec-sex-lex.l"
1143 { return REC_SEX_TOK_IMPLIES
; }
1147 #line 120 "../../src/rec-sex-lex.l"
1148 { return REC_SEX_TOK_MUL
; }
1152 #line 121 "../../src/rec-sex-lex.l"
1153 { return REC_SEX_TOK_EQL
; }
1157 #line 122 "../../src/rec-sex-lex.l"
1158 { return REC_SEX_TOK_NEQ
; }
1162 #line 123 "../../src/rec-sex-lex.l"
1163 { return REC_SEX_TOK_NOT
; }
1167 #line 124 "../../src/rec-sex-lex.l"
1168 { return REC_SEX_TOK_MAT
; }
1172 #line 125 "../../src/rec-sex-lex.l"
1173 { return REC_SEX_TOK_GT
; }
1177 #line 126 "../../src/rec-sex-lex.l"
1178 { return REC_SEX_TOK_LT
; }
1182 #line 127 "../../src/rec-sex-lex.l"
1183 { return REC_SEX_TOK_BP
; }
1187 #line 128 "../../src/rec-sex-lex.l"
1188 { return REC_SEX_TOK_EP
; }
1192 #line 129 "../../src/rec-sex-lex.l"
1193 { return REC_SEX_TOK_AND
; }
1197 #line 130 "../../src/rec-sex-lex.l"
1198 { return REC_SEX_TOK_OR
; }
1202 #line 131 "../../src/rec-sex-lex.l"
1203 { return REC_SEX_TOK_SHARP
; }
1207 #line 132 "../../src/rec-sex-lex.l"
1208 { return REC_SEX_TOK_QM
; }
1212 #line 133 "../../src/rec-sex-lex.l"
1213 { return REC_SEX_TOK_COLON
; }
1217 #line 134 "../../src/rec-sex-lex.l"
1218 { return REC_SEX_TOK_AMP
; }
1222 #line 136 "../../src/rec-sex-lex.l"
1226 char *name
, *subname
;
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
;
1247 /* rule 30 can match eol */
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
;
1266 #line 173 "../../src/rec-sex-lex.l"
1267 { return REC_SEX_TOK_ERR
; }
1271 #line 175 "../../src/rec-sex-lex.l"
1274 #line 1275 "rec-sex-lex.c"
1275 case YY_STATE_EOF(INITIAL
):
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
;
1300 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
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
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
;
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
);
1376 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1382 case EOB_ACT_CONTINUE_SCAN
:
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
;
1392 case EOB_ACT_LAST_MATCH
:
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
;
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 */
1415 /* %not-for-header */
1417 /* %ok-for-header */
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
1429 static int yy_get_next_buffer (yyscan_t yyscanner
)
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
;
1440 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
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
;
1456 /* We matched some text prior to the EOB, first
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,
1475 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
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;
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
);
1505 /* Can't grow it, we don't own it. */
1506 b
->yy_ch_buf
= NULL
;
1508 if ( ! b
->yy_ch_buf
)
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
-
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
);
1539 ret_val
= EOB_ACT_LAST_MATCH
;
1540 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1541 YY_BUFFER_EOF_PENDING
;
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];
1565 /* yy_get_previous_state - get the state just before the EOB char was reached */
1568 /* %not-for-header */
1570 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
1575 yy_state_type yy_current_state
;
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
1606 * next_state = yy_try_NUL_trans( current_state );
1609 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
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
;
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);
1635 return yy_is_jam
? 0 : yy_current_state
;
1647 static int yyinput (yyscan_t yyscanner
)
1649 static int input (yyscan_t yyscanner
)
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';
1672 { /* need more input */
1673 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
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
);
1694 case EOB_ACT_END_OF_FILE
:
1696 if ( sexwrap(yyscanner
) )
1699 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
1702 return yyinput(yyscanner
);
1704 return input(yyscanner
);
1708 case EOB_ACT_CONTINUE_SCAN
:
1709 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
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 */
1724 #endif /* ifndef YY_NO_INPUT */
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 .
1733 void sexrestart (FILE * input_file
, yyscan_t yyscanner
)
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
);
1753 /** Switch to a different input buffer.
1754 * @param new_buffer The new input buffer.
1755 * @param yyscanner The scanner object.
1758 void sex_switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1763 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1765 /* TODO. We should be able to replace this entire function body
1767 * sexpop_buffer_state();
1768 * sexpush_buffer_state(new_buffer);
1770 sexensure_buffer_stack (yyscanner
);
1771 if ( YY_CURRENT_BUFFER
== new_buffer
)
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;
1794 static void sex_load_buffer_state (yyscan_t yyscanner
)
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
;
1803 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
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.
1817 YY_BUFFER_STATE
sex_create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
1824 b
= (YY_BUFFER_STATE
) sexalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
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
);
1847 /** Destroy the buffer.
1848 * @param b a buffer created with sex_create_buffer()
1849 * @param yyscanner The scanner object.
1852 void sex_delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1857 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
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.
1876 static void sex_init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
1883 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1885 sex_flush_buffer(b
,yyscanner
);
1888 b
->yy_input_file
= file
;
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;
1905 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
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.
1918 void sex_flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
1923 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
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];
1939 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1941 if ( b
== YY_CURRENT_BUFFER
)
1942 sex_load_buffer_state(yyscanner
);
1946 /** Pushes the new state onto the stack. The new state becomes
1947 * the current state. This function will allocate the stack
1949 * @param new_buffer The new state.
1950 * @param yyscanner The scanner object.
1953 void sexpush_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
1958 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1959 if (new_buffer
== NULL
)
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;
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.
1990 void sexpop_buffer_state (yyscan_t yyscanner
)
1995 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1996 if (!YY_CURRENT_BUFFER
)
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;
2012 /* Allocates the stack if it does not exist.
2013 * Guarantees space for at least one push.
2016 static void sexensure_buffer_stack (yyscan_t yyscanner
)
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
*)
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;
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
*)
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
;
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
)
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. */
2081 b
= (YY_BUFFER_STATE
) sexalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
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;
2092 b
->yy_fill_buffer
= 0;
2093 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2095 sex_switch_to_buffer(b
,yyscanner
);
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
);
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
)
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
);
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
);
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;
2156 #ifndef YY_EXIT_FAILURE
2157 #define YY_EXIT_FAILURE 2
2161 static void yynoreturn
yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
2163 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2165 (void) fprintf( stderr
, "%s\n", msg
);
2166 exit( YY_EXIT_FAILURE
);
2172 /* Redefine yyless() so it works in section 3 code. */
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; \
2189 /* Accessor methods (get/set functions) to struct members. */
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
;
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
)
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
)
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
;
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
;
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
;
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
;
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
;
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
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
;
2324 void sexset_out (FILE * _out_str
, yyscan_t yyscanner
)
2326 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
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
;
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
;
2355 void sexset_lval (YYSTYPE
* yylval_param
, yyscan_t yyscanner
)
2357 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2358 yylval
= yylval_param
;
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
){
2378 *ptr_yy_globals
= (yyscan_t
) sexalloc ( sizeof( struct yyguts_t
), NULL
);
2380 if (*ptr_yy_globals
== NULL
){
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
){
2411 *ptr_yy_globals
= (yyscan_t
) sexalloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
2413 if (*ptr_yy_globals
== NULL
){
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 */
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
;
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 */
2457 /* For future reference: Set errno on error, since we are called by
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
);
2490 /* Destroy the main struct (reentrant only). */
2491 sexfree ( yyscanner
, yyscanner
);
2499 * Internal utility routines.
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
;
2509 for ( i
= 0; i
< n
; ++i
)
2514 #ifdef YY_NEED_STRLEN
2515 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
2518 for ( n
= 0; s
[n
]; ++n
)
2525 void *sexalloc (yy_size_t size
, yyscan_t yyscanner
)
2527 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
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
;
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
;
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"
2559 /* %ok-for-header */
2561 #line 175 "../../src/rec-sex-lex.l"
2566 rec_sex_lex_extract_name (char *str
)
2573 while ((*p
!= '[') && (*p
!= '.') && (*p
!= 0))
2579 res
= malloc (size
+ 1);
2580 memcpy (res
, str
, size
);
2587 rec_sex_lex_extract_subname (char *str
)
2591 /* If there is not a subname denoted in STR then this function
2595 while ((*p
!= '.') && (*p
!= '\0'))
2602 /* There is not a second name. */
2606 p
++; /* Skip the dot separator. */
2608 return rec_sex_lex_extract_name (p
);
2612 rec_sex_lex_extract_index (char *str
,
2620 /* Note that this function assumes syntax correctness in STR if a
2625 while ((*p
!= 0) && (*p
!= '['))
2636 p
++; /* Pass the [. */
2639 aux
[aux_size
++] = *p
;
2644 if (!rec_atoi (aux
, num
))
2655 /* End of rec-sex.l */