source: trunk/essentials/sys-devel/flex/flex.skl@ 3320

Last change on this file since 3320 was 3043, checked in by bird, 18 years ago

-> essentials

File size: 82.5 KB
Line 
1%# -*-C-*- vi: set ft=c:
2%# This file is processed in several stages.
3%# Here are the stages, as best as I can describe:
4%#
5%# 1. flex.skl is processed through GNU m4 during the
6%# pre-compilation stage of flex. Only macros starting
7%# with `m4preproc_' are processed, and quoting is normal.
8%#
9%# 2. The preprocessed skeleton is translated verbatim into a
10%# C array, saved as "skel.c" and compiled into the flex binary.
11%#
12%# 3. At runtime, the skeleton is generated and filtered (again)
13%# through m4. Macros beginning with `m4_' will be processed.
14%# The quoting is "[[" and "]]" so we don't interfere with
15%# user code.
16%#
17%# All generate macros for the m4 stage contain the text "m4" or "M4"
18%# in them. This is to distinguish them from CPP macros.
19%# The exception to this rule is YY_G, which is an m4 macro,
20%# but it needs to be remain short because it is used everywhere.
21%#
22/* A lexical scanner generated by flex */
23
24%# Macros for preproc stage.
25m4preproc_changecom
26
27%# Macros for runtime processing stage.
28m4_changecom
29m4_changequote
30m4_changequote([[, ]])
31
32%#
33%# Lines in this skeleton starting with a "%" character are "control lines"
34%# and affect the generation of the scanner. The possible control codes are
35%# listed and processed in misc.c.
36%#
37%# %# - A comment. The current line is omitted from the generated scanner.
38%# %if-c++-only - The following lines are printed for C++ scanners ONLY.
39%# %if-c-only - The following lines are NOT printed for C++ scanners.
40%# %if-c-or-c++ - The following lines are printed in BOTH C and C++ scanners.
41%# %if-reentrant - Print for reentrant scanners.(push)
42%# %if-not-reentrant - Print for non-reentrant scanners. (push)
43%# %if-bison-bridge - Print for bison-bridge. (push)
44%# %if-not-bison-bridge - Print for non-bison-bridge. (push)
45%# %endif - pop from the previous if code.
46%# %% - A stop-point, where code is inserted by flex.
47%# Each stop-point is numbered here and also in the code generator.
48%# (See gen.c, etc. for details.)
49%# %not-for-header - Begin code that should NOT appear in a ".h" file.
50%# %ok-for-header - %c and %e are used for building a header file.
51%# %if-tables-serialization
52%#
53%# All control-lines EXCEPT comment lines ("%#") will be inserted into
54%# the generated scanner as a C-style comment. This is to aid those who
55%# edit the skeleton.
56%#
57#define FLEX_SCANNER
58#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
59#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
60#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
61#if YY_FLEX_SUBMINOR_VERSION > 0
62#define FLEX_BETA
63#endif
64
65%# Some negated symbols
66m4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
67m4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
68
69%# This is the m4 way to say "(stack_used || is_reentrant)
70m4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
71m4_ifdef( [[M4_YY_REENTRANT]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
72
73%# Prefixes.
74%# The complexity here is necessary so that m4 preserves
75%# the argument lists to each C function.
76
77
78m4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
79
80m4preproc_define(`M4_GEN_PREFIX',
81 ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
82
83%if-c++-only
84 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
85 * following macro. This is required in order to pass the c++-multiple-scanners
86 * test in the regression suite. We get reports that it breaks inheritance.
87 * We will address this in a future release of flex, or omit the C++ scanner
88 * altogether.
89 */
90 #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
91%endif
92
93%if-c-only
94 M4_GEN_PREFIX(`_create_buffer')
95 M4_GEN_PREFIX(`_delete_buffer')
96 M4_GEN_PREFIX(`_scan_buffer')
97 M4_GEN_PREFIX(`_scan_string')
98 M4_GEN_PREFIX(`_scan_bytes')
99 M4_GEN_PREFIX(`_init_buffer')
100 M4_GEN_PREFIX(`_flush_buffer')
101 M4_GEN_PREFIX(`_load_buffer_state')
102 M4_GEN_PREFIX(`_switch_to_buffer')
103 M4_GEN_PREFIX(`push_buffer_state')
104 M4_GEN_PREFIX(`pop_buffer_state')
105 M4_GEN_PREFIX(`ensure_buffer_stack')
106 M4_GEN_PREFIX(`lex')
107 M4_GEN_PREFIX(`restart')
108 M4_GEN_PREFIX(`lex_init')
109 M4_GEN_PREFIX(`lex_destroy')
110 M4_GEN_PREFIX(`get_debug')
111 M4_GEN_PREFIX(`set_debug')
112 M4_GEN_PREFIX(`get_extra')
113 M4_GEN_PREFIX(`set_extra')
114 M4_GEN_PREFIX(`get_in')
115 M4_GEN_PREFIX(`set_in')
116 M4_GEN_PREFIX(`get_out')
117 M4_GEN_PREFIX(`set_out')
118 M4_GEN_PREFIX(`get_leng')
119 M4_GEN_PREFIX(`get_text')
120 M4_GEN_PREFIX(`get_lineno')
121 M4_GEN_PREFIX(`set_lineno')
122 m4_ifdef( [[M4_YY_REENTRANT]],
123 [[
124 M4_GEN_PREFIX(`get_column')
125 M4_GEN_PREFIX(`set_column')
126 ]])
127 M4_GEN_PREFIX(`wrap')
128%endif
129
130m4_ifdef( [[M4_YY_BISON_LVAL]],
131[[
132 M4_GEN_PREFIX(`get_lval')
133 M4_GEN_PREFIX(`set_lval')
134]])
135
136m4_ifdef( [[<M4_YY_BISON_LLOC>]],
137[[
138 M4_GEN_PREFIX(`get_lloc')
139 M4_GEN_PREFIX(`set_lloc')
140]])
141
142
143 M4_GEN_PREFIX(`alloc')
144 M4_GEN_PREFIX(`realloc')
145 M4_GEN_PREFIX(`free')
146
147%if-c-only
148m4_ifdef( [[M4_YY_NOT_REENTRANT]],
149[[
150 M4_GEN_PREFIX(`text')
151 M4_GEN_PREFIX(`leng')
152 M4_GEN_PREFIX(`in')
153 M4_GEN_PREFIX(`out')
154 M4_GEN_PREFIX(`_flex_debug')
155 M4_GEN_PREFIX(`lineno')
156]])
157%endif
158
159
160m4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
161[[
162 M4_GEN_PREFIX(`tables_fload')
163 M4_GEN_PREFIX(`tables_destroy')
164 M4_GEN_PREFIX(`TABLES_NAME')
165]])
166
167/* First, we deal with platform-specific or compiler-specific issues. */
168
169/* begin standard C headers. */
170%if-c-only
171#include <stdio.h>
172#include <string.h>
173#include <errno.h>
174#include <stdlib.h>
175%endif
176
177%if-tables-serialization
178#include <sys/types.h>
179#include <netinet/in.h>
180%endif
181/* end standard C headers. */
182
183%if-c-or-c++
184m4preproc_include(`flexint.h')
185%endif
186
187%if-c++-only
188/* begin standard C++ headers. */
189#include <iostream>
190#include <errno.h>
191#include <cstdlib>
192#include <cstring>
193/* end standard C++ headers. */
194%endif
195
196#ifdef __cplusplus
197
198/* The "const" storage-class-modifier is valid. */
199#define YY_USE_CONST
200
201#else /* ! __cplusplus */
202
203#if __STDC__
204
205#define YY_USE_CONST
206
207#endif /* __STDC__ */
208#endif /* ! __cplusplus */
209
210#ifdef YY_USE_CONST
211#define yyconst const
212#else
213#define yyconst
214#endif
215
216%# For compilers that can not handle prototypes.
217%# e.g.,
218%# The function prototype
219%# int foo(int x, char* y);
220%#
221%# ...should be written as
222%# int foo M4_YY_PARAMS(int x, char* y);
223%#
224%# ...which could possibly generate
225%# int foo ();
226%#
227m4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
228[[
229 m4_define( [[M4_YY_PARAMS]], [[()]])
230]],
231[[
232 m4_define( [[M4_YY_PARAMS]], [[($*)]])
233]])
234
235%not-for-header
236/* Returned upon end-of-file. */
237#define YY_NULL 0
238%ok-for-header
239
240%not-for-header
241/* Promotes a possibly negative, possibly signed char to an unsigned
242 * integer for use as an array index. If the signed char is negative,
243 * we want to instead treat it as an 8-bit unsigned char, hence the
244 * double cast.
245 */
246#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
247%ok-for-header
248
249
250
251%if-reentrant
252
253/* An opaque pointer. */
254#ifndef YY_TYPEDEF_YY_SCANNER_T
255#define YY_TYPEDEF_YY_SCANNER_T
256typedef void* yyscan_t;
257#endif
258
259%# Declare yyguts variable
260m4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
261%# For use wherever a Global is accessed or assigned.
262m4_define( [[YY_G]], [[yyg->$1]])
263
264%# For use in function prototypes to append the additional argument.
265m4_define( [[M4_YY_PROTO_LAST_ARG]], [[, yyscan_t yyscanner]])
266m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[yyscan_t yyscanner]])
267
268%# For use in function definitions to append the additional argument.
269m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
270[[
271 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
272 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
273]],
274[[
275 m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscan_t yyscanner]])
276 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscan_t yyscanner]])
277]])
278m4_define( [[M4_YY_DECL_LAST_ARG]], [[yyscan_t yyscanner;]])
279
280%# For use in function calls to pass the additional argument.
281m4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
282m4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
283
284%# For use in function documentation to adjust for additional argument.
285m4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
286
287/* For convenience, these vars (plus the bison vars far below)
288 are macros in the reentrant scanner. */
289#define yyin YY_G(yyin_r)
290#define yyout YY_G(yyout_r)
291#define yyextra YY_G(yyextra_r)
292#define yyleng YY_G(yyleng_r)
293#define yytext YY_G(yytext_r)
294#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
295#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
296#define yy_flex_debug YY_G(yy_flex_debug_r)
297
298m4_define( [[M4_YY_INCR_LINENO]],
299[[
300 do{ yylineno++;
301 yycolumn=0;
302 }while(0)
303]])
304
305int yylex_init M4_YY_PARAMS(yyscan_t* scanner);
306%endif
307
308
309
310%if-not-reentrant
311
312m4_define( [[M4_YY_INCR_LINENO]],
313[[
314 yylineno++;
315]])
316
317%# Define these macros to be no-ops.
318m4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
319m4_define( [[YY_G]], [[($1)]])
320m4_define( [[M4_YY_PROTO_LAST_ARG]])
321m4_define( [[M4_YY_PROTO_ONLY_ARG]], [[void]])
322m4_define( [[M4_YY_DEF_LAST_ARG]])
323
324m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
325[[
326 m4_define( [[M4_YY_DEF_ONLY_ARG]])
327]],
328[[
329 m4_define( [[M4_YY_DEF_ONLY_ARG]], [[void]])
330]])
331m4_define([[M4_YY_DECL_LAST_ARG]])
332m4_define([[M4_YY_CALL_LAST_ARG]])
333m4_define([[M4_YY_CALL_ONLY_ARG]])
334m4_define( [[M4_YY_DOC_PARAM]], [[]])
335
336%endif
337
338
339m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
340[[
341%# For compilers that need traditional function definitions.
342%# e.g.,
343%# The function prototype taking 2 arguments
344%# int foo (int x, char* y)
345%#
346%# ...should be written as
347%# int foo YYFARGS2(int,x, char*,y)
348%#
349%# ...which could possibly generate
350%# int foo (x,y,yyscanner)
351%# int x;
352%# char * y;
353%# yyscan_t yyscanner;
354%#
355%# Generate traditional function defs
356 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
357 M4_YY_DECL_LAST_ARG]])
358 m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
359 $1 $2; [[\]]
360 M4_YY_DECL_LAST_ARG]])
361 m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
362 $1 $2; [[\]]
363 $3 $4; [[\]]
364 M4_YY_DECL_LAST_ARG]])
365 m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
366 $1 $2; [[\]]
367 $3 $4; [[\]]
368 $5 $6; [[\]]
369 M4_YY_DECL_LAST_ARG]])
370]],
371[[
372%# Generate C99 function defs.
373 m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
374 m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
375 m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
376 m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
377]])
378
379m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
380[[
381/* Enter a start condition. This macro really ought to take a parameter,
382 * but we do it the disgusting crufty way forced on us by the ()-less
383 * definition of BEGIN.
384 */
385#define BEGIN YY_G(yy_start) = 1 + 2 *
386]])
387
388m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
389[[
390/* Translate the current start state into a value that can be later handed
391 * to BEGIN to return to the state. The YYSTATE alias is for lex
392 * compatibility.
393 */
394#define YY_START ((YY_G(yy_start) - 1) / 2)
395#define YYSTATE YY_START
396]])
397
398m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
399[[
400/* Action number for EOF rule of a given start state. */
401#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
402]])
403
404m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
405[[
406/* Special action meaning "start processing a new file". */
407#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
408]])
409
410m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
411[[
412#define YY_END_OF_BUFFER_CHAR 0
413]])
414
415m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
416[[
417/* Size of default input buffer. */
418#ifndef YY_BUF_SIZE
419#define YY_BUF_SIZE 16384
420#endif
421
422/* The state buf must be large enough to hold one state per character in the main buffer.
423 */
424#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
425]])
426
427
428#ifndef YY_TYPEDEF_YY_BUFFER_STATE
429#define YY_TYPEDEF_YY_BUFFER_STATE
430typedef struct yy_buffer_state *YY_BUFFER_STATE;
431#endif
432
433%if-not-reentrant
434extern int yyleng;
435%endif
436
437%if-c-only
438%if-not-reentrant
439extern FILE *yyin, *yyout;
440%endif
441%endif
442
443m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
444[[
445#define EOB_ACT_CONTINUE_SCAN 0
446#define EOB_ACT_END_OF_FILE 1
447#define EOB_ACT_LAST_MATCH 2
448]])
449
450m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
451[[
452 m4_ifdef( [[M4_YY_USE_LINENO]],
453 [[
454 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
455 * access to the local variable yy_act. Since yyless() is a macro, it would break
456 * existing scanners that call yyless() from OUTSIDE yylex.
457 * One obvious solution it to make yy_act a global. I tried that, and saw
458 * a 5% performance hit in a non-yylineno scanner, because yy_act is
459 * normally declared as a register variable-- so it is not worth it.
460 */
461 #define YY_LESS_LINENO(n) \
462 do { \
463 int yyl;\
464 for ( yyl = n; yyl < yyleng; ++yyl )\
465 if ( yytext[yyl] == '\n' )\
466 --yylineno;\
467 }while(0)
468 ]],
469 [[
470 #define YY_LESS_LINENO(n)
471 ]])
472]])
473
474m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
475[[
476/* Return all but the first "n" matched characters back to the input stream. */
477#define yyless(n) \
478 do \
479 { \
480 /* Undo effects of setting up yytext. */ \
481 int yyless_macro_arg = (n); \
482 YY_LESS_LINENO(yyless_macro_arg);\
483 *yy_cp = YY_G(yy_hold_char); \
484 YY_RESTORE_YY_MORE_OFFSET \
485 YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
486 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
487 } \
488 while ( 0 )
489]])
490
491m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
492[[
493#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
494]])
495
496/* The following is because we cannot portably get our hands on size_t
497 * (without autoconf's help, which isn't available because we want
498 * flex-generated scanners to compile on their own).
499 */
500
501#ifndef YY_TYPEDEF_YY_SIZE_T
502#define YY_TYPEDEF_YY_SIZE_T
503typedef unsigned int yy_size_t;
504#endif
505
506#ifndef YY_STRUCT_YY_BUFFER_STATE
507#define YY_STRUCT_YY_BUFFER_STATE
508struct yy_buffer_state
509 {
510%if-c-only
511 FILE *yy_input_file;
512%endif
513
514%if-c++-only
515 std::istream* yy_input_file;
516%endif
517
518
519 char *yy_ch_buf; /* input buffer */
520 char *yy_buf_pos; /* current position in input buffer */
521
522 /* Size of input buffer in bytes, not including room for EOB
523 * characters.
524 */
525 yy_size_t yy_buf_size;
526
527 /* Number of characters read into yy_ch_buf, not including EOB
528 * characters.
529 */
530 int yy_n_chars;
531
532 /* Whether we "own" the buffer - i.e., we know we created it,
533 * and can realloc() it to grow it, and should free() it to
534 * delete it.
535 */
536 int yy_is_our_buffer;
537
538 /* Whether this is an "interactive" input source; if so, and
539 * if we're using stdio for input, then we want to use getc()
540 * instead of fread(), to make sure we stop fetching input after
541 * each newline.
542 */
543 int yy_is_interactive;
544
545 /* Whether we're considered to be at the beginning of a line.
546 * If so, '^' rules will be active on the next match, otherwise
547 * not.
548 */
549 int yy_at_bol;
550
551 int yy_bs_lineno; /**< The line count. */
552 int yy_bs_column; /**< The column count. */
553
554
555 /* Whether to try to fill the input buffer when we reach the
556 * end of it.
557 */
558 int yy_fill_buffer;
559
560 int yy_buffer_status;
561m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
562[[
563#define YY_BUFFER_NEW 0
564#define YY_BUFFER_NORMAL 1
565 /* When an EOF's been seen but there's still some text to process
566 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
567 * shouldn't try reading from the input source any more. We might
568 * still have a bunch of tokens to match, though, because of
569 * possible backing-up.
570 *
571 * When we actually see the EOF, we change the status to "new"
572 * (via yyrestart()), so that the user can continue scanning by
573 * just pointing yyin at a new input file.
574 */
575#define YY_BUFFER_EOF_PENDING 2
576]])
577 };
578#endif /* !YY_STRUCT_YY_BUFFER_STATE */
579
580%if-c-only Standard (non-C++) definition
581%not-for-header
582%if-not-reentrant
583
584/* Stack of input buffers. */
585static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
586static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
587static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
588%endif
589%ok-for-header
590%endif
591
592m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
593[[
594/* We provide macros for accessing buffer states in case in the
595 * future we want to put the buffer states in a more general
596 * "scanner state".
597 *
598 * Returns the top of the stack, or NULL.
599 */
600#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
601 ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
602 : NULL)
603]])
604
605m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
606[[
607/* Same as previous macro, but useful when we know that the buffer stack is not
608 * NULL or when we need an lvalue. For internal use only.
609 */
610#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
611]])
612
613%if-c-only Standard (non-C++) definition
614
615%if-not-reentrant
616%not-for-header
617/* yy_hold_char holds the character lost when yytext is formed. */
618static char yy_hold_char;
619static int yy_n_chars; /* number of characters read into yy_ch_buf */
620int yyleng;
621
622/* Points to current character in buffer. */
623static char *yy_c_buf_p = (char *) 0;
624static int yy_init = 0; /* whether we need to initialize */
625static int yy_start = 0; /* start state number */
626
627/* Flag which is used to allow yywrap()'s to do buffer switches
628 * instead of setting up a fresh yyin. A bit of a hack ...
629 */
630static int yy_did_buffer_switch_on_eof;
631%ok-for-header
632%endif
633
634void yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
635void yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
636YY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
637void yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
638void yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
639void yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
640void yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
641
642m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
643[[
644static void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
645static void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
646static void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
647]])
648
649m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
650[[
651#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
652]])
653
654YY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
655YY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
656YY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, int len M4_YY_PROTO_LAST_ARG );
657
658%endif
659
660void *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
661void *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
662void yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
663
664m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
665[[
666#define yy_new_buffer yy_create_buffer
667]])
668
669m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
670[[
671#define yy_set_interactive(is_interactive) \
672 { \
673 if ( ! YY_CURRENT_BUFFER ){ \
674 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
675 YY_CURRENT_BUFFER_LVALUE = \
676 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
677 } \
678 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
679 }
680]])
681
682m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
683[[
684#define yy_set_bol(at_bol) \
685 { \
686 if ( ! YY_CURRENT_BUFFER ){\
687 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
688 YY_CURRENT_BUFFER_LVALUE = \
689 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
690 } \
691 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
692 }
693]])
694
695m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
696[[
697#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
698]])
699
700%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
701
702%if-c-only Standard (non-C++) definition
703
704m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
705[[
706static yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
707static yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state M4_YY_PROTO_LAST_ARG);
708static int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
709static void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
710]])
711
712%endif
713
714m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
715[[
716/* Done after the current pattern has been matched and before the
717 * corresponding action - sets up yytext.
718 */
719#define YY_DO_BEFORE_ACTION \
720 YY_G(yytext_ptr) = yy_bp; \
721%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
722 YY_G(yy_hold_char) = *yy_cp; \
723 *yy_cp = '\0'; \
724%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
725 YY_G(yy_c_buf_p) = yy_cp;
726]])
727
728m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
729[[
730%% [4.0] data tables for the DFA and the user's section 1 definitions go here
731]])
732
733m4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
734M4_YY_SC_DEFS
735m4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
736
737m4_ifdef( [[M4_YY_NO_UNISTD_H]],,
738[[
739#ifndef YY_NO_UNISTD_H
740/* Special case for "unistd.h", since it is non-ANSI. We include it way
741 * down here because we want the user's section 1 to have been scanned first.
742 * The user has a chance to override it with an option.
743 */
744%if-c-only
745#include <unistd.h>
746%endif
747%if-c++-only
748#include <unistd.h>
749%endif
750#endif
751]])
752
753#ifndef YY_EXTRA_TYPE
754#define YY_EXTRA_TYPE void *
755#endif
756
757%if-c-only Reentrant structure and macros (non-C++).
758%if-reentrant
759
760m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
761[[
762/* Holds the entire state of the reentrant scanner. */
763struct yyguts_t
764 {
765
766 /* User-defined. Not touched by flex. */
767 YY_EXTRA_TYPE yyextra_r;
768
769 /* The rest are the same as the globals declared in the non-reentrant scanner. */
770 FILE *yyin_r, *yyout_r;
771 size_t yy_buffer_stack_top; /**< index of top of stack. */
772 size_t yy_buffer_stack_max; /**< capacity of stack. */
773 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
774 char yy_hold_char;
775 int yy_n_chars;
776 int yyleng_r;
777 char *yy_c_buf_p;
778 int yy_init;
779 int yy_start;
780 int yy_did_buffer_switch_on_eof;
781 int yy_start_stack_ptr;
782 int yy_start_stack_depth;
783 int *yy_start_stack;
784 yy_state_type yy_last_accepting_state;
785 char* yy_last_accepting_cpos;
786
787 int yylineno_r;
788 int yy_flex_debug_r;
789
790m4_ifdef( [[M4_YY_USES_REJECT]],
791[[
792 yy_state_type *yy_state_buf;
793 yy_state_type *yy_state_ptr;
794 char *yy_full_match;
795 int yy_lp;
796]])
797
798m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
799[[
800 char yytext_r[YYLMAX];
801 char *yytext_ptr;
802 int yy_more_offset;
803 int yy_prev_more_offset;
804]],
805[[
806 char *yytext_r;
807 int yy_more_flag;
808 int yy_more_len;
809]])
810
811m4_ifdef( [[M4_YY_BISON_LVAL]],
812[[
813 YYSTYPE * yylval_r;
814]])
815
816m4_ifdef( [[<M4_YY_BISON_LLOC>]],
817[[
818 YYLTYPE * yylloc_r;
819]])
820
821 }; /* end struct yyguts_t */
822]])
823
824
825%if-c-only
826m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
827[[
828static int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
829]])
830%endif
831
832%if-reentrant
833
834m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
835[[
836 m4_ifdef( [[M4_YY_BISON_LVAL]],
837 [[
838 /* This must go here because YYSTYPE and YYLTYPE are included
839 * from bison output in section 1.*/
840 # define yylval YY_G(yylval_r)
841 ]])
842
843 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
844 [[
845 # define yylloc YY_G(yylloc_r)
846 ]])
847]])
848
849%endif
850
851/* Accessor methods to globals.
852 These are made visible to non-reentrant scanners for convenience. */
853
854m4_ifdef( [[M4_YY_NO_DESTROY]],,
855[[
856int yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
857]])
858
859m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
860[[
861int yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
862]])
863
864m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
865[[
866void yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
867]])
868
869m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
870[[
871YY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
872]])
873
874m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
875[[
876void yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
877]])
878
879m4_ifdef( [[M4_YY_NO_GET_IN]],,
880[[
881FILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
882]])
883
884m4_ifdef( [[M4_YY_NO_SET_IN]],,
885[[
886void yyset_in M4_YY_PARAMS( FILE * in_str M4_YY_PROTO_LAST_ARG );
887]])
888
889m4_ifdef( [[M4_YY_NO_GET_OUT]],,
890[[
891FILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
892]])
893
894m4_ifdef( [[M4_YY_NO_SET_OUT]],,
895[[
896void yyset_out M4_YY_PARAMS( FILE * out_str M4_YY_PROTO_LAST_ARG );
897]])
898
899m4_ifdef( [[M4_YY_NO_GET_LENG]],,
900[[
901int yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
902]])
903
904m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
905[[
906char *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
907]])
908
909m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
910[[
911int yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
912]])
913
914m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
915[[
916void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
917]])
918
919%if-bison-bridge
920m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
921[[
922YYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
923]])
924
925void yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
926
927m4_ifdef( [[<M4_YY_BISON_LLOC>]],
928[[
929 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
930 [[
931 YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
932 ]])
933
934 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
935 [[
936 void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
937 ]])
938]])
939%endif
940%endif End reentrant structures and macros.
941
942/* Macros after this point can all be overridden by user definitions in
943 * section 1.
944 */
945
946#ifndef YY_SKIP_YYWRAP
947#ifdef __cplusplus
948extern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
949#else
950extern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
951#endif
952#endif
953
954%not-for-header
955 m4_ifdef( [[M4_YY_NO_UNPUT]],,
956 [[
957 static void yyunput M4_YY_PARAMS( int c, char *buf_ptr M4_YY_PROTO_LAST_ARG);
958 ]])
959%ok-for-header
960%endif
961
962#ifndef yytext_ptr
963static void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
964#endif
965
966#ifdef YY_NEED_STRLEN
967static int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
968#endif
969
970#ifndef YY_NO_INPUT
971%if-c-only Standard (non-C++) definition
972%not-for-header
973#ifdef __cplusplus
974static int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
975#else
976static int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
977#endif
978%ok-for-header
979%endif
980#endif
981
982
983%if-c-only
984%# TODO: This is messy.
985m4_ifdef( [[M4_YY_STACK_USED]],
986[[
987
988m4_ifdef( [[M4_YY_NOT_REENTRANT]],
989[[
990 m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
991 [[
992 static int yy_start_stack_ptr = 0;
993 static int yy_start_stack_depth = 0;
994 static int *yy_start_stack = NULL;
995 ]])
996]])
997
998m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
999[[
1000 m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1001 [[
1002 static void yy_push_state M4_YY_PARAMS( int new_state M4_YY_PROTO_LAST_ARG);
1003 ]])
1004 m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1005 [[
1006 static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1007 ]])
1008 m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1009 [[
1010 static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1011 ]])
1012]])
1013
1014]],
1015[[
1016m4_define( [[M4_YY_NO_PUSH_STATE]])
1017m4_define( [[M4_YY_NO_POP_STATE]])
1018m4_define( [[M4_YY_NO_TOP_STATE]])
1019]])
1020%endif
1021
1022/* Amount of stuff to slurp up with each read. */
1023#ifndef YY_READ_BUF_SIZE
1024#define YY_READ_BUF_SIZE 8192
1025#endif
1026
1027m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1028[[
1029/* Copy whatever the last rule matched to the standard output. */
1030#ifndef ECHO
1031%if-c-only Standard (non-C++) definition
1032/* This used to be an fputs(), but since the string might contain NUL's,
1033 * we now use fwrite().
1034 */
1035#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1036%endif
1037%if-c++-only C++ definition
1038#define ECHO LexerOutput( yytext, yyleng )
1039%endif
1040#endif
1041]])
1042
1043m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1044[[
1045/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1046 * is returned in "result".
1047 */
1048#ifndef YY_INPUT
1049#define YY_INPUT(buf,result,max_size) \
1050%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1051\
1052%if-c++-only C++ definition \
1053 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
1054 YY_FATAL_ERROR( "input in flex scanner failed" );
1055%endif
1056
1057#endif
1058]])
1059
1060m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1061[[
1062/* No semi-colon after return; correct usage is to write "yyterminate();" -
1063 * we don't want an extra ';' after the "return" because that will cause
1064 * some compilers to complain about unreachable statements.
1065 */
1066#ifndef yyterminate
1067#define yyterminate() return YY_NULL
1068#endif
1069]])
1070
1071/* Number of entries by which start-condition stack grows. */
1072#ifndef YY_START_STACK_INCR
1073#define YY_START_STACK_INCR 25
1074#endif
1075
1076m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1077[[
1078/* Report a fatal error. */
1079#ifndef YY_FATAL_ERROR
1080%if-c-only
1081#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1082%endif
1083%if-c++-only
1084#define YY_FATAL_ERROR(msg) LexerError( msg )
1085%endif
1086#endif
1087]])
1088
1089%if-tables-serialization structures and prototypes
1090m4preproc_include(`tables_shared.h')
1091
1092/* Load the DFA tables from the given stream. */
1093int yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1094
1095/* Unload the tables from memory. */
1096int yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1097%not-for-header
1098
1099/** Describes a mapping from a serialized table id to its deserialized state in
1100 * this scanner. This is the bridge between our "generic" deserialization code
1101 * and the specifics of this scanner.
1102 */
1103struct yytbl_dmap {
1104 enum yytbl_id dm_id;/**< table identifier */
1105 void **dm_arr; /**< address of pointer to store the deserialized table. */
1106 size_t dm_sz; /**< local sizeof() each element in table. */
1107};
1108
1109/** A {0,0,0}-terminated list of structs, forming the map */
1110static struct yytbl_dmap yydmap[] =
1111{
1112%tables-yydmap generated elements
1113 {0,0,0}
1114};
1115
1116/** A tables-reader object to maintain some state in the read. */
1117struct yytbl_reader {
1118 FILE * fp; /**< input stream */
1119 flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1120};
1121
1122%endif
1123/* end tables serialization structures and prototypes */
1124
1125%ok-for-header
1126
1127/* Default declaration of generated scanner - a define so the user can
1128 * easily add parameters.
1129 */
1130#ifndef YY_DECL
1131#define YY_DECL_IS_OURS 1
1132%if-c-only Standard (non-C++) definition
1133
1134
1135m4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1136m4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1137
1138m4_ifdef( [[M4_YY_BISON_LVAL]],
1139[[
1140 m4_dnl The bison pure parser is used. Redefine yylex to
1141 m4_dnl accept the lval parameter.
1142
1143 m4_define( [[M4_YY_LEX_PROTO]],
1144 [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1145 m4_define( [[M4_YY_LEX_DECLARATION]],
1146 [[YYFARGS1(YYSTYPE *,yylval_param)]])
1147]])
1148
1149m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1150[[
1151 m4_dnl Locations are used. yylex should also accept the ylloc parameter.
1152
1153 m4_define( [[M4_YY_LEX_PROTO]],
1154 [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1155 m4_define( [[M4_YY_LEX_DECLARATION]],
1156 [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1157]])
1158
1159extern int yylex M4_YY_LEX_PROTO;
1160
1161#define YY_DECL int yylex M4_YY_LEX_DECLARATION
1162%endif
1163%if-c++-only C++ definition
1164#define YY_DECL int yyFlexLexer::yylex()
1165%endif
1166#endif /* !YY_DECL */
1167
1168m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1169[[
1170/* Code executed at the beginning of each rule, after yytext and yyleng
1171 * have been set up.
1172 */
1173#ifndef YY_USER_ACTION
1174#define YY_USER_ACTION
1175#endif
1176]])
1177
1178m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1179[[
1180/* Code executed at the end of each rule. */
1181#ifndef YY_BREAK
1182#define YY_BREAK break;
1183#endif
1184]])
1185
1186m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1187[[
1188%% [6.0] YY_RULE_SETUP definition goes here
1189]])
1190
1191%not-for-header
1192/** The main scanner function which does all the work.
1193 */
1194YY_DECL
1195{
1196 register yy_state_type yy_current_state;
1197 register char *yy_cp, *yy_bp;
1198 register int yy_act;
1199 M4_YY_DECL_GUTS_VAR();
1200
1201m4_ifdef( [[M4_YY_NOT_REENTRANT]],
1202[[
1203 m4_ifdef( [[M4_YY_BISON_LVAL]],
1204 [[
1205 YYSTYPE * yylval;
1206 ]])
1207 m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1208 [[
1209 YYLTYPE * yylloc;
1210 ]])
1211]])
1212
1213%% [7.0] user's declarations go here
1214
1215m4_ifdef( [[M4_YY_BISON_LVAL]],
1216[[
1217 yylval = yylval_param;
1218]])
1219
1220m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1221[[
1222 yylloc = yylloc_param;
1223]])
1224
1225 if ( !YY_G(yy_init) )
1226 {
1227 YY_G(yy_init) = 1;
1228
1229#ifdef YY_USER_INIT
1230 YY_USER_INIT;
1231#endif
1232
1233m4_ifdef( [[M4_YY_USES_REJECT]],
1234[[
1235 /* Create the reject buffer large enough to save one state per allowed character. */
1236 if ( ! YY_G(yy_state_buf) )
1237 YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);
1238]])
1239
1240 if ( ! YY_G(yy_start) )
1241 YY_G(yy_start) = 1; /* first start state */
1242
1243 if ( ! yyin )
1244%if-c-only
1245 yyin = stdin;
1246%endif
1247%if-c++-only
1248 yyin = & std::cin;
1249%endif
1250
1251 if ( ! yyout )
1252%if-c-only
1253 yyout = stdout;
1254%endif
1255%if-c++-only
1256 yyout = & std::cout;
1257%endif
1258
1259 if ( ! YY_CURRENT_BUFFER ) {
1260 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1261 YY_CURRENT_BUFFER_LVALUE =
1262 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1263 }
1264
1265 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1266 }
1267
1268 while ( 1 ) /* loops until end-of-file is reached */
1269 {
1270%% [8.0] yymore()-related code goes here
1271 yy_cp = YY_G(yy_c_buf_p);
1272
1273 /* Support of yytext. */
1274 *yy_cp = YY_G(yy_hold_char);
1275
1276 /* yy_bp points to the position in yy_ch_buf of the start of
1277 * the current run.
1278 */
1279 yy_bp = yy_cp;
1280
1281%% [9.0] code to set up and find next match goes here
1282
1283yy_find_action:
1284%% [10.0] code to find the action number goes here
1285
1286 YY_DO_BEFORE_ACTION;
1287
1288%% [11.0] code for yylineno update goes here
1289
1290do_action: /* This label is used only to access EOF actions. */
1291
1292%% [12.0] debug code goes here
1293
1294 switch ( yy_act )
1295 { /* beginning of action switch */
1296%% [13.0] actions go here
1297
1298 case YY_END_OF_BUFFER:
1299 {
1300 /* Amount of text matched not including the EOB char. */
1301 int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1302
1303 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1304 *yy_cp = YY_G(yy_hold_char);
1305 YY_RESTORE_YY_MORE_OFFSET
1306
1307 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1308 {
1309 /* We're scanning a new file or input source. It's
1310 * possible that this happened because the user
1311 * just pointed yyin at a new source and called
1312 * yylex(). If so, then we have to assure
1313 * consistency between YY_CURRENT_BUFFER and our
1314 * globals. Here is the right place to do so, because
1315 * this is the first action (other than possibly a
1316 * back-up) that will match for the new input source.
1317 */
1318 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1319 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1320 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1321 }
1322
1323 /* Note that here we test for yy_c_buf_p "<=" to the position
1324 * of the first EOB in the buffer, since yy_c_buf_p will
1325 * already have been incremented past the NUL character
1326 * (since all states make transitions on EOB to the
1327 * end-of-buffer state). Contrast this with the test
1328 * in input().
1329 */
1330 if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1331 { /* This was really a NUL. */
1332 yy_state_type yy_next_state;
1333
1334 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1335
1336 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1337
1338 /* Okay, we're now positioned to make the NUL
1339 * transition. We couldn't have
1340 * yy_get_previous_state() go ahead and do it
1341 * for us because it doesn't know how to deal
1342 * with the possibility of jamming (and we don't
1343 * want to build jamming into it because then it
1344 * will run more slowly).
1345 */
1346
1347 yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1348
1349 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1350
1351 if ( yy_next_state )
1352 {
1353 /* Consume the NUL. */
1354 yy_cp = ++YY_G(yy_c_buf_p);
1355 yy_current_state = yy_next_state;
1356 goto yy_match;
1357 }
1358
1359 else
1360 {
1361%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1362 goto yy_find_action;
1363 }
1364 }
1365
1366 else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1367 {
1368 case EOB_ACT_END_OF_FILE:
1369 {
1370 YY_G(yy_did_buffer_switch_on_eof) = 0;
1371
1372 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1373 {
1374 /* Note: because we've taken care in
1375 * yy_get_next_buffer() to have set up
1376 * yytext, we can now set up
1377 * yy_c_buf_p so that if some total
1378 * hoser (like flex itself) wants to
1379 * call the scanner after we return the
1380 * YY_NULL, it'll still work - another
1381 * YY_NULL will get returned.
1382 */
1383 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1384
1385 yy_act = YY_STATE_EOF(YY_START);
1386 goto do_action;
1387 }
1388
1389 else
1390 {
1391 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1392 YY_NEW_FILE;
1393 }
1394 break;
1395 }
1396
1397 case EOB_ACT_CONTINUE_SCAN:
1398 YY_G(yy_c_buf_p) =
1399 YY_G(yytext_ptr) + yy_amount_of_matched_text;
1400
1401 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1402
1403 yy_cp = YY_G(yy_c_buf_p);
1404 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1405 goto yy_match;
1406
1407 case EOB_ACT_LAST_MATCH:
1408 YY_G(yy_c_buf_p) =
1409 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1410
1411 yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1412
1413 yy_cp = YY_G(yy_c_buf_p);
1414 yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1415 goto yy_find_action;
1416 }
1417 break;
1418 }
1419
1420 default:
1421 YY_FATAL_ERROR(
1422 "fatal flex scanner internal error--no action found" );
1423 } /* end of action switch */
1424 } /* end of scanning one token */
1425} /* end of yylex */
1426%ok-for-header
1427
1428%if-c++-only
1429%not-for-header
1430yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1431{
1432 yyin = arg_yyin;
1433 yyout = arg_yyout;
1434 yy_c_buf_p = 0;
1435 yy_init = 0;
1436 yy_start = 0;
1437 yy_flex_debug = 0;
1438 yylineno = 1; // this will only get updated if %option yylineno
1439
1440 yy_did_buffer_switch_on_eof = 0;
1441
1442 yy_looking_for_trail_begin = 0;
1443 yy_more_flag = 0;
1444 yy_more_len = 0;
1445 yy_more_offset = yy_prev_more_offset = 0;
1446
1447 yy_start_stack_ptr = yy_start_stack_depth = 0;
1448 yy_start_stack = NULL;
1449
1450 YY_G(yy_buffer_stack) = 0;
1451 YY_G(yy_buffer_stack_top) = 0;
1452 YY_G(yy_buffer_stack_max) = 0;
1453
1454
1455m4_ifdef( [[M4_YY_USES_REJECT]],
1456[[
1457 yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1458]],
1459[[
1460 yy_state_buf = 0;
1461]])
1462}
1463
1464yyFlexLexer::~yyFlexLexer()
1465{
1466 delete [] yy_state_buf;
1467 yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1468 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1469}
1470
1471void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1472{
1473 if ( new_in )
1474 {
1475 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1476 yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1477 }
1478
1479 if ( new_out )
1480 yyout = new_out;
1481}
1482
1483#ifdef YY_INTERACTIVE
1484int yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1485#else
1486int yyFlexLexer::LexerInput( char* buf, int max_size )
1487#endif
1488{
1489 if ( yyin->eof() || yyin->fail() )
1490 return 0;
1491
1492#ifdef YY_INTERACTIVE
1493 yyin->get( buf[0] );
1494
1495 if ( yyin->eof() )
1496 return 0;
1497
1498 if ( yyin->bad() )
1499 return -1;
1500
1501 return 1;
1502
1503#else
1504 (void) yyin->read( buf, max_size );
1505
1506 if ( yyin->bad() )
1507 return -1;
1508 else
1509 return yyin->gcount();
1510#endif
1511}
1512
1513void yyFlexLexer::LexerOutput( const char* buf, int size )
1514{
1515 (void) yyout->write( buf, size );
1516}
1517%ok-for-header
1518%endif
1519
1520m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1521[[
1522/* yy_get_next_buffer - try to read in a new buffer
1523 *
1524 * Returns a code representing an action:
1525 * EOB_ACT_LAST_MATCH -
1526 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1527 * EOB_ACT_END_OF_FILE - end of file
1528 */
1529%if-c-only
1530static int yy_get_next_buffer YYFARGS0(void)
1531%endif
1532%if-c++-only
1533int yyFlexLexer::yy_get_next_buffer()
1534%endif
1535{
1536 M4_YY_DECL_GUTS_VAR();
1537 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1538 register char *source = YY_G(yytext_ptr);
1539 register int number_to_move, i;
1540 int ret_val;
1541
1542 if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1543 YY_FATAL_ERROR(
1544 "fatal flex scanner internal error--end of buffer missed" );
1545
1546 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1547 { /* Don't try to fill the buffer, so this is an EOF. */
1548 if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1549 {
1550 /* We matched a single character, the EOB, so
1551 * treat this as a final EOF.
1552 */
1553 return EOB_ACT_END_OF_FILE;
1554 }
1555
1556 else
1557 {
1558 /* We matched some text prior to the EOB, first
1559 * process it.
1560 */
1561 return EOB_ACT_LAST_MATCH;
1562 }
1563 }
1564
1565 /* Try to read more data. */
1566
1567 /* First move last chars to start of buffer. */
1568 number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
1569
1570 for ( i = 0; i < number_to_move; ++i )
1571 *(dest++) = *(source++);
1572
1573 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1574 /* don't do the read, it's not guaranteed to return an EOF,
1575 * just force an EOF
1576 */
1577 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1578
1579 else
1580 {
1581 int num_to_read =
1582 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1583
1584 while ( num_to_read <= 0 )
1585 { /* Not enough room in the buffer - grow it. */
1586m4_ifdef( [[M4_YY_USES_REJECT]],
1587[[
1588 YY_FATAL_ERROR(
1589"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1590]],
1591[[
1592 /* just a shorter name for the current buffer */
1593 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1594
1595 int yy_c_buf_p_offset =
1596 (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1597
1598 if ( b->yy_is_our_buffer )
1599 {
1600 int new_size = b->yy_buf_size * 2;
1601
1602 if ( new_size <= 0 )
1603 b->yy_buf_size += b->yy_buf_size / 8;
1604 else
1605 b->yy_buf_size *= 2;
1606
1607 b->yy_ch_buf = (char *)
1608 /* Include room in for 2 EOB chars. */
1609 yyrealloc( (void *) b->yy_ch_buf,
1610 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1611 }
1612 else
1613 /* Can't grow it, we don't own it. */
1614 b->yy_ch_buf = 0;
1615
1616 if ( ! b->yy_ch_buf )
1617 YY_FATAL_ERROR(
1618 "fatal error - scanner input buffer overflow" );
1619
1620 YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1621
1622 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1623 number_to_move - 1;
1624]])
1625 }
1626
1627 if ( num_to_read > YY_READ_BUF_SIZE )
1628 num_to_read = YY_READ_BUF_SIZE;
1629
1630 /* Read in more data. */
1631 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1632 YY_G(yy_n_chars), num_to_read );
1633
1634 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1635 }
1636
1637 if ( YY_G(yy_n_chars) == 0 )
1638 {
1639 if ( number_to_move == YY_MORE_ADJ )
1640 {
1641 ret_val = EOB_ACT_END_OF_FILE;
1642 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1643 }
1644
1645 else
1646 {
1647 ret_val = EOB_ACT_LAST_MATCH;
1648 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1649 YY_BUFFER_EOF_PENDING;
1650 }
1651 }
1652
1653 else
1654 ret_val = EOB_ACT_CONTINUE_SCAN;
1655
1656 YY_G(yy_n_chars) += number_to_move;
1657 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1658 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1659
1660 YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1661
1662 return ret_val;
1663}
1664]])
1665
1666/* yy_get_previous_state - get the state just before the EOB char was reached */
1667
1668%if-c-only
1669%not-for-header
1670 static yy_state_type yy_get_previous_state YYFARGS0(void)
1671%endif
1672%if-c++-only
1673 yy_state_type yyFlexLexer::yy_get_previous_state()
1674%endif
1675{
1676 register yy_state_type yy_current_state;
1677 register char *yy_cp;
1678 M4_YY_DECL_GUTS_VAR();
1679
1680%% [15.0] code to get the start state into yy_current_state goes here
1681
1682 for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1683 {
1684%% [16.0] code to find the next state goes here
1685 }
1686
1687 return yy_current_state;
1688}
1689
1690
1691/* yy_try_NUL_trans - try to make a transition on the NUL character
1692 *
1693 * synopsis
1694 * next_state = yy_try_NUL_trans( current_state );
1695 */
1696%if-c-only
1697 static yy_state_type yy_try_NUL_trans YYFARGS1( yy_state_type, yy_current_state)
1698%endif
1699%if-c++-only
1700 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1701%endif
1702{
1703 register int yy_is_jam;
1704 M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1705%% [17.0] code to find the next state, and perhaps do backing up, goes here
1706
1707 return yy_is_jam ? 0 : yy_current_state;
1708}
1709
1710
1711%if-c-only
1712m4_ifdef( [[M4_YY_NO_UNPUT]],,
1713[[
1714 static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1715%endif
1716%if-c++-only
1717 void yyFlexLexer::yyunput( int c, register char* yy_bp)
1718%endif
1719{
1720 register char *yy_cp;
1721 M4_YY_DECL_GUTS_VAR();
1722
1723 yy_cp = YY_G(yy_c_buf_p);
1724
1725 /* undo effects of setting up yytext */
1726 *yy_cp = YY_G(yy_hold_char);
1727
1728 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1729 { /* need to shift things up to make room */
1730 /* +2 for EOB chars. */
1731 register int number_to_move = YY_G(yy_n_chars) + 2;
1732 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1733 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1734 register char *source =
1735 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1736
1737 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1738 *--dest = *--source;
1739
1740 yy_cp += (int) (dest - source);
1741 yy_bp += (int) (dest - source);
1742 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1743 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1744
1745 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1746 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1747 }
1748
1749 *--yy_cp = (char) c;
1750
1751%% [18.0] update yylineno here
1752m4_ifdef( [[M4_YY_USE_LINENO]],
1753[[
1754 if ( c == '\n' ){
1755 --yylineno;
1756 }
1757]])
1758
1759 YY_G(yytext_ptr) = yy_bp;
1760 YY_G(yy_hold_char) = *yy_cp;
1761 YY_G(yy_c_buf_p) = yy_cp;
1762}
1763%if-c-only
1764]])
1765%endif
1766
1767%if-c-only
1768#ifndef YY_NO_INPUT
1769#ifdef __cplusplus
1770 static int yyinput YYFARGS0(void)
1771#else
1772 static int input YYFARGS0(void)
1773#endif
1774
1775%endif
1776%if-c++-only
1777 int yyFlexLexer::yyinput()
1778%endif
1779{
1780 int c;
1781 M4_YY_DECL_GUTS_VAR();
1782
1783 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1784
1785 if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1786 {
1787 /* yy_c_buf_p now points to the character we want to return.
1788 * If this occurs *before* the EOB characters, then it's a
1789 * valid NUL; if not, then we've hit the end of the buffer.
1790 */
1791 if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1792 /* This was really a NUL. */
1793 *YY_G(yy_c_buf_p) = '\0';
1794
1795 else
1796 { /* need more input */
1797 int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
1798 ++YY_G(yy_c_buf_p);
1799
1800 switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1801 {
1802 case EOB_ACT_LAST_MATCH:
1803 /* This happens because yy_g_n_b()
1804 * sees that we've accumulated a
1805 * token and flags that we need to
1806 * try matching the token before
1807 * proceeding. But for input(),
1808 * there's no matching to consider.
1809 * So convert the EOB_ACT_LAST_MATCH
1810 * to EOB_ACT_END_OF_FILE.
1811 */
1812
1813 /* Reset buffer status. */
1814 yyrestart( yyin M4_YY_CALL_LAST_ARG);
1815
1816 /*FALLTHROUGH*/
1817
1818 case EOB_ACT_END_OF_FILE:
1819 {
1820 if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1821 return EOF;
1822
1823 if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1824 YY_NEW_FILE;
1825#ifdef __cplusplus
1826 return yyinput(M4_YY_CALL_ONLY_ARG);
1827#else
1828 return input(M4_YY_CALL_ONLY_ARG);
1829#endif
1830 }
1831
1832 case EOB_ACT_CONTINUE_SCAN:
1833 YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1834 break;
1835 }
1836 }
1837 }
1838
1839 c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
1840 *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
1841 YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1842
1843%% [19.0] update BOL and yylineno
1844
1845 return c;
1846}
1847%if-c-only
1848#endif /* ifndef YY_NO_INPUT */
1849%endif
1850
1851/** Immediately switch to a different input stream.
1852 * @param input_file A readable stream.
1853 * M4_YY_DOC_PARAM
1854 * @note This function does not reset the start condition to @c INITIAL .
1855 */
1856%if-c-only
1857 void yyrestart YYFARGS1( FILE *,input_file)
1858%endif
1859%if-c++-only
1860 void yyFlexLexer::yyrestart( std::istream* input_file )
1861%endif
1862{
1863 M4_YY_DECL_GUTS_VAR();
1864
1865 if ( ! YY_CURRENT_BUFFER ){
1866 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1867 YY_CURRENT_BUFFER_LVALUE =
1868 yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1869 }
1870
1871 yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1872 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1873}
1874
1875/** Switch to a different input buffer.
1876 * @param new_buffer The new input buffer.
1877 * M4_YY_DOC_PARAM
1878 */
1879%if-c-only
1880 void yy_switch_to_buffer YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1881%endif
1882%if-c++-only
1883 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1884%endif
1885{
1886 M4_YY_DECL_GUTS_VAR();
1887
1888 /* TODO. We should be able to replace this entire function body
1889 * with
1890 * yypop_buffer_state();
1891 * yypush_buffer_state(new_buffer);
1892 */
1893 yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1894 if ( YY_CURRENT_BUFFER == new_buffer )
1895 return;
1896
1897 if ( YY_CURRENT_BUFFER )
1898 {
1899 /* Flush out information for old buffer. */
1900 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1901 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
1902 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1903 }
1904
1905 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1906 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1907
1908 /* We don't actually know whether we did this switch during
1909 * EOF (yywrap()) processing, but the only time this flag
1910 * is looked at is after yywrap() is called, so it's safe
1911 * to go ahead and always set it.
1912 */
1913 YY_G(yy_did_buffer_switch_on_eof) = 1;
1914}
1915
1916
1917%if-c-only
1918static void yy_load_buffer_state YYFARGS0(void)
1919%endif
1920%if-c++-only
1921 void yyFlexLexer::yy_load_buffer_state()
1922%endif
1923{
1924 M4_YY_DECL_GUTS_VAR();
1925 YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1926 YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1927 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1928 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
1929}
1930
1931/** Allocate and initialize an input buffer state.
1932 * @param file A readable stream.
1933 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1934 * M4_YY_DOC_PARAM
1935 * @return the allocated buffer state.
1936 */
1937%if-c-only
1938 YY_BUFFER_STATE yy_create_buffer YYFARGS2( FILE *,file, int ,size)
1939%endif
1940%if-c++-only
1941 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
1942%endif
1943{
1944 YY_BUFFER_STATE b;
1945 m4_dnl M4_YY_DECL_GUTS_VAR();
1946
1947 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
1948 if ( ! b )
1949 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1950
1951 b->yy_buf_size = size;
1952
1953 /* yy_ch_buf has to be 2 characters longer than the size given because
1954 * we need to put in 2 end-of-buffer characters.
1955 */
1956 b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1957 if ( ! b->yy_ch_buf )
1958 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1959
1960 b->yy_is_our_buffer = 1;
1961
1962 yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
1963
1964 return b;
1965}
1966
1967/** Destroy the buffer.
1968 * @param b a buffer created with yy_create_buffer()
1969 * M4_YY_DOC_PARAM
1970 */
1971%if-c-only
1972 void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
1973%endif
1974%if-c++-only
1975 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
1976%endif
1977{
1978 M4_YY_DECL_GUTS_VAR();
1979
1980 if ( ! b )
1981 return;
1982
1983 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1984 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1985
1986 if ( b->yy_is_our_buffer )
1987 yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
1988
1989 yyfree( (void *) b M4_YY_CALL_LAST_ARG );
1990}
1991
1992
1993%if-c-only
1994m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],,
1995[[
1996 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
1997 [[
1998#ifndef __cplusplus
1999extern int isatty M4_YY_PARAMS( int );
2000#endif /* __cplusplus */
2001 ]])
2002]])
2003%endif
2004
2005%if-c++-only
2006m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,
2007[[
2008extern "C" int isatty M4_YY_PARAMS( int );
2009]])
2010%endif
2011
2012/* Initializes or reinitializes a buffer.
2013 * This function is sometimes called more than once on the same buffer,
2014 * such as during a yyrestart() or at EOF.
2015 */
2016%if-c-only
2017 static void yy_init_buffer YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2018%endif
2019%if-c++-only
2020 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2021%endif
2022
2023{
2024 int oerrno = errno;
2025 M4_YY_DECL_GUTS_VAR();
2026
2027 yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2028
2029 b->yy_input_file = file;
2030 b->yy_fill_buffer = 1;
2031
2032 /* If b is the current buffer, then yy_init_buffer was _probably_
2033 * called from yyrestart() or through yy_get_next_buffer.
2034 * In that case, we don't want to reset the lineno or column.
2035 */
2036 if (b != YY_CURRENT_BUFFER){
2037 b->yy_bs_lineno = 1;
2038 b->yy_bs_column = 0;
2039 }
2040
2041%if-c-only
2042m4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2043[[
2044 b->yy_is_interactive = 1;
2045]],
2046[[
2047 m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2048 [[
2049 b->yy_is_interactive = 0;
2050 ]],
2051 [[
2052 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2053 ]])
2054]])
2055%endif
2056%if-c++-only
2057 b->yy_is_interactive = 0;
2058%endif
2059 errno = oerrno;
2060}
2061
2062/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2063 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2064 * M4_YY_DOC_PARAM
2065 */
2066%if-c-only
2067 void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2068%endif
2069%if-c++-only
2070 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2071%endif
2072{
2073 M4_YY_DECL_GUTS_VAR();
2074 if ( ! b )
2075 return;
2076
2077 b->yy_n_chars = 0;
2078
2079 /* We always need two end-of-buffer characters. The first causes
2080 * a transition to the end-of-buffer state. The second causes
2081 * a jam in that state.
2082 */
2083 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2084 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2085
2086 b->yy_buf_pos = &b->yy_ch_buf[0];
2087
2088 b->yy_at_bol = 1;
2089 b->yy_buffer_status = YY_BUFFER_NEW;
2090
2091 if ( b == YY_CURRENT_BUFFER )
2092 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2093}
2094
2095%if-c-or-c++
2096/** Pushes the new state onto the stack. The new state becomes
2097 * the current state. This function will allocate the stack
2098 * if necessary.
2099 * @param new_buffer The new state.
2100 * M4_YY_DOC_PARAM
2101 */
2102%if-c-only
2103void yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2104%endif
2105%if-c++-only
2106void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2107%endif
2108{
2109 M4_YY_DECL_GUTS_VAR();
2110 if (new_buffer == NULL)
2111 return;
2112
2113 yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2114
2115 /* This block is copied from yy_switch_to_buffer. */
2116 if ( YY_CURRENT_BUFFER )
2117 {
2118 /* Flush out information for old buffer. */
2119 *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2120 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2121 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2122 }
2123
2124 /* Only push if top exists. Otherwise, replace top. */
2125 if (YY_CURRENT_BUFFER)
2126 YY_G(yy_buffer_stack_top)++;
2127 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2128
2129 /* copied from yy_switch_to_buffer. */
2130 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2131 YY_G(yy_did_buffer_switch_on_eof) = 1;
2132}
2133%endif
2134
2135
2136%if-c-or-c++
2137/** Removes and deletes the top of the stack, if present.
2138 * The next element becomes the new top.
2139 * M4_YY_DOC_PARAM
2140 */
2141%if-c-only
2142void yypop_buffer_state YYFARGS0(void)
2143%endif
2144%if-c++-only
2145void yyFlexLexer::yypop_buffer_state (void)
2146%endif
2147{
2148 M4_YY_DECL_GUTS_VAR();
2149 if (!YY_CURRENT_BUFFER)
2150 return;
2151
2152 yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2153 YY_CURRENT_BUFFER_LVALUE = NULL;
2154 if (YY_G(yy_buffer_stack_top) > 0)
2155 --YY_G(yy_buffer_stack_top);
2156
2157 if (YY_CURRENT_BUFFER) {
2158 yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2159 YY_G(yy_did_buffer_switch_on_eof) = 1;
2160 }
2161}
2162%endif
2163
2164
2165%if-c-or-c++
2166/* Allocates the stack if it does not exist.
2167 * Guarantees space for at least one push.
2168 */
2169%if-c-only
2170static void yyensure_buffer_stack YYFARGS0(void)
2171%endif
2172%if-c++-only
2173void yyFlexLexer::yyensure_buffer_stack(void)
2174%endif
2175{
2176 int num_to_alloc;
2177 M4_YY_DECL_GUTS_VAR();
2178
2179 if (!YY_G(yy_buffer_stack)) {
2180
2181 /* First allocation is just for 2 elements, since we don't know if this
2182 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2183 * immediate realloc on the next call.
2184 */
2185 num_to_alloc = 1;
2186 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2187 (num_to_alloc * sizeof(struct yy_buffer_state*)
2188 M4_YY_CALL_LAST_ARG);
2189
2190 memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2191
2192 YY_G(yy_buffer_stack_max) = num_to_alloc;
2193 YY_G(yy_buffer_stack_top) = 0;
2194 return;
2195 }
2196
2197 if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2198
2199 /* Increase the buffer to prepare for a possible push. */
2200 int grow_size = 8 /* arbitrary grow size */;
2201
2202 num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2203 YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2204 (YY_G(yy_buffer_stack),
2205 num_to_alloc * sizeof(struct yy_buffer_state*)
2206 M4_YY_CALL_LAST_ARG);
2207
2208 /* zero only the new slots.*/
2209 memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2210 YY_G(yy_buffer_stack_max) = num_to_alloc;
2211 }
2212}
2213%endif
2214
2215
2216
2217
2218m4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2219[[
2220%if-c-only
2221/** Setup the input buffer state to scan directly from a user-specified character buffer.
2222 * @param base the character buffer
2223 * @param size the size in bytes of the character buffer
2224 * M4_YY_DOC_PARAM
2225 * @return the newly allocated buffer state object.
2226 */
2227YY_BUFFER_STATE yy_scan_buffer YYFARGS2( char *,base, yy_size_t ,size)
2228{
2229 YY_BUFFER_STATE b;
2230 m4_dnl M4_YY_DECL_GUTS_VAR();
2231
2232 if ( size < 2 ||
2233 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2234 base[size-1] != YY_END_OF_BUFFER_CHAR )
2235 /* They forgot to leave room for the EOB's. */
2236 return 0;
2237
2238 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2239 if ( ! b )
2240 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2241
2242 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2243 b->yy_buf_pos = b->yy_ch_buf = base;
2244 b->yy_is_our_buffer = 0;
2245 b->yy_input_file = 0;
2246 b->yy_n_chars = b->yy_buf_size;
2247 b->yy_is_interactive = 0;
2248 b->yy_at_bol = 1;
2249 b->yy_fill_buffer = 0;
2250 b->yy_buffer_status = YY_BUFFER_NEW;
2251
2252 yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2253
2254 return b;
2255}
2256%endif
2257]])
2258
2259
2260m4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2261[[
2262%if-c-only
2263/** Setup the input buffer state to scan a string. The next call to yylex() will
2264 * scan from a @e copy of @a str.
2265 * @param str a NUL-terminated string to scan
2266 * M4_YY_DOC_PARAM
2267 * @return the newly allocated buffer state object.
2268 * @note If you want to scan bytes that may contain NUL values, then use
2269 * yy_scan_bytes() instead.
2270 */
2271YY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2272{
2273 m4_dnl M4_YY_DECL_GUTS_VAR();
2274
2275 return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2276}
2277%endif
2278]])
2279
2280
2281m4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2282[[
2283%if-c-only
2284/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2285 * scan from a @e copy of @a bytes.
2286 * @param bytes the byte buffer to scan
2287 * @param len the number of bytes in the buffer pointed to by @a bytes.
2288 * M4_YY_DOC_PARAM
2289 * @return the newly allocated buffer state object.
2290 */
2291YY_BUFFER_STATE yy_scan_bytes YYFARGS2( yyconst char *,yybytes, int ,_yybytes_len)
2292{
2293 YY_BUFFER_STATE b;
2294 char *buf;
2295 yy_size_t n;
2296 int i;
2297 m4_dnl M4_YY_DECL_GUTS_VAR();
2298
2299 /* Get memory for full buffer, including space for trailing EOB's. */
2300 n = _yybytes_len + 2;
2301 buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2302 if ( ! buf )
2303 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2304
2305 for ( i = 0; i < _yybytes_len; ++i )
2306 buf[i] = yybytes[i];
2307
2308 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2309
2310 b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2311 if ( ! b )
2312 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2313
2314 /* It's okay to grow etc. this buffer, and we should throw it
2315 * away when we're done.
2316 */
2317 b->yy_is_our_buffer = 1;
2318
2319 return b;
2320}
2321%endif
2322]])
2323
2324
2325m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2326[[
2327%if-c-only
2328 static void yy_push_state YYFARGS1( int ,new_state)
2329%endif
2330%if-c++-only
2331 void yyFlexLexer::yy_push_state( int new_state )
2332%endif
2333{
2334 M4_YY_DECL_GUTS_VAR();
2335 if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2336 {
2337 yy_size_t new_size;
2338
2339 YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2340 new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2341
2342 if ( ! YY_G(yy_start_stack) )
2343 YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2344
2345 else
2346 YY_G(yy_start_stack) = (int *) yyrealloc(
2347 (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2348
2349 if ( ! YY_G(yy_start_stack) )
2350 YY_FATAL_ERROR(
2351 "out of memory expanding start-condition stack" );
2352 }
2353
2354 YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2355
2356 BEGIN(new_state);
2357}
2358]])
2359
2360
2361m4_ifdef( [[M4_YY_NO_POP_STATE]],,
2362[[
2363%if-c-only
2364 static void yy_pop_state YYFARGS0(void)
2365%endif
2366%if-c++-only
2367 void yyFlexLexer::yy_pop_state()
2368%endif
2369{
2370 M4_YY_DECL_GUTS_VAR();
2371 if ( --YY_G(yy_start_stack_ptr) < 0 )
2372 YY_FATAL_ERROR( "start-condition stack underflow" );
2373
2374 BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2375}
2376]])
2377
2378
2379m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2380[[
2381%if-c-only
2382 static int yy_top_state YYFARGS0(void)
2383%endif
2384%if-c++-only
2385 int yyFlexLexer::yy_top_state()
2386%endif
2387{
2388 M4_YY_DECL_GUTS_VAR();
2389 return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2390}
2391]])
2392
2393#ifndef YY_EXIT_FAILURE
2394#define YY_EXIT_FAILURE 2
2395#endif
2396
2397%if-c-only
2398static void yy_fatal_error YYFARGS1(yyconst char*, msg)
2399{
2400 m4_dnl M4_YY_DECL_GUTS_VAR();
2401 (void) fprintf( stderr, "%s\n", msg );
2402 exit( YY_EXIT_FAILURE );
2403}
2404%endif
2405%if-c++-only
2406void yyFlexLexer::LexerError( yyconst char msg[] )
2407{
2408 M4_YY_DECL_GUTS_VAR();
2409 std::cerr << msg << std::endl;
2410 exit( YY_EXIT_FAILURE );
2411}
2412%endif
2413
2414/* Redefine yyless() so it works in section 3 code. */
2415
2416#undef yyless
2417#define yyless(n) \
2418 do \
2419 { \
2420 /* Undo effects of setting up yytext. */ \
2421 int yyless_macro_arg = (n); \
2422 YY_LESS_LINENO(yyless_macro_arg);\
2423 yytext[yyleng] = YY_G(yy_hold_char); \
2424 YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2425 YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2426 *YY_G(yy_c_buf_p) = '\0'; \
2427 yyleng = yyless_macro_arg; \
2428 } \
2429 while ( 0 )
2430
2431
2432
2433/* Accessor methods (get/set functions) to struct members. */
2434
2435%if-c-only
2436%if-reentrant
2437m4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2438[[
2439/** Get the user-defined data for this scanner.
2440 * M4_YY_DOC_PARAM
2441 */
2442YY_EXTRA_TYPE yyget_extra YYFARGS0(void)
2443{
2444 M4_YY_DECL_GUTS_VAR();
2445 return yyextra;
2446}
2447]])
2448%endif
2449
2450m4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2451[[
2452/** Get the current line number.
2453 * M4_YY_DOC_PARAM
2454 */
2455int yyget_lineno YYFARGS0(void)
2456{
2457 M4_YY_DECL_GUTS_VAR();
2458
2459 m4_ifdef( [[M4_YY_REENTRANT]],
2460 [[
2461 if (! YY_CURRENT_BUFFER)
2462 return 0;
2463 ]])
2464 return yylineno;
2465}
2466]])
2467
2468m4_ifdef( [[M4_YY_REENTRANT]],
2469[[
2470m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2471[[
2472/** Get the current column number.
2473 * M4_YY_DOC_PARAM
2474 */
2475int yyget_column YYFARGS0(void)
2476{
2477 M4_YY_DECL_GUTS_VAR();
2478
2479 m4_ifdef( [[M4_YY_REENTRANT]],
2480 [[
2481 if (! YY_CURRENT_BUFFER)
2482 return 0;
2483 ]])
2484 return yycolumn;
2485}
2486]])
2487]])
2488
2489m4_ifdef( [[M4_YY_NO_GET_IN]],,
2490[[
2491/** Get the input stream.
2492 * M4_YY_DOC_PARAM
2493 */
2494FILE *yyget_in YYFARGS0(void)
2495{
2496 M4_YY_DECL_GUTS_VAR();
2497 return yyin;
2498}
2499]])
2500
2501m4_ifdef( [[M4_YY_NO_GET_OUT]],,
2502[[
2503/** Get the output stream.
2504 * M4_YY_DOC_PARAM
2505 */
2506FILE *yyget_out YYFARGS0(void)
2507{
2508 M4_YY_DECL_GUTS_VAR();
2509 return yyout;
2510}
2511]])
2512
2513m4_ifdef( [[M4_YY_NO_GET_LENG]],,
2514[[
2515/** Get the length of the current token.
2516 * M4_YY_DOC_PARAM
2517 */
2518int yyget_leng YYFARGS0(void)
2519{
2520 M4_YY_DECL_GUTS_VAR();
2521 return yyleng;
2522}
2523]])
2524
2525/** Get the current token.
2526 * M4_YY_DOC_PARAM
2527 */
2528m4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2529[[
2530char *yyget_text YYFARGS0(void)
2531{
2532 M4_YY_DECL_GUTS_VAR();
2533 return yytext;
2534}
2535]])
2536
2537%if-reentrant
2538m4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2539[[
2540/** Set the user-defined data. This data is never touched by the scanner.
2541 * @param user_defined The data to be associated with this scanner.
2542 * M4_YY_DOC_PARAM
2543 */
2544void yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2545{
2546 M4_YY_DECL_GUTS_VAR();
2547 yyextra = user_defined ;
2548}
2549]])
2550%endif
2551
2552m4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2553[[
2554/** Set the current line number.
2555 * @param line_number
2556 * M4_YY_DOC_PARAM
2557 */
2558void yyset_lineno YYFARGS1( int ,line_number)
2559{
2560 M4_YY_DECL_GUTS_VAR();
2561
2562 m4_ifdef( [[M4_YY_REENTRANT]],
2563 [[
2564 /* lineno is only valid if an input buffer exists. */
2565 if (! YY_CURRENT_BUFFER )
2566 yy_fatal_error( "yyset_lineno called with no buffer" M4_YY_CALL_LAST_ARG);
2567 ]])
2568 yylineno = line_number;
2569}
2570]])
2571
2572m4_ifdef( [[M4_YY_REENTRANT]],
2573[[
2574m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2575[[
2576/** Set the current column.
2577 * @param line_number
2578 * M4_YY_DOC_PARAM
2579 */
2580void yyset_column YYFARGS1( int , column_no)
2581{
2582 M4_YY_DECL_GUTS_VAR();
2583
2584 m4_ifdef( [[M4_YY_REENTRANT]],
2585 [[
2586 /* column is only valid if an input buffer exists. */
2587 if (! YY_CURRENT_BUFFER )
2588 yy_fatal_error( "yyset_column called with no buffer" M4_YY_CALL_LAST_ARG);
2589 ]])
2590 yycolumn = column_no;
2591}
2592]])
2593]])
2594
2595
2596m4_ifdef( [[M4_YY_NO_SET_IN]],,
2597[[
2598/** Set the input stream. This does not discard the current
2599 * input buffer.
2600 * @param in_str A readable stream.
2601 * M4_YY_DOC_PARAM
2602 * @see yy_switch_to_buffer
2603 */
2604void yyset_in YYFARGS1( FILE * ,in_str)
2605{
2606 M4_YY_DECL_GUTS_VAR();
2607 yyin = in_str ;
2608}
2609]])
2610
2611m4_ifdef( [[M4_YY_NO_SET_OUT]],,
2612[[
2613void yyset_out YYFARGS1( FILE * ,out_str)
2614{
2615 M4_YY_DECL_GUTS_VAR();
2616 yyout = out_str ;
2617}
2618]])
2619
2620
2621m4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2622[[
2623int yyget_debug YYFARGS0(void)
2624{
2625 M4_YY_DECL_GUTS_VAR();
2626 return yy_flex_debug;
2627}
2628]])
2629
2630m4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2631[[
2632void yyset_debug YYFARGS1( int ,bdebug)
2633{
2634 M4_YY_DECL_GUTS_VAR();
2635 yy_flex_debug = bdebug ;
2636}
2637]])
2638%endif
2639
2640%if-reentrant
2641/* Accessor methods for yylval and yylloc */
2642
2643%if-bison-bridge
2644m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2645[[
2646YYSTYPE * yyget_lval YYFARGS0(void)
2647{
2648 M4_YY_DECL_GUTS_VAR();
2649 return yylval;
2650}
2651]])
2652
2653m4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2654[[
2655void yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2656{
2657 M4_YY_DECL_GUTS_VAR();
2658 yylval = yylval_param;
2659}
2660]])
2661
2662m4_ifdef( [[<M4_YY_BISON_LLOC>]],
2663[[
2664 m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2665 [[
2666YYLTYPE *yyget_lloc YYFARGS0(void)
2667{
2668 M4_YY_DECL_GUTS_VAR();
2669 return yylloc;
2670}
2671 ]])
2672
2673 m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2674 [[
2675void yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2676{
2677 M4_YY_DECL_GUTS_VAR();
2678 yylloc = yylloc_param;
2679}
2680 ]])
2681]])
2682
2683%endif
2684
2685
2686/* User-visible API */
2687
2688/* yylex_init is special because it creates the scanner itself, so it is
2689 * the ONLY reentrant function that doesn't take the scanner as the last argument.
2690 * That's why we explicitly handle the declaration, instead of using our macros.
2691 */
2692m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2693[[
2694int yylex_init( ptr_yy_globals )
2695 yyscan_t* ptr_yy_globals;
2696]],
2697[[
2698int yylex_init(yyscan_t* ptr_yy_globals)
2699]])
2700{
2701 if (ptr_yy_globals == NULL){
2702 errno = EINVAL;
2703 return 1;
2704 }
2705
2706 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2707
2708 if (*ptr_yy_globals == NULL){
2709 errno = ENOMEM;
2710 return 1;
2711 }
2712
2713 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2714 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2715
2716 return yy_init_globals ( *ptr_yy_globals );
2717}
2718
2719%endif
2720
2721%if-c-only
2722static int yy_init_globals YYFARGS0(void)
2723{
2724 M4_YY_DECL_GUTS_VAR();
2725 /* Initialization is the same as for the non-reentrant scanner.
2726 * This function is called from yylex_destroy(), so don't allocate here.
2727 */
2728
2729m4_ifdef( [[M4_YY_USE_LINENO]],
2730[[
2731 m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2732 [[
2733 /* We do not touch yylineno unless the option is enabled. */
2734 yylineno = 1;
2735 ]])
2736]])
2737 YY_G(yy_buffer_stack) = 0;
2738 YY_G(yy_buffer_stack_top) = 0;
2739 YY_G(yy_buffer_stack_max) = 0;
2740 YY_G(yy_c_buf_p) = (char *) 0;
2741 YY_G(yy_init) = 0;
2742 YY_G(yy_start) = 0;
2743
2744m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2745[[
2746 YY_G(yy_start_stack_ptr) = 0;
2747 YY_G(yy_start_stack_depth) = 0;
2748 YY_G(yy_start_stack) = NULL;
2749]])
2750
2751m4_ifdef( [[M4_YY_USES_REJECT]],
2752[[
2753 YY_G(yy_state_buf) = 0;
2754 YY_G(yy_state_ptr) = 0;
2755 YY_G(yy_full_match) = 0;
2756 YY_G(yy_lp) = 0;
2757]])
2758
2759m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2760[[
2761 YY_G(yytext_ptr) = 0;
2762 YY_G(yy_more_offset) = 0;
2763 YY_G(yy_prev_more_offset) = 0;
2764]])
2765
2766/* Defined in main.c */
2767#ifdef YY_STDINIT
2768 yyin = stdin;
2769 yyout = stdout;
2770#else
2771 yyin = (FILE *) 0;
2772 yyout = (FILE *) 0;
2773#endif
2774
2775 /* For future reference: Set errno on error, since we are called by
2776 * yylex_init()
2777 */
2778 return 0;
2779}
2780%endif
2781
2782
2783%if-c-only SNIP! this currently causes conflicts with the c++ scanner
2784/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2785int yylex_destroy YYFARGS0(void)
2786{
2787 M4_YY_DECL_GUTS_VAR();
2788
2789 /* Pop the buffer stack, destroying each element. */
2790 while(YY_CURRENT_BUFFER){
2791 yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2792 YY_CURRENT_BUFFER_LVALUE = NULL;
2793 yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2794 }
2795
2796 /* Destroy the stack itself. */
2797 yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2798 YY_G(yy_buffer_stack) = NULL;
2799
2800m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2801[[
2802 /* Destroy the start condition stack. */
2803 yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2804 YY_G(yy_start_stack) = NULL;
2805]])
2806
2807m4_ifdef( [[M4_YY_USES_REJECT]],
2808[[
2809 yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2810 YY_G(yy_state_buf) = NULL;
2811]])
2812
2813 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2814 * yylex() is called, initialization will occur. */
2815 yy_init_globals( M4_YY_CALL_ONLY_ARG);
2816
2817%if-reentrant
2818 /* Destroy the main struct (reentrant only). */
2819 yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2820 yyscanner = NULL;
2821%endif
2822 return 0;
2823}
2824%endif
2825
2826
2827m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2828[[
2829/*
2830 * Internal utility routines.
2831 */
2832]])
2833
2834m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2835[[
2836#ifndef yytext_ptr
2837static void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2838{
2839 register int i;
2840 for ( i = 0; i < n; ++i )
2841 s1[i] = s2[i];
2842}
2843#endif
2844]])
2845
2846m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2847[[
2848#ifdef YY_NEED_STRLEN
2849static int yy_flex_strlen YYFARGS1( yyconst char *,s)
2850{
2851 register int n;
2852 for ( n = 0; s[n]; ++n )
2853 ;
2854
2855 return n;
2856}
2857#endif
2858]])
2859
2860m4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
2861[[
2862void *yyalloc YYFARGS1( yy_size_t ,size)
2863{
2864 return (void *) malloc( size );
2865}
2866]])
2867
2868m4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
2869[[
2870void *yyrealloc YYFARGS2( void *,ptr, yy_size_t ,size)
2871{
2872 /* The cast to (char *) in the following accommodates both
2873 * implementations that use char* generic pointers, and those
2874 * that use void* generic pointers. It works with the latter
2875 * because both ANSI C and C++ allow castless assignment from
2876 * any pointer type to void*, and deal with argument conversions
2877 * as though doing an assignment.
2878 */
2879 return (void *) realloc( (char *) ptr, size );
2880}
2881]])
2882
2883m4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
2884[[
2885void yyfree YYFARGS1( void *,ptr)
2886{
2887 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2888}
2889]])
2890
2891%if-tables-serialization definitions
2892m4preproc_include(`tables_shared.c')
2893
2894static int yytbl_read8 (void *v, struct yytbl_reader * rd)
2895{
2896 errno = 0;
2897 if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
2898 errno = EIO;
2899 return -1;
2900 }
2901 rd->bread += sizeof(flex_uint8_t);
2902 return 0;
2903}
2904
2905static int yytbl_read16 (void *v, struct yytbl_reader * rd)
2906{
2907 errno = 0;
2908 if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
2909 errno = EIO;
2910 return -1;
2911 }
2912 *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
2913 rd->bread += sizeof(flex_uint16_t);
2914 return 0;
2915}
2916
2917static int yytbl_read32 (void *v, struct yytbl_reader * rd)
2918{
2919 errno = 0;
2920 if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
2921 errno = EIO;
2922 return -1;
2923 }
2924 *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
2925 rd->bread += sizeof(flex_uint32_t);
2926 return 0;
2927}
2928
2929/** Read the header */
2930static int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
2931{
2932 int bytes;
2933 memset (th, 0, sizeof (struct yytbl_hdr));
2934
2935 if (yytbl_read32 (&(th->th_magic), rd) != 0)
2936 return -1;
2937
2938 if (th->th_magic != YYTBL_MAGIC){
2939 yy_fatal_error("bad magic number" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
2940 return -1;
2941 }
2942
2943 if (yytbl_read32 (&(th->th_hsize), rd) != 0
2944 || yytbl_read32 (&(th->th_ssize), rd) != 0
2945 || yytbl_read16 (&(th->th_flags), rd) != 0)
2946 return -1;
2947
2948 /* Sanity check on header size. Greater than 1k suggests some funny business. */
2949 if (th->th_hsize < 16 || th->th_hsize > 1024){
2950 yy_fatal_error("insane header size detected" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
2951 return -1;
2952 }
2953
2954 /* Allocate enough space for the version and name fields */
2955 bytes = th->th_hsize - 14;
2956 th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
2957
2958 /* we read it all into th_version, and point th_name into that data */
2959 if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
2960 errno = EIO;
2961 yyfree(th->th_version M4_YY_CALL_LAST_ARG);
2962 th->th_version = NULL;
2963 return -1;
2964 }
2965 else
2966 rd->bread += bytes;
2967
2968 th->th_name = th->th_version + strlen (th->th_version) + 1;
2969 return 0;
2970}
2971
2972/** lookup id in the dmap list.
2973 * @param dmap pointer to first element in list
2974 * @return NULL if not found.
2975 */
2976static struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
2977 int, id)
2978{
2979 while (dmap->dm_id)
2980 if (dmap->dm_id == id)
2981 return dmap;
2982 else
2983 dmap++;
2984 return NULL;
2985}
2986
2987/** Read a table while mapping its contents to the local array.
2988 * @param dmap used to performing mapping
2989 * @return 0 on success
2990 */
2991static int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
2992{
2993 struct yytbl_data td;
2994 struct yytbl_dmap *transdmap=0;
2995 int len, i, rv, inner_loop_count;
2996 void *p=0;
2997
2998 memset (&td, 0, sizeof (struct yytbl_data));
2999
3000 if (yytbl_read16 (&td.td_id, rd) != 0
3001 || yytbl_read16 (&td.td_flags, rd) != 0
3002 || yytbl_read32 (&td.td_hilen, rd) != 0
3003 || yytbl_read32 (&td.td_lolen, rd) != 0)
3004 return -1;
3005
3006 /* Lookup the map for the transition table so we have it in case we need it
3007 * inside the loop below. This scanner might not even have a transition
3008 * table, which is ok.
3009 */
3010 transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3011
3012 if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
3013 yy_fatal_error("table id not found in map." /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3014 return -1;
3015 }
3016
3017 /* Allocate space for table.
3018 * The --full yy_transition table is a special case, since we
3019 * need the dmap.dm_sz entry to tell us the sizeof the individual
3020 * struct members.
3021 */
3022 {
3023 size_t bytes;
3024
3025 if ((td.td_flags & YYTD_STRUCT))
3026 bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3027 else
3028 bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3029
3030 if(M4_YY_TABLES_VERIFY)
3031 /* We point to the array itself */
3032 p = dmap->dm_arr;
3033 else
3034 /* We point to the address of a pointer. */
3035 *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3036 }
3037
3038 /* If it's a struct, we read 2 integers to get one element */
3039 if ((td.td_flags & YYTD_STRUCT) != 0)
3040 inner_loop_count = 2;
3041 else
3042 inner_loop_count = 1;
3043
3044 /* read and map each element.
3045 * This loop iterates once for each element of the td_data array.
3046 * Notice that we increment 'i' in the inner loop.
3047 */
3048 len = yytbl_calc_total_len (&td);
3049 for (i = 0; i < len; ){
3050 int j;
3051
3052
3053 /* This loop really executes exactly 1 or 2 times.
3054 * The second time is to handle the second member of the
3055 * YYTD_STRUCT for the yy_transition array.
3056 */
3057 for (j = 0; j < inner_loop_count; j++, i++) {
3058 flex_int32_t t32;
3059
3060 /* read into t32 no matter what the real size is. */
3061 {
3062 flex_int16_t t16;
3063 flex_int8_t t8;
3064
3065 switch (YYTDFLAGS2BYTES (td.td_flags)) {
3066 case sizeof (flex_int32_t):
3067 rv = yytbl_read32 (&t32, rd);
3068 break;
3069 case sizeof (flex_int16_t):
3070 rv = yytbl_read16 (&t16, rd);
3071 t32 = t16;
3072 break;
3073 case sizeof (flex_int8_t):
3074 rv = yytbl_read8 (&t8, rd);
3075 t32 = t8;
3076 break;
3077 default:
3078 yy_fatal_error("invalid td_flags" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3079 return -1;
3080 }
3081 }
3082 if (rv != 0)
3083 return -1;
3084
3085 /* copy into the deserialized array... */
3086
3087 if ((td.td_flags & YYTD_STRUCT)) {
3088 /* t32 is the j'th member of a two-element struct. */
3089 void *v;
3090
3091 v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3092 : &(((struct yy_trans_info *) p)->yy_nxt);
3093
3094 switch (dmap->dm_sz) {
3095 case sizeof (flex_int32_t):
3096 if (M4_YY_TABLES_VERIFY){
3097 if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
3098 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int32_t" M4_YY_CALL_LAST_ARG);
3099 }else
3100 ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3101 break;
3102 case sizeof (flex_int16_t):
3103 if (M4_YY_TABLES_VERIFY ){
3104 if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
3105 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int16_t" M4_YY_CALL_LAST_ARG);
3106 }else
3107 ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3108 break;
3109 case sizeof(flex_int8_t):
3110 if (M4_YY_TABLES_VERIFY ){
3111 if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
3112 yy_fatal_error("tables verification failed at YYTD_STRUCT flex_int8_t" M4_YY_CALL_LAST_ARG);
3113 }else
3114 ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3115 break;
3116 default:
3117 yy_fatal_error("invalid dmap->dm_sz for struct" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3118 return -1;
3119 }
3120
3121 /* if we're done with j, increment p */
3122 if (j == 1)
3123 p = (struct yy_trans_info *) p + 1;
3124 }
3125 else if ((td.td_flags & YYTD_PTRANS)) {
3126 /* t32 is an index into the transition array. */
3127 struct yy_trans_info *v;
3128
3129
3130 if (!transdmap){
3131 yy_fatal_error("transition table not found" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3132 return -1;
3133 }
3134
3135 if( M4_YY_TABLES_VERIFY)
3136 v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3137 else
3138 v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3139
3140 if(M4_YY_TABLES_VERIFY ){
3141 if( ((struct yy_trans_info **) p)[0] != v)
3142 yy_fatal_error("tables verification failed at YYTD_PTRANS" M4_YY_CALL_LAST_ARG);
3143 }else
3144 ((struct yy_trans_info **) p)[0] = v;
3145
3146 /* increment p */
3147 p = (struct yy_trans_info **) p + 1;
3148 }
3149 else {
3150 /* t32 is a plain int. copy data, then incrememnt p. */
3151 switch (dmap->dm_sz) {
3152 case sizeof (flex_int32_t):
3153 if(M4_YY_TABLES_VERIFY ){
3154 if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
3155 yy_fatal_error("tables verification failed at flex_int32_t" M4_YY_CALL_LAST_ARG);
3156 }else
3157 ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3158 p = ((flex_int32_t *) p) + 1;
3159 break;
3160 case sizeof (flex_int16_t):
3161 if(M4_YY_TABLES_VERIFY ){
3162 if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
3163 yy_fatal_error("tables verification failed at flex_int16_t" M4_YY_CALL_LAST_ARG);
3164 }else
3165 ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3166 p = ((flex_int16_t *) p) + 1;
3167 break;
3168 case sizeof (flex_int8_t):
3169 if(M4_YY_TABLES_VERIFY ){
3170 if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
3171 yy_fatal_error("tables verification failed at flex_int8_t" M4_YY_CALL_LAST_ARG);
3172 }else
3173 ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3174 p = ((flex_int8_t *) p) + 1;
3175 break;
3176 default:
3177 yy_fatal_error("invalid dmap->dm_sz for plain int" /*TODO: not fatal.*/ M4_YY_CALL_LAST_ARG);
3178 return -1;
3179 }
3180 }
3181 }
3182
3183 }
3184
3185 /* Now eat padding. */
3186 {
3187 int pad;
3188 pad = yypad64(rd->bread);
3189 while(--pad >= 0){
3190 flex_int8_t t8;
3191 if(yytbl_read8(&t8,rd) != 0)
3192 return -1;
3193 }
3194 }
3195
3196 return 0;
3197}
3198
3199%define-yytables The name for this specific scanner's tables.
3200
3201/* Find the key and load the DFA tables from the given stream. */
3202static int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3203{
3204 int rv=0;
3205 struct yytbl_hdr th;
3206 struct yytbl_reader rd;
3207
3208 rd.fp = fp;
3209 th.th_version = NULL;
3210
3211 /* Keep trying until we find the right set of tables or end of file. */
3212 while (!feof(rd.fp)) {
3213 rd.bread = 0;
3214 if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3215 rv = -1;
3216 goto return_rv;
3217 }
3218
3219 /* A NULL key means choose the first set of tables. */
3220 if (key == NULL)
3221 break;
3222
3223 if (strcmp(th.th_name,key) != 0){
3224 /* Skip ahead to next set */
3225 fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3226 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3227 th.th_version = NULL;
3228 }
3229 else
3230 break;
3231 }
3232
3233 while (rd.bread < th.th_ssize){
3234 /* Load the data tables */
3235 if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3236 rv = -1;
3237 goto return_rv;
3238 }
3239 }
3240
3241return_rv:
3242 if(th.th_version){
3243 yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3244 th.th_version = NULL;
3245 }
3246
3247 return rv;
3248}
3249
3250/** Load the DFA tables for this scanner from the given stream. */
3251int yytables_fload YYFARGS1(FILE *, fp)
3252{
3253
3254 if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3255 return -1;
3256 return 0;
3257}
3258
3259/** Destroy the loaded tables, freeing memory, etc.. */
3260int yytables_destroy YYFARGS0(void)
3261{
3262 struct yytbl_dmap *dmap=0;
3263
3264 if(!M4_YY_TABLES_VERIFY){
3265 /* Walk the dmap, freeing the pointers */
3266 for(dmap=yydmap; dmap->dm_id; dmap++) {
3267 void * v;
3268 v = dmap->dm_arr;
3269 if(v && *(char**)v){
3270 yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3271 *(char**)v = NULL;
3272 }
3273 }
3274 }
3275
3276 return 0;
3277}
3278
3279/* end table serialization code definitions */
3280%endif
3281
3282
3283m4_ifdef([[M4_YY_MAIN]], [[
3284int main M4_YY_PARAMS(void);
3285
3286int main ()
3287{
3288
3289%if-reentrant
3290 yyscan_t lexer;
3291 yylex_init(&lexer);
3292 yylex( lexer );
3293 yylex_destroy( lexer);
3294
3295%endif
3296%if-not-reentrant
3297 yylex();
3298%endif
3299
3300 return 0;
3301}
3302]])
3303
3304%ok-for-header
3305m4_ifdef( [[M4_YY_IN_HEADER]],
3306[[
3307#undef YY_NEW_FILE
3308#undef YY_FLUSH_BUFFER
3309#undef yy_set_bol
3310#undef yy_new_buffer
3311#undef yy_set_interactive
3312#undef YY_DO_BEFORE_ACTION
3313
3314#ifdef YY_DECL_IS_OURS
3315#undef YY_DECL_IS_OURS
3316#undef YY_DECL
3317#endif
3318]])
Note: See TracBrowser for help on using the repository browser.