1 #line 2 "jsgf_scanner.c"
3 #line 4 "jsgf_scanner.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 35
13 #if YY_FLEX_SUBMINOR_VERSION > 0
17 /* First, we deal with platform-specific or compiler-specific issues. */
19 /* begin standard C headers. */
25 /* end standard C headers. */
27 /* flex integer type definitions */
32 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
34 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
36 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
37 * if you want the limit (max/min) macros for int types.
39 #ifndef __STDC_LIMIT_MACROS
40 #define __STDC_LIMIT_MACROS 1
44 typedef int8_t flex_int8_t;
45 typedef uint8_t flex_uint8_t;
46 typedef int16_t flex_int16_t;
47 typedef uint16_t flex_uint16_t;
48 typedef int32_t flex_int32_t;
49 typedef uint32_t flex_uint32_t;
51 typedef signed char flex_int8_t;
52 typedef short int flex_int16_t;
53 typedef int flex_int32_t;
54 typedef unsigned char flex_uint8_t;
55 typedef unsigned short int flex_uint16_t;
56 typedef unsigned int flex_uint32_t;
59 /* Limits of integral types. */
61 #define INT8_MIN (-128)
64 #define INT16_MIN (-32767-1)
67 #define INT32_MIN (-2147483647-1)
70 #define INT8_MAX (127)
73 #define INT16_MAX (32767)
76 #define INT32_MAX (2147483647)
79 #define UINT8_MAX (255U)
82 #define UINT16_MAX (65535U)
85 #define UINT32_MAX (4294967295U)
88 #endif /* ! FLEXINT_H */
92 /* The "const" storage-class-modifier is valid. */
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
106 #define yyconst const
111 /* Returned upon end-of-file. */
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* An opaque pointer. */
122 #ifndef YY_TYPEDEF_YY_SCANNER_T
123 #define YY_TYPEDEF_YY_SCANNER_T
124 typedef void* yyscan_t;
127 /* For convenience, these vars (plus the bison vars far below)
128 are macros in the reentrant scanner. */
129 #define yyin yyg->yyin_r
130 #define yyout yyg->yyout_r
131 #define yyextra yyg->yyextra_r
132 #define yyleng yyg->yyleng_r
133 #define yytext yyg->yytext_r
134 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
135 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
136 #define yy_flex_debug yyg->yy_flex_debug_r
138 /* Enter a start condition. This macro really ought to take a parameter,
139 * but we do it the disgusting crufty way forced on us by the ()-less
140 * definition of BEGIN.
142 #define BEGIN yyg->yy_start = 1 + 2 *
144 /* Translate the current start state into a value that can be later handed
145 * to BEGIN to return to the state. The YYSTATE alias is for lex
148 #define YY_START ((yyg->yy_start - 1) / 2)
149 #define YYSTATE YY_START
151 /* Action number for EOF rule of a given start state. */
152 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
154 /* Special action meaning "start processing a new file". */
155 #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
157 #define YY_END_OF_BUFFER_CHAR 0
159 /* Size of default input buffer. */
161 #define YY_BUF_SIZE 16384
164 /* The state buf must be large enough to hold one state per character in the main buffer.
166 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
168 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
169 #define YY_TYPEDEF_YY_BUFFER_STATE
170 typedef struct yy_buffer_state *YY_BUFFER_STATE;
173 #define EOB_ACT_CONTINUE_SCAN 0
174 #define EOB_ACT_END_OF_FILE 1
175 #define EOB_ACT_LAST_MATCH 2
177 #define YY_LESS_LINENO(n)
179 /* Return all but the first "n" matched characters back to the input stream. */
183 /* Undo effects of setting up yytext. */ \
184 int yyless_macro_arg = (n); \
185 YY_LESS_LINENO(yyless_macro_arg);\
186 *yy_cp = yyg->yy_hold_char; \
187 YY_RESTORE_YY_MORE_OFFSET \
188 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
189 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
193 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
195 #ifndef YY_TYPEDEF_YY_SIZE_T
196 #define YY_TYPEDEF_YY_SIZE_T
197 typedef size_t yy_size_t;
200 #ifndef YY_STRUCT_YY_BUFFER_STATE
201 #define YY_STRUCT_YY_BUFFER_STATE
202 struct yy_buffer_state
206 char *yy_ch_buf; /* input buffer */
207 char *yy_buf_pos; /* current position in input buffer */
209 /* Size of input buffer in bytes, not including room for EOB
212 yy_size_t yy_buf_size;
214 /* Number of characters read into yy_ch_buf, not including EOB
219 /* Whether we "own" the buffer - i.e., we know we created it,
220 * and can realloc() it to grow it, and should free() it to
223 int yy_is_our_buffer;
225 /* Whether this is an "interactive" input source; if so, and
226 * if we're using stdio for input, then we want to use getc()
227 * instead of fread(), to make sure we stop fetching input after
230 int yy_is_interactive;
232 /* Whether we're considered to be at the beginning of a line.
233 * If so, '^' rules will be active on the next match, otherwise
238 int yy_bs_lineno; /**< The line count. */
239 int yy_bs_column; /**< The column count. */
241 /* Whether to try to fill the input buffer when we reach the
246 int yy_buffer_status;
248 #define YY_BUFFER_NEW 0
249 #define YY_BUFFER_NORMAL 1
250 /* When an EOF's been seen but there's still some text to process
251 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
252 * shouldn't try reading from the input source any more. We might
253 * still have a bunch of tokens to match, though, because of
254 * possible backing-up.
256 * When we actually see the EOF, we change the status to "new"
257 * (via yyrestart()), so that the user can continue scanning by
258 * just pointing yyin at a new input file.
260 #define YY_BUFFER_EOF_PENDING 2
263 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
265 /* We provide macros for accessing buffer states in case in the
266 * future we want to put the buffer states in a more general
269 * Returns the top of the stack, or NULL.
271 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
272 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
275 /* Same as previous macro, but useful when we know that the buffer stack is not
276 * NULL or when we need an lvalue. For internal use only.
278 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
280 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
281 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
282 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
283 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
284 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
285 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
286 void yypop_buffer_state (yyscan_t yyscanner );
288 static void yyensure_buffer_stack (yyscan_t yyscanner );
289 static void yy_load_buffer_state (yyscan_t yyscanner );
290 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
292 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
294 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
295 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
296 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
298 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
299 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
300 void yyfree (void * ,yyscan_t yyscanner );
302 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
306 if ( ! YY_CURRENT_BUFFER ){ \
307 yyensure_buffer_stack (yyscanner); \
308 YY_CURRENT_BUFFER_LVALUE = \
309 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
311 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
314 #define yy_set_bol(at_bol) \
316 if ( ! YY_CURRENT_BUFFER ){\
317 yyensure_buffer_stack (yyscanner); \
318 YY_CURRENT_BUFFER_LVALUE = \
319 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
321 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
324 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
326 /* Begin user sect3 */
329 #define YY_SKIP_YYWRAP
331 typedef unsigned char YY_CHAR;
333 typedef int yy_state_type;
335 #define yytext_ptr yytext_r
337 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
338 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
339 static int yy_get_next_buffer (yyscan_t yyscanner );
340 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
342 /* Done after the current pattern has been matched and before the
343 * corresponding action - sets up yytext.
345 #define YY_DO_BEFORE_ACTION \
346 yyg->yytext_ptr = yy_bp; \
347 yyleng = (size_t) (yy_cp - yy_bp); \
348 yyg->yy_hold_char = *yy_cp; \
350 yyg->yy_c_buf_p = yy_cp;
352 #define YY_NUM_RULES 16
353 #define YY_END_OF_BUFFER 17
354 /* This struct is not used in this scanner,
355 but its presence is necessary. */
358 flex_int32_t yy_verify;
361 static yyconst flex_int16_t yy_accept[77] =
363 0, 0, 0, 0, 17, 12, 1, 1, 1, 12,
364 12, 15, 15, 15, 12, 12, 12, 15, 12, 5,
365 1, 5, 12, 12, 0, 12, 12, 12, 3, 0,
366 14, 0, 0, 12, 12, 12, 0, 0, 11, 12,
367 4, 13, 0, 12, 0, 12, 12, 12, 0, 0,
368 2, 14, 10, 12, 12, 12, 0, 0, 11, 12,
369 13, 0, 12, 12, 12, 12, 12, 6, 12, 12,
373 static yyconst flex_int32_t yy_ec[256] =
375 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
376 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 2, 1, 5, 6, 1, 1, 1, 1, 7,
379 7, 8, 7, 1, 1, 9, 10, 11, 11, 11,
380 11, 11, 11, 11, 11, 11, 11, 1, 7, 12,
381 7, 13, 1, 1, 1, 1, 1, 1, 1, 14,
382 15, 1, 1, 16, 1, 1, 1, 1, 1, 1,
383 1, 1, 17, 1, 1, 1, 1, 1, 1, 1,
384 7, 18, 7, 1, 1, 1, 19, 20, 21, 1,
386 1, 1, 22, 1, 23, 1, 1, 24, 25, 1,
387 26, 27, 1, 28, 1, 29, 30, 1, 1, 1,
388 1, 1, 31, 7, 32, 1, 1, 1, 1, 1,
389 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
390 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 33, 1, 1, 1,
395 34, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 35, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 static yyconst flex_int32_t yy_meta[36] =
407 1, 2, 2, 1, 1, 1, 2, 2, 1, 2,
408 1, 3, 3, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 static yyconst flex_int16_t yy_base[87] =
415 0, 0, 34, 37, 148, 0, 196, 196, 0, 44,
416 130, 196, 50, 0, 115, 116, 106, 32, 102, 196,
417 196, 124, 0, 75, 48, 0, 106, 116, 196, 121,
418 128, 58, 117, 110, 101, 107, 47, 52, 196, 91,
419 196, 196, 68, 0, 76, 0, 137, 108, 33, 119,
420 196, 196, 196, 96, 94, 93, 71, 94, 72, 104,
421 87, 97, 87, 74, 70, 73, 79, 0, 72, 45,
422 51, 35, 0, 0, 0, 196, 169, 47, 172, 175,
423 177, 180, 183, 186, 189, 192
426 static yyconst flex_int16_t yy_def[87] =
428 76, 1, 77, 77, 76, 78, 76, 76, 78, 79,
429 78, 76, 76, 80, 78, 78, 78, 81, 78, 76,
430 76, 76, 78, 79, 82, 78, 83, 78, 76, 76,
431 84, 76, 80, 78, 78, 78, 81, 85, 76, 78,
432 76, 76, 86, 24, 82, 24, 83, 78, 76, 84,
433 76, 76, 76, 78, 78, 78, 81, 85, 81, 78,
434 82, 86, 78, 78, 78, 78, 78, 78, 78, 78,
435 78, 78, 78, 78, 78, 0, 76, 76, 76, 76,
436 76, 76, 76, 76, 76, 76
439 static yyconst flex_int16_t yy_nxt[232] =
441 6, 7, 8, 9, 10, 11, 12, 12, 6, 13,
442 6, 14, 12, 6, 6, 6, 6, 6, 6, 6,
443 6, 15, 16, 6, 6, 6, 17, 6, 6, 6,
444 18, 12, 6, 6, 19, 21, 8, 21, 21, 8,
445 21, 22, 52, 49, 22, 25, 25, 23, 26, 38,
446 25, 25, 42, 25, 37, 25, 25, 29, 30, 31,
447 32, 27, 75, 39, 38, 43, 30, 52, 32, 58,
448 25, 74, 61, 73, 25, 25, 25, 25, 39, 26,
449 42, 25, 25, 59, 25, 62, 25, 25, 38, 38,
450 72, 42, 27, 43, 28, 71, 37, 70, 69, 25,
452 68, 61, 39, 39, 43, 25, 25, 45, 25, 67,
453 46, 58, 45, 45, 62, 45, 66, 45, 45, 65,
454 64, 51, 63, 47, 60, 59, 56, 55, 54, 53,
455 51, 49, 48, 41, 40, 36, 45, 45, 45, 25,
456 35, 46, 34, 45, 45, 28, 45, 76, 45, 45,
457 76, 76, 76, 76, 47, 76, 76, 76, 76, 76,
458 76, 76, 76, 76, 76, 76, 76, 45, 45, 20,
459 20, 20, 24, 24, 24, 33, 33, 37, 37, 37,
460 25, 25, 25, 44, 44, 44, 50, 50, 50, 57,
461 57, 57, 45, 45, 45, 5, 76, 76, 76, 76,
463 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
464 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
465 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
469 static yyconst flex_int16_t yy_chk[232] =
471 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
472 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
473 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
474 1, 1, 1, 1, 1, 3, 3, 3, 4, 4,
475 4, 3, 49, 49, 4, 10, 10, 78, 10, 18,
476 10, 10, 25, 10, 38, 10, 10, 13, 13, 13,
477 13, 10, 72, 18, 37, 25, 32, 32, 32, 38,
478 43, 71, 43, 70, 10, 10, 24, 24, 37, 24,
479 45, 24, 24, 38, 24, 43, 24, 24, 57, 59,
480 69, 61, 24, 45, 67, 66, 58, 65, 64, 62,
482 63, 62, 57, 59, 61, 24, 24, 27, 27, 60,
483 27, 58, 27, 27, 62, 27, 56, 27, 27, 55,
484 54, 50, 48, 27, 40, 58, 36, 35, 34, 33,
485 31, 30, 28, 22, 19, 17, 27, 27, 47, 47,
486 16, 47, 15, 47, 47, 11, 47, 5, 47, 47,
487 0, 0, 0, 0, 47, 0, 0, 0, 0, 0,
488 0, 0, 0, 0, 0, 0, 0, 47, 47, 77,
489 77, 77, 79, 79, 79, 80, 80, 81, 81, 81,
490 82, 82, 82, 83, 83, 83, 84, 84, 84, 85,
491 85, 85, 86, 86, 86, 76, 76, 76, 76, 76,
493 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
494 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
495 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
499 /* The intent behind this definition is that it'll catch
500 * any uses of REJECT which flex missed.
502 #define REJECT reject_used_but_not_detected
503 #define yymore() yymore_used_but_not_detected
504 #define YY_MORE_ADJ 0
505 #define YY_RESTORE_YY_MORE_OFFSET
506 #line 1 "_jsgf_scanner.l"
507 /* -*- mode: text -*- */
508 /* ====================================================================
509 * Copyright (c) 2007 Carnegie Mellon University. All rights
512 * Redistribution and use in source and binary forms, with or without
513 * modification, are permitted provided that the following conditions
516 * 1. Redistributions of source code must retain the above copyright
517 * notice, this list of conditions and the following disclaimer.
519 * 2. Redistributions in binary form must reproduce the above copyright
520 * notice, this list of conditions and the following disclaimer in
521 * the documentation and/or other materials provided with the
524 * This work was supported in part by funding from the Defense Advanced
525 * Research Projects Agency and the National Science Foundation of the
526 * United States of America, and the CMU Sphinx Speech Consortium.
528 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
529 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
530 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
531 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
532 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
533 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
534 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
535 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
536 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
537 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
538 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
540 * ====================================================================
543 /* YOU MUST USE FLEX 2.5.33 OR NEWER TO PROCESS THIS FILE!!! */
544 #line 39 "_jsgf_scanner.l"
546 #include "jsgf_internal.h"
547 #include "jsgf_parser.h"
550 #line 551 "jsgf_scanner.c"
555 #ifndef YY_NO_UNISTD_H
556 /* Special case for "unistd.h", since it is non-ANSI. We include it way
557 * down here because we want the user's section 1 to have been scanned first.
558 * The user has a chance to override it with an option.
563 #ifndef YY_EXTRA_TYPE
564 #define YY_EXTRA_TYPE void *
567 /* Holds the entire state of the reentrant scanner. */
571 /* User-defined. Not touched by flex. */
572 YY_EXTRA_TYPE yyextra_r;
574 /* The rest are the same as the globals declared in the non-reentrant scanner. */
575 FILE *yyin_r, *yyout_r;
576 size_t yy_buffer_stack_top; /**< index of top of stack. */
577 size_t yy_buffer_stack_max; /**< capacity of stack. */
578 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
585 int yy_did_buffer_switch_on_eof;
586 int yy_start_stack_ptr;
587 int yy_start_stack_depth;
589 yy_state_type yy_last_accepting_state;
590 char* yy_last_accepting_cpos;
601 }; /* end struct yyguts_t */
603 static int yy_init_globals (yyscan_t yyscanner );
605 /* This must go here because YYSTYPE and YYLTYPE are included
606 * from bison output in section 1.*/
607 # define yylval yyg->yylval_r
609 int yylex_init (yyscan_t* scanner);
611 int yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
613 /* Accessor methods to globals.
614 These are made visible to non-reentrant scanners for convenience. */
616 int yylex_destroy (yyscan_t yyscanner );
618 int yyget_debug (yyscan_t yyscanner );
620 void yyset_debug (int debug_flag ,yyscan_t yyscanner );
622 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
624 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
626 FILE *yyget_in (yyscan_t yyscanner );
628 void yyset_in (FILE * in_str ,yyscan_t yyscanner );
630 FILE *yyget_out (yyscan_t yyscanner );
632 void yyset_out (FILE * out_str ,yyscan_t yyscanner );
634 int yyget_leng (yyscan_t yyscanner );
636 char *yyget_text (yyscan_t yyscanner );
638 int yyget_lineno (yyscan_t yyscanner );
640 void yyset_lineno (int line_number ,yyscan_t yyscanner );
642 YYSTYPE * yyget_lval (yyscan_t yyscanner );
644 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
646 /* Macros after this point can all be overridden by user definitions in
650 #ifndef YY_SKIP_YYWRAP
652 extern "C" int yywrap (yyscan_t yyscanner );
654 extern int yywrap (yyscan_t yyscanner );
658 static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
661 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
664 #ifdef YY_NEED_STRLEN
665 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
671 static int yyinput (yyscan_t yyscanner );
673 static int input (yyscan_t yyscanner );
678 /* Amount of stuff to slurp up with each read. */
679 #ifndef YY_READ_BUF_SIZE
680 #define YY_READ_BUF_SIZE 8192
683 /* Copy whatever the last rule matched to the standard output. */
685 /* This used to be an fputs(), but since the string might contain NUL's,
686 * we now use fwrite().
688 #define ECHO fwrite( yytext, yyleng, 1, yyout )
691 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
692 * is returned in "result".
695 #define YY_INPUT(buf,result,max_size) \
696 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
700 for ( n = 0; n < max_size && \
701 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
704 buf[n++] = (char) c; \
705 if ( c == EOF && ferror( yyin ) ) \
706 YY_FATAL_ERROR( "input in flex scanner failed" ); \
712 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
714 if( errno != EINTR) \
716 YY_FATAL_ERROR( "input in flex scanner failed" ); \
727 /* No semi-colon after return; correct usage is to write "yyterminate();" -
728 * we don't want an extra ';' after the "return" because that will cause
729 * some compilers to complain about unreachable statements.
732 #define yyterminate() return YY_NULL
735 /* Number of entries by which start-condition stack grows. */
736 #ifndef YY_START_STACK_INCR
737 #define YY_START_STACK_INCR 25
740 /* Report a fatal error. */
741 #ifndef YY_FATAL_ERROR
742 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
745 /* end tables serialization structures and prototypes */
747 /* Default declaration of generated scanner - a define so the user can
748 * easily add parameters.
751 #define YY_DECL_IS_OURS 1
754 (YYSTYPE * yylval_param ,yyscan_t yyscanner);
756 #define YY_DECL int yylex \
757 (YYSTYPE * yylval_param , yyscan_t yyscanner)
758 #endif /* !YY_DECL */
760 /* Code executed at the beginning of each rule, after yytext and yyleng
763 #ifndef YY_USER_ACTION
764 #define YY_USER_ACTION
767 /* Code executed at the end of each rule. */
769 #define YY_BREAK break;
772 #define YY_RULE_SETUP \
775 /** The main scanner function which does all the work.
779 register yy_state_type yy_current_state;
780 register char *yy_cp, *yy_bp;
782 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
784 #line 57 "_jsgf_scanner.l"
787 #line 788 "jsgf_scanner.c"
789 yylval = yylval_param;
799 if ( ! yyg->yy_start )
800 yyg->yy_start = 1; /* first start state */
808 if ( ! YY_CURRENT_BUFFER ) {
809 yyensure_buffer_stack (yyscanner);
810 YY_CURRENT_BUFFER_LVALUE =
811 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
814 yy_load_buffer_state(yyscanner );
817 while ( 1 ) /* loops until end-of-file is reached */
819 yy_cp = yyg->yy_c_buf_p;
821 /* Support of yytext. */
822 *yy_cp = yyg->yy_hold_char;
824 /* yy_bp points to the position in yy_ch_buf of the start of
829 yy_current_state = yyg->yy_start;
833 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
834 if ( yy_accept[yy_current_state] )
836 yyg->yy_last_accepting_state = yy_current_state;
837 yyg->yy_last_accepting_cpos = yy_cp;
839 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
841 yy_current_state = (int) yy_def[yy_current_state];
842 if ( yy_current_state >= 77 )
843 yy_c = yy_meta[(unsigned int) yy_c];
845 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
848 while ( yy_base[yy_current_state] != 196 );
851 yy_act = yy_accept[yy_current_state];
853 { /* have to back up */
854 yy_cp = yyg->yy_last_accepting_cpos;
855 yy_current_state = yyg->yy_last_accepting_state;
856 yy_act = yy_accept[yy_current_state];
861 do_action: /* This label is used only to access EOF actions. */
864 { /* beginning of action switch */
865 case 0: /* must back up */
866 /* undo the effects of YY_DO_BEFORE_ACTION */
867 *yy_cp = yyg->yy_hold_char;
868 yy_cp = yyg->yy_last_accepting_cpos;
869 yy_current_state = yyg->yy_last_accepting_state;
873 /* rule 1 can match eol */
875 #line 59 "_jsgf_scanner.l"
876 ; /* ignore whitespace */
879 /* rule 2 can match eol */
881 #line 60 "_jsgf_scanner.l"
882 ; /* single-line comments */
886 #line 61 "_jsgf_scanner.l"
887 { BEGIN(COMMENT); } /* C-style comments */
891 #line 62 "_jsgf_scanner.l"
896 #line 63 "_jsgf_scanner.l"
897 ; /* Ignore stuff in comment mode */
901 #line 65 "_jsgf_scanner.l"
906 #line 66 "_jsgf_scanner.l"
911 #line 67 "_jsgf_scanner.l"
916 #line 68 "_jsgf_scanner.l"
920 /* rule 10 can match eol */
922 #line 70 "_jsgf_scanner.l"
923 { yylval->name = strdup(yytext); return RULENAME; }
926 /* rule 11 can match eol */
928 #line 71 "_jsgf_scanner.l"
929 { yylval->name = strdup(yytext); return TAG; }
933 #line 72 "_jsgf_scanner.l"
934 { yylval->name = strdup(yytext); return TOKEN; }
937 /* rule 13 can match eol */
939 #line 73 "_jsgf_scanner.l"
940 { yylval->name = strdup(yytext); return TOKEN; }
944 #line 74 "_jsgf_scanner.l"
945 { yylval->weight = atof_c(yytext+1); return WEIGHT; }
949 #line 76 "_jsgf_scanner.l"
950 return yytext[0]; /* Single-character tokens */
954 #line 78 "_jsgf_scanner.l"
957 #line 958 "jsgf_scanner.c"
958 case YY_STATE_EOF(INITIAL):
959 case YY_STATE_EOF(COMMENT):
962 case YY_END_OF_BUFFER:
964 /* Amount of text matched not including the EOB char. */
965 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
967 /* Undo the effects of YY_DO_BEFORE_ACTION. */
968 *yy_cp = yyg->yy_hold_char;
969 YY_RESTORE_YY_MORE_OFFSET
971 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
973 /* We're scanning a new file or input source. It's
974 * possible that this happened because the user
975 * just pointed yyin at a new source and called
976 * yylex(). If so, then we have to assure
977 * consistency between YY_CURRENT_BUFFER and our
978 * globals. Here is the right place to do so, because
979 * this is the first action (other than possibly a
980 * back-up) that will match for the new input source.
982 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
983 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
984 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
987 /* Note that here we test for yy_c_buf_p "<=" to the position
988 * of the first EOB in the buffer, since yy_c_buf_p will
989 * already have been incremented past the NUL character
990 * (since all states make transitions on EOB to the
991 * end-of-buffer state). Contrast this with the test
994 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
995 { /* This was really a NUL. */
996 yy_state_type yy_next_state;
998 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
1000 yy_current_state = yy_get_previous_state( yyscanner );
1002 /* Okay, we're now positioned to make the NUL
1003 * transition. We couldn't have
1004 * yy_get_previous_state() go ahead and do it
1005 * for us because it doesn't know how to deal
1006 * with the possibility of jamming (and we don't
1007 * want to build jamming into it because then it
1008 * will run more slowly).
1011 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
1013 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1015 if ( yy_next_state )
1017 /* Consume the NUL. */
1018 yy_cp = ++yyg->yy_c_buf_p;
1019 yy_current_state = yy_next_state;
1025 yy_cp = yyg->yy_c_buf_p;
1026 goto yy_find_action;
1030 else switch ( yy_get_next_buffer( yyscanner ) )
1032 case EOB_ACT_END_OF_FILE:
1034 yyg->yy_did_buffer_switch_on_eof = 0;
1036 if ( yywrap(yyscanner ) )
1038 /* Note: because we've taken care in
1039 * yy_get_next_buffer() to have set up
1040 * yytext, we can now set up
1041 * yy_c_buf_p so that if some total
1042 * hoser (like flex itself) wants to
1043 * call the scanner after we return the
1044 * YY_NULL, it'll still work - another
1045 * YY_NULL will get returned.
1047 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
1049 yy_act = YY_STATE_EOF(YY_START);
1055 if ( ! yyg->yy_did_buffer_switch_on_eof )
1061 case EOB_ACT_CONTINUE_SCAN:
1063 yyg->yytext_ptr + yy_amount_of_matched_text;
1065 yy_current_state = yy_get_previous_state( yyscanner );
1067 yy_cp = yyg->yy_c_buf_p;
1068 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1071 case EOB_ACT_LAST_MATCH:
1073 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
1075 yy_current_state = yy_get_previous_state( yyscanner );
1077 yy_cp = yyg->yy_c_buf_p;
1078 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
1079 goto yy_find_action;
1086 "fatal flex scanner internal error--no action found" );
1087 } /* end of action switch */
1088 } /* end of scanning one token */
1089 } /* end of yylex */
1091 /* yy_get_next_buffer - try to read in a new buffer
1093 * Returns a code representing an action:
1094 * EOB_ACT_LAST_MATCH -
1095 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1096 * EOB_ACT_END_OF_FILE - end of file
1098 static int yy_get_next_buffer (yyscan_t yyscanner)
1100 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1101 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1102 register char *source = yyg->yytext_ptr;
1103 register int number_to_move, i;
1106 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
1108 "fatal flex scanner internal error--end of buffer missed" );
1110 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1111 { /* Don't try to fill the buffer, so this is an EOF. */
1112 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
1114 /* We matched a single character, the EOB, so
1115 * treat this as a final EOF.
1117 return EOB_ACT_END_OF_FILE;
1122 /* We matched some text prior to the EOB, first
1125 return EOB_ACT_LAST_MATCH;
1129 /* Try to read more data. */
1131 /* First move last chars to start of buffer. */
1132 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
1134 for ( i = 0; i < number_to_move; ++i )
1135 *(dest++) = *(source++);
1137 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1138 /* don't do the read, it's not guaranteed to return an EOF,
1141 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
1146 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1148 while ( num_to_read <= 0 )
1149 { /* Not enough room in the buffer - grow it. */
1151 /* just a shorter name for the current buffer */
1152 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1154 int yy_c_buf_p_offset =
1155 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
1157 if ( b->yy_is_our_buffer )
1159 int new_size = b->yy_buf_size * 2;
1161 if ( new_size <= 0 )
1162 b->yy_buf_size += b->yy_buf_size / 8;
1164 b->yy_buf_size *= 2;
1166 b->yy_ch_buf = (char *)
1167 /* Include room in for 2 EOB chars. */
1168 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
1171 /* Can't grow it, we don't own it. */
1174 if ( ! b->yy_ch_buf )
1176 "fatal error - scanner input buffer overflow" );
1178 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1180 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1185 if ( num_to_read > YY_READ_BUF_SIZE )
1186 num_to_read = YY_READ_BUF_SIZE;
1188 /* Read in more data. */
1189 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1190 yyg->yy_n_chars, (size_t) num_to_read );
1192 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1195 if ( yyg->yy_n_chars == 0 )
1197 if ( number_to_move == YY_MORE_ADJ )
1199 ret_val = EOB_ACT_END_OF_FILE;
1200 yyrestart(yyin ,yyscanner);
1205 ret_val = EOB_ACT_LAST_MATCH;
1206 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1207 YY_BUFFER_EOF_PENDING;
1212 ret_val = EOB_ACT_CONTINUE_SCAN;
1214 if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1215 /* Extend the array by 50%, plus the number we really need. */
1216 yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
1217 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
1218 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1219 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1222 yyg->yy_n_chars += number_to_move;
1223 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1224 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1226 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1231 /* yy_get_previous_state - get the state just before the EOB char was reached */
1233 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
1235 register yy_state_type yy_current_state;
1236 register char *yy_cp;
1237 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1239 yy_current_state = yyg->yy_start;
1241 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
1243 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1244 if ( yy_accept[yy_current_state] )
1246 yyg->yy_last_accepting_state = yy_current_state;
1247 yyg->yy_last_accepting_cpos = yy_cp;
1249 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1251 yy_current_state = (int) yy_def[yy_current_state];
1252 if ( yy_current_state >= 77 )
1253 yy_c = yy_meta[(unsigned int) yy_c];
1255 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1258 return yy_current_state;
1261 /* yy_try_NUL_trans - try to make a transition on the NUL character
1264 * next_state = yy_try_NUL_trans( current_state );
1266 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
1268 register int yy_is_jam;
1269 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
1270 register char *yy_cp = yyg->yy_c_buf_p;
1272 register YY_CHAR yy_c = 1;
1273 if ( yy_accept[yy_current_state] )
1275 yyg->yy_last_accepting_state = yy_current_state;
1276 yyg->yy_last_accepting_cpos = yy_cp;
1278 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1280 yy_current_state = (int) yy_def[yy_current_state];
1281 if ( yy_current_state >= 77 )
1282 yy_c = yy_meta[(unsigned int) yy_c];
1284 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1285 yy_is_jam = (yy_current_state == 76);
1287 return yy_is_jam ? 0 : yy_current_state;
1290 static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
1292 register char *yy_cp;
1293 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1295 yy_cp = yyg->yy_c_buf_p;
1297 /* undo effects of setting up yytext */
1298 *yy_cp = yyg->yy_hold_char;
1300 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1301 { /* need to shift things up to make room */
1302 /* +2 for EOB chars. */
1303 register int number_to_move = yyg->yy_n_chars + 2;
1304 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1305 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1306 register char *source =
1307 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1309 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1310 *--dest = *--source;
1312 yy_cp += (int) (dest - source);
1313 yy_bp += (int) (dest - source);
1314 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1315 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1317 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1318 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1321 *--yy_cp = (char) c;
1323 yyg->yytext_ptr = yy_bp;
1324 yyg->yy_hold_char = *yy_cp;
1325 yyg->yy_c_buf_p = yy_cp;
1330 static int yyinput (yyscan_t yyscanner)
1332 static int input (yyscan_t yyscanner)
1337 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1339 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1341 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1343 /* yy_c_buf_p now points to the character we want to return.
1344 * If this occurs *before* the EOB characters, then it's a
1345 * valid NUL; if not, then we've hit the end of the buffer.
1347 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
1348 /* This was really a NUL. */
1349 *yyg->yy_c_buf_p = '\0';
1352 { /* need more input */
1353 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
1356 switch ( yy_get_next_buffer( yyscanner ) )
1358 case EOB_ACT_LAST_MATCH:
1359 /* This happens because yy_g_n_b()
1360 * sees that we've accumulated a
1361 * token and flags that we need to
1362 * try matching the token before
1363 * proceeding. But for input(),
1364 * there's no matching to consider.
1365 * So convert the EOB_ACT_LAST_MATCH
1366 * to EOB_ACT_END_OF_FILE.
1369 /* Reset buffer status. */
1370 yyrestart(yyin ,yyscanner);
1374 case EOB_ACT_END_OF_FILE:
1376 if ( yywrap(yyscanner ) )
1379 if ( ! yyg->yy_did_buffer_switch_on_eof )
1382 return yyinput(yyscanner);
1384 return input(yyscanner);
1388 case EOB_ACT_CONTINUE_SCAN:
1389 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
1395 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
1396 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
1397 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
1401 #endif /* ifndef YY_NO_INPUT */
1403 /** Immediately switch to a different input stream.
1404 * @param input_file A readable stream.
1405 * @param yyscanner The scanner object.
1406 * @note This function does not reset the start condition to @c INITIAL .
1408 void yyrestart (FILE * input_file , yyscan_t yyscanner)
1410 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1412 if ( ! YY_CURRENT_BUFFER ){
1413 yyensure_buffer_stack (yyscanner);
1414 YY_CURRENT_BUFFER_LVALUE =
1415 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1418 yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
1419 yy_load_buffer_state(yyscanner );
1422 /** Switch to a different input buffer.
1423 * @param new_buffer The new input buffer.
1424 * @param yyscanner The scanner object.
1426 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1428 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1430 /* TODO. We should be able to replace this entire function body
1432 * yypop_buffer_state();
1433 * yypush_buffer_state(new_buffer);
1435 yyensure_buffer_stack (yyscanner);
1436 if ( YY_CURRENT_BUFFER == new_buffer )
1439 if ( YY_CURRENT_BUFFER )
1441 /* Flush out information for old buffer. */
1442 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1443 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1444 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1447 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1448 yy_load_buffer_state(yyscanner );
1450 /* We don't actually know whether we did this switch during
1451 * EOF (yywrap()) processing, but the only time this flag
1452 * is looked at is after yywrap() is called, so it's safe
1453 * to go ahead and always set it.
1455 yyg->yy_did_buffer_switch_on_eof = 1;
1458 static void yy_load_buffer_state (yyscan_t yyscanner)
1460 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1461 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1462 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1463 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1464 yyg->yy_hold_char = *yyg->yy_c_buf_p;
1467 /** Allocate and initialize an input buffer state.
1468 * @param file A readable stream.
1469 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1470 * @param yyscanner The scanner object.
1471 * @return the allocated buffer state.
1473 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
1477 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1479 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1481 b->yy_buf_size = size;
1483 /* yy_ch_buf has to be 2 characters longer than the size given because
1484 * we need to put in 2 end-of-buffer characters.
1486 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
1487 if ( ! b->yy_ch_buf )
1488 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1490 b->yy_is_our_buffer = 1;
1492 yy_init_buffer(b,file ,yyscanner);
1497 /** Destroy the buffer.
1498 * @param b a buffer created with yy_create_buffer()
1499 * @param yyscanner The scanner object.
1501 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1503 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1508 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1509 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1511 if ( b->yy_is_our_buffer )
1512 yyfree((void *) b->yy_ch_buf ,yyscanner );
1514 yyfree((void *) b ,yyscanner );
1518 extern int isatty (int );
1519 #endif /* __cplusplus */
1521 /* Initializes or reinitializes a buffer.
1522 * This function is sometimes called more than once on the same buffer,
1523 * such as during a yyrestart() or at EOF.
1525 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
1529 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1531 yy_flush_buffer(b ,yyscanner);
1533 b->yy_input_file = file;
1534 b->yy_fill_buffer = 1;
1536 /* If b is the current buffer, then yy_init_buffer was _probably_
1537 * called from yyrestart() or through yy_get_next_buffer.
1538 * In that case, we don't want to reset the lineno or column.
1540 if (b != YY_CURRENT_BUFFER){
1541 b->yy_bs_lineno = 1;
1542 b->yy_bs_column = 0;
1545 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1550 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1551 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1552 * @param yyscanner The scanner object.
1554 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
1556 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1562 /* We always need two end-of-buffer characters. The first causes
1563 * a transition to the end-of-buffer state. The second causes
1564 * a jam in that state.
1566 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1567 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1569 b->yy_buf_pos = &b->yy_ch_buf[0];
1572 b->yy_buffer_status = YY_BUFFER_NEW;
1574 if ( b == YY_CURRENT_BUFFER )
1575 yy_load_buffer_state(yyscanner );
1578 /** Pushes the new state onto the stack. The new state becomes
1579 * the current state. This function will allocate the stack
1581 * @param new_buffer The new state.
1582 * @param yyscanner The scanner object.
1584 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
1586 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1587 if (new_buffer == NULL)
1590 yyensure_buffer_stack(yyscanner);
1592 /* This block is copied from yy_switch_to_buffer. */
1593 if ( YY_CURRENT_BUFFER )
1595 /* Flush out information for old buffer. */
1596 *yyg->yy_c_buf_p = yyg->yy_hold_char;
1597 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
1598 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
1601 /* Only push if top exists. Otherwise, replace top. */
1602 if (YY_CURRENT_BUFFER)
1603 yyg->yy_buffer_stack_top++;
1604 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1606 /* copied from yy_switch_to_buffer. */
1607 yy_load_buffer_state(yyscanner );
1608 yyg->yy_did_buffer_switch_on_eof = 1;
1611 /** Removes and deletes the top of the stack, if present.
1612 * The next element becomes the new top.
1613 * @param yyscanner The scanner object.
1615 void yypop_buffer_state (yyscan_t yyscanner)
1617 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1618 if (!YY_CURRENT_BUFFER)
1621 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
1622 YY_CURRENT_BUFFER_LVALUE = NULL;
1623 if (yyg->yy_buffer_stack_top > 0)
1624 --yyg->yy_buffer_stack_top;
1626 if (YY_CURRENT_BUFFER) {
1627 yy_load_buffer_state(yyscanner );
1628 yyg->yy_did_buffer_switch_on_eof = 1;
1632 /* Allocates the stack if it does not exist.
1633 * Guarantees space for at least one push.
1635 static void yyensure_buffer_stack (yyscan_t yyscanner)
1638 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1640 if (!yyg->yy_buffer_stack) {
1642 /* First allocation is just for 2 elements, since we don't know if this
1643 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1644 * immediate realloc on the next call.
1647 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
1648 (num_to_alloc * sizeof(struct yy_buffer_state*)
1650 if ( ! yyg->yy_buffer_stack )
1651 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1653 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1655 yyg->yy_buffer_stack_max = num_to_alloc;
1656 yyg->yy_buffer_stack_top = 0;
1660 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
1662 /* Increase the buffer to prepare for a possible push. */
1663 int grow_size = 8 /* arbitrary grow size */;
1665 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
1666 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
1667 (yyg->yy_buffer_stack,
1668 num_to_alloc * sizeof(struct yy_buffer_state*)
1670 if ( ! yyg->yy_buffer_stack )
1671 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1673 /* zero only the new slots.*/
1674 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
1675 yyg->yy_buffer_stack_max = num_to_alloc;
1679 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1680 * @param base the character buffer
1681 * @param size the size in bytes of the character buffer
1682 * @param yyscanner The scanner object.
1683 * @return the newly allocated buffer state object.
1685 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
1690 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1691 base[size-1] != YY_END_OF_BUFFER_CHAR )
1692 /* They forgot to leave room for the EOB's. */
1695 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
1697 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1699 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1700 b->yy_buf_pos = b->yy_ch_buf = base;
1701 b->yy_is_our_buffer = 0;
1702 b->yy_input_file = 0;
1703 b->yy_n_chars = b->yy_buf_size;
1704 b->yy_is_interactive = 0;
1706 b->yy_fill_buffer = 0;
1707 b->yy_buffer_status = YY_BUFFER_NEW;
1709 yy_switch_to_buffer(b ,yyscanner );
1714 /** Setup the input buffer state to scan a string. The next call to yylex() will
1715 * scan from a @e copy of @a str.
1716 * @param yystr a NUL-terminated string to scan
1717 * @param yyscanner The scanner object.
1718 * @return the newly allocated buffer state object.
1719 * @note If you want to scan bytes that may contain NUL values, then use
1720 * yy_scan_bytes() instead.
1722 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
1725 return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
1728 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1729 * scan from a @e copy of @a bytes.
1730 * @param bytes the byte buffer to scan
1731 * @param len the number of bytes in the buffer pointed to by @a bytes.
1732 * @param yyscanner The scanner object.
1733 * @return the newly allocated buffer state object.
1735 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
1742 /* Get memory for full buffer, including space for trailing EOB's. */
1743 n = _yybytes_len + 2;
1744 buf = (char *) yyalloc(n ,yyscanner );
1746 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1748 for ( i = 0; i < _yybytes_len; ++i )
1749 buf[i] = yybytes[i];
1751 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1753 b = yy_scan_buffer(buf,n ,yyscanner);
1755 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1757 /* It's okay to grow etc. this buffer, and we should throw it
1758 * away when we're done.
1760 b->yy_is_our_buffer = 1;
1765 #ifndef YY_EXIT_FAILURE
1766 #define YY_EXIT_FAILURE 2
1769 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
1771 (void) fprintf( stderr, "%s\n", msg );
1772 exit( YY_EXIT_FAILURE );
1775 /* Redefine yyless() so it works in section 3 code. */
1781 /* Undo effects of setting up yytext. */ \
1782 int yyless_macro_arg = (n); \
1783 YY_LESS_LINENO(yyless_macro_arg);\
1784 yytext[yyleng] = yyg->yy_hold_char; \
1785 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
1786 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
1787 *yyg->yy_c_buf_p = '\0'; \
1788 yyleng = yyless_macro_arg; \
1792 /* Accessor methods (get/set functions) to struct members. */
1794 /** Get the user-defined data for this scanner.
1795 * @param yyscanner The scanner object.
1797 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
1799 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1803 /** Get the current line number.
1804 * @param yyscanner The scanner object.
1806 int yyget_lineno (yyscan_t yyscanner)
1808 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1810 if (! YY_CURRENT_BUFFER)
1816 /** Get the current column number.
1817 * @param yyscanner The scanner object.
1819 int yyget_column (yyscan_t yyscanner)
1821 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1823 if (! YY_CURRENT_BUFFER)
1829 /** Get the input stream.
1830 * @param yyscanner The scanner object.
1832 FILE *yyget_in (yyscan_t yyscanner)
1834 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1838 /** Get the output stream.
1839 * @param yyscanner The scanner object.
1841 FILE *yyget_out (yyscan_t yyscanner)
1843 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1847 /** Get the length of the current token.
1848 * @param yyscanner The scanner object.
1850 int yyget_leng (yyscan_t yyscanner)
1852 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1856 /** Get the current token.
1857 * @param yyscanner The scanner object.
1860 char *yyget_text (yyscan_t yyscanner)
1862 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1866 /** Set the user-defined data. This data is never touched by the scanner.
1867 * @param user_defined The data to be associated with this scanner.
1868 * @param yyscanner The scanner object.
1870 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
1872 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1873 yyextra = user_defined ;
1876 /** Set the current line number.
1877 * @param line_number
1878 * @param yyscanner The scanner object.
1880 void yyset_lineno (int line_number , yyscan_t yyscanner)
1882 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1884 /* lineno is only valid if an input buffer exists. */
1885 if (! YY_CURRENT_BUFFER )
1886 yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
1888 yylineno = line_number;
1891 /** Set the current column.
1892 * @param line_number
1893 * @param yyscanner The scanner object.
1895 void yyset_column (int column_no , yyscan_t yyscanner)
1897 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1899 /* column is only valid if an input buffer exists. */
1900 if (! YY_CURRENT_BUFFER )
1901 yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
1903 yycolumn = column_no;
1906 /** Set the input stream. This does not discard the current
1908 * @param in_str A readable stream.
1909 * @param yyscanner The scanner object.
1910 * @see yy_switch_to_buffer
1912 void yyset_in (FILE * in_str , yyscan_t yyscanner)
1914 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1918 void yyset_out (FILE * out_str , yyscan_t yyscanner)
1920 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1924 int yyget_debug (yyscan_t yyscanner)
1926 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1927 return yy_flex_debug;
1930 void yyset_debug (int bdebug , yyscan_t yyscanner)
1932 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1933 yy_flex_debug = bdebug ;
1936 /* Accessor methods for yylval and yylloc */
1938 YYSTYPE * yyget_lval (yyscan_t yyscanner)
1940 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1944 void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
1946 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1947 yylval = yylval_param;
1950 /* User-visible API */
1952 /* yylex_init is special because it creates the scanner itself, so it is
1953 * the ONLY reentrant function that doesn't take the scanner as the last argument.
1954 * That's why we explicitly handle the declaration, instead of using our macros.
1957 int yylex_init(yyscan_t* ptr_yy_globals)
1960 if (ptr_yy_globals == NULL){
1965 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
1967 if (*ptr_yy_globals == NULL){
1972 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
1973 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
1975 return yy_init_globals ( *ptr_yy_globals );
1978 /* yylex_init_extra has the same functionality as yylex_init, but follows the
1979 * convention of taking the scanner as the last argument. Note however, that
1980 * this is a *pointer* to a scanner, as it will be allocated by this call (and
1981 * is the reason, too, why this function also must handle its own declaration).
1982 * The user defined value in the first argument will be available to yyalloc in
1983 * the yyextra field.
1986 int yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
1989 struct yyguts_t dummy_yyguts;
1991 yyset_extra (yy_user_defined, &dummy_yyguts);
1993 if (ptr_yy_globals == NULL){
1998 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2000 if (*ptr_yy_globals == NULL){
2005 /* By setting to 0xAA, we expose bugs in
2006 yy_init_globals. Leave at 0x00 for releases. */
2007 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2009 yyset_extra (yy_user_defined, *ptr_yy_globals);
2011 return yy_init_globals ( *ptr_yy_globals );
2014 static int yy_init_globals (yyscan_t yyscanner)
2016 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2017 /* Initialization is the same as for the non-reentrant scanner.
2018 * This function is called from yylex_destroy(), so don't allocate here.
2021 yyg->yy_buffer_stack = 0;
2022 yyg->yy_buffer_stack_top = 0;
2023 yyg->yy_buffer_stack_max = 0;
2024 yyg->yy_c_buf_p = (char *) 0;
2028 yyg->yy_start_stack_ptr = 0;
2029 yyg->yy_start_stack_depth = 0;
2030 yyg->yy_start_stack = NULL;
2032 /* Defined in main.c */
2041 /* For future reference: Set errno on error, since we are called by
2047 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2048 int yylex_destroy (yyscan_t yyscanner)
2050 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2052 /* Pop the buffer stack, destroying each element. */
2053 while(YY_CURRENT_BUFFER){
2054 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
2055 YY_CURRENT_BUFFER_LVALUE = NULL;
2056 yypop_buffer_state(yyscanner);
2059 /* Destroy the stack itself. */
2060 yyfree(yyg->yy_buffer_stack ,yyscanner);
2061 yyg->yy_buffer_stack = NULL;
2063 /* Destroy the start condition stack. */
2064 yyfree(yyg->yy_start_stack ,yyscanner );
2065 yyg->yy_start_stack = NULL;
2067 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2068 * yylex() is called, initialization will occur. */
2069 yy_init_globals( yyscanner);
2071 /* Destroy the main struct (reentrant only). */
2072 yyfree ( yyscanner , yyscanner );
2078 * Internal utility routines.
2082 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
2085 for ( i = 0; i < n; ++i )
2090 #ifdef YY_NEED_STRLEN
2091 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
2094 for ( n = 0; s[n]; ++n )
2101 void *yyalloc (yy_size_t size , yyscan_t yyscanner)
2103 return (void *) malloc( size );
2106 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
2108 /* The cast to (char *) in the following accommodates both
2109 * implementations that use char* generic pointers, and those
2110 * that use void* generic pointers. It works with the latter
2111 * because both ANSI C and C++ allow castless assignment from
2112 * any pointer type to void*, and deal with argument conversions
2113 * as though doing an assignment.
2115 return (void *) realloc( (char *) ptr, size );
2118 void yyfree (void * ptr , yyscan_t yyscanner)
2120 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2123 #define YYTABLES_NAME "yytables"
2125 #line 78 "_jsgf_scanner.l"