xref: /minix3/external/bsd/flex/dist/flex.skl (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1357f1050SThomas Veerman%# -*-C-*- vi: set ft=c:
2357f1050SThomas Veerman%# This file is processed in several stages.
3357f1050SThomas Veerman%# Here are the stages, as best as I can describe:
4357f1050SThomas Veerman%#
5357f1050SThomas Veerman%#   1. flex.skl is processed through GNU m4 during the
6357f1050SThomas Veerman%#      pre-compilation stage of flex. Only macros starting
7357f1050SThomas Veerman%#      with `m4preproc_' are processed, and quoting is normal.
8357f1050SThomas Veerman%#
9357f1050SThomas Veerman%#   2. The preprocessed skeleton is translated verbatim into a
10357f1050SThomas Veerman%#      C array, saved as "skel.c" and compiled into the flex binary.
11357f1050SThomas Veerman%#
12357f1050SThomas Veerman%#   3. At runtime, the skeleton is generated and filtered (again)
13357f1050SThomas Veerman%#      through m4. Macros beginning with `m4_' will be processed.
14357f1050SThomas Veerman%#      The quoting is "[[" and "]]" so we don't interfere with
15357f1050SThomas Veerman%#      user code.
16357f1050SThomas Veerman%#
17357f1050SThomas Veerman%# All generate macros for the m4 stage contain the text "m4" or "M4"
18357f1050SThomas Veerman%# in them. This is to distinguish them from CPP macros.
19357f1050SThomas Veerman%# The exception to this rule is YY_G, which is an m4 macro,
20357f1050SThomas Veerman%# but it needs to be remain short because it is used everywhere.
21357f1050SThomas Veerman%#
22357f1050SThomas Veerman/* A lexical scanner generated by flex */
23357f1050SThomas Veerman
24357f1050SThomas Veerman%#  Macros for preproc stage.
25357f1050SThomas Veermanm4preproc_changecom
26357f1050SThomas Veerman
27357f1050SThomas Veerman%# Macros for runtime processing stage.
28357f1050SThomas Veermanm4_changecom
29357f1050SThomas Veermanm4_changequote
30357f1050SThomas Veermanm4_changequote([[, ]])
31357f1050SThomas Veerman
32357f1050SThomas Veerman%#
33357f1050SThomas Veerman%# Lines in this skeleton starting with a "%" character are "control lines"
34357f1050SThomas Veerman%# and affect the generation of the scanner. The possible control codes are
35357f1050SThomas Veerman%# listed and processed in misc.c.
36357f1050SThomas Veerman%#
37357f1050SThomas Veerman%#   %#  -  A comment. The current line is omitted from the generated scanner.
38357f1050SThomas Veerman%#   %if-c++-only  -  The following lines are printed for C++ scanners ONLY.
39357f1050SThomas Veerman%#   %if-c-only    -  The following lines are NOT printed for C++ scanners.
40357f1050SThomas Veerman%#   %if-c-or-c++  -  The following lines are printed in BOTH C and C++ scanners.
41357f1050SThomas Veerman%#   %if-reentrant     - Print for reentrant scanners.(push)
42357f1050SThomas Veerman%#   %if-not-reentrant - Print for non-reentrant scanners. (push)
43357f1050SThomas Veerman%#   %if-bison-bridge  - Print for bison-bridge. (push)
44357f1050SThomas Veerman%#   %if-not-bison-bridge  - Print for non-bison-bridge. (push)
45357f1050SThomas Veerman%#   %endif        - pop from the previous if code.
46357f1050SThomas Veerman%#   %%  -  A stop-point, where code is inserted by flex.
47357f1050SThomas Veerman%#          Each stop-point is numbered here and also in the code generator.
48357f1050SThomas Veerman%#          (See gen.c, etc. for details.)
49357f1050SThomas Veerman%#   %not-for-header  -  Begin code that should NOT appear in a ".h" file.
50357f1050SThomas Veerman%#   %ok-for-header   -  %c and %e are used for building a header file.
51357f1050SThomas Veerman%#   %if-tables-serialization
52357f1050SThomas Veerman%#
53357f1050SThomas Veerman%#   All control-lines EXCEPT comment lines ("%#") will be inserted into
54357f1050SThomas Veerman%#   the generated scanner as a C-style comment. This is to aid those who
55357f1050SThomas Veerman%#   edit the skeleton.
56357f1050SThomas Veerman%#
57357f1050SThomas Veerman
58357f1050SThomas Veerman%not-for-header
59357f1050SThomas Veerman%if-c-only
60357f1050SThomas Veerman%if-not-reentrant
61357f1050SThomas Veermanm4_ifelse(M4_YY_PREFIX,yy,,
62357f1050SThomas Veerman#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
63357f1050SThomas Veerman#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
64357f1050SThomas Veerman#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
65357f1050SThomas Veerman#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
66357f1050SThomas Veerman#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
67357f1050SThomas Veerman#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
68357f1050SThomas Veerman#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
69357f1050SThomas Veerman#define yyin M4_YY_PREFIX[[in]]
70357f1050SThomas Veerman#define yyleng M4_YY_PREFIX[[leng]]
71357f1050SThomas Veerman#define yylex M4_YY_PREFIX[[lex]]
72357f1050SThomas Veerman#define yylineno M4_YY_PREFIX[[lineno]]
73357f1050SThomas Veerman#define yyout M4_YY_PREFIX[[out]]
74357f1050SThomas Veerman#define yyrestart M4_YY_PREFIX[[restart]]
75357f1050SThomas Veerman#define yytext M4_YY_PREFIX[[text]]
76357f1050SThomas Veerman#define yywrap M4_YY_PREFIX[[wrap]]
77357f1050SThomas Veerman#define yyalloc M4_YY_PREFIX[[alloc]]
78357f1050SThomas Veerman#define yyrealloc M4_YY_PREFIX[[realloc]]
79357f1050SThomas Veerman#define yyfree M4_YY_PREFIX[[free]]
80357f1050SThomas Veerman)
81357f1050SThomas Veerman%endif
82357f1050SThomas Veerman%endif
83357f1050SThomas Veerman%ok-for-header
84357f1050SThomas Veerman
85357f1050SThomas Veerman#define FLEX_SCANNER
86357f1050SThomas Veerman#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
87357f1050SThomas Veerman#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
88357f1050SThomas Veerman#define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
89357f1050SThomas Veerman#if YY_FLEX_SUBMINOR_VERSION > 0
90357f1050SThomas Veerman#define FLEX_BETA
91357f1050SThomas Veerman#endif
92357f1050SThomas Veerman
93357f1050SThomas Veerman%# Some negated symbols
94357f1050SThomas Veermanm4_ifdef( [[M4_YY_IN_HEADER]], , [[m4_define([[M4_YY_NOT_IN_HEADER]], [[]])]])
95357f1050SThomas Veermanm4_ifdef( [[M4_YY_REENTRANT]], , [[m4_define([[M4_YY_NOT_REENTRANT]], [[]])]])
96357f1050SThomas Veerman
97357f1050SThomas Veerman%# This is the m4 way to say "(stack_used || is_reentrant)
98357f1050SThomas Veermanm4_ifdef( [[M4_YY_STACK_USED]], [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
99357f1050SThomas Veermanm4_ifdef( [[M4_YY_REENTRANT]],  [[m4_define([[M4_YY_HAS_START_STACK_VARS]])]])
100357f1050SThomas Veerman
101357f1050SThomas Veerman%# Prefixes.
102357f1050SThomas Veerman%# The complexity here is necessary so that m4 preserves
103357f1050SThomas Veerman%# the argument lists to each C function.
104357f1050SThomas Veerman
105357f1050SThomas Veerman
106357f1050SThomas Veermanm4_ifdef( [[M4_YY_PREFIX]],, [[m4_define([[M4_YY_PREFIX]], [[yy]])]])
107357f1050SThomas Veerman
108357f1050SThomas Veermanm4preproc_define(`M4_GEN_PREFIX',
109357f1050SThomas Veerman    ``m4_define(yy[[$1]], [[M4_YY_PREFIX[[$1]]m4_ifelse($'`#,0,,[[($'`@)]])]])'')
110357f1050SThomas Veerman
111357f1050SThomas Veerman%if-c++-only
112357f1050SThomas Veerman    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
113357f1050SThomas Veerman     * following macro. This is required in order to pass the c++-multiple-scanners
114357f1050SThomas Veerman     * test in the regression suite. We get reports that it breaks inheritance.
115357f1050SThomas Veerman     * We will address this in a future release of flex, or omit the C++ scanner
116357f1050SThomas Veerman     * altogether.
117357f1050SThomas Veerman     */
118357f1050SThomas Veerman    #define yyFlexLexer M4_YY_PREFIX[[FlexLexer]]
119357f1050SThomas Veerman%endif
120357f1050SThomas Veerman
121357f1050SThomas Veerman%if-c-only
122357f1050SThomas Veerman    M4_GEN_PREFIX(`_create_buffer')
123357f1050SThomas Veerman    M4_GEN_PREFIX(`_delete_buffer')
124357f1050SThomas Veerman    M4_GEN_PREFIX(`_scan_buffer')
125357f1050SThomas Veerman    M4_GEN_PREFIX(`_scan_string')
126357f1050SThomas Veerman    M4_GEN_PREFIX(`_scan_bytes')
127357f1050SThomas Veerman    M4_GEN_PREFIX(`_init_buffer')
128357f1050SThomas Veerman    M4_GEN_PREFIX(`_flush_buffer')
129357f1050SThomas Veerman    M4_GEN_PREFIX(`_load_buffer_state')
130357f1050SThomas Veerman    M4_GEN_PREFIX(`_switch_to_buffer')
131357f1050SThomas Veerman    M4_GEN_PREFIX(`push_buffer_state')
132357f1050SThomas Veerman    M4_GEN_PREFIX(`pop_buffer_state')
133357f1050SThomas Veerman    M4_GEN_PREFIX(`ensure_buffer_stack')
134357f1050SThomas Veerman    M4_GEN_PREFIX(`lex')
135357f1050SThomas Veerman    M4_GEN_PREFIX(`restart')
136357f1050SThomas Veerman    M4_GEN_PREFIX(`lex_init')
137357f1050SThomas Veerman    M4_GEN_PREFIX(`lex_init_extra')
138357f1050SThomas Veerman    M4_GEN_PREFIX(`lex_destroy')
139357f1050SThomas Veerman    M4_GEN_PREFIX(`get_debug')
140357f1050SThomas Veerman    M4_GEN_PREFIX(`set_debug')
141357f1050SThomas Veerman    M4_GEN_PREFIX(`get_extra')
142357f1050SThomas Veerman    M4_GEN_PREFIX(`set_extra')
143357f1050SThomas Veerman    M4_GEN_PREFIX(`get_in')
144357f1050SThomas Veerman    M4_GEN_PREFIX(`set_in')
145357f1050SThomas Veerman    M4_GEN_PREFIX(`get_out')
146357f1050SThomas Veerman    M4_GEN_PREFIX(`set_out')
147357f1050SThomas Veerman    M4_GEN_PREFIX(`get_leng')
148357f1050SThomas Veerman    M4_GEN_PREFIX(`get_text')
149357f1050SThomas Veerman    M4_GEN_PREFIX(`get_lineno')
150357f1050SThomas Veerman    M4_GEN_PREFIX(`set_lineno')
151357f1050SThomas Veerman    m4_ifdef( [[M4_YY_REENTRANT]],
152357f1050SThomas Veerman    [[
153357f1050SThomas Veerman        M4_GEN_PREFIX(`get_column')
154357f1050SThomas Veerman        M4_GEN_PREFIX(`set_column')
155357f1050SThomas Veerman    ]])
156357f1050SThomas Veerman    M4_GEN_PREFIX(`wrap')
157357f1050SThomas Veerman%endif
158357f1050SThomas Veerman
159357f1050SThomas Veermanm4_ifdef( [[M4_YY_BISON_LVAL]],
160357f1050SThomas Veerman[[
161357f1050SThomas Veerman    M4_GEN_PREFIX(`get_lval')
162357f1050SThomas Veerman    M4_GEN_PREFIX(`set_lval')
163357f1050SThomas Veerman]])
164357f1050SThomas Veerman
165357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
166357f1050SThomas Veerman[[
167357f1050SThomas Veerman    M4_GEN_PREFIX(`get_lloc')
168357f1050SThomas Veerman    M4_GEN_PREFIX(`set_lloc')
169357f1050SThomas Veerman]])
170357f1050SThomas Veerman
171357f1050SThomas Veerman
172357f1050SThomas Veerman    M4_GEN_PREFIX(`alloc')
173357f1050SThomas Veerman    M4_GEN_PREFIX(`realloc')
174357f1050SThomas Veerman    M4_GEN_PREFIX(`free')
175357f1050SThomas Veerman
176357f1050SThomas Veerman%if-c-only
177357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_REENTRANT]],
178357f1050SThomas Veerman[[
179357f1050SThomas Veerman    M4_GEN_PREFIX(`text')
180357f1050SThomas Veerman    M4_GEN_PREFIX(`leng')
181357f1050SThomas Veerman    M4_GEN_PREFIX(`in')
182357f1050SThomas Veerman    M4_GEN_PREFIX(`out')
183357f1050SThomas Veerman    M4_GEN_PREFIX(`_flex_debug')
184357f1050SThomas Veerman    M4_GEN_PREFIX(`lineno')
185357f1050SThomas Veerman]])
186357f1050SThomas Veerman%endif
187357f1050SThomas Veerman
188357f1050SThomas Veerman
189357f1050SThomas Veermanm4_ifdef( [[M4_YY_TABLES_EXTERNAL]],
190357f1050SThomas Veerman[[
191357f1050SThomas Veerman    M4_GEN_PREFIX(`tables_fload')
192357f1050SThomas Veerman    M4_GEN_PREFIX(`tables_destroy')
193357f1050SThomas Veerman    M4_GEN_PREFIX(`TABLES_NAME')
194357f1050SThomas Veerman]])
195357f1050SThomas Veerman
196357f1050SThomas Veerman/* First, we deal with  platform-specific or compiler-specific issues. */
197357f1050SThomas Veerman
198357f1050SThomas Veerman/* begin standard C headers. */
199357f1050SThomas Veerman%if-c-only
200357f1050SThomas Veerman#ifdef _LIBC
201357f1050SThomas Veerman#include "namespace.h"
202357f1050SThomas Veerman#endif
203357f1050SThomas Veerman#include <stdio.h>
204357f1050SThomas Veerman#include <string.h>
205357f1050SThomas Veerman#include <errno.h>
206357f1050SThomas Veerman#include <stdlib.h>
207357f1050SThomas Veerman%endif
208357f1050SThomas Veerman
209357f1050SThomas Veerman%if-tables-serialization
210357f1050SThomas Veerman#include <sys/types.h>
211357f1050SThomas Veerman#include <netinet/in.h>
212357f1050SThomas Veerman%endif
213357f1050SThomas Veerman/* end standard C headers. */
214357f1050SThomas Veerman
215357f1050SThomas Veerman%if-c-or-c++
216357f1050SThomas Veermanm4preproc_include(`flexint.h')
217357f1050SThomas Veerman%endif
218357f1050SThomas Veerman
219357f1050SThomas Veerman%if-c++-only
220357f1050SThomas Veerman/* begin standard C++ headers. */
221357f1050SThomas Veerman#ifdef _LIBC
222357f1050SThomas Veerman#include "namespace.h"
223357f1050SThomas Veerman#endif
224357f1050SThomas Veerman#include <iostream>
225357f1050SThomas Veerman#include <errno.h>
226357f1050SThomas Veerman#include <cstdlib>
22784d9c625SLionel Sambuc#include <cstdio>
228357f1050SThomas Veerman#include <cstring>
229357f1050SThomas Veerman/* end standard C++ headers. */
230357f1050SThomas Veerman%endif
231357f1050SThomas Veerman
232357f1050SThomas Veerman#ifdef __cplusplus
233357f1050SThomas Veerman
234357f1050SThomas Veerman/* The "const" storage-class-modifier is valid. */
235357f1050SThomas Veerman#define YY_USE_CONST
236357f1050SThomas Veerman
237357f1050SThomas Veerman#else	/* ! __cplusplus */
238357f1050SThomas Veerman
239357f1050SThomas Veerman/* C99 requires __STDC__ to be defined as 1. */
240357f1050SThomas Veerman#if defined (__STDC__)
241357f1050SThomas Veerman
242357f1050SThomas Veerman#define YY_USE_CONST
243357f1050SThomas Veerman
244357f1050SThomas Veerman#endif	/* defined (__STDC__) */
245357f1050SThomas Veerman#endif	/* ! __cplusplus */
246357f1050SThomas Veerman
247357f1050SThomas Veerman#ifdef YY_USE_CONST
248357f1050SThomas Veerman#define yyconst const
249357f1050SThomas Veerman#else
250357f1050SThomas Veerman#define yyconst
251357f1050SThomas Veerman#endif
252357f1050SThomas Veerman
253357f1050SThomas Veerman%# For compilers that can not handle prototypes.
254357f1050SThomas Veerman%# e.g.,
255357f1050SThomas Veerman%# The function prototype
256357f1050SThomas Veerman%#    int foo(int x, char* y);
257357f1050SThomas Veerman%#
258357f1050SThomas Veerman%# ...should be written as
259357f1050SThomas Veerman%#    int foo M4_YY_PARAMS(int x, char* y);
260357f1050SThomas Veerman%#
261357f1050SThomas Veerman%# ...which could possibly generate
262357f1050SThomas Veerman%#    int foo ();
263357f1050SThomas Veerman%#
264357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_PROTOS]],
265357f1050SThomas Veerman[[
266357f1050SThomas Veerman    m4_define( [[M4_YY_PARAMS]], [[()]])
267357f1050SThomas Veerman]],
268357f1050SThomas Veerman[[
269357f1050SThomas Veerman    m4_define( [[M4_YY_PARAMS]], [[($*)]])
270357f1050SThomas Veerman]])
271357f1050SThomas Veerman
272357f1050SThomas Veerman%not-for-header
273357f1050SThomas Veerman/* Returned upon end-of-file. */
274357f1050SThomas Veerman#define YY_NULL 0
275357f1050SThomas Veerman%ok-for-header
276357f1050SThomas Veerman
277357f1050SThomas Veerman%not-for-header
278357f1050SThomas Veerman/* Promotes a possibly negative, possibly signed char to an unsigned
279357f1050SThomas Veerman * integer for use as an array index.  If the signed char is negative,
280357f1050SThomas Veerman * we want to instead treat it as an 8-bit unsigned char, hence the
281357f1050SThomas Veerman * double cast.
282357f1050SThomas Veerman */
283357f1050SThomas Veerman#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
284357f1050SThomas Veerman%ok-for-header
285357f1050SThomas Veerman
286357f1050SThomas Veerman
287357f1050SThomas Veerman
288357f1050SThomas Veerman%if-reentrant
289357f1050SThomas Veerman
290357f1050SThomas Veerman/* An opaque pointer. */
291357f1050SThomas Veerman#ifndef YY_TYPEDEF_YY_SCANNER_T
292357f1050SThomas Veerman#define YY_TYPEDEF_YY_SCANNER_T
293357f1050SThomas Veermantypedef void* yyscan_t;
294357f1050SThomas Veerman#endif
295357f1050SThomas Veerman
296357f1050SThomas Veerman%# Declare yyguts variable
297357f1050SThomas Veermanm4_define( [[M4_YY_DECL_GUTS_VAR]], [[struct yyguts_t * yyg = (struct yyguts_t*)yyscanner]])
29884d9c625SLionel Sambuc%# Perform a noop access on yyguts to prevent unused variable complains
29984d9c625SLionel Sambucm4_define( [[M4_YY_NOOP_GUTS_VAR]], [[(void)yyg]])
300357f1050SThomas Veerman%# For use wherever a Global is accessed or assigned.
301357f1050SThomas Veermanm4_define( [[YY_G]], [[yyg->$1]])
302357f1050SThomas Veerman
303357f1050SThomas Veerman%# For use in function prototypes to append the additional argument.
304357f1050SThomas Veermanm4_define( [[M4_YY_PROTO_LAST_ARG]],  [[, yyscan_t yyscanner]])
305357f1050SThomas Veermanm4_define( [[M4_YY_PROTO_ONLY_ARG]],  [[yyscan_t yyscanner]])
306357f1050SThomas Veerman
307357f1050SThomas Veerman%# For use in function definitions to append the additional argument.
308357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
309357f1050SThomas Veerman[[
310357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_LAST_ARG]], [[, yyscanner]])
311357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_ONLY_ARG]], [[yyscanner]])
312357f1050SThomas Veerman]],
313357f1050SThomas Veerman[[
314357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_LAST_ARG]],  [[, yyscan_t yyscanner]])
315357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_ONLY_ARG]],  [[yyscan_t yyscanner]])
316357f1050SThomas Veerman]])
317357f1050SThomas Veermanm4_define( [[M4_YY_DECL_LAST_ARG]],  [[yyscan_t yyscanner;]])
318357f1050SThomas Veerman
319357f1050SThomas Veerman%# For use in function calls to pass the additional argument.
320357f1050SThomas Veermanm4_define( [[M4_YY_CALL_LAST_ARG]], [[, yyscanner]])
321357f1050SThomas Veermanm4_define( [[M4_YY_CALL_ONLY_ARG]], [[yyscanner]])
322357f1050SThomas Veerman
323357f1050SThomas Veerman%# For use in function documentation to adjust for additional argument.
324357f1050SThomas Veermanm4_define( [[M4_YY_DOC_PARAM]], [[@param yyscanner The scanner object.]])
325357f1050SThomas Veerman
326357f1050SThomas Veerman/* For convenience, these vars (plus the bison vars far below)
327357f1050SThomas Veerman   are macros in the reentrant scanner. */
328357f1050SThomas Veerman#define yyin YY_G(yyin_r)
329357f1050SThomas Veerman#define yyout YY_G(yyout_r)
330357f1050SThomas Veerman#define yyextra YY_G(yyextra_r)
331357f1050SThomas Veerman#define yyleng YY_G(yyleng_r)
332357f1050SThomas Veerman#define yytext YY_G(yytext_r)
333357f1050SThomas Veerman#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
334357f1050SThomas Veerman#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
335357f1050SThomas Veerman#define yy_flex_debug YY_G(yy_flex_debug_r)
336357f1050SThomas Veerman
337357f1050SThomas Veermanm4_define( [[M4_YY_INCR_LINENO]],
338357f1050SThomas Veerman[[
339357f1050SThomas Veerman    do{ yylineno++;
340357f1050SThomas Veerman        yycolumn=0;
341357f1050SThomas Veerman    }while(0)
342357f1050SThomas Veerman]])
343357f1050SThomas Veerman
344357f1050SThomas Veerman%endif
345357f1050SThomas Veerman
346357f1050SThomas Veerman
347357f1050SThomas Veerman
348357f1050SThomas Veerman%if-not-reentrant
349357f1050SThomas Veerman
350357f1050SThomas Veermanm4_define( [[M4_YY_INCR_LINENO]],
351357f1050SThomas Veerman[[
352357f1050SThomas Veerman    yylineno++;
353357f1050SThomas Veerman]])
354357f1050SThomas Veerman
355357f1050SThomas Veerman%# Define these macros to be no-ops.
356357f1050SThomas Veermanm4_define( [[M4_YY_DECL_GUTS_VAR]], [[m4_dnl]])
35784d9c625SLionel Sambucm4_define( [[M4_YY_NOOP_GUTS_VAR]], [[m4_dnl]])
358357f1050SThomas Veermanm4_define( [[YY_G]], [[($1)]])
359357f1050SThomas Veermanm4_define( [[M4_YY_PROTO_LAST_ARG]])
360357f1050SThomas Veermanm4_define( [[M4_YY_PROTO_ONLY_ARG]],  [[void]])
361357f1050SThomas Veermanm4_define( [[M4_YY_DEF_LAST_ARG]])
362357f1050SThomas Veerman
363357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
364357f1050SThomas Veerman[[
365357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_ONLY_ARG]])
366357f1050SThomas Veerman]],
367357f1050SThomas Veerman[[
368357f1050SThomas Veerman    m4_define( [[M4_YY_DEF_ONLY_ARG]],  [[void]])
369357f1050SThomas Veerman]])
370357f1050SThomas Veermanm4_define([[M4_YY_DECL_LAST_ARG]])
371357f1050SThomas Veermanm4_define([[M4_YY_CALL_LAST_ARG]])
372357f1050SThomas Veermanm4_define([[M4_YY_CALL_ONLY_ARG]])
373357f1050SThomas Veermanm4_define( [[M4_YY_DOC_PARAM]], [[]])
374357f1050SThomas Veerman
375357f1050SThomas Veerman%endif
376357f1050SThomas Veerman
377357f1050SThomas Veerman
378357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
379357f1050SThomas Veerman[[
380357f1050SThomas Veerman%# For compilers that need traditional function definitions.
381357f1050SThomas Veerman%# e.g.,
382357f1050SThomas Veerman%# The function prototype taking 2 arguments
383357f1050SThomas Veerman%#    int foo (int x, char* y)
384357f1050SThomas Veerman%#
385357f1050SThomas Veerman%# ...should be written as
386357f1050SThomas Veerman%#    int foo YYFARGS2(int,x, char*,y)
387357f1050SThomas Veerman%#
388357f1050SThomas Veerman%# ...which could possibly generate
389357f1050SThomas Veerman%#    int foo (x,y,yyscanner)
390357f1050SThomas Veerman%#        int x;
391357f1050SThomas Veerman%#        char * y;
392357f1050SThomas Veerman%#        yyscan_t yyscanner;
393357f1050SThomas Veerman%#
394357f1050SThomas Veerman%# Generate traditional function defs
395357f1050SThomas Veerman    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG) [[\]]
396357f1050SThomas Veerman        M4_YY_DECL_LAST_ARG]])
397357f1050SThomas Veerman    m4_define( [[YYFARGS1]], [[($2 M4_YY_DEF_LAST_ARG) [[\]]
398357f1050SThomas Veerman        $1 $2; [[\]]
399357f1050SThomas Veerman        M4_YY_DECL_LAST_ARG]])
400357f1050SThomas Veerman    m4_define( [[YYFARGS2]], [[($2,$4 M4_YY_DEF_LAST_ARG) [[\]]
401357f1050SThomas Veerman        $1 $2; [[\]]
402357f1050SThomas Veerman        $3 $4; [[\]]
403357f1050SThomas Veerman        M4_YY_DECL_LAST_ARG]])
404357f1050SThomas Veerman    m4_define( [[YYFARGS3]], [[($2,$4,$6 M4_YY_DEF_LAST_ARG) [[\]]
405357f1050SThomas Veerman        $1 $2; [[\]]
406357f1050SThomas Veerman        $3 $4; [[\]]
407357f1050SThomas Veerman        $5 $6; [[\]]
408357f1050SThomas Veerman        M4_YY_DECL_LAST_ARG]])
409357f1050SThomas Veerman]],
410357f1050SThomas Veerman[[
411357f1050SThomas Veerman%# Generate C99 function defs.
412357f1050SThomas Veerman    m4_define( [[YYFARGS0]], [[(M4_YY_DEF_ONLY_ARG)]])
413357f1050SThomas Veerman    m4_define( [[YYFARGS1]], [[($1 $2 M4_YY_DEF_LAST_ARG)]])
414357f1050SThomas Veerman    m4_define( [[YYFARGS2]], [[($1 $2, $3 $4 M4_YY_DEF_LAST_ARG)]])
415357f1050SThomas Veerman    m4_define( [[YYFARGS3]], [[($1 $2, $3 $4, $5 $6 M4_YY_DEF_LAST_ARG)]])
416357f1050SThomas Veerman]])
417357f1050SThomas Veerman
418357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
419357f1050SThomas Veerman[[
420357f1050SThomas Veerman/* Enter a start condition.  This macro really ought to take a parameter,
421357f1050SThomas Veerman * but we do it the disgusting crufty way forced on us by the ()-less
422357f1050SThomas Veerman * definition of BEGIN.
423357f1050SThomas Veerman */
424357f1050SThomas Veerman#define BEGIN YY_G(yy_start) = 1 + 2 *
425357f1050SThomas Veerman]])
426357f1050SThomas Veerman
427357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
428357f1050SThomas Veerman[[
429357f1050SThomas Veerman/* Translate the current start state into a value that can be later handed
430357f1050SThomas Veerman * to BEGIN to return to the state.  The YYSTATE alias is for lex
431357f1050SThomas Veerman * compatibility.
432357f1050SThomas Veerman */
433357f1050SThomas Veerman#define YY_START ((YY_G(yy_start) - 1) / 2)
434357f1050SThomas Veerman#define YYSTATE YY_START
435357f1050SThomas Veerman]])
436357f1050SThomas Veerman
437357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
438357f1050SThomas Veerman[[
439357f1050SThomas Veerman/* Action number for EOF rule of a given start state. */
440357f1050SThomas Veerman#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
441357f1050SThomas Veerman]])
442357f1050SThomas Veerman
443357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
444357f1050SThomas Veerman[[
445357f1050SThomas Veerman/* Special action meaning "start processing a new file". */
446357f1050SThomas Veerman#define YY_NEW_FILE yyrestart( yyin M4_YY_CALL_LAST_ARG )
447357f1050SThomas Veerman]])
448357f1050SThomas Veerman
449357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
450357f1050SThomas Veerman[[
451357f1050SThomas Veerman#define YY_END_OF_BUFFER_CHAR 0
452357f1050SThomas Veerman]])
453357f1050SThomas Veerman
454357f1050SThomas Veerman/* Size of default input buffer. */
455357f1050SThomas Veerman#ifndef YY_BUF_SIZE
456357f1050SThomas Veerman#define YY_BUF_SIZE 16384
457357f1050SThomas Veerman#endif
458357f1050SThomas Veerman
459357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
460357f1050SThomas Veerman[[
461357f1050SThomas Veerman/* The state buf must be large enough to hold one state per character in the main buffer.
462357f1050SThomas Veerman */
463357f1050SThomas Veerman#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
464357f1050SThomas Veerman]])
465357f1050SThomas Veerman
466357f1050SThomas Veerman
467357f1050SThomas Veerman#ifndef YY_TYPEDEF_YY_BUFFER_STATE
468357f1050SThomas Veerman#define YY_TYPEDEF_YY_BUFFER_STATE
469357f1050SThomas Veermantypedef struct yy_buffer_state *YY_BUFFER_STATE;
470357f1050SThomas Veerman#endif
471357f1050SThomas Veerman
47284d9c625SLionel Sambuc#ifndef YY_TYPEDEF_YY_SIZE_T
47384d9c625SLionel Sambuc#define YY_TYPEDEF_YY_SIZE_T
47484d9c625SLionel Sambuctypedef size_t yy_size_t;
47584d9c625SLionel Sambuc#endif
47684d9c625SLionel Sambuc
477357f1050SThomas Veerman%if-not-reentrant
47884d9c625SLionel Sambucextern yy_size_t yyleng;
479357f1050SThomas Veerman%endif
480357f1050SThomas Veerman
481357f1050SThomas Veerman%if-c-only
482357f1050SThomas Veerman%if-not-reentrant
483357f1050SThomas Veermanextern FILE *yyin, *yyout;
484357f1050SThomas Veerman%endif
485357f1050SThomas Veerman%endif
486357f1050SThomas Veerman
487357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
488357f1050SThomas Veerman[[
489357f1050SThomas Veerman#define EOB_ACT_CONTINUE_SCAN 0
490357f1050SThomas Veerman#define EOB_ACT_END_OF_FILE 1
491357f1050SThomas Veerman#define EOB_ACT_LAST_MATCH 2
492357f1050SThomas Veerman]])
493357f1050SThomas Veerman
494357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
495357f1050SThomas Veerman[[
496357f1050SThomas Veerman    m4_ifdef( [[M4_YY_USE_LINENO]],
497357f1050SThomas Veerman    [[
498357f1050SThomas Veerman    /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
499357f1050SThomas Veerman     *       access to the local variable yy_act. Since yyless() is a macro, it would break
500357f1050SThomas Veerman     *       existing scanners that call yyless() from OUTSIDE yylex.
501357f1050SThomas Veerman     *       One obvious solution it to make yy_act a global. I tried that, and saw
502357f1050SThomas Veerman     *       a 5% performance hit in a non-yylineno scanner, because yy_act is
503357f1050SThomas Veerman     *       normally declared as a register variable-- so it is not worth it.
504357f1050SThomas Veerman     */
505357f1050SThomas Veerman    #define  YY_LESS_LINENO(n) \
506357f1050SThomas Veerman            do { \
507357f1050SThomas Veerman                int yyl;\
508357f1050SThomas Veerman                for ( yyl = n; yyl < yyleng; ++yyl )\
509357f1050SThomas Veerman                    if ( yytext[yyl] == '\n' )\
510357f1050SThomas Veerman                        --yylineno;\
511357f1050SThomas Veerman            }while(0)
512*0a6a1f1dSLionel Sambuc    #define YY_LINENO_REWIND_TO(dst) \
513*0a6a1f1dSLionel Sambuc            do {\
514*0a6a1f1dSLionel Sambuc                const char *p;\
515*0a6a1f1dSLionel Sambuc                for ( p = yy_cp-1; p >= (dst); --p)\
516*0a6a1f1dSLionel Sambuc                    if ( *p == '\n' )\
517*0a6a1f1dSLionel Sambuc                        --yylineno;\
518*0a6a1f1dSLionel Sambuc            }while(0)
519357f1050SThomas Veerman    ]],
520357f1050SThomas Veerman    [[
521357f1050SThomas Veerman    #define YY_LESS_LINENO(n)
522*0a6a1f1dSLionel Sambuc    #define YY_LINENO_REWIND_TO(ptr)
523357f1050SThomas Veerman    ]])
524357f1050SThomas Veerman]])
525357f1050SThomas Veerman
526357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
527357f1050SThomas Veerman[[
528357f1050SThomas Veerman/* Return all but the first "n" matched characters back to the input stream. */
529357f1050SThomas Veerman#define yyless(n) \
530357f1050SThomas Veerman	do \
531357f1050SThomas Veerman		{ \
532357f1050SThomas Veerman		/* Undo effects of setting up yytext. */ \
533357f1050SThomas Veerman        int yyless_macro_arg = (n); \
534357f1050SThomas Veerman        YY_LESS_LINENO(yyless_macro_arg);\
535357f1050SThomas Veerman		*yy_cp = YY_G(yy_hold_char); \
536357f1050SThomas Veerman		YY_RESTORE_YY_MORE_OFFSET \
537357f1050SThomas Veerman		YY_G(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
538357f1050SThomas Veerman		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
539357f1050SThomas Veerman		} \
540357f1050SThomas Veerman	while ( 0 )
541357f1050SThomas Veerman]])
542357f1050SThomas Veerman
543357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
544357f1050SThomas Veerman[[
545357f1050SThomas Veerman#define unput(c) yyunput( c, YY_G(yytext_ptr) M4_YY_CALL_LAST_ARG )
546357f1050SThomas Veerman]])
547357f1050SThomas Veerman
548357f1050SThomas Veerman#ifndef YY_STRUCT_YY_BUFFER_STATE
549357f1050SThomas Veerman#define YY_STRUCT_YY_BUFFER_STATE
550357f1050SThomas Veermanstruct yy_buffer_state
551357f1050SThomas Veerman	{
552357f1050SThomas Veerman%if-c-only
553357f1050SThomas Veerman	FILE *yy_input_file;
554357f1050SThomas Veerman%endif
555357f1050SThomas Veerman
556357f1050SThomas Veerman%if-c++-only
557357f1050SThomas Veerman	std::istream* yy_input_file;
558357f1050SThomas Veerman%endif
559357f1050SThomas Veerman
560357f1050SThomas Veerman
561357f1050SThomas Veerman	char *yy_ch_buf;		/* input buffer */
562357f1050SThomas Veerman	char *yy_buf_pos;		/* current position in input buffer */
563357f1050SThomas Veerman
564357f1050SThomas Veerman	/* Size of input buffer in bytes, not including room for EOB
565357f1050SThomas Veerman	 * characters.
566357f1050SThomas Veerman	 */
567357f1050SThomas Veerman	yy_size_t yy_buf_size;
568357f1050SThomas Veerman
569357f1050SThomas Veerman	/* Number of characters read into yy_ch_buf, not including EOB
570357f1050SThomas Veerman	 * characters.
571357f1050SThomas Veerman	 */
57284d9c625SLionel Sambuc	yy_size_t yy_n_chars;
573357f1050SThomas Veerman
574357f1050SThomas Veerman	/* Whether we "own" the buffer - i.e., we know we created it,
575357f1050SThomas Veerman	 * and can realloc() it to grow it, and should free() it to
576357f1050SThomas Veerman	 * delete it.
577357f1050SThomas Veerman	 */
578357f1050SThomas Veerman	int yy_is_our_buffer;
579357f1050SThomas Veerman
580357f1050SThomas Veerman	/* Whether this is an "interactive" input source; if so, and
581357f1050SThomas Veerman	 * if we're using stdio for input, then we want to use getc()
582357f1050SThomas Veerman	 * instead of fread(), to make sure we stop fetching input after
583357f1050SThomas Veerman	 * each newline.
584357f1050SThomas Veerman	 */
585357f1050SThomas Veerman	int yy_is_interactive;
586357f1050SThomas Veerman
587357f1050SThomas Veerman	/* Whether we're considered to be at the beginning of a line.
588357f1050SThomas Veerman	 * If so, '^' rules will be active on the next match, otherwise
589357f1050SThomas Veerman	 * not.
590357f1050SThomas Veerman	 */
591357f1050SThomas Veerman	int yy_at_bol;
592357f1050SThomas Veerman
593357f1050SThomas Veerman    int yy_bs_lineno; /**< The line count. */
594357f1050SThomas Veerman    int yy_bs_column; /**< The column count. */
595357f1050SThomas Veerman
596357f1050SThomas Veerman
597357f1050SThomas Veerman	/* Whether to try to fill the input buffer when we reach the
598357f1050SThomas Veerman	 * end of it.
599357f1050SThomas Veerman	 */
600357f1050SThomas Veerman	int yy_fill_buffer;
601357f1050SThomas Veerman
602357f1050SThomas Veerman	int yy_buffer_status;
603357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
604357f1050SThomas Veerman[[
605357f1050SThomas Veerman#define YY_BUFFER_NEW 0
606357f1050SThomas Veerman#define YY_BUFFER_NORMAL 1
607357f1050SThomas Veerman	/* When an EOF's been seen but there's still some text to process
608357f1050SThomas Veerman	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
609357f1050SThomas Veerman	 * shouldn't try reading from the input source any more.  We might
610357f1050SThomas Veerman	 * still have a bunch of tokens to match, though, because of
611357f1050SThomas Veerman	 * possible backing-up.
612357f1050SThomas Veerman	 *
613357f1050SThomas Veerman	 * When we actually see the EOF, we change the status to "new"
614357f1050SThomas Veerman	 * (via yyrestart()), so that the user can continue scanning by
615357f1050SThomas Veerman	 * just pointing yyin at a new input file.
616357f1050SThomas Veerman	 */
617357f1050SThomas Veerman#define YY_BUFFER_EOF_PENDING 2
618357f1050SThomas Veerman]])
619357f1050SThomas Veerman	};
620357f1050SThomas Veerman#endif /* !YY_STRUCT_YY_BUFFER_STATE */
621357f1050SThomas Veerman
622357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
623357f1050SThomas Veerman%not-for-header
624357f1050SThomas Veerman%if-not-reentrant
625357f1050SThomas Veerman
626357f1050SThomas Veerman/* Stack of input buffers. */
627357f1050SThomas Veermanstatic size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
628357f1050SThomas Veermanstatic size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
629357f1050SThomas Veermanstatic YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
630357f1050SThomas Veerman%endif
631357f1050SThomas Veerman%ok-for-header
632357f1050SThomas Veerman%endif
633357f1050SThomas Veerman
634357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
635357f1050SThomas Veerman[[
636357f1050SThomas Veerman/* We provide macros for accessing buffer states in case in the
637357f1050SThomas Veerman * future we want to put the buffer states in a more general
638357f1050SThomas Veerman * "scanner state".
639357f1050SThomas Veerman *
640357f1050SThomas Veerman * Returns the top of the stack, or NULL.
641357f1050SThomas Veerman */
642357f1050SThomas Veerman#define YY_CURRENT_BUFFER ( YY_G(yy_buffer_stack) \
643357f1050SThomas Veerman                          ? YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)] \
644357f1050SThomas Veerman                          : NULL)
645357f1050SThomas Veerman]])
646357f1050SThomas Veerman
647357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
648357f1050SThomas Veerman[[
649357f1050SThomas Veerman/* Same as previous macro, but useful when we know that the buffer stack is not
650357f1050SThomas Veerman * NULL or when we need an lvalue. For internal use only.
651357f1050SThomas Veerman */
652357f1050SThomas Veerman#define YY_CURRENT_BUFFER_LVALUE YY_G(yy_buffer_stack)[YY_G(yy_buffer_stack_top)]
653357f1050SThomas Veerman]])
654357f1050SThomas Veerman
655357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
656357f1050SThomas Veerman
657357f1050SThomas Veerman%if-not-reentrant
658357f1050SThomas Veerman%not-for-header
659357f1050SThomas Veerman/* yy_hold_char holds the character lost when yytext is formed. */
660357f1050SThomas Veermanstatic char yy_hold_char;
66184d9c625SLionel Sambucstatic yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
66284d9c625SLionel Sambucyy_size_t yyleng;
663357f1050SThomas Veerman
664357f1050SThomas Veerman/* Points to current character in buffer. */
665357f1050SThomas Veermanstatic char *yy_c_buf_p = (char *) 0;
666357f1050SThomas Veermanstatic int yy_init = 0;		/* whether we need to initialize */
667357f1050SThomas Veermanstatic int yy_start = 0;	/* start state number */
668357f1050SThomas Veerman
669357f1050SThomas Veerman/* Flag which is used to allow yywrap()'s to do buffer switches
670357f1050SThomas Veerman * instead of setting up a fresh yyin.  A bit of a hack ...
671357f1050SThomas Veerman */
672357f1050SThomas Veermanstatic int yy_did_buffer_switch_on_eof;
673357f1050SThomas Veerman%ok-for-header
674357f1050SThomas Veerman%endif
675357f1050SThomas Veerman
676357f1050SThomas Veermanvoid yyrestart M4_YY_PARAMS( FILE *input_file M4_YY_PROTO_LAST_ARG );
677357f1050SThomas Veermanvoid yy_switch_to_buffer M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
678357f1050SThomas VeermanYY_BUFFER_STATE yy_create_buffer M4_YY_PARAMS( FILE *file, int size M4_YY_PROTO_LAST_ARG );
679357f1050SThomas Veermanvoid yy_delete_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
680357f1050SThomas Veermanvoid yy_flush_buffer M4_YY_PARAMS( YY_BUFFER_STATE b M4_YY_PROTO_LAST_ARG );
681357f1050SThomas Veermanvoid yypush_buffer_state M4_YY_PARAMS( YY_BUFFER_STATE new_buffer M4_YY_PROTO_LAST_ARG );
682357f1050SThomas Veermanvoid yypop_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
683357f1050SThomas Veerman
684357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
685357f1050SThomas Veerman[[
686357f1050SThomas Veermanstatic void yyensure_buffer_stack M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
687357f1050SThomas Veermanstatic void yy_load_buffer_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
688357f1050SThomas Veermanstatic void yy_init_buffer M4_YY_PARAMS( YY_BUFFER_STATE b, FILE *file M4_YY_PROTO_LAST_ARG );
689357f1050SThomas Veerman]])
690357f1050SThomas Veerman
691357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
692357f1050SThomas Veerman[[
693357f1050SThomas Veerman#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG)
694357f1050SThomas Veerman]])
695357f1050SThomas Veerman
696357f1050SThomas VeermanYY_BUFFER_STATE yy_scan_buffer M4_YY_PARAMS( char *base, yy_size_t size M4_YY_PROTO_LAST_ARG );
697357f1050SThomas VeermanYY_BUFFER_STATE yy_scan_string M4_YY_PARAMS( yyconst char *yy_str M4_YY_PROTO_LAST_ARG );
69884d9c625SLionel SambucYY_BUFFER_STATE yy_scan_bytes M4_YY_PARAMS( yyconst char *bytes, yy_size_t len M4_YY_PROTO_LAST_ARG );
699357f1050SThomas Veerman
700357f1050SThomas Veerman%endif
701357f1050SThomas Veerman
702357f1050SThomas Veermanvoid *yyalloc M4_YY_PARAMS( yy_size_t M4_YY_PROTO_LAST_ARG );
703357f1050SThomas Veermanvoid *yyrealloc M4_YY_PARAMS( void *, yy_size_t M4_YY_PROTO_LAST_ARG );
704357f1050SThomas Veermanvoid yyfree M4_YY_PARAMS( void * M4_YY_PROTO_LAST_ARG );
705357f1050SThomas Veerman
706357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
707357f1050SThomas Veerman[[
708357f1050SThomas Veerman#define yy_new_buffer yy_create_buffer
709357f1050SThomas Veerman]])
710357f1050SThomas Veerman
711357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
712357f1050SThomas Veerman[[
713357f1050SThomas Veerman#define yy_set_interactive(is_interactive) \
714357f1050SThomas Veerman	{ \
715357f1050SThomas Veerman	if ( ! YY_CURRENT_BUFFER ){ \
716357f1050SThomas Veerman        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
717357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE =    \
718357f1050SThomas Veerman            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
719357f1050SThomas Veerman	} \
720357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
721357f1050SThomas Veerman	}
722357f1050SThomas Veerman]])
723357f1050SThomas Veerman
724357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
725357f1050SThomas Veerman[[
726357f1050SThomas Veerman#define yy_set_bol(at_bol) \
727357f1050SThomas Veerman	{ \
728357f1050SThomas Veerman	if ( ! YY_CURRENT_BUFFER ){\
729357f1050SThomas Veerman        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG); \
730357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE =    \
731357f1050SThomas Veerman            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG); \
732357f1050SThomas Veerman	} \
733357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
734357f1050SThomas Veerman	}
735357f1050SThomas Veerman]])
736357f1050SThomas Veerman
737357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
738357f1050SThomas Veerman[[
739357f1050SThomas Veerman#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
740357f1050SThomas Veerman]])
741357f1050SThomas Veerman
742357f1050SThomas Veerman%% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here
743357f1050SThomas Veerman
744*0a6a1f1dSLionel Sambucm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
745*0a6a1f1dSLionel Sambuc[[
746*0a6a1f1dSLionel Sambuc%% [1.5] DFA
747*0a6a1f1dSLionel Sambuc]])
748*0a6a1f1dSLionel Sambuc
749357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
750357f1050SThomas Veerman
751357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
752357f1050SThomas Veerman[[
753357f1050SThomas Veermanstatic yy_state_type yy_get_previous_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
754357f1050SThomas Veermanstatic yy_state_type yy_try_NUL_trans M4_YY_PARAMS( yy_state_type current_state  M4_YY_PROTO_LAST_ARG);
755357f1050SThomas Veermanstatic int yy_get_next_buffer M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
756357f1050SThomas Veerman#if defined(__GNUC__) && __GNUC__ >= 3
757357f1050SThomas Veerman__attribute__((__noreturn__))
758357f1050SThomas Veerman#endif
759357f1050SThomas Veermanstatic void yy_fatal_error M4_YY_PARAMS( yyconst char msg[] M4_YY_PROTO_LAST_ARG );
760357f1050SThomas Veerman]])
761357f1050SThomas Veerman
762357f1050SThomas Veerman%endif
763357f1050SThomas Veerman
764357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
765357f1050SThomas Veerman[[
766357f1050SThomas Veerman/* Done after the current pattern has been matched and before the
767357f1050SThomas Veerman * corresponding action - sets up yytext.
768357f1050SThomas Veerman */
769357f1050SThomas Veerman#define YY_DO_BEFORE_ACTION \
770357f1050SThomas Veerman	YY_G(yytext_ptr) = yy_bp; \
771357f1050SThomas Veerman%% [2.0] code to fiddle yytext and yyleng for yymore() goes here \
772357f1050SThomas Veerman	YY_G(yy_hold_char) = *yy_cp; \
773357f1050SThomas Veerman	*yy_cp = '\0'; \
774357f1050SThomas Veerman%% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \
775357f1050SThomas Veerman	YY_G(yy_c_buf_p) = yy_cp;
776357f1050SThomas Veerman]])
777357f1050SThomas Veerman
778357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
779357f1050SThomas Veerman[[
780357f1050SThomas Veerman%% [4.0] data tables for the DFA and the user's section 1 definitions go here
781357f1050SThomas Veerman]])
782357f1050SThomas Veerman
783357f1050SThomas Veermanm4_ifdef( [[M4_YY_IN_HEADER]], [[#ifdef YY_HEADER_EXPORT_START_CONDITIONS]])
784357f1050SThomas VeermanM4_YY_SC_DEFS
785357f1050SThomas Veermanm4_ifdef( [[M4_YY_IN_HEADER]], [[#endif]])
786357f1050SThomas Veerman
787357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_UNISTD_H]],,
788357f1050SThomas Veerman[[
789357f1050SThomas Veerman#ifndef YY_NO_UNISTD_H
790357f1050SThomas Veerman/* Special case for "unistd.h", since it is non-ANSI. We include it way
791357f1050SThomas Veerman * down here because we want the user's section 1 to have been scanned first.
792357f1050SThomas Veerman * The user has a chance to override it with an option.
793357f1050SThomas Veerman */
794357f1050SThomas Veerman%if-c-only
795357f1050SThomas Veerman#include <unistd.h>
796357f1050SThomas Veerman%endif
797357f1050SThomas Veerman%if-c++-only
798357f1050SThomas Veerman#include <unistd.h>
799357f1050SThomas Veerman%endif
800357f1050SThomas Veerman#endif
801357f1050SThomas Veerman]])
802357f1050SThomas Veerman
803357f1050SThomas Veermanm4_ifdef( [[M4_EXTRA_TYPE_DEFS]],
804357f1050SThomas Veerman[[
805357f1050SThomas Veerman#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS
806357f1050SThomas Veerman]],
807357f1050SThomas Veerman[[
808357f1050SThomas Veerman#ifndef YY_EXTRA_TYPE
809357f1050SThomas Veerman#define YY_EXTRA_TYPE void *
810357f1050SThomas Veerman#endif
811357f1050SThomas Veerman]]
812357f1050SThomas Veerman)
813357f1050SThomas Veerman
814357f1050SThomas Veerman%if-c-only Reentrant structure and macros (non-C++).
815357f1050SThomas Veerman%if-reentrant
816357f1050SThomas Veerman
817357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
818357f1050SThomas Veerman[[
819357f1050SThomas Veerman/* Holds the entire state of the reentrant scanner. */
820357f1050SThomas Veermanstruct yyguts_t
821357f1050SThomas Veerman    {
822357f1050SThomas Veerman
823357f1050SThomas Veerman    /* User-defined. Not touched by flex. */
824357f1050SThomas Veerman    YY_EXTRA_TYPE yyextra_r;
825357f1050SThomas Veerman
826357f1050SThomas Veerman    /* The rest are the same as the globals declared in the non-reentrant scanner. */
827357f1050SThomas Veerman    FILE *yyin_r, *yyout_r;
828357f1050SThomas Veerman    size_t yy_buffer_stack_top; /**< index of top of stack. */
829357f1050SThomas Veerman    size_t yy_buffer_stack_max; /**< capacity of stack. */
830357f1050SThomas Veerman    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
831357f1050SThomas Veerman    char yy_hold_char;
83284d9c625SLionel Sambuc    yy_size_t yy_n_chars;
83384d9c625SLionel Sambuc    yy_size_t yyleng_r;
834357f1050SThomas Veerman    char *yy_c_buf_p;
835357f1050SThomas Veerman    int yy_init;
836357f1050SThomas Veerman    int yy_start;
837357f1050SThomas Veerman    int yy_did_buffer_switch_on_eof;
838357f1050SThomas Veerman    int yy_start_stack_ptr;
839357f1050SThomas Veerman    int yy_start_stack_depth;
840357f1050SThomas Veerman    int *yy_start_stack;
841357f1050SThomas Veerman    yy_state_type yy_last_accepting_state;
842357f1050SThomas Veerman    char* yy_last_accepting_cpos;
843357f1050SThomas Veerman
844357f1050SThomas Veerman    int yylineno_r;
845357f1050SThomas Veerman    int yy_flex_debug_r;
846357f1050SThomas Veerman
847357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
848357f1050SThomas Veerman[[
849357f1050SThomas Veerman    yy_state_type *yy_state_buf;
850357f1050SThomas Veerman    yy_state_type *yy_state_ptr;
851357f1050SThomas Veerman    char *yy_full_match;
852357f1050SThomas Veerman    int yy_lp;
853357f1050SThomas Veerman
854357f1050SThomas Veerman    /* These are only needed for trailing context rules,
855357f1050SThomas Veerman     * but there's no conditional variable for that yet. */
856357f1050SThomas Veerman    int yy_looking_for_trail_begin;
857357f1050SThomas Veerman    int yy_full_lp;
858357f1050SThomas Veerman    int *yy_full_state;
859357f1050SThomas Veerman]])
860357f1050SThomas Veerman
861357f1050SThomas Veermanm4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
862357f1050SThomas Veerman[[
863357f1050SThomas Veerman    char yytext_r[YYLMAX];
864357f1050SThomas Veerman    char *yytext_ptr;
865357f1050SThomas Veerman    int yy_more_offset;
866357f1050SThomas Veerman    int yy_prev_more_offset;
867357f1050SThomas Veerman]],
868357f1050SThomas Veerman[[
869357f1050SThomas Veerman    char *yytext_r;
870357f1050SThomas Veerman    int yy_more_flag;
871357f1050SThomas Veerman    int yy_more_len;
872357f1050SThomas Veerman]])
873357f1050SThomas Veerman
874357f1050SThomas Veermanm4_ifdef( [[M4_YY_BISON_LVAL]],
875357f1050SThomas Veerman[[
876357f1050SThomas Veerman    YYSTYPE * yylval_r;
877357f1050SThomas Veerman]])
878357f1050SThomas Veerman
879357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
880357f1050SThomas Veerman[[
881357f1050SThomas Veerman    YYLTYPE * yylloc_r;
882357f1050SThomas Veerman]])
883357f1050SThomas Veerman
884357f1050SThomas Veerman    }; /* end struct yyguts_t */
885357f1050SThomas Veerman]])
886357f1050SThomas Veerman
887357f1050SThomas Veerman
888357f1050SThomas Veerman%if-c-only
889357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
890357f1050SThomas Veerman[[
891357f1050SThomas Veermanstatic int yy_init_globals M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
892357f1050SThomas Veerman]])
893357f1050SThomas Veerman%endif
894357f1050SThomas Veerman
895357f1050SThomas Veerman%if-reentrant
896357f1050SThomas Veerman
897357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
898357f1050SThomas Veerman[[
899357f1050SThomas Veerman    m4_ifdef( [[M4_YY_BISON_LVAL]],
900357f1050SThomas Veerman    [[
901357f1050SThomas Veerman    /* This must go here because YYSTYPE and YYLTYPE are included
902357f1050SThomas Veerman     * from bison output in section 1.*/
903357f1050SThomas Veerman    #    define yylval YY_G(yylval_r)
904357f1050SThomas Veerman    ]])
905357f1050SThomas Veerman
906357f1050SThomas Veerman    m4_ifdef( [[<M4_YY_BISON_LLOC>]],
907357f1050SThomas Veerman    [[
908357f1050SThomas Veerman    #    define yylloc YY_G(yylloc_r)
909357f1050SThomas Veerman    ]])
910357f1050SThomas Veerman]])
911357f1050SThomas Veerman
912357f1050SThomas Veermanint yylex_init M4_YY_PARAMS(yyscan_t* scanner);
913357f1050SThomas Veerman
914357f1050SThomas Veermanint yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
915357f1050SThomas Veerman
916357f1050SThomas Veerman%endif
917357f1050SThomas Veerman
918357f1050SThomas Veerman%endif End reentrant structures and macros.
919357f1050SThomas Veerman
920357f1050SThomas Veerman/* Accessor methods to globals.
921357f1050SThomas Veerman   These are made visible to non-reentrant scanners for convenience. */
922357f1050SThomas Veerman
923357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_DESTROY]],,
924357f1050SThomas Veerman[[
925357f1050SThomas Veermanint yylex_destroy M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
926357f1050SThomas Veerman]])
927357f1050SThomas Veerman
928357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
929357f1050SThomas Veerman[[
930357f1050SThomas Veermanint yyget_debug M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
931357f1050SThomas Veerman]])
932357f1050SThomas Veerman
933357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
934357f1050SThomas Veerman[[
935357f1050SThomas Veermanvoid yyset_debug M4_YY_PARAMS( int debug_flag M4_YY_PROTO_LAST_ARG );
936357f1050SThomas Veerman]])
937357f1050SThomas Veerman
938357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
939357f1050SThomas Veerman[[
940357f1050SThomas VeermanYY_EXTRA_TYPE yyget_extra M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
941357f1050SThomas Veerman]])
942357f1050SThomas Veerman
943357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
944357f1050SThomas Veerman[[
945357f1050SThomas Veermanvoid yyset_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined M4_YY_PROTO_LAST_ARG );
946357f1050SThomas Veerman]])
947357f1050SThomas Veerman
948357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_IN]],,
949357f1050SThomas Veerman[[
950357f1050SThomas VeermanFILE *yyget_in M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
951357f1050SThomas Veerman]])
952357f1050SThomas Veerman
953357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_IN]],,
954357f1050SThomas Veerman[[
955357f1050SThomas Veermanvoid yyset_in  M4_YY_PARAMS( FILE * _in_str M4_YY_PROTO_LAST_ARG );
956357f1050SThomas Veerman]])
957357f1050SThomas Veerman
958357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_OUT]],,
959357f1050SThomas Veerman[[
960357f1050SThomas VeermanFILE *yyget_out M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
961357f1050SThomas Veerman]])
962357f1050SThomas Veerman
963357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_OUT]],,
964357f1050SThomas Veerman[[
965357f1050SThomas Veermanvoid yyset_out  M4_YY_PARAMS( FILE * _out_str M4_YY_PROTO_LAST_ARG );
966357f1050SThomas Veerman]])
967357f1050SThomas Veerman
968357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LENG]],,
969357f1050SThomas Veerman[[
97084d9c625SLionel Sambucyy_size_t yyget_leng M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
971357f1050SThomas Veerman]])
972357f1050SThomas Veerman
973357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_TEXT]],,
974357f1050SThomas Veerman[[
975357f1050SThomas Veermanchar *yyget_text M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
976357f1050SThomas Veerman]])
977357f1050SThomas Veerman
978357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LINENO]],,
979357f1050SThomas Veerman[[
980357f1050SThomas Veermanint yyget_lineno M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
981357f1050SThomas Veerman]])
982357f1050SThomas Veerman
983357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_LINENO]],,
984357f1050SThomas Veerman[[
985357f1050SThomas Veermanvoid yyset_lineno M4_YY_PARAMS( int _line_number M4_YY_PROTO_LAST_ARG );
986357f1050SThomas Veerman]])
987357f1050SThomas Veerman
98884d9c625SLionel Sambucm4_ifdef( [[M4_YY_REENTRANT]],
98984d9c625SLionel Sambuc[[
99084d9c625SLionel Sambucm4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
99184d9c625SLionel Sambuc[[
99284d9c625SLionel Sambucint yyget_column  M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
99384d9c625SLionel Sambuc]])
99484d9c625SLionel Sambuc]])
99584d9c625SLionel Sambuc
99684d9c625SLionel Sambucm4_ifdef( [[M4_YY_REENTRANT]],
99784d9c625SLionel Sambuc[[
99884d9c625SLionel Sambucm4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
99984d9c625SLionel Sambuc[[
100084d9c625SLionel Sambucvoid yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
100184d9c625SLionel Sambuc]])
100284d9c625SLionel Sambuc]])
100384d9c625SLionel Sambuc
1004357f1050SThomas Veerman%if-bison-bridge
1005357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LVAL]],,
1006357f1050SThomas Veerman[[
1007357f1050SThomas VeermanYYSTYPE * yyget_lval M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1008357f1050SThomas Veerman]])
1009357f1050SThomas Veerman
1010357f1050SThomas Veermanvoid yyset_lval M4_YY_PARAMS( YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG );
1011357f1050SThomas Veerman
1012357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
1013357f1050SThomas Veerman[[
1014357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
1015357f1050SThomas Veerman    [[
1016357f1050SThomas Veerman       YYLTYPE *yyget_lloc M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1017357f1050SThomas Veerman    ]])
1018357f1050SThomas Veerman
1019357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
1020357f1050SThomas Veerman    [[
1021357f1050SThomas Veerman        void yyset_lloc M4_YY_PARAMS( YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG );
1022357f1050SThomas Veerman    ]])
1023357f1050SThomas Veerman]])
1024357f1050SThomas Veerman%endif
1025357f1050SThomas Veerman
1026357f1050SThomas Veerman/* Macros after this point can all be overridden by user definitions in
1027357f1050SThomas Veerman * section 1.
1028357f1050SThomas Veerman */
1029357f1050SThomas Veerman
1030357f1050SThomas Veerman#ifndef YY_SKIP_YYWRAP
1031357f1050SThomas Veerman#ifdef __cplusplus
1032357f1050SThomas Veermanextern "C" int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1033357f1050SThomas Veerman#else
1034357f1050SThomas Veermanextern int yywrap M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1035357f1050SThomas Veerman#endif
1036357f1050SThomas Veerman#endif
1037357f1050SThomas Veerman
1038357f1050SThomas Veerman%not-for-header
1039357f1050SThomas Veerman#ifndef YY_NO_UNPUT
1040357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_UNPUT]],,
1041357f1050SThomas Veerman    [[
1042357f1050SThomas Veerman    static void yyunput M4_YY_PARAMS( int c, char *buf_ptr  M4_YY_PROTO_LAST_ARG);
1043357f1050SThomas Veerman    ]])
1044357f1050SThomas Veerman#endif
1045357f1050SThomas Veerman%ok-for-header
1046357f1050SThomas Veerman%endif
1047357f1050SThomas Veerman
1048357f1050SThomas Veerman#ifndef yytext_ptr
1049357f1050SThomas Veermanstatic void yy_flex_strncpy M4_YY_PARAMS( char *, yyconst char *, int M4_YY_PROTO_LAST_ARG);
1050357f1050SThomas Veerman#endif
1051357f1050SThomas Veerman
1052357f1050SThomas Veerman#ifdef YY_NEED_STRLEN
1053357f1050SThomas Veermanstatic int yy_flex_strlen M4_YY_PARAMS( yyconst char * M4_YY_PROTO_LAST_ARG);
1054357f1050SThomas Veerman#endif
1055357f1050SThomas Veerman
1056357f1050SThomas Veerman#ifndef YY_NO_INPUT
1057357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
1058357f1050SThomas Veerman%not-for-header
1059357f1050SThomas Veerman#ifdef __cplusplus
1060357f1050SThomas Veermanstatic int yyinput M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1061357f1050SThomas Veerman#else
1062357f1050SThomas Veermanstatic int input M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1063357f1050SThomas Veerman#endif
1064357f1050SThomas Veerman%ok-for-header
1065357f1050SThomas Veerman%endif
1066357f1050SThomas Veerman#endif
1067357f1050SThomas Veerman
1068357f1050SThomas Veerman
1069357f1050SThomas Veerman%if-c-only
1070357f1050SThomas Veerman%# TODO: This is messy.
1071357f1050SThomas Veermanm4_ifdef( [[M4_YY_STACK_USED]],
1072357f1050SThomas Veerman[[
1073357f1050SThomas Veerman
1074357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_REENTRANT]],
1075357f1050SThomas Veerman[[
1076357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1077357f1050SThomas Veerman    [[
1078357f1050SThomas Veerman        static int yy_start_stack_ptr = 0;
1079357f1050SThomas Veerman        static int yy_start_stack_depth = 0;
1080357f1050SThomas Veerman        static int *yy_start_stack = NULL;
1081357f1050SThomas Veerman    ]])
1082357f1050SThomas Veerman]])
1083357f1050SThomas Veerman
1084357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1085357f1050SThomas Veerman[[
1086357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
1087357f1050SThomas Veerman    [[
1088357f1050SThomas Veerman    static void yy_push_state M4_YY_PARAMS( int _new_state M4_YY_PROTO_LAST_ARG);
1089357f1050SThomas Veerman    ]])
1090357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_POP_STATE]],,
1091357f1050SThomas Veerman    [[
1092357f1050SThomas Veerman    static void yy_pop_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1093357f1050SThomas Veerman    ]])
1094357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_TOP_STATE]],,
1095357f1050SThomas Veerman    [[
1096357f1050SThomas Veerman    static int yy_top_state M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
1097357f1050SThomas Veerman    ]])
1098357f1050SThomas Veerman]])
1099357f1050SThomas Veerman
1100357f1050SThomas Veerman]],
1101357f1050SThomas Veerman[[
1102357f1050SThomas Veermanm4_define( [[M4_YY_NO_PUSH_STATE]])
1103357f1050SThomas Veermanm4_define( [[M4_YY_NO_POP_STATE]])
1104357f1050SThomas Veermanm4_define( [[M4_YY_NO_TOP_STATE]])
1105357f1050SThomas Veerman]])
1106357f1050SThomas Veerman%endif
1107357f1050SThomas Veerman
1108357f1050SThomas Veerman/* Amount of stuff to slurp up with each read. */
1109357f1050SThomas Veerman#ifndef YY_READ_BUF_SIZE
1110357f1050SThomas Veerman#define YY_READ_BUF_SIZE 8192
1111357f1050SThomas Veerman#endif
1112357f1050SThomas Veerman
1113357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1114357f1050SThomas Veerman[[
1115357f1050SThomas Veerman/* Copy whatever the last rule matched to the standard output. */
1116357f1050SThomas Veerman#ifndef ECHO
1117357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
1118357f1050SThomas Veerman/* This used to be an fputs(), but since the string might contain NUL's,
1119357f1050SThomas Veerman * we now use fwrite().
1120357f1050SThomas Veerman */
112184d9c625SLionel Sambuc#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
1122357f1050SThomas Veerman%endif
1123357f1050SThomas Veerman%if-c++-only C++ definition
1124357f1050SThomas Veerman#define ECHO LexerOutput( yytext, yyleng )
1125357f1050SThomas Veerman%endif
1126357f1050SThomas Veerman#endif
1127357f1050SThomas Veerman]])
1128357f1050SThomas Veerman
1129357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1130357f1050SThomas Veerman[[
1131357f1050SThomas Veerman/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
1132357f1050SThomas Veerman * is returned in "result".
1133357f1050SThomas Veerman */
1134357f1050SThomas Veerman#ifndef YY_INPUT
1135357f1050SThomas Veerman#define YY_INPUT(buf,result,max_size) \
1136357f1050SThomas Veerman%% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \
1137357f1050SThomas Veerman\
1138357f1050SThomas Veerman%if-c++-only C++ definition \
1139357f1050SThomas Veerman	if ( (int)(result = LexerInput( (char *) buf, max_size )) < 0 ) \
1140357f1050SThomas Veerman		YY_FATAL_ERROR( "input in flex scanner failed" );
1141357f1050SThomas Veerman%endif
1142357f1050SThomas Veerman
1143357f1050SThomas Veerman#endif
1144357f1050SThomas Veerman]])
1145357f1050SThomas Veerman
1146357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1147357f1050SThomas Veerman[[
1148357f1050SThomas Veerman/* No semi-colon after return; correct usage is to write "yyterminate();" -
1149357f1050SThomas Veerman * we don't want an extra ';' after the "return" because that will cause
1150357f1050SThomas Veerman * some compilers to complain about unreachable statements.
1151357f1050SThomas Veerman */
1152357f1050SThomas Veerman#ifndef yyterminate
1153357f1050SThomas Veerman#define yyterminate() return YY_NULL
1154357f1050SThomas Veerman#endif
1155357f1050SThomas Veerman]])
1156357f1050SThomas Veerman
1157357f1050SThomas Veerman/* Number of entries by which start-condition stack grows. */
1158357f1050SThomas Veerman#ifndef YY_START_STACK_INCR
1159357f1050SThomas Veerman#define YY_START_STACK_INCR 25
1160357f1050SThomas Veerman#endif
1161357f1050SThomas Veerman
1162357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1163357f1050SThomas Veerman[[
1164357f1050SThomas Veerman/* Report a fatal error. */
1165357f1050SThomas Veerman#ifndef YY_FATAL_ERROR
1166357f1050SThomas Veerman%if-c-only
1167357f1050SThomas Veerman#define YY_FATAL_ERROR(msg) yy_fatal_error( msg M4_YY_CALL_LAST_ARG)
1168357f1050SThomas Veerman%endif
1169357f1050SThomas Veerman%if-c++-only
1170357f1050SThomas Veerman#define YY_FATAL_ERROR(msg) LexerError( msg )
1171357f1050SThomas Veerman%endif
1172357f1050SThomas Veerman#endif
1173357f1050SThomas Veerman]])
1174357f1050SThomas Veerman
1175357f1050SThomas Veerman%if-tables-serialization structures and prototypes
1176357f1050SThomas Veermanm4preproc_include(`tables_shared.h')
1177357f1050SThomas Veerman
1178357f1050SThomas Veerman/* Load the DFA tables from the given stream.  */
1179357f1050SThomas Veermanint yytables_fload M4_YY_PARAMS(FILE * fp M4_YY_PROTO_LAST_ARG);
1180357f1050SThomas Veerman
1181357f1050SThomas Veerman/* Unload the tables from memory. */
1182357f1050SThomas Veermanint yytables_destroy M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG);
1183357f1050SThomas Veerman%not-for-header
1184357f1050SThomas Veerman
1185357f1050SThomas Veerman/** Describes a mapping from a serialized table id to its deserialized state in
1186357f1050SThomas Veerman * this scanner.  This is the bridge between our "generic" deserialization code
1187357f1050SThomas Veerman * and the specifics of this scanner.
1188357f1050SThomas Veerman */
1189357f1050SThomas Veermanstruct yytbl_dmap {
1190357f1050SThomas Veerman	enum yytbl_id dm_id;/**< table identifier */
1191357f1050SThomas Veerman	void  **dm_arr;		/**< address of pointer to store the deserialized table. */
1192357f1050SThomas Veerman	size_t  dm_sz;		/**< local sizeof() each element in table. */
1193357f1050SThomas Veerman};
1194357f1050SThomas Veerman
1195357f1050SThomas Veerman/** A {0,0,0}-terminated list of structs, forming the map */
1196357f1050SThomas Veermanstatic struct yytbl_dmap yydmap[] =
1197357f1050SThomas Veerman{
1198357f1050SThomas Veerman%tables-yydmap generated elements
1199357f1050SThomas Veerman    {0,0,0}
1200357f1050SThomas Veerman};
1201357f1050SThomas Veerman
1202357f1050SThomas Veerman/** A tables-reader object to maintain some state in the read. */
1203357f1050SThomas Veermanstruct yytbl_reader {
1204357f1050SThomas Veerman    FILE * fp; /**< input stream */
1205357f1050SThomas Veerman    flex_uint32_t bread; /**< bytes read since beginning of current tableset */
1206357f1050SThomas Veerman};
1207357f1050SThomas Veerman
1208357f1050SThomas Veerman%endif
1209357f1050SThomas Veerman/* end tables serialization structures and prototypes */
1210357f1050SThomas Veerman
1211357f1050SThomas Veerman%ok-for-header
1212357f1050SThomas Veerman
1213357f1050SThomas Veerman/* Default declaration of generated scanner - a define so the user can
1214357f1050SThomas Veerman * easily add parameters.
1215357f1050SThomas Veerman */
1216357f1050SThomas Veerman#ifndef YY_DECL
1217357f1050SThomas Veerman#define YY_DECL_IS_OURS 1
1218357f1050SThomas Veerman%if-c-only Standard (non-C++) definition
1219357f1050SThomas Veerman
1220357f1050SThomas Veerman
1221357f1050SThomas Veermanm4_define( [[M4_YY_LEX_PROTO]], [[M4_YY_PARAMS(M4_YY_PROTO_ONLY_ARG)]])
1222357f1050SThomas Veermanm4_define( [[M4_YY_LEX_DECLARATION]], [[YYFARGS0(void)]])
1223357f1050SThomas Veerman
1224357f1050SThomas Veermanm4_ifdef( [[M4_YY_BISON_LVAL]],
1225357f1050SThomas Veerman[[
1226357f1050SThomas Veerman    m4_dnl  The bison pure parser is used. Redefine yylex to
1227357f1050SThomas Veerman    m4_dnl  accept the lval parameter.
1228357f1050SThomas Veerman
1229357f1050SThomas Veerman    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1230357f1050SThomas Veerman               [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
1231357f1050SThomas Veerman    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1232357f1050SThomas Veerman               [[YYFARGS1(YYSTYPE *,yylval_param)]])
1233357f1050SThomas Veerman]])
1234357f1050SThomas Veerman
1235357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
1236357f1050SThomas Veerman[[
1237357f1050SThomas Veerman    m4_dnl  Locations are used. yylex should also accept the ylloc parameter.
1238357f1050SThomas Veerman
1239357f1050SThomas Veerman    m4_define( [[M4_YY_LEX_PROTO]], [[\]]
1240357f1050SThomas Veerman               [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
1241357f1050SThomas Veerman    m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
1242357f1050SThomas Veerman               [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
1243357f1050SThomas Veerman]])
1244357f1050SThomas Veerman
1245357f1050SThomas Veermanextern int yylex M4_YY_LEX_PROTO;
1246357f1050SThomas Veerman
1247357f1050SThomas Veerman#define YY_DECL int yylex M4_YY_LEX_DECLARATION
1248357f1050SThomas Veerman%endif
1249357f1050SThomas Veerman%if-c++-only C++ definition
1250357f1050SThomas Veerman#define YY_DECL int yyFlexLexer::yylex()
1251357f1050SThomas Veerman%endif
1252357f1050SThomas Veerman#endif /* !YY_DECL */
1253357f1050SThomas Veerman
1254357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1255357f1050SThomas Veerman[[
1256357f1050SThomas Veerman/* Code executed at the beginning of each rule, after yytext and yyleng
1257357f1050SThomas Veerman * have been set up.
1258357f1050SThomas Veerman */
1259357f1050SThomas Veerman#ifndef YY_USER_ACTION
1260357f1050SThomas Veerman#define YY_USER_ACTION
1261357f1050SThomas Veerman#endif
1262357f1050SThomas Veerman]])
1263357f1050SThomas Veerman
1264357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1265357f1050SThomas Veerman[[
1266357f1050SThomas Veerman/* Code executed at the end of each rule. */
1267357f1050SThomas Veerman#ifndef YY_BREAK
1268357f1050SThomas Veerman#define YY_BREAK /*LINTED*/break;
1269357f1050SThomas Veerman#endif
1270357f1050SThomas Veerman]])
1271357f1050SThomas Veerman
1272357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1273357f1050SThomas Veerman[[
1274357f1050SThomas Veerman%% [6.0] YY_RULE_SETUP definition goes here
1275357f1050SThomas Veerman]])
1276357f1050SThomas Veerman
1277357f1050SThomas Veerman%not-for-header
1278357f1050SThomas Veerman/** The main scanner function which does all the work.
1279357f1050SThomas Veerman */
1280357f1050SThomas VeermanYY_DECL
1281357f1050SThomas Veerman{
1282357f1050SThomas Veerman	register yy_state_type yy_current_state;
1283357f1050SThomas Veerman	register char *yy_cp, *yy_bp;
1284357f1050SThomas Veerman	register int yy_act;
1285357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1286357f1050SThomas Veerman
1287357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_REENTRANT]],
1288357f1050SThomas Veerman[[
1289357f1050SThomas Veerman    m4_ifdef( [[M4_YY_BISON_LVAL]],
1290357f1050SThomas Veerman    [[
1291357f1050SThomas Veerman        YYSTYPE * yylval;
1292357f1050SThomas Veerman    ]])
1293357f1050SThomas Veerman    m4_ifdef( [[<M4_YY_BISON_LLOC>]],
1294357f1050SThomas Veerman    [[
1295357f1050SThomas Veerman        YYLTYPE * yylloc;
1296357f1050SThomas Veerman    ]])
1297357f1050SThomas Veerman]])
1298357f1050SThomas Veerman
1299357f1050SThomas Veermanm4_ifdef( [[M4_YY_BISON_LVAL]],
1300357f1050SThomas Veerman[[
1301357f1050SThomas Veerman    yylval = yylval_param;
1302357f1050SThomas Veerman]])
1303357f1050SThomas Veerman
1304357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
1305357f1050SThomas Veerman[[
1306357f1050SThomas Veerman    yylloc = yylloc_param;
1307357f1050SThomas Veerman]])
1308357f1050SThomas Veerman
1309357f1050SThomas Veerman	if ( !YY_G(yy_init) )
1310357f1050SThomas Veerman		{
1311357f1050SThomas Veerman		YY_G(yy_init) = 1;
1312357f1050SThomas Veerman
1313357f1050SThomas Veerman#ifdef YY_USER_INIT
1314357f1050SThomas Veerman		YY_USER_INIT;
1315357f1050SThomas Veerman#endif
1316357f1050SThomas Veerman
1317357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
1318357f1050SThomas Veerman[[
1319357f1050SThomas Veerman        /* Create the reject buffer large enough to save one state per allowed character. */
1320357f1050SThomas Veerman        if ( ! YY_G(yy_state_buf) )
1321357f1050SThomas Veerman            YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE  M4_YY_CALL_LAST_ARG);
1322357f1050SThomas Veerman            if ( ! YY_G(yy_state_buf) )
1323357f1050SThomas Veerman                YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
1324357f1050SThomas Veerman]])
1325357f1050SThomas Veerman
1326357f1050SThomas Veerman		if ( ! YY_G(yy_start) )
1327357f1050SThomas Veerman			YY_G(yy_start) = 1;	/* first start state */
1328357f1050SThomas Veerman
1329357f1050SThomas Veerman		if ( ! yyin )
1330357f1050SThomas Veerman%if-c-only
1331357f1050SThomas Veerman			yyin = stdin;
1332357f1050SThomas Veerman%endif
1333357f1050SThomas Veerman%if-c++-only
1334357f1050SThomas Veerman			yyin = & std::cin;
1335357f1050SThomas Veerman%endif
1336357f1050SThomas Veerman
1337357f1050SThomas Veerman		if ( ! yyout )
1338357f1050SThomas Veerman%if-c-only
1339357f1050SThomas Veerman			yyout = stdout;
1340357f1050SThomas Veerman%endif
1341357f1050SThomas Veerman%if-c++-only
1342357f1050SThomas Veerman			yyout = & std::cout;
1343357f1050SThomas Veerman%endif
1344357f1050SThomas Veerman
1345357f1050SThomas Veerman		if ( ! YY_CURRENT_BUFFER ) {
1346357f1050SThomas Veerman			yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1347357f1050SThomas Veerman			YY_CURRENT_BUFFER_LVALUE =
1348357f1050SThomas Veerman				yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1349357f1050SThomas Veerman		}
1350357f1050SThomas Veerman
1351357f1050SThomas Veerman		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1352357f1050SThomas Veerman		}
1353357f1050SThomas Veerman
1354*0a6a1f1dSLionel Sambuc	{
1355*0a6a1f1dSLionel Sambuc%% [7.0] user's declarations go here
1356*0a6a1f1dSLionel Sambuc
1357357f1050SThomas Veerman	while (/*CONSTCOND*/ 1 )		/* loops until end-of-file is reached */
1358357f1050SThomas Veerman		{
1359357f1050SThomas Veerman%% [8.0] yymore()-related code goes here
1360357f1050SThomas Veerman		yy_cp = YY_G(yy_c_buf_p);
1361357f1050SThomas Veerman
1362357f1050SThomas Veerman		/* Support of yytext. */
1363357f1050SThomas Veerman		*yy_cp = YY_G(yy_hold_char);
1364357f1050SThomas Veerman
1365357f1050SThomas Veerman		/* yy_bp points to the position in yy_ch_buf of the start of
1366357f1050SThomas Veerman		 * the current run.
1367357f1050SThomas Veerman		 */
1368357f1050SThomas Veerman		yy_bp = yy_cp;
1369357f1050SThomas Veerman
1370357f1050SThomas Veerman%% [9.0] code to set up and find next match goes here
1371357f1050SThomas Veerman
1372357f1050SThomas Veermanyy_find_action:
1373357f1050SThomas Veerman%% [10.0] code to find the action number goes here
1374357f1050SThomas Veerman
1375357f1050SThomas Veerman		YY_DO_BEFORE_ACTION;
1376357f1050SThomas Veerman
1377357f1050SThomas Veerman%% [11.0] code for yylineno update goes here
1378357f1050SThomas Veerman
1379357f1050SThomas Veermando_action:	/* This label is used only to access EOF actions. */
1380357f1050SThomas Veerman
1381357f1050SThomas Veerman%% [12.0] debug code goes here
1382357f1050SThomas Veerman
1383357f1050SThomas Veerman		switch ( yy_act )
1384357f1050SThomas Veerman	{ /* beginning of action switch */
1385357f1050SThomas Veerman%% [13.0] actions go here
1386357f1050SThomas Veerman
1387357f1050SThomas Veerman	case YY_END_OF_BUFFER:
1388357f1050SThomas Veerman		{
1389357f1050SThomas Veerman		/* Amount of text matched not including the EOB char. */
1390357f1050SThomas Veerman		int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
1391357f1050SThomas Veerman
1392357f1050SThomas Veerman		/* Undo the effects of YY_DO_BEFORE_ACTION. */
1393357f1050SThomas Veerman		*yy_cp = YY_G(yy_hold_char);
1394357f1050SThomas Veerman		YY_RESTORE_YY_MORE_OFFSET
1395357f1050SThomas Veerman
1396357f1050SThomas Veerman		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1397357f1050SThomas Veerman			{
1398357f1050SThomas Veerman			/* We're scanning a new file or input source.  It's
1399357f1050SThomas Veerman			 * possible that this happened because the user
1400357f1050SThomas Veerman			 * just pointed yyin at a new source and called
1401357f1050SThomas Veerman			 * yylex().  If so, then we have to assure
1402357f1050SThomas Veerman			 * consistency between YY_CURRENT_BUFFER and our
1403357f1050SThomas Veerman			 * globals.  Here is the right place to do so, because
1404357f1050SThomas Veerman			 * this is the first action (other than possibly a
1405357f1050SThomas Veerman			 * back-up) that will match for the new input source.
1406357f1050SThomas Veerman			 */
1407357f1050SThomas Veerman			YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1408357f1050SThomas Veerman			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1409357f1050SThomas Veerman			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1410357f1050SThomas Veerman			}
1411357f1050SThomas Veerman
1412357f1050SThomas Veerman		/* Note that here we test for yy_c_buf_p "<=" to the position
1413357f1050SThomas Veerman		 * of the first EOB in the buffer, since yy_c_buf_p will
1414357f1050SThomas Veerman		 * already have been incremented past the NUL character
1415357f1050SThomas Veerman		 * (since all states make transitions on EOB to the
1416357f1050SThomas Veerman		 * end-of-buffer state).  Contrast this with the test
1417357f1050SThomas Veerman		 * in input().
1418357f1050SThomas Veerman		 */
1419357f1050SThomas Veerman		if ( YY_G(yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1420357f1050SThomas Veerman			{ /* This was really a NUL. */
1421357f1050SThomas Veerman			yy_state_type yy_next_state;
1422357f1050SThomas Veerman
1423357f1050SThomas Veerman			YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
1424357f1050SThomas Veerman
1425357f1050SThomas Veerman			yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1426357f1050SThomas Veerman
1427357f1050SThomas Veerman			/* Okay, we're now positioned to make the NUL
1428357f1050SThomas Veerman			 * transition.  We couldn't have
1429357f1050SThomas Veerman			 * yy_get_previous_state() go ahead and do it
1430357f1050SThomas Veerman			 * for us because it doesn't know how to deal
1431357f1050SThomas Veerman			 * with the possibility of jamming (and we don't
1432357f1050SThomas Veerman			 * want to build jamming into it because then it
1433357f1050SThomas Veerman			 * will run more slowly).
1434357f1050SThomas Veerman			 */
1435357f1050SThomas Veerman
1436357f1050SThomas Veerman			yy_next_state = yy_try_NUL_trans( yy_current_state M4_YY_CALL_LAST_ARG);
1437357f1050SThomas Veerman
1438357f1050SThomas Veerman			yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1439357f1050SThomas Veerman
1440357f1050SThomas Veerman			if ( yy_next_state )
1441357f1050SThomas Veerman				{
1442357f1050SThomas Veerman				/* Consume the NUL. */
1443357f1050SThomas Veerman				yy_cp = ++YY_G(yy_c_buf_p);
1444357f1050SThomas Veerman				yy_current_state = yy_next_state;
1445357f1050SThomas Veerman				goto yy_match;
1446357f1050SThomas Veerman				}
1447357f1050SThomas Veerman
1448357f1050SThomas Veerman			else
1449357f1050SThomas Veerman				{
1450357f1050SThomas Veerman%% [14.0] code to do back-up for compressed tables and set up yy_cp goes here
1451357f1050SThomas Veerman				goto yy_find_action;
1452357f1050SThomas Veerman				}
1453357f1050SThomas Veerman			}
1454357f1050SThomas Veerman
1455357f1050SThomas Veerman		else switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1456357f1050SThomas Veerman			{
1457357f1050SThomas Veerman			case EOB_ACT_END_OF_FILE:
1458357f1050SThomas Veerman				{
1459357f1050SThomas Veerman				YY_G(yy_did_buffer_switch_on_eof) = 0;
1460357f1050SThomas Veerman
1461357f1050SThomas Veerman				if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1462357f1050SThomas Veerman					{
1463357f1050SThomas Veerman					/* Note: because we've taken care in
1464357f1050SThomas Veerman					 * yy_get_next_buffer() to have set up
1465357f1050SThomas Veerman					 * yytext, we can now set up
1466357f1050SThomas Veerman					 * yy_c_buf_p so that if some total
1467357f1050SThomas Veerman					 * hoser (like flex itself) wants to
1468357f1050SThomas Veerman					 * call the scanner after we return the
1469357f1050SThomas Veerman					 * YY_NULL, it'll still work - another
1470357f1050SThomas Veerman					 * YY_NULL will get returned.
1471357f1050SThomas Veerman					 */
1472357f1050SThomas Veerman					YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
1473357f1050SThomas Veerman
1474357f1050SThomas Veerman					yy_act = YY_STATE_EOF(YY_START);
1475357f1050SThomas Veerman					goto do_action;
1476357f1050SThomas Veerman					}
1477357f1050SThomas Veerman
1478357f1050SThomas Veerman				else
1479357f1050SThomas Veerman					{
1480357f1050SThomas Veerman					if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1481357f1050SThomas Veerman						YY_NEW_FILE;
1482357f1050SThomas Veerman					}
1483357f1050SThomas Veerman				break;
1484357f1050SThomas Veerman				}
1485357f1050SThomas Veerman
1486357f1050SThomas Veerman			case EOB_ACT_CONTINUE_SCAN:
1487357f1050SThomas Veerman				YY_G(yy_c_buf_p) =
1488357f1050SThomas Veerman					YY_G(yytext_ptr) + yy_amount_of_matched_text;
1489357f1050SThomas Veerman
1490357f1050SThomas Veerman				yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1491357f1050SThomas Veerman
1492357f1050SThomas Veerman				yy_cp = YY_G(yy_c_buf_p);
1493357f1050SThomas Veerman				yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1494357f1050SThomas Veerman				goto yy_match;
1495357f1050SThomas Veerman
1496357f1050SThomas Veerman			case EOB_ACT_LAST_MATCH:
1497357f1050SThomas Veerman				YY_G(yy_c_buf_p) =
1498357f1050SThomas Veerman				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)];
1499357f1050SThomas Veerman
1500357f1050SThomas Veerman				yy_current_state = yy_get_previous_state( M4_YY_CALL_ONLY_ARG );
1501357f1050SThomas Veerman
1502357f1050SThomas Veerman				yy_cp = YY_G(yy_c_buf_p);
1503357f1050SThomas Veerman				yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
1504357f1050SThomas Veerman				goto yy_find_action;
1505357f1050SThomas Veerman			}
1506357f1050SThomas Veerman		break;
1507357f1050SThomas Veerman		}
1508357f1050SThomas Veerman
1509357f1050SThomas Veerman	default:
1510357f1050SThomas Veerman		YY_FATAL_ERROR(
1511357f1050SThomas Veerman			"fatal flex scanner internal error--no action found" );
1512357f1050SThomas Veerman	} /* end of action switch */
1513357f1050SThomas Veerman		} /* end of scanning one token */
1514*0a6a1f1dSLionel Sambuc	} /* end of user's declarations */
1515357f1050SThomas Veerman} /* end of yylex */
1516357f1050SThomas Veerman%ok-for-header
1517357f1050SThomas Veerman
1518357f1050SThomas Veerman%if-c++-only
1519357f1050SThomas Veerman%not-for-header
1520357f1050SThomas Veerman/* The contents of this function are C++ specific, so the YY_G macro is not used.
1521357f1050SThomas Veerman */
1522357f1050SThomas VeermanyyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )
1523357f1050SThomas Veerman{
1524357f1050SThomas Veerman	yyin = arg_yyin;
1525357f1050SThomas Veerman	yyout = arg_yyout;
1526357f1050SThomas Veerman	yy_c_buf_p = 0;
1527357f1050SThomas Veerman	yy_init = 0;
1528357f1050SThomas Veerman	yy_start = 0;
1529357f1050SThomas Veerman	yy_flex_debug = 0;
1530357f1050SThomas Veerman	yylineno = 1;	// this will only get updated if %option yylineno
1531357f1050SThomas Veerman
1532357f1050SThomas Veerman	yy_did_buffer_switch_on_eof = 0;
1533357f1050SThomas Veerman
1534357f1050SThomas Veerman	yy_looking_for_trail_begin = 0;
1535357f1050SThomas Veerman	yy_more_flag = 0;
1536357f1050SThomas Veerman	yy_more_len = 0;
1537357f1050SThomas Veerman	yy_more_offset = yy_prev_more_offset = 0;
1538357f1050SThomas Veerman
1539357f1050SThomas Veerman	yy_start_stack_ptr = yy_start_stack_depth = 0;
1540357f1050SThomas Veerman	yy_start_stack = NULL;
1541357f1050SThomas Veerman
1542357f1050SThomas Veerman	yy_buffer_stack = 0;
1543357f1050SThomas Veerman	yy_buffer_stack_top = 0;
1544357f1050SThomas Veerman	yy_buffer_stack_max = 0;
1545357f1050SThomas Veerman
1546357f1050SThomas Veerman
1547357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
1548357f1050SThomas Veerman[[
1549357f1050SThomas Veerman	yy_state_buf = new yy_state_type[YY_STATE_BUF_SIZE];
1550357f1050SThomas Veerman]],
1551357f1050SThomas Veerman[[
1552357f1050SThomas Veerman	yy_state_buf = 0;
1553357f1050SThomas Veerman]])
1554357f1050SThomas Veerman}
1555357f1050SThomas Veerman
1556357f1050SThomas Veerman/* The contents of this function are C++ specific, so the YY_G macro is not used.
1557357f1050SThomas Veerman */
1558357f1050SThomas VeermanyyFlexLexer::~yyFlexLexer()
1559357f1050SThomas Veerman{
1560357f1050SThomas Veerman	delete [] yy_state_buf;
1561357f1050SThomas Veerman	yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );
1562357f1050SThomas Veerman	yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1563357f1050SThomas Veerman	yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );
1564357f1050SThomas Veerman}
1565357f1050SThomas Veerman
1566357f1050SThomas Veerman/* The contents of this function are C++ specific, so the YY_G macro is not used.
1567357f1050SThomas Veerman */
1568357f1050SThomas Veermanvoid yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )
1569357f1050SThomas Veerman{
1570357f1050SThomas Veerman	if ( new_in )
1571357f1050SThomas Veerman		{
1572357f1050SThomas Veerman		yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
1573357f1050SThomas Veerman		yy_switch_to_buffer( yy_create_buffer( new_in, YY_BUF_SIZE  M4_YY_CALL_LAST_ARG) M4_YY_CALL_LAST_ARG);
1574357f1050SThomas Veerman		}
1575357f1050SThomas Veerman
1576357f1050SThomas Veerman	if ( new_out )
1577357f1050SThomas Veerman		yyout = new_out;
1578357f1050SThomas Veerman}
1579357f1050SThomas Veerman
1580357f1050SThomas Veerman#ifdef YY_INTERACTIVE
1581357f1050SThomas Veermanint yyFlexLexer::LexerInput( char* buf, int /* max_size */ )
1582357f1050SThomas Veerman#else
1583357f1050SThomas Veermanint yyFlexLexer::LexerInput( char* buf, int max_size )
1584357f1050SThomas Veerman#endif
1585357f1050SThomas Veerman{
1586357f1050SThomas Veerman	if ( yyin->eof() || yyin->fail() )
1587357f1050SThomas Veerman		return 0;
1588357f1050SThomas Veerman
1589357f1050SThomas Veerman#ifdef YY_INTERACTIVE
1590357f1050SThomas Veerman	yyin->get( buf[0] );
1591357f1050SThomas Veerman
1592357f1050SThomas Veerman	if ( yyin->eof() )
1593357f1050SThomas Veerman		return 0;
1594357f1050SThomas Veerman
1595357f1050SThomas Veerman	if ( yyin->bad() )
1596357f1050SThomas Veerman		return -1;
1597357f1050SThomas Veerman
1598357f1050SThomas Veerman	return 1;
1599357f1050SThomas Veerman
1600357f1050SThomas Veerman#else
1601357f1050SThomas Veerman	(void) yyin->read( buf, max_size );
1602357f1050SThomas Veerman
1603357f1050SThomas Veerman	if ( yyin->bad() )
1604357f1050SThomas Veerman		return -1;
1605357f1050SThomas Veerman	else
1606357f1050SThomas Veerman		return yyin->gcount();
1607357f1050SThomas Veerman#endif
1608357f1050SThomas Veerman}
1609357f1050SThomas Veerman
1610357f1050SThomas Veermanvoid yyFlexLexer::LexerOutput( const char* buf, int size )
1611357f1050SThomas Veerman{
1612357f1050SThomas Veerman	(void) yyout->write( buf, size );
1613357f1050SThomas Veerman}
1614357f1050SThomas Veerman%ok-for-header
1615357f1050SThomas Veerman%endif
1616357f1050SThomas Veerman
1617357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
1618357f1050SThomas Veerman[[
1619357f1050SThomas Veerman/* yy_get_next_buffer - try to read in a new buffer
1620357f1050SThomas Veerman *
1621357f1050SThomas Veerman * Returns a code representing an action:
1622357f1050SThomas Veerman *	EOB_ACT_LAST_MATCH -
1623357f1050SThomas Veerman *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1624357f1050SThomas Veerman *	EOB_ACT_END_OF_FILE - end of file
1625357f1050SThomas Veerman */
1626357f1050SThomas Veerman%if-c-only
1627357f1050SThomas Veermanstatic int yy_get_next_buffer YYFARGS0(void)
1628357f1050SThomas Veerman%endif
1629357f1050SThomas Veerman%if-c++-only
1630357f1050SThomas Veermanint yyFlexLexer::yy_get_next_buffer()
1631357f1050SThomas Veerman%endif
1632357f1050SThomas Veerman{
1633357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1634357f1050SThomas Veerman	register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1635357f1050SThomas Veerman	register char *source = YY_G(yytext_ptr);
1636*0a6a1f1dSLionel Sambuc	register yy_size_t number_to_move, i;
1637357f1050SThomas Veerman	int ret_val;
1638357f1050SThomas Veerman
1639357f1050SThomas Veerman	if ( YY_G(yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] )
1640357f1050SThomas Veerman		YY_FATAL_ERROR(
1641357f1050SThomas Veerman		"fatal flex scanner internal error--end of buffer missed" );
1642357f1050SThomas Veerman
1643357f1050SThomas Veerman	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1644357f1050SThomas Veerman		{ /* Don't try to fill the buffer, so this is an EOF. */
1645357f1050SThomas Veerman		if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
1646357f1050SThomas Veerman			{
1647357f1050SThomas Veerman			/* We matched a single character, the EOB, so
1648357f1050SThomas Veerman			 * treat this as a final EOF.
1649357f1050SThomas Veerman			 */
1650357f1050SThomas Veerman			return EOB_ACT_END_OF_FILE;
1651357f1050SThomas Veerman			}
1652357f1050SThomas Veerman
1653357f1050SThomas Veerman		else
1654357f1050SThomas Veerman			{
1655357f1050SThomas Veerman			/* We matched some text prior to the EOB, first
1656357f1050SThomas Veerman			 * process it.
1657357f1050SThomas Veerman			 */
1658357f1050SThomas Veerman			return EOB_ACT_LAST_MATCH;
1659357f1050SThomas Veerman			}
1660357f1050SThomas Veerman		}
1661357f1050SThomas Veerman
1662357f1050SThomas Veerman	/* Try to read more data. */
1663357f1050SThomas Veerman
1664357f1050SThomas Veerman	/* First move last chars to start of buffer. */
1665*0a6a1f1dSLionel Sambuc	number_to_move = (yy_size_t)((YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1);
1666357f1050SThomas Veerman
1667357f1050SThomas Veerman	for ( i = 0; i < number_to_move; ++i )
1668357f1050SThomas Veerman		*(dest++) = *(source++);
1669357f1050SThomas Veerman
1670357f1050SThomas Veerman	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1671357f1050SThomas Veerman		/* don't do the read, it's not guaranteed to return an EOF,
1672357f1050SThomas Veerman		 * just force an EOF
1673357f1050SThomas Veerman		 */
1674357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars) = 0;
1675357f1050SThomas Veerman
1676357f1050SThomas Veerman	else
1677357f1050SThomas Veerman		{
167884d9c625SLionel Sambuc			yy_size_t num_to_read =
1679357f1050SThomas Veerman			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1680357f1050SThomas Veerman
1681357f1050SThomas Veerman		while ( num_to_read <= 0 )
1682357f1050SThomas Veerman			{ /* Not enough room in the buffer - grow it. */
1683357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
1684357f1050SThomas Veerman[[
1685357f1050SThomas Veerman			YY_FATAL_ERROR(
1686357f1050SThomas Veerman"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1687357f1050SThomas Veerman]],
1688357f1050SThomas Veerman[[
1689357f1050SThomas Veerman			/* just a shorter name for the current buffer */
169084d9c625SLionel Sambuc			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1691357f1050SThomas Veerman
1692357f1050SThomas Veerman			int yy_c_buf_p_offset =
1693357f1050SThomas Veerman				(int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
1694357f1050SThomas Veerman
1695357f1050SThomas Veerman			if ( b->yy_is_our_buffer )
1696357f1050SThomas Veerman				{
169784d9c625SLionel Sambuc				yy_size_t new_size = b->yy_buf_size * 2;
1698357f1050SThomas Veerman
1699357f1050SThomas Veerman				if ( new_size <= 0 )
1700357f1050SThomas Veerman					b->yy_buf_size += b->yy_buf_size / 8;
1701357f1050SThomas Veerman				else
1702357f1050SThomas Veerman					b->yy_buf_size *= 2;
1703357f1050SThomas Veerman
1704357f1050SThomas Veerman				b->yy_ch_buf = (char *)
1705357f1050SThomas Veerman					/* Include room in for 2 EOB chars. */
1706357f1050SThomas Veerman					yyrealloc( (void *) b->yy_ch_buf,
1707357f1050SThomas Veerman							 b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
1708357f1050SThomas Veerman				}
1709357f1050SThomas Veerman			else
1710357f1050SThomas Veerman				/* Can't grow it, we don't own it. */
1711357f1050SThomas Veerman				b->yy_ch_buf = 0;
1712357f1050SThomas Veerman
1713357f1050SThomas Veerman			if ( ! b->yy_ch_buf )
1714357f1050SThomas Veerman				YY_FATAL_ERROR(
1715357f1050SThomas Veerman				"fatal error - scanner input buffer overflow" );
1716357f1050SThomas Veerman
1717357f1050SThomas Veerman			YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1718357f1050SThomas Veerman
1719357f1050SThomas Veerman			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1720357f1050SThomas Veerman						number_to_move - 1;
1721357f1050SThomas Veerman]])
1722357f1050SThomas Veerman			}
1723357f1050SThomas Veerman
1724357f1050SThomas Veerman		if ( num_to_read > YY_READ_BUF_SIZE )
1725357f1050SThomas Veerman			num_to_read = YY_READ_BUF_SIZE;
1726357f1050SThomas Veerman
1727357f1050SThomas Veerman		/* Read in more data. */
1728357f1050SThomas Veerman		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
172984d9c625SLionel Sambuc			YY_G(yy_n_chars), num_to_read );
1730357f1050SThomas Veerman
1731357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
1732357f1050SThomas Veerman		}
1733357f1050SThomas Veerman
1734357f1050SThomas Veerman	if ( YY_G(yy_n_chars) == 0 )
1735357f1050SThomas Veerman		{
1736357f1050SThomas Veerman		if ( number_to_move == YY_MORE_ADJ )
1737357f1050SThomas Veerman			{
1738357f1050SThomas Veerman			ret_val = EOB_ACT_END_OF_FILE;
1739357f1050SThomas Veerman			yyrestart( yyin  M4_YY_CALL_LAST_ARG);
1740357f1050SThomas Veerman			}
1741357f1050SThomas Veerman
1742357f1050SThomas Veerman		else
1743357f1050SThomas Veerman			{
1744357f1050SThomas Veerman			ret_val = EOB_ACT_LAST_MATCH;
1745357f1050SThomas Veerman			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1746357f1050SThomas Veerman				YY_BUFFER_EOF_PENDING;
1747357f1050SThomas Veerman			}
1748357f1050SThomas Veerman		}
1749357f1050SThomas Veerman
1750357f1050SThomas Veerman	else
1751357f1050SThomas Veerman		ret_val = EOB_ACT_CONTINUE_SCAN;
1752357f1050SThomas Veerman
1753357f1050SThomas Veerman	if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1754357f1050SThomas Veerman		/* Extend the array by 50%, plus the number we really need. */
1755357f1050SThomas Veerman		yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);
1756357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1757357f1050SThomas Veerman			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );
1758357f1050SThomas Veerman		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1759357f1050SThomas Veerman			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1760357f1050SThomas Veerman	}
1761357f1050SThomas Veerman
1762357f1050SThomas Veerman	YY_G(yy_n_chars) += number_to_move;
1763357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1764357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1765357f1050SThomas Veerman
1766357f1050SThomas Veerman	YY_G(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1767357f1050SThomas Veerman
1768357f1050SThomas Veerman	return ret_val;
1769357f1050SThomas Veerman}
1770357f1050SThomas Veerman]])
1771357f1050SThomas Veerman
1772357f1050SThomas Veerman/* yy_get_previous_state - get the state just before the EOB char was reached */
1773357f1050SThomas Veerman
1774357f1050SThomas Veerman%if-c-only
1775357f1050SThomas Veerman%not-for-header
1776357f1050SThomas Veerman    static yy_state_type yy_get_previous_state YYFARGS0(void)
1777357f1050SThomas Veerman%endif
1778357f1050SThomas Veerman%if-c++-only
1779357f1050SThomas Veerman    yy_state_type yyFlexLexer::yy_get_previous_state()
1780357f1050SThomas Veerman%endif
1781357f1050SThomas Veerman{
1782357f1050SThomas Veerman	register yy_state_type yy_current_state;
1783357f1050SThomas Veerman	register char *yy_cp;
1784357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1785357f1050SThomas Veerman
1786357f1050SThomas Veerman%% [15.0] code to get the start state into yy_current_state goes here
1787357f1050SThomas Veerman
1788357f1050SThomas Veerman	for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
1789357f1050SThomas Veerman		{
1790357f1050SThomas Veerman%% [16.0] code to find the next state goes here
1791357f1050SThomas Veerman		}
1792357f1050SThomas Veerman
1793357f1050SThomas Veerman	return yy_current_state;
1794357f1050SThomas Veerman}
1795357f1050SThomas Veerman
1796357f1050SThomas Veerman
1797357f1050SThomas Veerman/* yy_try_NUL_trans - try to make a transition on the NUL character
1798357f1050SThomas Veerman *
1799357f1050SThomas Veerman * synopsis
1800357f1050SThomas Veerman *	next_state = yy_try_NUL_trans( current_state );
1801357f1050SThomas Veerman */
1802357f1050SThomas Veerman%if-c-only
1803357f1050SThomas Veerman    static yy_state_type yy_try_NUL_trans  YYFARGS1( yy_state_type, yy_current_state)
1804357f1050SThomas Veerman%endif
1805357f1050SThomas Veerman%if-c++-only
1806357f1050SThomas Veerman    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
1807357f1050SThomas Veerman%endif
1808357f1050SThomas Veerman{
1809357f1050SThomas Veerman	register int yy_is_jam;
1810357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR(); /* This var may be unused depending upon options. */
1811357f1050SThomas Veerman%% [17.0] code to find the next state, and perhaps do backing up, goes here
1812357f1050SThomas Veerman
181384d9c625SLionel Sambuc	M4_YY_NOOP_GUTS_VAR();
1814357f1050SThomas Veerman	return yy_is_jam ? 0 : yy_current_state;
1815357f1050SThomas Veerman}
1816357f1050SThomas Veerman
1817357f1050SThomas Veerman
1818357f1050SThomas Veerman#ifndef YY_NO_UNPUT
1819357f1050SThomas Veerman%if-c-only
1820357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_UNPUT]],,
1821357f1050SThomas Veerman[[
1822357f1050SThomas Veerman    static void yyunput YYFARGS2( int,c, register char *,yy_bp)
1823357f1050SThomas Veerman%endif
1824357f1050SThomas Veerman%if-c++-only
1825357f1050SThomas Veerman    void yyFlexLexer::yyunput( int c, register char* yy_bp)
1826357f1050SThomas Veerman%endif
1827357f1050SThomas Veerman{
1828357f1050SThomas Veerman	register char *yy_cp;
1829357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1830357f1050SThomas Veerman
1831357f1050SThomas Veerman    yy_cp = YY_G(yy_c_buf_p);
1832357f1050SThomas Veerman
1833357f1050SThomas Veerman	/* undo effects of setting up yytext */
1834357f1050SThomas Veerman	*yy_cp = YY_G(yy_hold_char);
1835357f1050SThomas Veerman
1836357f1050SThomas Veerman	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1837357f1050SThomas Veerman		{ /* need to shift things up to make room */
1838357f1050SThomas Veerman		/* +2 for EOB chars. */
183984d9c625SLionel Sambuc		register yy_size_t number_to_move = YY_G(yy_n_chars) + 2;
1840357f1050SThomas Veerman		register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1841357f1050SThomas Veerman					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1842357f1050SThomas Veerman		register char *source =
1843357f1050SThomas Veerman				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1844357f1050SThomas Veerman
1845357f1050SThomas Veerman		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1846357f1050SThomas Veerman			*--dest = *--source;
1847357f1050SThomas Veerman
1848357f1050SThomas Veerman		yy_cp += (int) (dest - source);
1849357f1050SThomas Veerman		yy_bp += (int) (dest - source);
1850357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1851357f1050SThomas Veerman			YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1852357f1050SThomas Veerman
1853357f1050SThomas Veerman		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1854357f1050SThomas Veerman			YY_FATAL_ERROR( "flex scanner push-back overflow" );
1855357f1050SThomas Veerman		}
1856357f1050SThomas Veerman
1857357f1050SThomas Veerman	*--yy_cp = (char) c;
1858357f1050SThomas Veerman
1859357f1050SThomas Veerman%% [18.0] update yylineno here
1860357f1050SThomas Veermanm4_ifdef( [[M4_YY_USE_LINENO]],
1861357f1050SThomas Veerman[[
1862357f1050SThomas Veerman    if ( c == '\n' ){
1863357f1050SThomas Veerman        --yylineno;
1864357f1050SThomas Veerman    }
1865357f1050SThomas Veerman]])
1866357f1050SThomas Veerman
1867357f1050SThomas Veerman	YY_G(yytext_ptr) = yy_bp;
1868357f1050SThomas Veerman	YY_G(yy_hold_char) = *yy_cp;
1869357f1050SThomas Veerman	YY_G(yy_c_buf_p) = yy_cp;
1870357f1050SThomas Veerman}
1871357f1050SThomas Veerman%if-c-only
1872357f1050SThomas Veerman]])
1873357f1050SThomas Veerman%endif
1874357f1050SThomas Veerman#endif
1875357f1050SThomas Veerman
1876357f1050SThomas Veerman%if-c-only
1877357f1050SThomas Veerman#ifndef YY_NO_INPUT
1878357f1050SThomas Veerman#ifdef __cplusplus
1879357f1050SThomas Veerman    static int yyinput YYFARGS0(void)
1880357f1050SThomas Veerman#else
1881357f1050SThomas Veerman    static int input  YYFARGS0(void)
1882357f1050SThomas Veerman#endif
1883357f1050SThomas Veerman
1884357f1050SThomas Veerman%endif
1885357f1050SThomas Veerman%if-c++-only
1886357f1050SThomas Veerman    int yyFlexLexer::yyinput()
1887357f1050SThomas Veerman%endif
1888357f1050SThomas Veerman{
1889357f1050SThomas Veerman	int c;
1890357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1891357f1050SThomas Veerman
1892357f1050SThomas Veerman	*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
1893357f1050SThomas Veerman
1894357f1050SThomas Veerman	if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1895357f1050SThomas Veerman		{
1896357f1050SThomas Veerman		/* yy_c_buf_p now points to the character we want to return.
1897357f1050SThomas Veerman		 * If this occurs *before* the EOB characters, then it's a
1898357f1050SThomas Veerman		 * valid NUL; if not, then we've hit the end of the buffer.
1899357f1050SThomas Veerman		 */
1900357f1050SThomas Veerman		if ( YY_G(yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] )
1901357f1050SThomas Veerman			/* This was really a NUL. */
1902357f1050SThomas Veerman			*YY_G(yy_c_buf_p) = '\0';
1903357f1050SThomas Veerman
1904357f1050SThomas Veerman		else
1905357f1050SThomas Veerman			{ /* need more input */
1906*0a6a1f1dSLionel Sambuc			yy_size_t offset = (yy_size_t)
1907*0a6a1f1dSLionel Sambuc			    (YY_G(yy_c_buf_p) - YY_G(yytext_ptr));
1908357f1050SThomas Veerman			++YY_G(yy_c_buf_p);
1909357f1050SThomas Veerman
1910357f1050SThomas Veerman			switch ( yy_get_next_buffer( M4_YY_CALL_ONLY_ARG ) )
1911357f1050SThomas Veerman				{
1912357f1050SThomas Veerman				case EOB_ACT_LAST_MATCH:
1913357f1050SThomas Veerman					/* This happens because yy_g_n_b()
1914357f1050SThomas Veerman					 * sees that we've accumulated a
1915357f1050SThomas Veerman					 * token and flags that we need to
1916357f1050SThomas Veerman					 * try matching the token before
1917357f1050SThomas Veerman					 * proceeding.  But for input(),
1918357f1050SThomas Veerman					 * there's no matching to consider.
1919357f1050SThomas Veerman					 * So convert the EOB_ACT_LAST_MATCH
1920357f1050SThomas Veerman					 * to EOB_ACT_END_OF_FILE.
1921357f1050SThomas Veerman					 */
1922357f1050SThomas Veerman
1923357f1050SThomas Veerman					/* Reset buffer status. */
1924357f1050SThomas Veerman					yyrestart( yyin M4_YY_CALL_LAST_ARG);
1925357f1050SThomas Veerman
1926357f1050SThomas Veerman					/*FALLTHROUGH*/
1927357f1050SThomas Veerman
1928357f1050SThomas Veerman				case EOB_ACT_END_OF_FILE:
1929357f1050SThomas Veerman					{
1930357f1050SThomas Veerman					if ( yywrap( M4_YY_CALL_ONLY_ARG ) )
1931357f1050SThomas Veerman						return EOF;
1932357f1050SThomas Veerman
1933357f1050SThomas Veerman					if ( ! YY_G(yy_did_buffer_switch_on_eof) )
1934357f1050SThomas Veerman						YY_NEW_FILE;
1935357f1050SThomas Veerman#ifdef __cplusplus
1936357f1050SThomas Veerman					return yyinput(M4_YY_CALL_ONLY_ARG);
1937357f1050SThomas Veerman#else
1938357f1050SThomas Veerman					return input(M4_YY_CALL_ONLY_ARG);
1939357f1050SThomas Veerman#endif
1940357f1050SThomas Veerman					}
1941357f1050SThomas Veerman
1942357f1050SThomas Veerman				case EOB_ACT_CONTINUE_SCAN:
1943357f1050SThomas Veerman					YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
1944357f1050SThomas Veerman					break;
1945357f1050SThomas Veerman				}
1946357f1050SThomas Veerman			}
1947357f1050SThomas Veerman		}
1948357f1050SThomas Veerman
1949357f1050SThomas Veerman	c = *(unsigned char *) YY_G(yy_c_buf_p);	/* cast for 8-bit char's */
1950357f1050SThomas Veerman	*YY_G(yy_c_buf_p) = '\0';	/* preserve yytext */
1951357f1050SThomas Veerman	YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
1952357f1050SThomas Veerman
1953357f1050SThomas Veerman%% [19.0] update BOL and yylineno
1954357f1050SThomas Veerman
1955357f1050SThomas Veerman	return c;
1956357f1050SThomas Veerman}
1957357f1050SThomas Veerman%if-c-only
1958357f1050SThomas Veerman#endif	/* ifndef YY_NO_INPUT */
1959357f1050SThomas Veerman%endif
1960357f1050SThomas Veerman
1961357f1050SThomas Veerman/** Immediately switch to a different input stream.
1962357f1050SThomas Veerman * @param input_file A readable stream.
1963357f1050SThomas Veerman * M4_YY_DOC_PARAM
1964357f1050SThomas Veerman * @note This function does not reset the start condition to @c INITIAL .
1965357f1050SThomas Veerman */
1966357f1050SThomas Veerman%if-c-only
1967357f1050SThomas Veerman    void yyrestart  YYFARGS1( FILE *,input_file)
1968357f1050SThomas Veerman%endif
1969357f1050SThomas Veerman%if-c++-only
1970357f1050SThomas Veerman    void yyFlexLexer::yyrestart( std::istream* input_file )
1971357f1050SThomas Veerman%endif
1972357f1050SThomas Veerman{
1973357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1974357f1050SThomas Veerman
1975357f1050SThomas Veerman	if ( ! YY_CURRENT_BUFFER ){
1976357f1050SThomas Veerman        yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
1977357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE =
1978357f1050SThomas Veerman            yy_create_buffer( yyin, YY_BUF_SIZE M4_YY_CALL_LAST_ARG);
1979357f1050SThomas Veerman	}
1980357f1050SThomas Veerman
1981357f1050SThomas Veerman	yy_init_buffer( YY_CURRENT_BUFFER, input_file M4_YY_CALL_LAST_ARG);
1982357f1050SThomas Veerman	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
1983357f1050SThomas Veerman}
1984357f1050SThomas Veerman
1985357f1050SThomas Veerman/** Switch to a different input buffer.
1986357f1050SThomas Veerman * @param new_buffer The new input buffer.
1987357f1050SThomas Veerman * M4_YY_DOC_PARAM
1988357f1050SThomas Veerman */
1989357f1050SThomas Veerman%if-c-only
1990357f1050SThomas Veerman    void yy_switch_to_buffer  YYFARGS1( YY_BUFFER_STATE ,new_buffer)
1991357f1050SThomas Veerman%endif
1992357f1050SThomas Veerman%if-c++-only
1993357f1050SThomas Veerman    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1994357f1050SThomas Veerman%endif
1995357f1050SThomas Veerman{
1996357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
1997357f1050SThomas Veerman
1998357f1050SThomas Veerman	/* TODO. We should be able to replace this entire function body
1999357f1050SThomas Veerman	 * with
2000357f1050SThomas Veerman	 *		yypop_buffer_state();
2001357f1050SThomas Veerman	 *		yypush_buffer_state(new_buffer);
2002357f1050SThomas Veerman     */
2003357f1050SThomas Veerman	yyensure_buffer_stack (M4_YY_CALL_ONLY_ARG);
2004357f1050SThomas Veerman	if ( YY_CURRENT_BUFFER == new_buffer )
2005357f1050SThomas Veerman		return;
2006357f1050SThomas Veerman
2007357f1050SThomas Veerman	if ( YY_CURRENT_BUFFER )
2008357f1050SThomas Veerman		{
2009357f1050SThomas Veerman		/* Flush out information for old buffer. */
2010357f1050SThomas Veerman		*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2011357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2012357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2013357f1050SThomas Veerman		}
2014357f1050SThomas Veerman
2015357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2016357f1050SThomas Veerman	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2017357f1050SThomas Veerman
2018357f1050SThomas Veerman	/* We don't actually know whether we did this switch during
2019357f1050SThomas Veerman	 * EOF (yywrap()) processing, but the only time this flag
2020357f1050SThomas Veerman	 * is looked at is after yywrap() is called, so it's safe
2021357f1050SThomas Veerman	 * to go ahead and always set it.
2022357f1050SThomas Veerman	 */
2023357f1050SThomas Veerman	YY_G(yy_did_buffer_switch_on_eof) = 1;
2024357f1050SThomas Veerman}
2025357f1050SThomas Veerman
2026357f1050SThomas Veerman
2027357f1050SThomas Veerman%if-c-only
2028357f1050SThomas Veermanstatic void yy_load_buffer_state  YYFARGS0(void)
2029357f1050SThomas Veerman%endif
2030357f1050SThomas Veerman%if-c++-only
2031357f1050SThomas Veerman    void yyFlexLexer::yy_load_buffer_state()
2032357f1050SThomas Veerman%endif
2033357f1050SThomas Veerman{
2034357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2035357f1050SThomas Veerman	YY_G(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2036357f1050SThomas Veerman	YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2037357f1050SThomas Veerman	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2038357f1050SThomas Veerman	YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
2039357f1050SThomas Veerman}
2040357f1050SThomas Veerman
2041357f1050SThomas Veerman/** Allocate and initialize an input buffer state.
2042357f1050SThomas Veerman * @param file A readable stream.
2043357f1050SThomas Veerman * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2044357f1050SThomas Veerman * M4_YY_DOC_PARAM
2045357f1050SThomas Veerman * @return the allocated buffer state.
2046357f1050SThomas Veerman */
2047357f1050SThomas Veerman%if-c-only
2048357f1050SThomas Veerman    YY_BUFFER_STATE yy_create_buffer  YYFARGS2( FILE *,file, int ,size)
2049357f1050SThomas Veerman%endif
2050357f1050SThomas Veerman%if-c++-only
2051357f1050SThomas Veerman    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
2052357f1050SThomas Veerman%endif
2053357f1050SThomas Veerman{
2054357f1050SThomas Veerman	YY_BUFFER_STATE b;
2055357f1050SThomas Veerman    m4_dnl M4_YY_DECL_GUTS_VAR();
2056357f1050SThomas Veerman
2057357f1050SThomas Veerman	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2058357f1050SThomas Veerman	if ( ! b )
2059357f1050SThomas Veerman		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2060357f1050SThomas Veerman
2061*0a6a1f1dSLionel Sambuc	b->yy_buf_size = (yy_size_t)size;
2062357f1050SThomas Veerman
2063357f1050SThomas Veerman	/* yy_ch_buf has to be 2 characters longer than the size given because
2064357f1050SThomas Veerman	 * we need to put in 2 end-of-buffer characters.
2065357f1050SThomas Veerman	 */
2066357f1050SThomas Veerman	b->yy_ch_buf = (char *) yyalloc( b->yy_buf_size + 2 M4_YY_CALL_LAST_ARG );
2067357f1050SThomas Veerman	if ( ! b->yy_ch_buf )
2068357f1050SThomas Veerman		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2069357f1050SThomas Veerman
2070357f1050SThomas Veerman	b->yy_is_our_buffer = 1;
2071357f1050SThomas Veerman
2072357f1050SThomas Veerman	yy_init_buffer( b, file M4_YY_CALL_LAST_ARG);
2073357f1050SThomas Veerman
2074357f1050SThomas Veerman	return b;
2075357f1050SThomas Veerman}
2076357f1050SThomas Veerman
2077357f1050SThomas Veerman/** Destroy the buffer.
2078357f1050SThomas Veerman * @param b a buffer created with yy_create_buffer()
2079357f1050SThomas Veerman * M4_YY_DOC_PARAM
2080357f1050SThomas Veerman */
2081357f1050SThomas Veerman%if-c-only
2082357f1050SThomas Veerman    void yy_delete_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2083357f1050SThomas Veerman%endif
2084357f1050SThomas Veerman%if-c++-only
2085357f1050SThomas Veerman    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
2086357f1050SThomas Veerman%endif
2087357f1050SThomas Veerman{
2088357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2089357f1050SThomas Veerman
2090357f1050SThomas Veerman	if ( ! b )
2091357f1050SThomas Veerman		return;
2092357f1050SThomas Veerman
2093357f1050SThomas Veerman	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2094357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2095357f1050SThomas Veerman
2096357f1050SThomas Veerman	if ( b->yy_is_our_buffer )
2097357f1050SThomas Veerman		yyfree( (void *) b->yy_ch_buf M4_YY_CALL_LAST_ARG );
2098357f1050SThomas Veerman
2099357f1050SThomas Veerman	yyfree( (void *) b M4_YY_CALL_LAST_ARG );
2100357f1050SThomas Veerman}
2101357f1050SThomas Veerman
2102357f1050SThomas Veerman
2103357f1050SThomas Veerman/* Initializes or reinitializes a buffer.
2104357f1050SThomas Veerman * This function is sometimes called more than once on the same buffer,
2105357f1050SThomas Veerman * such as during a yyrestart() or at EOF.
2106357f1050SThomas Veerman */
2107357f1050SThomas Veerman%if-c-only
2108357f1050SThomas Veerman    static void yy_init_buffer  YYFARGS2( YY_BUFFER_STATE ,b, FILE *,file)
2109357f1050SThomas Veerman%endif
2110357f1050SThomas Veerman%if-c++-only
2111357f1050SThomas Veerman    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
2112357f1050SThomas Veerman%endif
2113357f1050SThomas Veerman
2114357f1050SThomas Veerman{
2115357f1050SThomas Veerman	int oerrno = errno;
2116357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2117357f1050SThomas Veerman
2118357f1050SThomas Veerman	yy_flush_buffer( b M4_YY_CALL_LAST_ARG);
2119357f1050SThomas Veerman
2120357f1050SThomas Veerman	b->yy_input_file = file;
2121357f1050SThomas Veerman	b->yy_fill_buffer = 1;
2122357f1050SThomas Veerman
2123357f1050SThomas Veerman    /* If b is the current buffer, then yy_init_buffer was _probably_
2124357f1050SThomas Veerman     * called from yyrestart() or through yy_get_next_buffer.
2125357f1050SThomas Veerman     * In that case, we don't want to reset the lineno or column.
2126357f1050SThomas Veerman     */
2127357f1050SThomas Veerman    if (b != YY_CURRENT_BUFFER){
2128357f1050SThomas Veerman        b->yy_bs_lineno = 1;
2129357f1050SThomas Veerman        b->yy_bs_column = 0;
2130357f1050SThomas Veerman    }
2131357f1050SThomas Veerman
2132357f1050SThomas Veerman%if-c-only
2133357f1050SThomas Veermanm4_ifdef( [[M4_YY_ALWAYS_INTERACTIVE]],
2134357f1050SThomas Veerman[[
2135357f1050SThomas Veerman	b->yy_is_interactive = 1;
2136357f1050SThomas Veerman]],
2137357f1050SThomas Veerman[[
2138357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],
2139357f1050SThomas Veerman    [[
2140357f1050SThomas Veerman        b->yy_is_interactive = 0;
2141357f1050SThomas Veerman    ]],
2142357f1050SThomas Veerman    [[
2143357f1050SThomas Veerman        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2144357f1050SThomas Veerman    ]])
2145357f1050SThomas Veerman]])
2146357f1050SThomas Veerman%endif
2147357f1050SThomas Veerman%if-c++-only
2148357f1050SThomas Veerman	b->yy_is_interactive = 0;
2149357f1050SThomas Veerman%endif
2150357f1050SThomas Veerman	errno = oerrno;
2151357f1050SThomas Veerman}
2152357f1050SThomas Veerman
2153357f1050SThomas Veerman/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2154357f1050SThomas Veerman * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2155357f1050SThomas Veerman * M4_YY_DOC_PARAM
2156357f1050SThomas Veerman */
2157357f1050SThomas Veerman%if-c-only
2158357f1050SThomas Veerman    void yy_flush_buffer YYFARGS1( YY_BUFFER_STATE ,b)
2159357f1050SThomas Veerman%endif
2160357f1050SThomas Veerman%if-c++-only
2161357f1050SThomas Veerman    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
2162357f1050SThomas Veerman%endif
2163357f1050SThomas Veerman{
2164357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2165357f1050SThomas Veerman	if ( ! b )
2166357f1050SThomas Veerman		return;
2167357f1050SThomas Veerman
2168357f1050SThomas Veerman	b->yy_n_chars = 0;
2169357f1050SThomas Veerman
2170357f1050SThomas Veerman	/* We always need two end-of-buffer characters.  The first causes
2171357f1050SThomas Veerman	 * a transition to the end-of-buffer state.  The second causes
2172357f1050SThomas Veerman	 * a jam in that state.
2173357f1050SThomas Veerman	 */
2174357f1050SThomas Veerman	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2175357f1050SThomas Veerman	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2176357f1050SThomas Veerman
2177357f1050SThomas Veerman	b->yy_buf_pos = &b->yy_ch_buf[0];
2178357f1050SThomas Veerman
2179357f1050SThomas Veerman	b->yy_at_bol = 1;
2180357f1050SThomas Veerman	b->yy_buffer_status = YY_BUFFER_NEW;
2181357f1050SThomas Veerman
2182357f1050SThomas Veerman	if ( b == YY_CURRENT_BUFFER )
2183357f1050SThomas Veerman		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2184357f1050SThomas Veerman}
2185357f1050SThomas Veerman
2186357f1050SThomas Veerman%if-c-or-c++
2187357f1050SThomas Veerman/** Pushes the new state onto the stack. The new state becomes
2188357f1050SThomas Veerman *  the current state. This function will allocate the stack
2189357f1050SThomas Veerman *  if necessary.
2190357f1050SThomas Veerman *  @param new_buffer The new state.
2191357f1050SThomas Veerman *  M4_YY_DOC_PARAM
2192357f1050SThomas Veerman */
2193357f1050SThomas Veerman%if-c-only
2194357f1050SThomas Veermanvoid yypush_buffer_state YYFARGS1(YY_BUFFER_STATE,new_buffer)
2195357f1050SThomas Veerman%endif
2196357f1050SThomas Veerman%if-c++-only
2197357f1050SThomas Veermanvoid yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
2198357f1050SThomas Veerman%endif
2199357f1050SThomas Veerman{
2200357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2201357f1050SThomas Veerman	if (new_buffer == NULL)
2202357f1050SThomas Veerman		return;
2203357f1050SThomas Veerman
2204357f1050SThomas Veerman	yyensure_buffer_stack(M4_YY_CALL_ONLY_ARG);
2205357f1050SThomas Veerman
2206357f1050SThomas Veerman	/* This block is copied from yy_switch_to_buffer. */
2207357f1050SThomas Veerman	if ( YY_CURRENT_BUFFER )
2208357f1050SThomas Veerman		{
2209357f1050SThomas Veerman		/* Flush out information for old buffer. */
2210357f1050SThomas Veerman		*YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
2211357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = YY_G(yy_c_buf_p);
2212357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);
2213357f1050SThomas Veerman		}
2214357f1050SThomas Veerman
2215357f1050SThomas Veerman	/* Only push if top exists. Otherwise, replace top. */
2216357f1050SThomas Veerman	if (YY_CURRENT_BUFFER)
2217357f1050SThomas Veerman		YY_G(yy_buffer_stack_top)++;
2218357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE = new_buffer;
2219357f1050SThomas Veerman
2220357f1050SThomas Veerman	/* copied from yy_switch_to_buffer. */
2221357f1050SThomas Veerman	yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2222357f1050SThomas Veerman	YY_G(yy_did_buffer_switch_on_eof) = 1;
2223357f1050SThomas Veerman}
2224357f1050SThomas Veerman%endif
2225357f1050SThomas Veerman
2226357f1050SThomas Veerman
2227357f1050SThomas Veerman%if-c-or-c++
2228357f1050SThomas Veerman/** Removes and deletes the top of the stack, if present.
2229357f1050SThomas Veerman *  The next element becomes the new top.
2230357f1050SThomas Veerman *  M4_YY_DOC_PARAM
2231357f1050SThomas Veerman */
2232357f1050SThomas Veerman%if-c-only
2233357f1050SThomas Veermanvoid yypop_buffer_state YYFARGS0(void)
2234357f1050SThomas Veerman%endif
2235357f1050SThomas Veerman%if-c++-only
2236357f1050SThomas Veermanvoid yyFlexLexer::yypop_buffer_state (void)
2237357f1050SThomas Veerman%endif
2238357f1050SThomas Veerman{
2239357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2240357f1050SThomas Veerman	if (!YY_CURRENT_BUFFER)
2241357f1050SThomas Veerman		return;
2242357f1050SThomas Veerman
2243357f1050SThomas Veerman	yy_delete_buffer(YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);
2244357f1050SThomas Veerman	YY_CURRENT_BUFFER_LVALUE = NULL;
2245357f1050SThomas Veerman	if (YY_G(yy_buffer_stack_top) > 0)
2246357f1050SThomas Veerman		--YY_G(yy_buffer_stack_top);
2247357f1050SThomas Veerman
2248357f1050SThomas Veerman	if (YY_CURRENT_BUFFER) {
2249357f1050SThomas Veerman		yy_load_buffer_state( M4_YY_CALL_ONLY_ARG );
2250357f1050SThomas Veerman		YY_G(yy_did_buffer_switch_on_eof) = 1;
2251357f1050SThomas Veerman	}
2252357f1050SThomas Veerman}
2253357f1050SThomas Veerman%endif
2254357f1050SThomas Veerman
2255357f1050SThomas Veerman
2256357f1050SThomas Veerman%if-c-or-c++
2257357f1050SThomas Veerman/* Allocates the stack if it does not exist.
2258357f1050SThomas Veerman *  Guarantees space for at least one push.
2259357f1050SThomas Veerman */
2260357f1050SThomas Veerman%if-c-only
2261357f1050SThomas Veermanstatic void yyensure_buffer_stack YYFARGS0(void)
2262357f1050SThomas Veerman%endif
2263357f1050SThomas Veerman%if-c++-only
2264357f1050SThomas Veermanvoid yyFlexLexer::yyensure_buffer_stack(void)
2265357f1050SThomas Veerman%endif
2266357f1050SThomas Veerman{
226784d9c625SLionel Sambuc	yy_size_t num_to_alloc;
2268357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2269357f1050SThomas Veerman
2270357f1050SThomas Veerman	if (!YY_G(yy_buffer_stack)) {
2271357f1050SThomas Veerman
2272357f1050SThomas Veerman		/* First allocation is just for 2 elements, since we don't know if this
2273357f1050SThomas Veerman		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2274357f1050SThomas Veerman		 * immediate realloc on the next call.
2275357f1050SThomas Veerman         */
2276357f1050SThomas Veerman		num_to_alloc = 1;
2277357f1050SThomas Veerman		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2278357f1050SThomas Veerman								(num_to_alloc * sizeof(struct yy_buffer_state*)
2279357f1050SThomas Veerman								M4_YY_CALL_LAST_ARG);
2280357f1050SThomas Veerman		if ( ! YY_G(yy_buffer_stack) )
2281357f1050SThomas Veerman			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2282357f1050SThomas Veerman
2283357f1050SThomas Veerman
2284357f1050SThomas Veerman		memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2285357f1050SThomas Veerman
2286357f1050SThomas Veerman		YY_G(yy_buffer_stack_max) = num_to_alloc;
2287357f1050SThomas Veerman		YY_G(yy_buffer_stack_top) = 0;
2288357f1050SThomas Veerman		return;
2289357f1050SThomas Veerman	}
2290357f1050SThomas Veerman
2291357f1050SThomas Veerman	if (YY_G(yy_buffer_stack_top) >= (YY_G(yy_buffer_stack_max)) - 1){
2292357f1050SThomas Veerman
2293357f1050SThomas Veerman		/* Increase the buffer to prepare for a possible push. */
2294*0a6a1f1dSLionel Sambuc		yy_size_t grow_size = 8 /* arbitrary grow size */;
2295357f1050SThomas Veerman
2296357f1050SThomas Veerman		num_to_alloc = YY_G(yy_buffer_stack_max) + grow_size;
2297357f1050SThomas Veerman		YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2298357f1050SThomas Veerman								(YY_G(yy_buffer_stack),
2299357f1050SThomas Veerman								num_to_alloc * sizeof(struct yy_buffer_state*)
2300357f1050SThomas Veerman								M4_YY_CALL_LAST_ARG);
2301357f1050SThomas Veerman		if ( ! YY_G(yy_buffer_stack) )
2302357f1050SThomas Veerman			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2303357f1050SThomas Veerman
2304357f1050SThomas Veerman		/* zero only the new slots.*/
2305357f1050SThomas Veerman		memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2306357f1050SThomas Veerman		YY_G(yy_buffer_stack_max) = num_to_alloc;
2307357f1050SThomas Veerman	}
2308357f1050SThomas Veerman}
2309357f1050SThomas Veerman%endif
2310357f1050SThomas Veerman
2311357f1050SThomas Veerman
2312357f1050SThomas Veerman
2313357f1050SThomas Veerman
2314357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SCAN_BUFFER]],,
2315357f1050SThomas Veerman[[
2316357f1050SThomas Veerman%if-c-only
2317357f1050SThomas Veerman/** Setup the input buffer state to scan directly from a user-specified character buffer.
2318357f1050SThomas Veerman * @param base the character buffer
2319357f1050SThomas Veerman * @param size the size in bytes of the character buffer
2320357f1050SThomas Veerman * M4_YY_DOC_PARAM
2321357f1050SThomas Veerman * @return the newly allocated buffer state object.
2322357f1050SThomas Veerman */
2323357f1050SThomas VeermanYY_BUFFER_STATE yy_scan_buffer  YYFARGS2( char *,base, yy_size_t ,size)
2324357f1050SThomas Veerman{
2325357f1050SThomas Veerman	YY_BUFFER_STATE b;
2326357f1050SThomas Veerman    m4_dnl M4_YY_DECL_GUTS_VAR();
2327357f1050SThomas Veerman
2328357f1050SThomas Veerman	if ( size < 2 ||
2329357f1050SThomas Veerman	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
2330357f1050SThomas Veerman	     base[size-1] != YY_END_OF_BUFFER_CHAR )
2331357f1050SThomas Veerman		/* They forgot to leave room for the EOB's. */
2332357f1050SThomas Veerman		return 0;
2333357f1050SThomas Veerman
2334357f1050SThomas Veerman	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) M4_YY_CALL_LAST_ARG );
2335357f1050SThomas Veerman	if ( ! b )
2336357f1050SThomas Veerman		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2337357f1050SThomas Veerman
2338357f1050SThomas Veerman	b->yy_buf_size = size - 2;	/* "- 2" to take care of EOB's */
2339357f1050SThomas Veerman	b->yy_buf_pos = b->yy_ch_buf = base;
2340357f1050SThomas Veerman	b->yy_is_our_buffer = 0;
2341357f1050SThomas Veerman	b->yy_input_file = 0;
2342357f1050SThomas Veerman	b->yy_n_chars = b->yy_buf_size;
2343357f1050SThomas Veerman	b->yy_is_interactive = 0;
2344357f1050SThomas Veerman	b->yy_at_bol = 1;
2345357f1050SThomas Veerman	b->yy_fill_buffer = 0;
2346357f1050SThomas Veerman	b->yy_buffer_status = YY_BUFFER_NEW;
2347357f1050SThomas Veerman
2348357f1050SThomas Veerman	yy_switch_to_buffer( b M4_YY_CALL_LAST_ARG );
2349357f1050SThomas Veerman
2350357f1050SThomas Veerman	return b;
2351357f1050SThomas Veerman}
2352357f1050SThomas Veerman%endif
2353357f1050SThomas Veerman]])
2354357f1050SThomas Veerman
2355357f1050SThomas Veerman
2356357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SCAN_STRING]],,
2357357f1050SThomas Veerman[[
2358357f1050SThomas Veerman%if-c-only
2359357f1050SThomas Veerman/** Setup the input buffer state to scan a string. The next call to yylex() will
2360357f1050SThomas Veerman * scan from a @e copy of @a str.
2361357f1050SThomas Veerman * @param yystr a NUL-terminated string to scan
2362357f1050SThomas Veerman * M4_YY_DOC_PARAM
2363357f1050SThomas Veerman * @return the newly allocated buffer state object.
2364357f1050SThomas Veerman * @note If you want to scan bytes that may contain NUL values, then use
2365357f1050SThomas Veerman *       yy_scan_bytes() instead.
2366357f1050SThomas Veerman */
2367357f1050SThomas VeermanYY_BUFFER_STATE yy_scan_string YYFARGS1( yyconst char *, yystr)
2368357f1050SThomas Veerman{
2369357f1050SThomas Veerman    m4_dnl M4_YY_DECL_GUTS_VAR();
2370357f1050SThomas Veerman
2371357f1050SThomas Veerman	return yy_scan_bytes( yystr, strlen(yystr) M4_YY_CALL_LAST_ARG);
2372357f1050SThomas Veerman}
2373357f1050SThomas Veerman%endif
2374357f1050SThomas Veerman]])
2375357f1050SThomas Veerman
2376357f1050SThomas Veerman
2377357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SCAN_BYTES]],,
2378357f1050SThomas Veerman[[
2379357f1050SThomas Veerman%if-c-only
2380357f1050SThomas Veerman/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2381357f1050SThomas Veerman * scan from a @e copy of @a bytes.
238284d9c625SLionel Sambuc * @param yybytes the byte buffer to scan
238384d9c625SLionel Sambuc * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2384357f1050SThomas Veerman * M4_YY_DOC_PARAM
2385357f1050SThomas Veerman * @return the newly allocated buffer state object.
2386357f1050SThomas Veerman */
238784d9c625SLionel SambucYY_BUFFER_STATE yy_scan_bytes  YYFARGS2( yyconst char *,yybytes, yy_size_t ,_yybytes_len)
2388357f1050SThomas Veerman{
2389357f1050SThomas Veerman	YY_BUFFER_STATE b;
2390357f1050SThomas Veerman	char *buf;
2391*0a6a1f1dSLionel Sambuc	yy_size_t n;
2392*0a6a1f1dSLionel Sambuc	yy_size_t i;
2393357f1050SThomas Veerman    m4_dnl M4_YY_DECL_GUTS_VAR();
2394357f1050SThomas Veerman
2395357f1050SThomas Veerman	/* Get memory for full buffer, including space for trailing EOB's. */
2396357f1050SThomas Veerman	n = _yybytes_len + 2;
2397357f1050SThomas Veerman	buf = (char *) yyalloc( n M4_YY_CALL_LAST_ARG );
2398357f1050SThomas Veerman	if ( ! buf )
2399357f1050SThomas Veerman		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2400357f1050SThomas Veerman
2401357f1050SThomas Veerman	for ( i = 0; i < _yybytes_len; ++i )
2402357f1050SThomas Veerman		buf[i] = yybytes[i];
2403357f1050SThomas Veerman
2404357f1050SThomas Veerman	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2405357f1050SThomas Veerman
2406357f1050SThomas Veerman	b = yy_scan_buffer( buf, n M4_YY_CALL_LAST_ARG);
2407357f1050SThomas Veerman	if ( ! b )
2408357f1050SThomas Veerman		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2409357f1050SThomas Veerman
2410357f1050SThomas Veerman	/* It's okay to grow etc. this buffer, and we should throw it
2411357f1050SThomas Veerman	 * away when we're done.
2412357f1050SThomas Veerman	 */
2413357f1050SThomas Veerman	b->yy_is_our_buffer = 1;
2414357f1050SThomas Veerman
2415357f1050SThomas Veerman	return b;
2416357f1050SThomas Veerman}
2417357f1050SThomas Veerman%endif
2418357f1050SThomas Veerman]])
2419357f1050SThomas Veerman
2420357f1050SThomas Veerman
2421357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_PUSH_STATE]],,
2422357f1050SThomas Veerman[[
2423357f1050SThomas Veerman%if-c-only
2424357f1050SThomas Veerman    static void yy_push_state YYFARGS1( int ,_new_state)
2425357f1050SThomas Veerman%endif
2426357f1050SThomas Veerman%if-c++-only
2427357f1050SThomas Veerman    void yyFlexLexer::yy_push_state( int _new_state )
2428357f1050SThomas Veerman%endif
2429357f1050SThomas Veerman{
2430357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2431357f1050SThomas Veerman	if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
2432357f1050SThomas Veerman		{
2433357f1050SThomas Veerman		yy_size_t new_size;
2434357f1050SThomas Veerman
2435357f1050SThomas Veerman		YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
2436357f1050SThomas Veerman		new_size = YY_G(yy_start_stack_depth) * sizeof( int );
2437357f1050SThomas Veerman
2438357f1050SThomas Veerman		if ( ! YY_G(yy_start_stack) )
2439357f1050SThomas Veerman			YY_G(yy_start_stack) = (int *) yyalloc( new_size M4_YY_CALL_LAST_ARG );
2440357f1050SThomas Veerman
2441357f1050SThomas Veerman		else
2442357f1050SThomas Veerman			YY_G(yy_start_stack) = (int *) yyrealloc(
2443357f1050SThomas Veerman					(void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );
2444357f1050SThomas Veerman
2445357f1050SThomas Veerman		if ( ! YY_G(yy_start_stack) )
2446357f1050SThomas Veerman			YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
2447357f1050SThomas Veerman		}
2448357f1050SThomas Veerman
2449357f1050SThomas Veerman	YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
2450357f1050SThomas Veerman
2451357f1050SThomas Veerman	BEGIN(_new_state);
2452357f1050SThomas Veerman}
2453357f1050SThomas Veerman]])
2454357f1050SThomas Veerman
2455357f1050SThomas Veerman
2456357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_POP_STATE]],,
2457357f1050SThomas Veerman[[
2458357f1050SThomas Veerman%if-c-only
2459357f1050SThomas Veerman    static void yy_pop_state  YYFARGS0(void)
2460357f1050SThomas Veerman%endif
2461357f1050SThomas Veerman%if-c++-only
2462357f1050SThomas Veerman    void yyFlexLexer::yy_pop_state()
2463357f1050SThomas Veerman%endif
2464357f1050SThomas Veerman{
2465357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2466357f1050SThomas Veerman	if ( --YY_G(yy_start_stack_ptr) < 0 )
2467357f1050SThomas Veerman		YY_FATAL_ERROR( "start-condition stack underflow" );
2468357f1050SThomas Veerman
2469357f1050SThomas Veerman	BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
2470357f1050SThomas Veerman}
2471357f1050SThomas Veerman]])
2472357f1050SThomas Veerman
2473357f1050SThomas Veerman
2474357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_TOP_STATE]],,
2475357f1050SThomas Veerman[[
2476357f1050SThomas Veerman%if-c-only
2477357f1050SThomas Veerman    static int yy_top_state  YYFARGS0(void)
2478357f1050SThomas Veerman%endif
2479357f1050SThomas Veerman%if-c++-only
2480357f1050SThomas Veerman    int yyFlexLexer::yy_top_state()
2481357f1050SThomas Veerman%endif
2482357f1050SThomas Veerman{
2483357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2484357f1050SThomas Veerman	return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
2485357f1050SThomas Veerman}
2486357f1050SThomas Veerman]])
2487357f1050SThomas Veerman
2488357f1050SThomas Veerman#ifndef YY_EXIT_FAILURE
2489357f1050SThomas Veerman#define YY_EXIT_FAILURE 2
2490357f1050SThomas Veerman#endif
2491357f1050SThomas Veerman
2492357f1050SThomas Veerman%if-c-only
2493357f1050SThomas Veermanstatic void yy_fatal_error YYFARGS1(yyconst char*, msg)
2494357f1050SThomas Veerman{
2495357f1050SThomas Veerman    m4_dnl M4_YY_DECL_GUTS_VAR();
2496357f1050SThomas Veerman	(void) fprintf( stderr, "%s\n", msg );
2497357f1050SThomas Veerman	exit( YY_EXIT_FAILURE );
2498357f1050SThomas Veerman}
2499357f1050SThomas Veerman%endif
2500357f1050SThomas Veerman%if-c++-only
2501357f1050SThomas Veermanvoid yyFlexLexer::LexerError( yyconst char msg[] )
2502357f1050SThomas Veerman{
2503357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2504357f1050SThomas Veerman	std::cerr << msg << std::endl;
2505357f1050SThomas Veerman	exit( YY_EXIT_FAILURE );
2506357f1050SThomas Veerman}
2507357f1050SThomas Veerman%endif
2508357f1050SThomas Veerman
2509357f1050SThomas Veerman/* Redefine yyless() so it works in section 3 code. */
2510357f1050SThomas Veerman
2511357f1050SThomas Veerman#undef yyless
2512357f1050SThomas Veerman#define yyless(n) \
2513357f1050SThomas Veerman	do \
2514357f1050SThomas Veerman		{ \
2515357f1050SThomas Veerman		/* Undo effects of setting up yytext. */ \
2516357f1050SThomas Veerman        int yyless_macro_arg = (n); \
2517357f1050SThomas Veerman        YY_LESS_LINENO(yyless_macro_arg);\
2518357f1050SThomas Veerman		yytext[yyleng] = YY_G(yy_hold_char); \
2519357f1050SThomas Veerman		YY_G(yy_c_buf_p) = yytext + yyless_macro_arg; \
2520357f1050SThomas Veerman		YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
2521357f1050SThomas Veerman		*YY_G(yy_c_buf_p) = '\0'; \
2522357f1050SThomas Veerman		yyleng = yyless_macro_arg; \
2523357f1050SThomas Veerman		} \
2524357f1050SThomas Veerman	while ( 0 )
2525357f1050SThomas Veerman
2526357f1050SThomas Veerman
2527357f1050SThomas Veerman
2528357f1050SThomas Veerman/* Accessor  methods (get/set functions) to struct members. */
2529357f1050SThomas Veerman
2530357f1050SThomas Veerman%if-c-only
2531357f1050SThomas Veerman%if-reentrant
2532357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_EXTRA]],,
2533357f1050SThomas Veerman[[
2534357f1050SThomas Veerman/** Get the user-defined data for this scanner.
2535357f1050SThomas Veerman * M4_YY_DOC_PARAM
2536357f1050SThomas Veerman */
2537357f1050SThomas VeermanYY_EXTRA_TYPE yyget_extra  YYFARGS0(void)
2538357f1050SThomas Veerman{
2539357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2540357f1050SThomas Veerman    return yyextra;
2541357f1050SThomas Veerman}
2542357f1050SThomas Veerman]])
2543357f1050SThomas Veerman%endif
2544357f1050SThomas Veerman
2545357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LINENO]],,
2546357f1050SThomas Veerman[[
2547357f1050SThomas Veerman/** Get the current line number.
2548357f1050SThomas Veerman * M4_YY_DOC_PARAM
2549357f1050SThomas Veerman */
2550357f1050SThomas Veermanint yyget_lineno  YYFARGS0(void)
2551357f1050SThomas Veerman{
2552357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2553357f1050SThomas Veerman
2554357f1050SThomas Veerman    m4_ifdef( [[M4_YY_REENTRANT]],
2555357f1050SThomas Veerman    [[
2556357f1050SThomas Veerman        if (! YY_CURRENT_BUFFER)
2557357f1050SThomas Veerman            return 0;
2558357f1050SThomas Veerman    ]])
2559357f1050SThomas Veerman    return yylineno;
2560357f1050SThomas Veerman}
2561357f1050SThomas Veerman]])
2562357f1050SThomas Veerman
2563357f1050SThomas Veermanm4_ifdef( [[M4_YY_REENTRANT]],
2564357f1050SThomas Veerman[[
2565357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
2566357f1050SThomas Veerman[[
2567357f1050SThomas Veerman/** Get the current column number.
2568357f1050SThomas Veerman * M4_YY_DOC_PARAM
2569357f1050SThomas Veerman */
2570357f1050SThomas Veermanint yyget_column  YYFARGS0(void)
2571357f1050SThomas Veerman{
2572357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2573357f1050SThomas Veerman
2574357f1050SThomas Veerman    m4_ifdef( [[M4_YY_REENTRANT]],
2575357f1050SThomas Veerman    [[
2576357f1050SThomas Veerman        if (! YY_CURRENT_BUFFER)
2577357f1050SThomas Veerman            return 0;
2578357f1050SThomas Veerman    ]])
2579357f1050SThomas Veerman    return yycolumn;
2580357f1050SThomas Veerman}
2581357f1050SThomas Veerman]])
2582357f1050SThomas Veerman]])
2583357f1050SThomas Veerman
2584357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_IN]],,
2585357f1050SThomas Veerman[[
2586357f1050SThomas Veerman/** Get the input stream.
2587357f1050SThomas Veerman * M4_YY_DOC_PARAM
2588357f1050SThomas Veerman */
2589357f1050SThomas VeermanFILE *yyget_in  YYFARGS0(void)
2590357f1050SThomas Veerman{
2591357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2592357f1050SThomas Veerman    return yyin;
2593357f1050SThomas Veerman}
2594357f1050SThomas Veerman]])
2595357f1050SThomas Veerman
2596357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_OUT]],,
2597357f1050SThomas Veerman[[
2598357f1050SThomas Veerman/** Get the output stream.
2599357f1050SThomas Veerman * M4_YY_DOC_PARAM
2600357f1050SThomas Veerman */
2601357f1050SThomas VeermanFILE *yyget_out  YYFARGS0(void)
2602357f1050SThomas Veerman{
2603357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2604357f1050SThomas Veerman    return yyout;
2605357f1050SThomas Veerman}
2606357f1050SThomas Veerman]])
2607357f1050SThomas Veerman
2608357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LENG]],,
2609357f1050SThomas Veerman[[
2610357f1050SThomas Veerman/** Get the length of the current token.
2611357f1050SThomas Veerman * M4_YY_DOC_PARAM
2612357f1050SThomas Veerman */
261384d9c625SLionel Sambucyy_size_t yyget_leng  YYFARGS0(void)
2614357f1050SThomas Veerman{
2615357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2616357f1050SThomas Veerman    return yyleng;
2617357f1050SThomas Veerman}
2618357f1050SThomas Veerman]])
2619357f1050SThomas Veerman
2620357f1050SThomas Veerman/** Get the current token.
2621357f1050SThomas Veerman * M4_YY_DOC_PARAM
2622357f1050SThomas Veerman */
2623357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_TEXT]],,
2624357f1050SThomas Veerman[[
2625357f1050SThomas Veermanchar *yyget_text  YYFARGS0(void)
2626357f1050SThomas Veerman{
2627357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2628357f1050SThomas Veerman    return yytext;
2629357f1050SThomas Veerman}
2630357f1050SThomas Veerman]])
2631357f1050SThomas Veerman
2632357f1050SThomas Veerman%if-reentrant
2633357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_EXTRA]],,
2634357f1050SThomas Veerman[[
2635357f1050SThomas Veerman/** Set the user-defined data. This data is never touched by the scanner.
2636357f1050SThomas Veerman * @param user_defined The data to be associated with this scanner.
2637357f1050SThomas Veerman * M4_YY_DOC_PARAM
2638357f1050SThomas Veerman */
2639357f1050SThomas Veermanvoid yyset_extra YYFARGS1( YY_EXTRA_TYPE ,user_defined)
2640357f1050SThomas Veerman{
2641357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2642357f1050SThomas Veerman    yyextra = user_defined ;
2643357f1050SThomas Veerman}
2644357f1050SThomas Veerman]])
2645357f1050SThomas Veerman%endif
2646357f1050SThomas Veerman
2647357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_LINENO]],,
2648357f1050SThomas Veerman[[
2649357f1050SThomas Veerman/** Set the current line number.
2650357f1050SThomas Veerman * @param _line_number
2651357f1050SThomas Veerman * M4_YY_DOC_PARAM
2652357f1050SThomas Veerman */
2653357f1050SThomas Veermanvoid yyset_lineno YYFARGS1( int ,_line_number)
2654357f1050SThomas Veerman{
2655357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2656357f1050SThomas Veerman
2657357f1050SThomas Veerman    m4_ifdef( [[M4_YY_REENTRANT]],
2658357f1050SThomas Veerman    [[
2659357f1050SThomas Veerman        /* lineno is only valid if an input buffer exists. */
2660357f1050SThomas Veerman        if (! YY_CURRENT_BUFFER )
266184d9c625SLionel Sambuc           YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
2662357f1050SThomas Veerman    ]])
2663357f1050SThomas Veerman    yylineno = _line_number;
2664357f1050SThomas Veerman}
2665357f1050SThomas Veerman]])
2666357f1050SThomas Veerman
2667357f1050SThomas Veermanm4_ifdef( [[M4_YY_REENTRANT]],
2668357f1050SThomas Veerman[[
2669357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
2670357f1050SThomas Veerman[[
2671357f1050SThomas Veerman/** Set the current column.
2672357f1050SThomas Veerman * @param _line_number
2673357f1050SThomas Veerman * M4_YY_DOC_PARAM
2674357f1050SThomas Veerman */
2675357f1050SThomas Veermanvoid yyset_column YYFARGS1( int , _column_no)
2676357f1050SThomas Veerman{
2677357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2678357f1050SThomas Veerman
2679357f1050SThomas Veerman    m4_ifdef( [[M4_YY_REENTRANT]],
2680357f1050SThomas Veerman    [[
2681357f1050SThomas Veerman        /* column is only valid if an input buffer exists. */
2682357f1050SThomas Veerman        if (! YY_CURRENT_BUFFER )
268384d9c625SLionel Sambuc           YY_FATAL_ERROR( "yyset_column called with no buffer" );
2684357f1050SThomas Veerman    ]])
2685357f1050SThomas Veerman    yycolumn = _column_no;
2686357f1050SThomas Veerman}
2687357f1050SThomas Veerman]])
2688357f1050SThomas Veerman]])
2689357f1050SThomas Veerman
2690357f1050SThomas Veerman
2691357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_IN]],,
2692357f1050SThomas Veerman[[
2693357f1050SThomas Veerman/** Set the input stream. This does not discard the current
2694357f1050SThomas Veerman * input buffer.
2695357f1050SThomas Veerman * @param _in_str A readable stream.
2696357f1050SThomas Veerman * M4_YY_DOC_PARAM
2697357f1050SThomas Veerman * @see yy_switch_to_buffer
2698357f1050SThomas Veerman */
2699357f1050SThomas Veermanvoid yyset_in YYFARGS1( FILE * ,_in_str)
2700357f1050SThomas Veerman{
2701357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2702357f1050SThomas Veerman    yyin = _in_str ;
2703357f1050SThomas Veerman}
2704357f1050SThomas Veerman]])
2705357f1050SThomas Veerman
2706357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_OUT]],,
2707357f1050SThomas Veerman[[
2708357f1050SThomas Veermanvoid yyset_out YYFARGS1( FILE * ,_out_str)
2709357f1050SThomas Veerman{
2710357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2711357f1050SThomas Veerman    yyout = _out_str ;
2712357f1050SThomas Veerman}
2713357f1050SThomas Veerman]])
2714357f1050SThomas Veerman
2715357f1050SThomas Veerman
2716357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_DEBUG]],,
2717357f1050SThomas Veerman[[
2718357f1050SThomas Veermanint yyget_debug  YYFARGS0(void)
2719357f1050SThomas Veerman{
2720357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2721357f1050SThomas Veerman    return yy_flex_debug;
2722357f1050SThomas Veerman}
2723357f1050SThomas Veerman]])
2724357f1050SThomas Veerman
2725357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_DEBUG]],,
2726357f1050SThomas Veerman[[
2727357f1050SThomas Veermanvoid yyset_debug YYFARGS1( int ,_bdebug)
2728357f1050SThomas Veerman{
2729357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2730357f1050SThomas Veerman    yy_flex_debug = _bdebug ;
2731357f1050SThomas Veerman}
2732357f1050SThomas Veerman]])
2733357f1050SThomas Veerman%endif
2734357f1050SThomas Veerman
2735357f1050SThomas Veerman%if-reentrant
2736357f1050SThomas Veerman/* Accessor methods for yylval and yylloc */
2737357f1050SThomas Veerman
2738357f1050SThomas Veerman%if-bison-bridge
2739357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_GET_LVAL]],,
2740357f1050SThomas Veerman[[
2741357f1050SThomas VeermanYYSTYPE * yyget_lval  YYFARGS0(void)
2742357f1050SThomas Veerman{
2743357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2744357f1050SThomas Veerman    return yylval;
2745357f1050SThomas Veerman}
2746357f1050SThomas Veerman]])
2747357f1050SThomas Veerman
2748357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_SET_LVAL]],,
2749357f1050SThomas Veerman[[
2750357f1050SThomas Veermanvoid yyset_lval YYFARGS1( YYSTYPE * ,yylval_param)
2751357f1050SThomas Veerman{
2752357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2753357f1050SThomas Veerman    yylval = yylval_param;
2754357f1050SThomas Veerman}
2755357f1050SThomas Veerman]])
2756357f1050SThomas Veerman
2757357f1050SThomas Veermanm4_ifdef( [[<M4_YY_BISON_LLOC>]],
2758357f1050SThomas Veerman[[
2759357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_GET_LLOC]],,
2760357f1050SThomas Veerman    [[
2761357f1050SThomas VeermanYYLTYPE *yyget_lloc  YYFARGS0(void)
2762357f1050SThomas Veerman{
2763357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2764357f1050SThomas Veerman    return yylloc;
2765357f1050SThomas Veerman}
2766357f1050SThomas Veerman    ]])
2767357f1050SThomas Veerman
2768357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NO_SET_LLOC]],,
2769357f1050SThomas Veerman    [[
2770357f1050SThomas Veermanvoid yyset_lloc YYFARGS1( YYLTYPE * ,yylloc_param)
2771357f1050SThomas Veerman{
2772357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2773357f1050SThomas Veerman    yylloc = yylloc_param;
2774357f1050SThomas Veerman}
2775357f1050SThomas Veerman    ]])
2776357f1050SThomas Veerman]])
2777357f1050SThomas Veerman
2778357f1050SThomas Veerman%endif
2779357f1050SThomas Veerman
2780357f1050SThomas Veerman
2781357f1050SThomas Veerman/* User-visible API */
2782357f1050SThomas Veerman
2783357f1050SThomas Veerman/* yylex_init is special because it creates the scanner itself, so it is
2784357f1050SThomas Veerman * the ONLY reentrant function that doesn't take the scanner as the last argument.
2785357f1050SThomas Veerman * That's why we explicitly handle the declaration, instead of using our macros.
2786357f1050SThomas Veerman */
2787357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2788357f1050SThomas Veerman[[
2789357f1050SThomas Veermanint yylex_init( ptr_yy_globals )
2790357f1050SThomas Veerman    yyscan_t* ptr_yy_globals;
2791357f1050SThomas Veerman]],
2792357f1050SThomas Veerman[[
2793357f1050SThomas Veermanint yylex_init(yyscan_t* ptr_yy_globals)
2794357f1050SThomas Veerman]])
2795357f1050SThomas Veerman{
2796357f1050SThomas Veerman    if (ptr_yy_globals == NULL){
2797357f1050SThomas Veerman        errno = EINVAL;
2798357f1050SThomas Veerman        return 1;
2799357f1050SThomas Veerman    }
2800357f1050SThomas Veerman
2801357f1050SThomas Veerman    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
2802357f1050SThomas Veerman
2803357f1050SThomas Veerman    if (*ptr_yy_globals == NULL){
2804357f1050SThomas Veerman        errno = ENOMEM;
2805357f1050SThomas Veerman        return 1;
2806357f1050SThomas Veerman    }
2807357f1050SThomas Veerman
2808357f1050SThomas Veerman    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
2809357f1050SThomas Veerman    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2810357f1050SThomas Veerman
2811357f1050SThomas Veerman    return yy_init_globals ( *ptr_yy_globals );
2812357f1050SThomas Veerman}
2813357f1050SThomas Veerman
2814357f1050SThomas Veerman
2815357f1050SThomas Veerman/* yylex_init_extra has the same functionality as yylex_init, but follows the
2816357f1050SThomas Veerman * convention of taking the scanner as the last argument. Note however, that
2817357f1050SThomas Veerman * this is a *pointer* to a scanner, as it will be allocated by this call (and
2818357f1050SThomas Veerman * is the reason, too, why this function also must handle its own declaration).
2819357f1050SThomas Veerman * The user defined value in the first argument will be available to yyalloc in
2820357f1050SThomas Veerman * the yyextra field.
2821357f1050SThomas Veerman */
2822357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],
2823357f1050SThomas Veerman[[
2824357f1050SThomas Veermanint yylex_init_extra( yy_user_defined, ptr_yy_globals )
2825357f1050SThomas Veerman    YY_EXTRA_TYPE yy_user_defined;
2826357f1050SThomas Veerman    yyscan_t* ptr_yy_globals;
2827357f1050SThomas Veerman]],
2828357f1050SThomas Veerman[[
2829357f1050SThomas Veermanint yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
2830357f1050SThomas Veerman]])
2831357f1050SThomas Veerman{
2832357f1050SThomas Veerman    struct yyguts_t dummy_yyguts;
2833357f1050SThomas Veerman
2834357f1050SThomas Veerman    yyset_extra (yy_user_defined, &dummy_yyguts);
2835357f1050SThomas Veerman
2836357f1050SThomas Veerman    if (ptr_yy_globals == NULL){
2837357f1050SThomas Veerman        errno = EINVAL;
2838357f1050SThomas Veerman        return 1;
2839357f1050SThomas Veerman    }
2840357f1050SThomas Veerman
2841357f1050SThomas Veerman    *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
2842357f1050SThomas Veerman
2843357f1050SThomas Veerman    if (*ptr_yy_globals == NULL){
2844357f1050SThomas Veerman        errno = ENOMEM;
2845357f1050SThomas Veerman        return 1;
2846357f1050SThomas Veerman    }
2847357f1050SThomas Veerman
2848357f1050SThomas Veerman    /* By setting to 0xAA, we expose bugs in
2849357f1050SThomas Veerman    yy_init_globals. Leave at 0x00 for releases. */
2850357f1050SThomas Veerman    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
2851357f1050SThomas Veerman
2852357f1050SThomas Veerman    yyset_extra (yy_user_defined, *ptr_yy_globals);
2853357f1050SThomas Veerman
2854357f1050SThomas Veerman    return yy_init_globals ( *ptr_yy_globals );
2855357f1050SThomas Veerman}
2856357f1050SThomas Veerman
2857357f1050SThomas Veerman%endif if-c-only
2858357f1050SThomas Veerman
2859357f1050SThomas Veerman
2860357f1050SThomas Veerman%if-c-only
2861357f1050SThomas Veermanstatic int yy_init_globals YYFARGS0(void)
2862357f1050SThomas Veerman{
2863357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2864357f1050SThomas Veerman    /* Initialization is the same as for the non-reentrant scanner.
2865357f1050SThomas Veerman     * This function is called from yylex_destroy(), so don't allocate here.
2866357f1050SThomas Veerman     */
2867357f1050SThomas Veerman
2868357f1050SThomas Veermanm4_ifdef( [[M4_YY_USE_LINENO]],
2869357f1050SThomas Veerman[[
2870357f1050SThomas Veerman    m4_ifdef( [[M4_YY_NOT_REENTRANT]],
2871357f1050SThomas Veerman    [[
2872357f1050SThomas Veerman    /* We do not touch yylineno unless the option is enabled. */
2873357f1050SThomas Veerman    yylineno =  1;
2874357f1050SThomas Veerman    ]])
2875357f1050SThomas Veerman]])
2876357f1050SThomas Veerman    YY_G(yy_buffer_stack) = 0;
2877357f1050SThomas Veerman    YY_G(yy_buffer_stack_top) = 0;
2878357f1050SThomas Veerman    YY_G(yy_buffer_stack_max) = 0;
2879357f1050SThomas Veerman    YY_G(yy_c_buf_p) = (char *) 0;
2880357f1050SThomas Veerman    YY_G(yy_init) = 0;
2881357f1050SThomas Veerman    YY_G(yy_start) = 0;
2882357f1050SThomas Veerman
2883357f1050SThomas Veermanm4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2884357f1050SThomas Veerman[[
2885357f1050SThomas Veerman    YY_G(yy_start_stack_ptr) = 0;
2886357f1050SThomas Veerman    YY_G(yy_start_stack_depth) = 0;
2887357f1050SThomas Veerman    YY_G(yy_start_stack) =  NULL;
2888357f1050SThomas Veerman]])
2889357f1050SThomas Veerman
2890357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
2891357f1050SThomas Veerman[[
2892357f1050SThomas Veerman    YY_G(yy_state_buf) = 0;
2893357f1050SThomas Veerman    YY_G(yy_state_ptr) = 0;
2894357f1050SThomas Veerman    YY_G(yy_full_match) = 0;
2895357f1050SThomas Veerman    YY_G(yy_lp) = 0;
2896357f1050SThomas Veerman]])
2897357f1050SThomas Veerman
2898357f1050SThomas Veermanm4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],
2899357f1050SThomas Veerman[[
2900357f1050SThomas Veerman    YY_G(yytext_ptr) = 0;
2901357f1050SThomas Veerman    YY_G(yy_more_offset) = 0;
2902357f1050SThomas Veerman    YY_G(yy_prev_more_offset) = 0;
2903357f1050SThomas Veerman]])
2904357f1050SThomas Veerman
2905357f1050SThomas Veerman/* Defined in main.c */
2906357f1050SThomas Veerman#ifdef YY_STDINIT
2907357f1050SThomas Veerman    yyin = stdin;
2908357f1050SThomas Veerman    yyout = stdout;
2909357f1050SThomas Veerman#else
2910357f1050SThomas Veerman    yyin = (FILE *) 0;
2911357f1050SThomas Veerman    yyout = (FILE *) 0;
2912357f1050SThomas Veerman#endif
2913357f1050SThomas Veerman
2914357f1050SThomas Veerman    /* For future reference: Set errno on error, since we are called by
2915357f1050SThomas Veerman     * yylex_init()
2916357f1050SThomas Veerman     */
2917357f1050SThomas Veerman    return 0;
2918357f1050SThomas Veerman}
2919357f1050SThomas Veerman%endif
2920357f1050SThomas Veerman
2921357f1050SThomas Veerman
2922357f1050SThomas Veerman%if-c-only SNIP! this currently causes conflicts with the c++ scanner
2923357f1050SThomas Veerman/* yylex_destroy is for both reentrant and non-reentrant scanners. */
2924357f1050SThomas Veermanint yylex_destroy  YYFARGS0(void)
2925357f1050SThomas Veerman{
2926357f1050SThomas Veerman    M4_YY_DECL_GUTS_VAR();
2927357f1050SThomas Veerman
2928357f1050SThomas Veerman    /* Pop the buffer stack, destroying each element. */
2929357f1050SThomas Veerman	while(YY_CURRENT_BUFFER){
2930357f1050SThomas Veerman		yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG );
2931357f1050SThomas Veerman		YY_CURRENT_BUFFER_LVALUE = NULL;
2932357f1050SThomas Veerman		yypop_buffer_state(M4_YY_CALL_ONLY_ARG);
2933357f1050SThomas Veerman	}
2934357f1050SThomas Veerman
2935357f1050SThomas Veerman	/* Destroy the stack itself. */
2936357f1050SThomas Veerman	yyfree(YY_G(yy_buffer_stack) M4_YY_CALL_LAST_ARG);
2937357f1050SThomas Veerman	YY_G(yy_buffer_stack) = NULL;
2938357f1050SThomas Veerman
2939357f1050SThomas Veermanm4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
2940357f1050SThomas Veerman[[
2941357f1050SThomas Veerman    /* Destroy the start condition stack. */
2942357f1050SThomas Veerman        yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
2943357f1050SThomas Veerman        YY_G(yy_start_stack) = NULL;
2944357f1050SThomas Veerman]])
2945357f1050SThomas Veerman
2946357f1050SThomas Veermanm4_ifdef( [[M4_YY_USES_REJECT]],
2947357f1050SThomas Veerman[[
2948357f1050SThomas Veerman    yyfree ( YY_G(yy_state_buf) M4_YY_CALL_LAST_ARG);
2949357f1050SThomas Veerman    YY_G(yy_state_buf)  = NULL;
2950357f1050SThomas Veerman]])
2951357f1050SThomas Veerman
2952357f1050SThomas Veerman    /* Reset the globals. This is important in a non-reentrant scanner so the next time
2953357f1050SThomas Veerman     * yylex() is called, initialization will occur. */
2954357f1050SThomas Veerman    yy_init_globals( M4_YY_CALL_ONLY_ARG);
2955357f1050SThomas Veerman
2956357f1050SThomas Veerman%if-reentrant
2957357f1050SThomas Veerman    /* Destroy the main struct (reentrant only). */
2958357f1050SThomas Veerman    yyfree ( yyscanner M4_YY_CALL_LAST_ARG );
2959357f1050SThomas Veerman    yyscanner = NULL;
2960357f1050SThomas Veerman%endif
2961357f1050SThomas Veerman    return 0;
2962357f1050SThomas Veerman}
2963357f1050SThomas Veerman%endif
2964357f1050SThomas Veerman
2965357f1050SThomas Veerman
2966357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2967357f1050SThomas Veerman[[
2968357f1050SThomas Veerman/*
2969357f1050SThomas Veerman * Internal utility routines.
2970357f1050SThomas Veerman */
2971357f1050SThomas Veerman]])
2972357f1050SThomas Veerman
2973357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2974357f1050SThomas Veerman[[
2975357f1050SThomas Veerman#ifndef yytext_ptr
2976357f1050SThomas Veermanstatic void yy_flex_strncpy YYFARGS3( char*,s1, yyconst char *,s2, int,n)
2977357f1050SThomas Veerman{
2978357f1050SThomas Veerman	register int i;
2979357f1050SThomas Veerman	for ( i = 0; i < n; ++i )
2980357f1050SThomas Veerman		s1[i] = s2[i];
2981357f1050SThomas Veerman}
2982357f1050SThomas Veerman#endif
2983357f1050SThomas Veerman]])
2984357f1050SThomas Veerman
2985357f1050SThomas Veermanm4_ifdef( [[M4_YY_NOT_IN_HEADER]],
2986357f1050SThomas Veerman[[
2987357f1050SThomas Veerman#ifdef YY_NEED_STRLEN
2988357f1050SThomas Veermanstatic int yy_flex_strlen YYFARGS1( yyconst char *,s)
2989357f1050SThomas Veerman{
2990357f1050SThomas Veerman	register int n;
2991357f1050SThomas Veerman	for ( n = 0; s[n]; ++n )
2992357f1050SThomas Veerman		;
2993357f1050SThomas Veerman
2994357f1050SThomas Veerman	return n;
2995357f1050SThomas Veerman}
2996357f1050SThomas Veerman#endif
2997357f1050SThomas Veerman]])
2998357f1050SThomas Veerman
2999357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_FLEX_ALLOC]],,
3000357f1050SThomas Veerman[[
3001357f1050SThomas Veermanvoid *yyalloc YYFARGS1( yy_size_t ,size)
3002357f1050SThomas Veerman{
3003357f1050SThomas Veerman	return (void *) malloc( size );
3004357f1050SThomas Veerman}
3005357f1050SThomas Veerman]])
3006357f1050SThomas Veerman
3007357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_FLEX_REALLOC]],,
3008357f1050SThomas Veerman[[
3009357f1050SThomas Veermanvoid *yyrealloc  YYFARGS2( void *,ptr, yy_size_t ,size)
3010357f1050SThomas Veerman{
3011357f1050SThomas Veerman	/* The cast to (char *) in the following accommodates both
3012357f1050SThomas Veerman	 * implementations that use char* generic pointers, and those
3013357f1050SThomas Veerman	 * that use void* generic pointers.  It works with the latter
3014357f1050SThomas Veerman	 * because both ANSI C and C++ allow castless assignment from
3015357f1050SThomas Veerman	 * any pointer type to void*, and deal with argument conversions
3016357f1050SThomas Veerman	 * as though doing an assignment.
3017357f1050SThomas Veerman	 */
3018357f1050SThomas Veerman	return (void *) realloc( (char *) ptr, size );
3019357f1050SThomas Veerman}
3020357f1050SThomas Veerman]])
3021357f1050SThomas Veerman
3022357f1050SThomas Veermanm4_ifdef( [[M4_YY_NO_FLEX_FREE]],,
3023357f1050SThomas Veerman[[
3024357f1050SThomas Veermanvoid yyfree YYFARGS1( void *,ptr)
3025357f1050SThomas Veerman{
3026357f1050SThomas Veerman	free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
3027357f1050SThomas Veerman}
3028357f1050SThomas Veerman]])
3029357f1050SThomas Veerman
3030357f1050SThomas Veerman%if-tables-serialization definitions
3031357f1050SThomas Veermanm4preproc_include(`tables_shared.c')
3032357f1050SThomas Veerman
3033357f1050SThomas Veermanstatic int yytbl_read8 (void *v, struct yytbl_reader * rd)
3034357f1050SThomas Veerman{
3035357f1050SThomas Veerman    errno = 0;
3036357f1050SThomas Veerman    if (fread (v, sizeof (flex_uint8_t), 1, rd->fp) != 1){
3037357f1050SThomas Veerman        errno = EIO;
3038357f1050SThomas Veerman        return -1;
3039357f1050SThomas Veerman    }
3040357f1050SThomas Veerman    rd->bread += sizeof(flex_uint8_t);
3041357f1050SThomas Veerman    return 0;
3042357f1050SThomas Veerman}
3043357f1050SThomas Veerman
3044357f1050SThomas Veermanstatic int yytbl_read16 (void *v, struct yytbl_reader * rd)
3045357f1050SThomas Veerman{
3046357f1050SThomas Veerman    errno = 0;
3047357f1050SThomas Veerman    if (fread (v, sizeof (flex_uint16_t), 1, rd->fp) != 1){
3048357f1050SThomas Veerman        errno = EIO;
3049357f1050SThomas Veerman        return -1;
3050357f1050SThomas Veerman    }
3051357f1050SThomas Veerman    *((flex_uint16_t *) v) = ntohs (*((flex_uint16_t *) v));
3052357f1050SThomas Veerman    rd->bread += sizeof(flex_uint16_t);
3053357f1050SThomas Veerman    return 0;
3054357f1050SThomas Veerman}
3055357f1050SThomas Veerman
3056357f1050SThomas Veermanstatic int yytbl_read32 (void *v, struct yytbl_reader * rd)
3057357f1050SThomas Veerman{
3058357f1050SThomas Veerman    errno = 0;
3059357f1050SThomas Veerman    if (fread (v, sizeof (flex_uint32_t), 1, rd->fp) != 1){
3060357f1050SThomas Veerman        errno = EIO;
3061357f1050SThomas Veerman        return -1;
3062357f1050SThomas Veerman    }
3063357f1050SThomas Veerman    *((flex_uint32_t *) v) = ntohl (*((flex_uint32_t *) v));
3064357f1050SThomas Veerman    rd->bread += sizeof(flex_uint32_t);
3065357f1050SThomas Veerman    return 0;
3066357f1050SThomas Veerman}
3067357f1050SThomas Veerman
3068357f1050SThomas Veerman/** Read the header */
3069357f1050SThomas Veermanstatic int yytbl_hdr_read YYFARGS2(struct yytbl_hdr *, th, struct yytbl_reader *, rd)
3070357f1050SThomas Veerman{
3071357f1050SThomas Veerman    int     bytes;
3072357f1050SThomas Veerman    memset (th, 0, sizeof (struct yytbl_hdr));
3073357f1050SThomas Veerman
3074357f1050SThomas Veerman    if (yytbl_read32 (&(th->th_magic), rd) != 0)
3075357f1050SThomas Veerman        return -1;
3076357f1050SThomas Veerman
3077357f1050SThomas Veerman    if (th->th_magic != YYTBL_MAGIC){
307884d9c625SLionel Sambuc        YY_FATAL_ERROR( "bad magic number" );   /* TODO: not fatal. */
3079357f1050SThomas Veerman        return -1;
3080357f1050SThomas Veerman    }
3081357f1050SThomas Veerman
3082357f1050SThomas Veerman    if (yytbl_read32 (&(th->th_hsize), rd) != 0
3083357f1050SThomas Veerman        || yytbl_read32 (&(th->th_ssize), rd) != 0
3084357f1050SThomas Veerman        || yytbl_read16 (&(th->th_flags), rd) != 0)
3085357f1050SThomas Veerman        return -1;
3086357f1050SThomas Veerman
3087357f1050SThomas Veerman    /* Sanity check on header size. Greater than 1k suggests some funny business. */
3088357f1050SThomas Veerman    if (th->th_hsize < 16 || th->th_hsize > 1024){
308984d9c625SLionel Sambuc        YY_FATAL_ERROR( "insane header size detected" );   /* TODO: not fatal. */
3090357f1050SThomas Veerman        return -1;
3091357f1050SThomas Veerman    }
3092357f1050SThomas Veerman
3093357f1050SThomas Veerman    /* Allocate enough space for the version and name fields */
3094357f1050SThomas Veerman    bytes = th->th_hsize - 14;
3095357f1050SThomas Veerman    th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3096357f1050SThomas Veerman    if ( ! th->th_version )
3097357f1050SThomas Veerman        YY_FATAL_ERROR( "out of dynamic memory in yytbl_hdr_read()" );
3098357f1050SThomas Veerman
3099357f1050SThomas Veerman    /* we read it all into th_version, and point th_name into that data */
3100357f1050SThomas Veerman    if (fread (th->th_version, 1, bytes, rd->fp) != bytes){
3101357f1050SThomas Veerman        errno = EIO;
3102357f1050SThomas Veerman        yyfree(th->th_version M4_YY_CALL_LAST_ARG);
3103357f1050SThomas Veerman        th->th_version = NULL;
3104357f1050SThomas Veerman        return -1;
3105357f1050SThomas Veerman    }
3106357f1050SThomas Veerman    else
3107357f1050SThomas Veerman        rd->bread += bytes;
3108357f1050SThomas Veerman
3109357f1050SThomas Veerman    th->th_name = th->th_version + strlen (th->th_version) + 1;
3110357f1050SThomas Veerman    return 0;
3111357f1050SThomas Veerman}
3112357f1050SThomas Veerman
3113357f1050SThomas Veerman/** lookup id in the dmap list.
3114357f1050SThomas Veerman *  @param dmap pointer to first element in list
3115357f1050SThomas Veerman *  @return NULL if not found.
3116357f1050SThomas Veerman */
3117357f1050SThomas Veermanstatic struct yytbl_dmap *yytbl_dmap_lookup YYFARGS2(struct yytbl_dmap *, dmap,
3118357f1050SThomas Veerman                                                      int, id)
3119357f1050SThomas Veerman{
3120357f1050SThomas Veerman    while (dmap->dm_id)
3121357f1050SThomas Veerman        if (dmap->dm_id == id)
3122357f1050SThomas Veerman            return dmap;
3123357f1050SThomas Veerman        else
3124357f1050SThomas Veerman            dmap++;
3125357f1050SThomas Veerman    return NULL;
3126357f1050SThomas Veerman}
3127357f1050SThomas Veerman
3128357f1050SThomas Veerman/** Read a table while mapping its contents to the local array.
3129357f1050SThomas Veerman *  @param dmap used to performing mapping
3130357f1050SThomas Veerman *  @return 0 on success
3131357f1050SThomas Veerman */
3132357f1050SThomas Veermanstatic int yytbl_data_load YYFARGS2(struct yytbl_dmap *, dmap, struct yytbl_reader*, rd)
3133357f1050SThomas Veerman{
3134357f1050SThomas Veerman    struct yytbl_data td;
3135357f1050SThomas Veerman    struct yytbl_dmap *transdmap=0;
3136357f1050SThomas Veerman    int     len, i, rv, inner_loop_count;
3137357f1050SThomas Veerman    void   *p=0;
3138357f1050SThomas Veerman
3139357f1050SThomas Veerman    memset (&td, 0, sizeof (struct yytbl_data));
3140357f1050SThomas Veerman
3141357f1050SThomas Veerman    if (yytbl_read16 (&td.td_id, rd) != 0
3142357f1050SThomas Veerman        || yytbl_read16 (&td.td_flags, rd) != 0
3143357f1050SThomas Veerman        || yytbl_read32 (&td.td_hilen, rd) != 0
3144357f1050SThomas Veerman        || yytbl_read32 (&td.td_lolen, rd) != 0)
3145357f1050SThomas Veerman        return -1;
3146357f1050SThomas Veerman
3147357f1050SThomas Veerman    /* Lookup the map for the transition table so we have it in case we need it
3148357f1050SThomas Veerman     * inside the loop below. This scanner might not even have a transition
3149357f1050SThomas Veerman     * table, which is ok.
3150357f1050SThomas Veerman     */
3151357f1050SThomas Veerman    transdmap = yytbl_dmap_lookup (dmap, YYTD_ID_TRANSITION M4_YY_CALL_LAST_ARG);
3152357f1050SThomas Veerman
3153357f1050SThomas Veerman    if ((dmap = yytbl_dmap_lookup (dmap, td.td_id M4_YY_CALL_LAST_ARG)) == NULL){
315484d9c625SLionel Sambuc        YY_FATAL_ERROR( "table id not found in map." );   /* TODO: not fatal. */
3155357f1050SThomas Veerman        return -1;
3156357f1050SThomas Veerman    }
3157357f1050SThomas Veerman
3158357f1050SThomas Veerman    /* Allocate space for table.
3159357f1050SThomas Veerman     * The --full yy_transition table is a special case, since we
3160357f1050SThomas Veerman     * need the dmap.dm_sz entry to tell us the sizeof the individual
3161357f1050SThomas Veerman     * struct members.
3162357f1050SThomas Veerman     */
3163357f1050SThomas Veerman    {
3164357f1050SThomas Veerman    size_t  bytes;
3165357f1050SThomas Veerman
3166357f1050SThomas Veerman    if ((td.td_flags & YYTD_STRUCT))
3167357f1050SThomas Veerman        bytes = sizeof(struct yy_trans_info) * td.td_lolen * (td.td_hilen ? td.td_hilen : 1);
3168357f1050SThomas Veerman    else
3169357f1050SThomas Veerman        bytes = td.td_lolen * (td.td_hilen ? td.td_hilen : 1) * dmap->dm_sz;
3170357f1050SThomas Veerman
3171357f1050SThomas Veerman    if(M4_YY_TABLES_VERIFY)
3172357f1050SThomas Veerman        /* We point to the array itself */
3173357f1050SThomas Veerman        p = dmap->dm_arr;
3174357f1050SThomas Veerman    else
3175357f1050SThomas Veerman        /* We point to the address of a pointer. */
3176357f1050SThomas Veerman        *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);
3177357f1050SThomas Veerman        if ( ! p )
3178357f1050SThomas Veerman            YY_FATAL_ERROR( "out of dynamic memory in yytbl_data_load()" );
3179357f1050SThomas Veerman    }
3180357f1050SThomas Veerman
3181357f1050SThomas Veerman    /* If it's a struct, we read 2 integers to get one element */
3182357f1050SThomas Veerman    if ((td.td_flags & YYTD_STRUCT) != 0)
3183357f1050SThomas Veerman        inner_loop_count = 2;
3184357f1050SThomas Veerman    else
3185357f1050SThomas Veerman        inner_loop_count = 1;
3186357f1050SThomas Veerman
3187357f1050SThomas Veerman    /* read and map each element.
3188357f1050SThomas Veerman     * This loop iterates once for each element of the td_data array.
3189357f1050SThomas Veerman     * Notice that we increment 'i' in the inner loop.
3190357f1050SThomas Veerman     */
3191357f1050SThomas Veerman    len = yytbl_calc_total_len (&td);
3192357f1050SThomas Veerman    for (i = 0; i < len; ){
3193357f1050SThomas Veerman        int    j;
3194357f1050SThomas Veerman
3195357f1050SThomas Veerman
3196357f1050SThomas Veerman        /* This loop really executes exactly 1 or 2 times.
3197357f1050SThomas Veerman         * The second time is to handle the second member of the
3198357f1050SThomas Veerman         * YYTD_STRUCT for the yy_transition array.
3199357f1050SThomas Veerman         */
3200357f1050SThomas Veerman        for (j = 0; j < inner_loop_count; j++, i++) {
3201357f1050SThomas Veerman            flex_int32_t t32;
3202357f1050SThomas Veerman
3203357f1050SThomas Veerman            /* read into t32 no matter what the real size is. */
3204357f1050SThomas Veerman            {
3205357f1050SThomas Veerman            flex_int16_t t16;
3206357f1050SThomas Veerman            flex_int8_t  t8;
3207357f1050SThomas Veerman
3208357f1050SThomas Veerman            switch (YYTDFLAGS2BYTES (td.td_flags)) {
3209357f1050SThomas Veerman            case sizeof (flex_int32_t):
3210357f1050SThomas Veerman                rv = yytbl_read32 (&t32, rd);
3211357f1050SThomas Veerman                break;
3212357f1050SThomas Veerman            case sizeof (flex_int16_t):
3213357f1050SThomas Veerman                rv = yytbl_read16 (&t16, rd);
3214357f1050SThomas Veerman                t32 = t16;
3215357f1050SThomas Veerman                break;
3216357f1050SThomas Veerman            case sizeof (flex_int8_t):
3217357f1050SThomas Veerman                rv = yytbl_read8 (&t8, rd);
3218357f1050SThomas Veerman                t32 = t8;
3219357f1050SThomas Veerman                break;
3220357f1050SThomas Veerman            default:
322184d9c625SLionel Sambuc                YY_FATAL_ERROR( "invalid td_flags" );   /* TODO: not fatal. */
3222357f1050SThomas Veerman                return -1;
3223357f1050SThomas Veerman            }
3224357f1050SThomas Veerman            }
3225357f1050SThomas Veerman            if (rv != 0)
3226357f1050SThomas Veerman                return -1;
3227357f1050SThomas Veerman
3228357f1050SThomas Veerman            /* copy into the deserialized array... */
3229357f1050SThomas Veerman
3230357f1050SThomas Veerman            if ((td.td_flags & YYTD_STRUCT)) {
3231357f1050SThomas Veerman                /* t32 is the j'th member of a two-element struct. */
3232357f1050SThomas Veerman                void   *v;
3233357f1050SThomas Veerman
3234357f1050SThomas Veerman                v = j == 0 ? &(((struct yy_trans_info *) p)->yy_verify)
3235357f1050SThomas Veerman                    : &(((struct yy_trans_info *) p)->yy_nxt);
3236357f1050SThomas Veerman
3237357f1050SThomas Veerman                switch (dmap->dm_sz) {
3238357f1050SThomas Veerman                case sizeof (flex_int32_t):
3239357f1050SThomas Veerman                    if (M4_YY_TABLES_VERIFY){
3240357f1050SThomas Veerman                        if( ((flex_int32_t *) v)[0] != (flex_int32_t) t32)
324184d9c625SLionel Sambuc                           YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int32_t" );
3242357f1050SThomas Veerman                    }else
3243357f1050SThomas Veerman                        ((flex_int32_t *) v)[0] = (flex_int32_t) t32;
3244357f1050SThomas Veerman                    break;
3245357f1050SThomas Veerman                case sizeof (flex_int16_t):
3246357f1050SThomas Veerman                    if (M4_YY_TABLES_VERIFY ){
3247357f1050SThomas Veerman                        if(((flex_int16_t *) v)[0] != (flex_int16_t) t32)
324884d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int16_t" );
3249357f1050SThomas Veerman                    }else
3250357f1050SThomas Veerman                        ((flex_int16_t *) v)[0] = (flex_int16_t) t32;
3251357f1050SThomas Veerman                    break;
3252357f1050SThomas Veerman                case sizeof(flex_int8_t):
3253357f1050SThomas Veerman                    if (M4_YY_TABLES_VERIFY ){
3254357f1050SThomas Veerman                         if( ((flex_int8_t *) v)[0] != (flex_int8_t) t32)
325584d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at YYTD_STRUCT flex_int8_t" );
3256357f1050SThomas Veerman                    }else
3257357f1050SThomas Veerman                        ((flex_int8_t *) v)[0] = (flex_int8_t) t32;
3258357f1050SThomas Veerman                    break;
3259357f1050SThomas Veerman                default:
326084d9c625SLionel Sambuc                    YY_FATAL_ERROR( "invalid dmap->dm_sz for struct" );   /* TODO: not fatal. */
3261357f1050SThomas Veerman                    return -1;
3262357f1050SThomas Veerman                }
3263357f1050SThomas Veerman
3264357f1050SThomas Veerman                /* if we're done with j, increment p */
3265357f1050SThomas Veerman                if (j == 1)
3266357f1050SThomas Veerman                    p = (struct yy_trans_info *) p + 1;
3267357f1050SThomas Veerman            }
3268357f1050SThomas Veerman            else if ((td.td_flags & YYTD_PTRANS)) {
3269357f1050SThomas Veerman                /* t32 is an index into the transition array. */
3270357f1050SThomas Veerman                struct yy_trans_info *v;
3271357f1050SThomas Veerman
3272357f1050SThomas Veerman
3273357f1050SThomas Veerman                if (!transdmap){
327484d9c625SLionel Sambuc                    YY_FATAL_ERROR( "transition table not found" );   /* TODO: not fatal. */
3275357f1050SThomas Veerman                    return -1;
3276357f1050SThomas Veerman                }
3277357f1050SThomas Veerman
3278357f1050SThomas Veerman                if( M4_YY_TABLES_VERIFY)
3279357f1050SThomas Veerman                    v = &(((struct yy_trans_info *) (transdmap->dm_arr))[t32]);
3280357f1050SThomas Veerman                else
3281357f1050SThomas Veerman                    v = &((*((struct yy_trans_info **) (transdmap->dm_arr)))[t32]);
3282357f1050SThomas Veerman
3283357f1050SThomas Veerman                if(M4_YY_TABLES_VERIFY ){
3284357f1050SThomas Veerman                    if( ((struct yy_trans_info **) p)[0] != v)
328584d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at YYTD_PTRANS" );
3286357f1050SThomas Veerman                }else
3287357f1050SThomas Veerman                    ((struct yy_trans_info **) p)[0] = v;
3288357f1050SThomas Veerman
3289357f1050SThomas Veerman                /* increment p */
3290357f1050SThomas Veerman                p = (struct yy_trans_info **) p + 1;
3291357f1050SThomas Veerman            }
3292357f1050SThomas Veerman            else {
3293357f1050SThomas Veerman                /* t32 is a plain int. copy data, then incrememnt p. */
3294357f1050SThomas Veerman                switch (dmap->dm_sz) {
3295357f1050SThomas Veerman                case sizeof (flex_int32_t):
3296357f1050SThomas Veerman                    if(M4_YY_TABLES_VERIFY ){
3297357f1050SThomas Veerman                        if( ((flex_int32_t *) p)[0] != (flex_int32_t) t32)
329884d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at flex_int32_t" );
3299357f1050SThomas Veerman                    }else
3300357f1050SThomas Veerman                        ((flex_int32_t *) p)[0] = (flex_int32_t) t32;
3301357f1050SThomas Veerman                    p = ((flex_int32_t *) p) + 1;
3302357f1050SThomas Veerman                    break;
3303357f1050SThomas Veerman                case sizeof (flex_int16_t):
3304357f1050SThomas Veerman                    if(M4_YY_TABLES_VERIFY ){
3305357f1050SThomas Veerman                        if( ((flex_int16_t *) p)[0] != (flex_int16_t) t32)
330684d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at flex_int16_t" );
3307357f1050SThomas Veerman                    }else
3308357f1050SThomas Veerman                        ((flex_int16_t *) p)[0] = (flex_int16_t) t32;
3309357f1050SThomas Veerman                    p = ((flex_int16_t *) p) + 1;
3310357f1050SThomas Veerman                    break;
3311357f1050SThomas Veerman                case sizeof (flex_int8_t):
3312357f1050SThomas Veerman                    if(M4_YY_TABLES_VERIFY ){
3313357f1050SThomas Veerman                        if( ((flex_int8_t *) p)[0] != (flex_int8_t) t32)
331484d9c625SLionel Sambuc                        YY_FATAL_ERROR( "tables verification failed at flex_int8_t" );
3315357f1050SThomas Veerman                    }else
3316357f1050SThomas Veerman                        ((flex_int8_t *) p)[0] = (flex_int8_t) t32;
3317357f1050SThomas Veerman                    p = ((flex_int8_t *) p) + 1;
3318357f1050SThomas Veerman                    break;
3319357f1050SThomas Veerman                default:
332084d9c625SLionel Sambuc                    YY_FATAL_ERROR( "invalid dmap->dm_sz for plain int" );   /* TODO: not fatal. */
3321357f1050SThomas Veerman                    return -1;
3322357f1050SThomas Veerman                }
3323357f1050SThomas Veerman            }
3324357f1050SThomas Veerman        }
3325357f1050SThomas Veerman
3326357f1050SThomas Veerman    }
3327357f1050SThomas Veerman
3328357f1050SThomas Veerman    /* Now eat padding. */
3329357f1050SThomas Veerman    {
3330357f1050SThomas Veerman        int pad;
3331357f1050SThomas Veerman        pad = yypad64(rd->bread);
3332357f1050SThomas Veerman        while(--pad >= 0){
3333357f1050SThomas Veerman            flex_int8_t t8;
3334357f1050SThomas Veerman            if(yytbl_read8(&t8,rd) != 0)
3335357f1050SThomas Veerman                return -1;
3336357f1050SThomas Veerman        }
3337357f1050SThomas Veerman    }
3338357f1050SThomas Veerman
3339357f1050SThomas Veerman    return 0;
3340357f1050SThomas Veerman}
3341357f1050SThomas Veerman
3342357f1050SThomas Veerman%define-yytables   The name for this specific scanner's tables.
3343357f1050SThomas Veerman
3344357f1050SThomas Veerman/* Find the key and load the DFA tables from the given stream.  */
3345357f1050SThomas Veermanstatic int yytbl_fload YYFARGS2(FILE *, fp, const char *, key)
3346357f1050SThomas Veerman{
3347357f1050SThomas Veerman    int rv=0;
3348357f1050SThomas Veerman    struct yytbl_hdr th;
3349357f1050SThomas Veerman    struct yytbl_reader rd;
3350357f1050SThomas Veerman
3351357f1050SThomas Veerman    rd.fp = fp;
3352357f1050SThomas Veerman    th.th_version = NULL;
3353357f1050SThomas Veerman
3354357f1050SThomas Veerman    /* Keep trying until we find the right set of tables or end of file. */
3355357f1050SThomas Veerman    while (!feof(rd.fp)) {
3356357f1050SThomas Veerman        rd.bread = 0;
3357357f1050SThomas Veerman        if (yytbl_hdr_read (&th, &rd M4_YY_CALL_LAST_ARG) != 0){
3358357f1050SThomas Veerman            rv = -1;
3359357f1050SThomas Veerman            goto return_rv;
3360357f1050SThomas Veerman        }
3361357f1050SThomas Veerman
3362357f1050SThomas Veerman        /* A NULL key means choose the first set of tables. */
3363357f1050SThomas Veerman        if (key == NULL)
3364357f1050SThomas Veerman            break;
3365357f1050SThomas Veerman
3366357f1050SThomas Veerman        if (strcmp(th.th_name,key) != 0){
3367357f1050SThomas Veerman            /* Skip ahead to next set */
3368357f1050SThomas Veerman            fseek(rd.fp, th.th_ssize - th.th_hsize, SEEK_CUR);
3369357f1050SThomas Veerman            yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3370357f1050SThomas Veerman            th.th_version = NULL;
3371357f1050SThomas Veerman        }
3372357f1050SThomas Veerman        else
3373357f1050SThomas Veerman            break;
3374357f1050SThomas Veerman    }
3375357f1050SThomas Veerman
3376357f1050SThomas Veerman    while (rd.bread < th.th_ssize){
3377357f1050SThomas Veerman        /* Load the data tables */
3378357f1050SThomas Veerman        if(yytbl_data_load (yydmap,&rd M4_YY_CALL_LAST_ARG) != 0){
3379357f1050SThomas Veerman            rv = -1;
3380357f1050SThomas Veerman            goto return_rv;
3381357f1050SThomas Veerman        }
3382357f1050SThomas Veerman    }
3383357f1050SThomas Veerman
3384357f1050SThomas Veermanreturn_rv:
3385357f1050SThomas Veerman    if(th.th_version){
3386357f1050SThomas Veerman        yyfree(th.th_version M4_YY_CALL_LAST_ARG);
3387357f1050SThomas Veerman        th.th_version = NULL;
3388357f1050SThomas Veerman    }
3389357f1050SThomas Veerman
3390357f1050SThomas Veerman    return rv;
3391357f1050SThomas Veerman}
3392357f1050SThomas Veerman
3393357f1050SThomas Veerman/** Load the DFA tables for this scanner from the given stream.  */
3394357f1050SThomas Veermanint yytables_fload YYFARGS1(FILE *, fp)
3395357f1050SThomas Veerman{
3396357f1050SThomas Veerman
3397357f1050SThomas Veerman    if( yytbl_fload(fp, YYTABLES_NAME M4_YY_CALL_LAST_ARG) != 0)
3398357f1050SThomas Veerman        return -1;
3399357f1050SThomas Veerman    return 0;
3400357f1050SThomas Veerman}
3401357f1050SThomas Veerman
3402357f1050SThomas Veerman/** Destroy the loaded tables, freeing memory, etc.. */
3403357f1050SThomas Veermanint yytables_destroy YYFARGS0(void)
3404357f1050SThomas Veerman{
3405357f1050SThomas Veerman    struct yytbl_dmap *dmap=0;
3406357f1050SThomas Veerman
3407357f1050SThomas Veerman    if(!M4_YY_TABLES_VERIFY){
3408357f1050SThomas Veerman        /* Walk the dmap, freeing the pointers */
3409357f1050SThomas Veerman        for(dmap=yydmap; dmap->dm_id; dmap++) {
3410357f1050SThomas Veerman            void * v;
3411357f1050SThomas Veerman            v = dmap->dm_arr;
3412357f1050SThomas Veerman            if(v && *(char**)v){
3413357f1050SThomas Veerman                    yyfree(*(char**)v M4_YY_CALL_LAST_ARG);
3414357f1050SThomas Veerman                    *(char**)v = NULL;
3415357f1050SThomas Veerman            }
3416357f1050SThomas Veerman        }
3417357f1050SThomas Veerman    }
3418357f1050SThomas Veerman
3419357f1050SThomas Veerman    return 0;
3420357f1050SThomas Veerman}
3421357f1050SThomas Veerman
3422357f1050SThomas Veerman/* end table serialization code definitions */
3423357f1050SThomas Veerman%endif
3424357f1050SThomas Veerman
3425357f1050SThomas Veerman
3426357f1050SThomas Veermanm4_ifdef([[M4_YY_MAIN]], [[
3427357f1050SThomas Veermanint main M4_YY_PARAMS(void);
3428357f1050SThomas Veerman
3429357f1050SThomas Veermanint main ()
3430357f1050SThomas Veerman{
3431357f1050SThomas Veerman
3432357f1050SThomas Veerman%if-reentrant
3433357f1050SThomas Veerman    yyscan_t lexer;
3434357f1050SThomas Veerman    yylex_init(&lexer);
3435357f1050SThomas Veerman    yylex( lexer );
3436357f1050SThomas Veerman    yylex_destroy( lexer);
3437357f1050SThomas Veerman
3438357f1050SThomas Veerman%endif
3439357f1050SThomas Veerman%if-not-reentrant
3440357f1050SThomas Veerman	yylex();
3441357f1050SThomas Veerman%endif
3442357f1050SThomas Veerman
3443357f1050SThomas Veerman	return 0;
3444357f1050SThomas Veerman}
3445357f1050SThomas Veerman]])
3446357f1050SThomas Veerman
3447357f1050SThomas Veerman%ok-for-header
3448357f1050SThomas Veermanm4_ifdef( [[M4_YY_IN_HEADER]],
3449357f1050SThomas Veerman[[
3450357f1050SThomas Veerman#undef YY_NEW_FILE
3451357f1050SThomas Veerman#undef YY_FLUSH_BUFFER
3452357f1050SThomas Veerman#undef yy_set_bol
3453357f1050SThomas Veerman#undef yy_new_buffer
3454357f1050SThomas Veerman#undef yy_set_interactive
3455357f1050SThomas Veerman#undef YY_DO_BEFORE_ACTION
3456357f1050SThomas Veerman
3457357f1050SThomas Veerman#ifdef YY_DECL_IS_OURS
3458357f1050SThomas Veerman#undef YY_DECL_IS_OURS
3459357f1050SThomas Veerman#undef YY_DECL
3460357f1050SThomas Veerman#endif
3461357f1050SThomas Veerman]])
3462