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