sbin/*hammer: Add missing braces to conform to code style
[dragonfly.git] / usr.bin / m4 / manual_tokenizer.c
blob7e80865f36a9aed58c8368be5dca80eba6289afb
2 #line 3 "<stdout>"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
10 #define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
11 #define YY_FLEX_SUBMINOR_VERSION FLEX_SUBMINOR_VERSION
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
24 /* end standard C headers. */
26 /* flex integer type definitions */
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
40 #endif
42 #include <inttypes.h>
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
49 #else
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX (4294967295U)
84 #endif
86 #endif /* ! C99 */
88 #endif /* ! FLEXINT_H */
90 #ifdef __cplusplus
92 /* The "const" storage-class-modifier is valid. */
93 #define YY_USE_CONST
95 #else /* ! __cplusplus */
97 /* C99 requires __STDC__ to be defined as 1. */
98 #if defined (__STDC__)
100 #define YY_USE_CONST
102 #endif /* defined (__STDC__) */
103 #endif /* ! __cplusplus */
105 #ifdef YY_USE_CONST
106 #define yyconst const
107 #else
108 #define yyconst
109 #endif
111 /* Returned upon end-of-file. */
112 #define YY_NULL 0
114 /* Promotes a possibly negative, possibly signed char to an unsigned
115 * integer for use as an array index. If the signed char is negative,
116 * we want to instead treat it as an 8-bit unsigned char, hence the
117 * double cast.
119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
121 /* Enter a start condition. This macro really ought to take a parameter,
122 * but we do it the disgusting crufty way forced on us by the ()-less
123 * definition of BEGIN.
125 #define BEGIN (yy_start) = 1 + 2 *
127 /* Translate the current start state into a value that can be later handed
128 * to BEGIN to return to the state. The YYSTATE alias is for lex
129 * compatibility.
131 #define YY_START (((yy_start) - 1) / 2)
132 #define YYSTATE YY_START
134 /* Action number for EOF rule of a given start state. */
135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
137 /* Special action meaning "start processing a new file". */
138 #define YY_NEW_FILE yyrestart(yyin )
140 #define YY_END_OF_BUFFER_CHAR 0
142 /* Size of default input buffer. */
143 #ifndef YY_BUF_SIZE
144 #define YY_BUF_SIZE 16384
145 #endif
147 /* The state buf must be large enough to hold one state per character in the main buffer.
149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
152 #define YY_TYPEDEF_YY_BUFFER_STATE
153 typedef struct yy_buffer_state *YY_BUFFER_STATE;
154 #endif
156 #ifndef YY_TYPEDEF_YY_SIZE_T
157 #define YY_TYPEDEF_YY_SIZE_T
158 typedef size_t yy_size_t;
159 #endif
161 extern yy_size_t yyleng;
163 extern FILE *yyin, *yyout;
165 #define EOB_ACT_CONTINUE_SCAN 0
166 #define EOB_ACT_END_OF_FILE 1
167 #define EOB_ACT_LAST_MATCH 2
169 #define YY_LESS_LINENO(n)
171 /* Return all but the first "n" matched characters back to the input stream. */
172 #define yyless(n) \
173 do \
175 /* Undo effects of setting up yytext. */ \
176 int yyless_macro_arg = (n); \
177 YY_LESS_LINENO(yyless_macro_arg);\
178 *yy_cp = (yy_hold_char); \
179 YY_RESTORE_YY_MORE_OFFSET \
180 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
181 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
183 while ( 0 )
185 #define unput(c) yyunput( c, (yytext_ptr) )
187 #ifndef YY_STRUCT_YY_BUFFER_STATE
188 #define YY_STRUCT_YY_BUFFER_STATE
189 struct yy_buffer_state
191 FILE *yy_input_file;
193 char *yy_ch_buf; /* input buffer */
194 char *yy_buf_pos; /* current position in input buffer */
196 /* Size of input buffer in bytes, not including room for EOB
197 * characters.
199 yy_size_t yy_buf_size;
201 /* Number of characters read into yy_ch_buf, not including EOB
202 * characters.
204 yy_size_t yy_n_chars;
206 /* Whether we "own" the buffer - i.e., we know we created it,
207 * and can realloc() it to grow it, and should free() it to
208 * delete it.
210 int yy_is_our_buffer;
212 /* Whether this is an "interactive" input source; if so, and
213 * if we're using stdio for input, then we want to use getc()
214 * instead of fread(), to make sure we stop fetching input after
215 * each newline.
217 int yy_is_interactive;
219 /* Whether we're considered to be at the beginning of a line.
220 * If so, '^' rules will be active on the next match, otherwise
221 * not.
223 int yy_at_bol;
225 int yy_bs_lineno; /**< The line count. */
226 int yy_bs_column; /**< The column count. */
228 /* Whether to try to fill the input buffer when we reach the
229 * end of it.
231 int yy_fill_buffer;
233 int yy_buffer_status;
235 #define YY_BUFFER_NEW 0
236 #define YY_BUFFER_NORMAL 1
237 /* When an EOF's been seen but there's still some text to process
238 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
239 * shouldn't try reading from the input source any more. We might
240 * still have a bunch of tokens to match, though, because of
241 * possible backing-up.
243 * When we actually see the EOF, we change the status to "new"
244 * (via yyrestart()), so that the user can continue scanning by
245 * just pointing yyin at a new input file.
247 #define YY_BUFFER_EOF_PENDING 2
250 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
252 /* Stack of input buffers. */
253 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
254 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
255 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
257 /* We provide macros for accessing buffer states in case in the
258 * future we want to put the buffer states in a more general
259 * "scanner state".
261 * Returns the top of the stack, or NULL.
263 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
264 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
265 : NULL)
267 /* Same as previous macro, but useful when we know that the buffer stack is not
268 * NULL or when we need an lvalue. For internal use only.
270 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
272 /* yy_hold_char holds the character lost when yytext is formed. */
273 static char yy_hold_char;
274 static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
275 yy_size_t yyleng;
277 /* Points to current character in buffer. */
278 static char *yy_c_buf_p = (char *) 0;
279 static int yy_init = 0; /* whether we need to initialize */
280 static int yy_start = 0; /* start state number */
282 /* Flag which is used to allow yywrap()'s to do buffer switches
283 * instead of setting up a fresh yyin. A bit of a hack ...
285 static int yy_did_buffer_switch_on_eof;
287 void yyrestart (FILE *input_file );
288 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
289 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
290 void yy_delete_buffer (YY_BUFFER_STATE b );
291 void yy_flush_buffer (YY_BUFFER_STATE b );
292 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
293 void yypop_buffer_state (void );
295 static void yyensure_buffer_stack (void );
296 static void yy_load_buffer_state (void );
297 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
299 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
301 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
302 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
303 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
305 void *yyalloc (yy_size_t );
306 void *yyrealloc (void *,yy_size_t );
307 void yyfree (void * );
309 #define yy_new_buffer yy_create_buffer
311 #define yy_set_interactive(is_interactive) \
313 if ( ! YY_CURRENT_BUFFER ){ \
314 yyensure_buffer_stack (); \
315 YY_CURRENT_BUFFER_LVALUE = \
316 yy_create_buffer(yyin,YY_BUF_SIZE ); \
318 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
321 #define yy_set_bol(at_bol) \
323 if ( ! YY_CURRENT_BUFFER ){\
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer(yyin,YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
331 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
333 /* Begin user sect3 */
335 typedef unsigned char YY_CHAR;
337 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
339 typedef int yy_state_type;
341 extern int yylineno;
343 int yylineno = 1;
345 extern char *yytext;
346 #define yytext_ptr yytext
348 static yy_state_type yy_get_previous_state (void );
349 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
350 static int yy_get_next_buffer (void );
351 static void yy_fatal_error (yyconst char msg[] );
353 /* Done after the current pattern has been matched and before the
354 * corresponding action - sets up yytext.
356 #define YY_DO_BEFORE_ACTION \
357 (yytext_ptr) = yy_bp; \
358 yyleng = (size_t) (yy_cp - yy_bp); \
359 (yy_hold_char) = *yy_cp; \
360 *yy_cp = '\0'; \
361 (yy_c_buf_p) = yy_cp;
363 #define YY_NUM_RULES 14
364 #define YY_END_OF_BUFFER 15
365 /* This struct is not used in this scanner,
366 but its presence is necessary. */
367 struct yy_trans_info
369 flex_int32_t yy_verify;
370 flex_int32_t yy_nxt;
372 static yyconst flex_int16_t yy_accept[35] =
373 { 0,
374 0, 0, 15, 13, 1, 1, 13, 13, 13, 2,
375 2, 13, 13, 13, 13, 1, 9, 10, 12, 2,
376 0, 0, 2, 6, 4, 8, 5, 7, 11, 0,
377 2, 0, 3, 0
380 static yyconst flex_int32_t yy_ec[256] =
381 { 0,
382 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 2, 4, 1, 1, 1, 1, 5, 1, 1,
386 1, 6, 1, 1, 1, 1, 1, 7, 8, 8,
387 8, 8, 8, 8, 8, 9, 9, 10, 1, 11,
388 12, 13, 1, 1, 14, 14, 14, 14, 14, 14,
389 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
390 15, 16, 15, 15, 15, 15, 15, 17, 15, 15,
391 1, 1, 1, 1, 1, 1, 14, 14, 14, 14,
393 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
394 15, 15, 15, 16, 15, 15, 15, 15, 15, 17,
395 15, 15, 1, 18, 1, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1
412 static yyconst flex_int32_t yy_meta[19] =
413 { 0,
414 1, 1, 1, 1, 1, 1, 2, 2, 2, 1,
415 1, 1, 1, 3, 4, 4, 4, 1
418 static yyconst flex_int16_t yy_base[39] =
419 { 0,
420 0, 0, 48, 49, 17, 19, 35, 41, 39, 16,
421 0, 14, 32, 15, 25, 27, 49, 49, 49, 27,
422 0, 0, 0, 49, 49, 49, 49, 49, 49, 32,
423 0, 0, 0, 49, 39, 29, 34, 36
426 static yyconst flex_int16_t yy_def[39] =
427 { 0,
428 34, 1, 34, 34, 34, 34, 34, 34, 34, 34,
429 35, 34, 34, 34, 34, 34, 34, 34, 34, 34,
430 36, 37, 35, 34, 34, 34, 34, 34, 34, 36,
431 37, 38, 38, 0, 34, 34, 34, 34
434 static yyconst flex_int16_t yy_nxt[68] =
435 { 0,
436 4, 5, 6, 7, 8, 9, 10, 11, 11, 4,
437 12, 13, 14, 4, 4, 4, 4, 15, 16, 16,
438 16, 16, 20, 20, 24, 25, 27, 28, 16, 16,
439 30, 21, 22, 20, 20, 31, 31, 33, 33, 33,
440 23, 32, 29, 26, 19, 18, 17, 34, 3, 34,
441 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
442 34, 34, 34, 34, 34, 34, 34
445 static yyconst flex_int16_t yy_chk[68] =
446 { 0,
447 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 1, 1, 1, 5, 5,
449 6, 6, 10, 10, 12, 12, 14, 14, 16, 16,
450 36, 10, 10, 20, 20, 37, 37, 38, 38, 38,
451 35, 30, 15, 13, 9, 8, 7, 3, 34, 34,
452 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
453 34, 34, 34, 34, 34, 34, 34
456 static yy_state_type yy_last_accepting_state;
457 static char *yy_last_accepting_cpos;
459 extern int yy_flex_debug;
460 int yy_flex_debug = 0;
462 /* The intent behind this definition is that it'll catch
463 * any uses of REJECT which flex missed.
465 #define REJECT reject_used_but_not_detected
466 #define yymore() yymore_used_but_not_detected
467 #define YY_MORE_ADJ 0
468 #define YY_RESTORE_YY_MORE_OFFSET
469 char *yytext;
470 #line 1 "/usr/src/usr.bin/m4/tokenizer.l"
471 #define YY_NO_INPUT 1
472 #line 3 "/usr/src/usr.bin/m4/tokenizer.l"
473 /* $OpenBSD: tokenizer.l,v 1.7 2010/03/22 20:40:44 espie Exp $ */
475 * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
477 * Permission to use, copy, modify, and distribute this software for any
478 * purpose with or without fee is hereby granted, provided that the above
479 * copyright notice and this permission notice appear in all copies.
481 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
482 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
483 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
484 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
485 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
486 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
487 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
489 * $FreeBSD: src/usr.bin/m4/tokenizer.l,v 1.3 2012/11/17 01:54:24 svnexp Exp $
492 #include "parser.h"
493 #include <assert.h>
494 #include <stdlib.h>
495 #include <errno.h>
496 #include <stdint.h>
497 #include <limits.h>
498 #include <sys/param.h>
500 extern int mimic_gnu;
501 extern int32_t yylval;
503 int32_t number(void);
504 int32_t parse_radix(void);
505 #line 506 "<stdout>"
507 #define INITIAL 0
509 #ifndef YY_NO_UNISTD_H
510 /* Special case for "unistd.h", since it is non-ANSI. We include it way
511 * down here because we want the user's section 1 to have been scanned first.
512 * The user has a chance to override it with an option.
514 #include <unistd.h>
515 #endif
517 #ifndef YY_EXTRA_TYPE
518 #define YY_EXTRA_TYPE void *
519 #endif
521 static int yy_init_globals (void );
523 /* Accessor methods to globals.
524 These are made visible to non-reentrant scanners for convenience. */
526 int yylex_destroy (void );
528 int yyget_debug (void );
530 void yyset_debug (int debug_flag );
532 YY_EXTRA_TYPE yyget_extra (void );
534 void yyset_extra (YY_EXTRA_TYPE user_defined );
536 FILE *yyget_in (void );
538 void yyset_in (FILE * in_str );
540 FILE *yyget_out (void );
542 void yyset_out (FILE * out_str );
544 yy_size_t yyget_leng (void );
546 char *yyget_text (void );
548 int yyget_lineno (void );
550 void yyset_lineno (int line_number );
552 /* Macros after this point can all be overridden by user definitions in
553 * section 1.
556 #ifndef YY_SKIP_YYWRAP
557 #ifdef __cplusplus
558 extern "C" int yywrap (void );
559 #else
560 extern int yywrap (void );
561 #endif
562 #endif
564 #ifndef yytext_ptr
565 static void yy_flex_strncpy (char *,yyconst char *,int );
566 #endif
568 #ifdef YY_NEED_STRLEN
569 static int yy_flex_strlen (yyconst char * );
570 #endif
572 #ifndef YY_NO_INPUT
574 #ifdef __cplusplus
575 static int yyinput (void );
576 #else
577 static int input (void );
578 #endif
580 #endif
582 /* Amount of stuff to slurp up with each read. */
583 #ifndef YY_READ_BUF_SIZE
584 #define YY_READ_BUF_SIZE 8192
585 #endif
587 /* Copy whatever the last rule matched to the standard output. */
588 #ifndef ECHO
589 /* This used to be an fputs(), but since the string might contain NUL's,
590 * we now use fwrite().
592 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
593 #endif
595 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
596 * is returned in "result".
598 #ifndef YY_INPUT
599 #define YY_INPUT(buf,result,max_size) \
600 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
602 int c = '*'; \
603 size_t n; \
604 for ( n = 0; n < max_size && \
605 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
606 buf[n] = (char) c; \
607 if ( c == '\n' ) \
608 buf[n++] = (char) c; \
609 if ( c == EOF && ferror( yyin ) ) \
610 YY_FATAL_ERROR( "input in flex scanner failed" ); \
611 result = n; \
613 else \
615 errno=0; \
616 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
618 if( errno != EINTR) \
620 YY_FATAL_ERROR( "input in flex scanner failed" ); \
621 break; \
623 errno=0; \
624 clearerr(yyin); \
629 #endif
631 /* No semi-colon after return; correct usage is to write "yyterminate();" -
632 * we don't want an extra ';' after the "return" because that will cause
633 * some compilers to complain about unreachable statements.
635 #ifndef yyterminate
636 #define yyterminate() return YY_NULL
637 #endif
639 /* Number of entries by which start-condition stack grows. */
640 #ifndef YY_START_STACK_INCR
641 #define YY_START_STACK_INCR 25
642 #endif
644 /* Report a fatal error. */
645 #ifndef YY_FATAL_ERROR
646 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
647 #endif
649 /* end tables serialization structures and prototypes */
651 /* Default declaration of generated scanner - a define so the user can
652 * easily add parameters.
654 #ifndef YY_DECL
655 #define YY_DECL_IS_OURS 1
657 extern int yylex (void);
659 #define YY_DECL int yylex (void)
660 #endif /* !YY_DECL */
662 /* Code executed at the beginning of each rule, after yytext and yyleng
663 * have been set up.
665 #ifndef YY_USER_ACTION
666 #define YY_USER_ACTION
667 #endif
669 /* Code executed at the end of each rule. */
670 #ifndef YY_BREAK
671 #define YY_BREAK break;
672 #endif
674 #define YY_RULE_SETUP \
675 YY_USER_ACTION
677 /** The main scanner function which does all the work.
679 YY_DECL
681 register yy_state_type yy_current_state;
682 register char *yy_cp, *yy_bp;
683 register int yy_act;
685 #line 44 "/usr/src/usr.bin/m4/tokenizer.l"
687 #line 688 "<stdout>"
689 if ( !(yy_init) )
691 (yy_init) = 1;
693 #ifdef YY_USER_INIT
694 YY_USER_INIT;
695 #endif
697 if ( ! (yy_start) )
698 (yy_start) = 1; /* first start state */
700 if ( ! yyin )
701 yyin = stdin;
703 if ( ! yyout )
704 yyout = stdout;
706 if ( ! YY_CURRENT_BUFFER ) {
707 yyensure_buffer_stack ();
708 YY_CURRENT_BUFFER_LVALUE =
709 yy_create_buffer(yyin,YY_BUF_SIZE );
712 yy_load_buffer_state( );
715 while ( 1 ) /* loops until end-of-file is reached */
717 yy_cp = (yy_c_buf_p);
719 /* Support of yytext. */
720 *yy_cp = (yy_hold_char);
722 /* yy_bp points to the position in yy_ch_buf of the start of
723 * the current run.
725 yy_bp = yy_cp;
727 yy_current_state = (yy_start);
728 yy_match:
731 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
732 if ( yy_accept[yy_current_state] )
734 (yy_last_accepting_state) = yy_current_state;
735 (yy_last_accepting_cpos) = yy_cp;
737 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
739 yy_current_state = (int) yy_def[yy_current_state];
740 if ( yy_current_state >= 35 )
741 yy_c = yy_meta[(unsigned int) yy_c];
743 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
744 ++yy_cp;
746 while ( yy_base[yy_current_state] != 49 );
748 yy_find_action:
749 yy_act = yy_accept[yy_current_state];
750 if ( yy_act == 0 )
751 { /* have to back up */
752 yy_cp = (yy_last_accepting_cpos);
753 yy_current_state = (yy_last_accepting_state);
754 yy_act = yy_accept[yy_current_state];
757 YY_DO_BEFORE_ACTION;
759 do_action: /* This label is used only to access EOF actions. */
761 switch ( yy_act )
762 { /* beginning of action switch */
763 case 0: /* must back up */
764 /* undo the effects of YY_DO_BEFORE_ACTION */
765 *yy_cp = (yy_hold_char);
766 yy_cp = (yy_last_accepting_cpos);
767 yy_current_state = (yy_last_accepting_state);
768 goto yy_find_action;
770 case 1:
771 /* rule 1 can match eol */
772 YY_RULE_SETUP
773 #line 45 "/usr/src/usr.bin/m4/tokenizer.l"
774 {/* just skip it */}
775 YY_BREAK
776 case 2:
777 YY_RULE_SETUP
778 #line 46 "/usr/src/usr.bin/m4/tokenizer.l"
779 { yylval = number(); return(NUMBER); }
780 YY_BREAK
781 case 3:
782 YY_RULE_SETUP
783 #line 47 "/usr/src/usr.bin/m4/tokenizer.l"
784 { if (mimic_gnu) {
785 yylval = parse_radix(); return(NUMBER);
786 } else {
787 return(ERROR);
790 YY_BREAK
791 case 4:
792 YY_RULE_SETUP
793 #line 53 "/usr/src/usr.bin/m4/tokenizer.l"
794 { return(LE); }
795 YY_BREAK
796 case 5:
797 YY_RULE_SETUP
798 #line 54 "/usr/src/usr.bin/m4/tokenizer.l"
799 { return(GE); }
800 YY_BREAK
801 case 6:
802 YY_RULE_SETUP
803 #line 55 "/usr/src/usr.bin/m4/tokenizer.l"
804 { return(LSHIFT); }
805 YY_BREAK
806 case 7:
807 YY_RULE_SETUP
808 #line 56 "/usr/src/usr.bin/m4/tokenizer.l"
809 { return(RSHIFT); }
810 YY_BREAK
811 case 8:
812 YY_RULE_SETUP
813 #line 57 "/usr/src/usr.bin/m4/tokenizer.l"
814 { return(EQ); }
815 YY_BREAK
816 case 9:
817 YY_RULE_SETUP
818 #line 58 "/usr/src/usr.bin/m4/tokenizer.l"
819 { return(NE); }
820 YY_BREAK
821 case 10:
822 YY_RULE_SETUP
823 #line 59 "/usr/src/usr.bin/m4/tokenizer.l"
824 { return(LAND); }
825 YY_BREAK
826 case 11:
827 YY_RULE_SETUP
828 #line 60 "/usr/src/usr.bin/m4/tokenizer.l"
829 { return(LOR); }
830 YY_BREAK
831 case 12:
832 YY_RULE_SETUP
833 #line 61 "/usr/src/usr.bin/m4/tokenizer.l"
834 { if (mimic_gnu) { return (EXPONENT); } }
835 YY_BREAK
836 case 13:
837 YY_RULE_SETUP
838 #line 62 "/usr/src/usr.bin/m4/tokenizer.l"
839 { return yytext[0]; }
840 YY_BREAK
841 case 14:
842 YY_RULE_SETUP
843 #line 63 "/usr/src/usr.bin/m4/tokenizer.l"
844 ECHO;
845 YY_BREAK
846 #line 847 "<stdout>"
847 case YY_STATE_EOF(INITIAL):
848 yyterminate();
850 case YY_END_OF_BUFFER:
852 /* Amount of text matched not including the EOB char. */
853 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
855 /* Undo the effects of YY_DO_BEFORE_ACTION. */
856 *yy_cp = (yy_hold_char);
857 YY_RESTORE_YY_MORE_OFFSET
859 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
861 /* We're scanning a new file or input source. It's
862 * possible that this happened because the user
863 * just pointed yyin at a new source and called
864 * yylex(). If so, then we have to assure
865 * consistency between YY_CURRENT_BUFFER and our
866 * globals. Here is the right place to do so, because
867 * this is the first action (other than possibly a
868 * back-up) that will match for the new input source.
870 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
871 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
872 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
875 /* Note that here we test for yy_c_buf_p "<=" to the position
876 * of the first EOB in the buffer, since yy_c_buf_p will
877 * already have been incremented past the NUL character
878 * (since all states make transitions on EOB to the
879 * end-of-buffer state). Contrast this with the test
880 * in input().
882 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
883 { /* This was really a NUL. */
884 yy_state_type yy_next_state;
886 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
888 yy_current_state = yy_get_previous_state( );
890 /* Okay, we're now positioned to make the NUL
891 * transition. We couldn't have
892 * yy_get_previous_state() go ahead and do it
893 * for us because it doesn't know how to deal
894 * with the possibility of jamming (and we don't
895 * want to build jamming into it because then it
896 * will run more slowly).
899 yy_next_state = yy_try_NUL_trans( yy_current_state );
901 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
903 if ( yy_next_state )
905 /* Consume the NUL. */
906 yy_cp = ++(yy_c_buf_p);
907 yy_current_state = yy_next_state;
908 goto yy_match;
911 else
913 yy_cp = (yy_c_buf_p);
914 goto yy_find_action;
918 else switch ( yy_get_next_buffer( ) )
920 case EOB_ACT_END_OF_FILE:
922 (yy_did_buffer_switch_on_eof) = 0;
924 if ( yywrap( ) )
926 /* Note: because we've taken care in
927 * yy_get_next_buffer() to have set up
928 * yytext, we can now set up
929 * yy_c_buf_p so that if some total
930 * hoser (like flex itself) wants to
931 * call the scanner after we return the
932 * YY_NULL, it'll still work - another
933 * YY_NULL will get returned.
935 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
937 yy_act = YY_STATE_EOF(YY_START);
938 goto do_action;
941 else
943 if ( ! (yy_did_buffer_switch_on_eof) )
944 YY_NEW_FILE;
946 break;
949 case EOB_ACT_CONTINUE_SCAN:
950 (yy_c_buf_p) =
951 (yytext_ptr) + yy_amount_of_matched_text;
953 yy_current_state = yy_get_previous_state( );
955 yy_cp = (yy_c_buf_p);
956 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
957 goto yy_match;
959 case EOB_ACT_LAST_MATCH:
960 (yy_c_buf_p) =
961 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
963 yy_current_state = yy_get_previous_state( );
965 yy_cp = (yy_c_buf_p);
966 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
967 goto yy_find_action;
969 break;
972 default:
973 YY_FATAL_ERROR(
974 "fatal flex scanner internal error--no action found" );
975 } /* end of action switch */
976 } /* end of scanning one token */
977 } /* end of yylex */
979 /* yy_get_next_buffer - try to read in a new buffer
981 * Returns a code representing an action:
982 * EOB_ACT_LAST_MATCH -
983 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
984 * EOB_ACT_END_OF_FILE - end of file
986 static int yy_get_next_buffer (void)
988 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
989 register char *source = (yytext_ptr);
990 register int number_to_move, i;
991 int ret_val;
993 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
994 YY_FATAL_ERROR(
995 "fatal flex scanner internal error--end of buffer missed" );
997 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
998 { /* Don't try to fill the buffer, so this is an EOF. */
999 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1001 /* We matched a single character, the EOB, so
1002 * treat this as a final EOF.
1004 return EOB_ACT_END_OF_FILE;
1007 else
1009 /* We matched some text prior to the EOB, first
1010 * process it.
1012 return EOB_ACT_LAST_MATCH;
1016 /* Try to read more data. */
1018 /* First move last chars to start of buffer. */
1019 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1021 for ( i = 0; i < number_to_move; ++i )
1022 *(dest++) = *(source++);
1024 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1025 /* don't do the read, it's not guaranteed to return an EOF,
1026 * just force an EOF
1028 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1030 else
1032 yy_size_t num_to_read =
1033 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1035 while ( num_to_read <= 0 )
1036 { /* Not enough room in the buffer - grow it. */
1038 /* just a shorter name for the current buffer */
1039 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1041 int yy_c_buf_p_offset =
1042 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1044 if ( b->yy_is_our_buffer )
1046 yy_size_t new_size = b->yy_buf_size * 2;
1048 if ( new_size <= 0 )
1049 b->yy_buf_size += b->yy_buf_size / 8;
1050 else
1051 b->yy_buf_size *= 2;
1053 b->yy_ch_buf = (char *)
1054 /* Include room in for 2 EOB chars. */
1055 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1057 else
1058 /* Can't grow it, we don't own it. */
1059 b->yy_ch_buf = 0;
1061 if ( ! b->yy_ch_buf )
1062 YY_FATAL_ERROR(
1063 "fatal error - scanner input buffer overflow" );
1065 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1067 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1068 number_to_move - 1;
1072 if ( num_to_read > YY_READ_BUF_SIZE )
1073 num_to_read = YY_READ_BUF_SIZE;
1075 /* Read in more data. */
1076 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1077 (yy_n_chars), num_to_read );
1079 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1082 if ( (yy_n_chars) == 0 )
1084 if ( number_to_move == YY_MORE_ADJ )
1086 ret_val = EOB_ACT_END_OF_FILE;
1087 yyrestart(yyin );
1090 else
1092 ret_val = EOB_ACT_LAST_MATCH;
1093 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1094 YY_BUFFER_EOF_PENDING;
1098 else
1099 ret_val = EOB_ACT_CONTINUE_SCAN;
1101 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1102 /* Extend the array by 50%, plus the number we really need. */
1103 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1104 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1105 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1106 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1109 (yy_n_chars) += number_to_move;
1110 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1111 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1113 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1115 return ret_val;
1118 /* yy_get_previous_state - get the state just before the EOB char was reached */
1120 static yy_state_type yy_get_previous_state (void)
1122 register yy_state_type yy_current_state;
1123 register char *yy_cp;
1125 yy_current_state = (yy_start);
1127 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1129 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1130 if ( yy_accept[yy_current_state] )
1132 (yy_last_accepting_state) = yy_current_state;
1133 (yy_last_accepting_cpos) = yy_cp;
1135 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1137 yy_current_state = (int) yy_def[yy_current_state];
1138 if ( yy_current_state >= 35 )
1139 yy_c = yy_meta[(unsigned int) yy_c];
1141 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1144 return yy_current_state;
1147 /* yy_try_NUL_trans - try to make a transition on the NUL character
1149 * synopsis
1150 * next_state = yy_try_NUL_trans( current_state );
1152 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1154 register int yy_is_jam;
1155 register char *yy_cp = (yy_c_buf_p);
1157 register YY_CHAR yy_c = 1;
1158 if ( yy_accept[yy_current_state] )
1160 (yy_last_accepting_state) = yy_current_state;
1161 (yy_last_accepting_cpos) = yy_cp;
1163 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1165 yy_current_state = (int) yy_def[yy_current_state];
1166 if ( yy_current_state >= 35 )
1167 yy_c = yy_meta[(unsigned int) yy_c];
1169 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1170 yy_is_jam = (yy_current_state == 34);
1172 return yy_is_jam ? 0 : yy_current_state;
1175 #ifndef YY_NO_INPUT
1176 #ifdef __cplusplus
1177 static int yyinput (void)
1178 #else
1179 static int input (void)
1180 #endif
1183 int c;
1185 *(yy_c_buf_p) = (yy_hold_char);
1187 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1189 /* yy_c_buf_p now points to the character we want to return.
1190 * If this occurs *before* the EOB characters, then it's a
1191 * valid NUL; if not, then we've hit the end of the buffer.
1193 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1194 /* This was really a NUL. */
1195 *(yy_c_buf_p) = '\0';
1197 else
1198 { /* need more input */
1199 yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
1200 ++(yy_c_buf_p);
1202 switch ( yy_get_next_buffer( ) )
1204 case EOB_ACT_LAST_MATCH:
1205 /* This happens because yy_g_n_b()
1206 * sees that we've accumulated a
1207 * token and flags that we need to
1208 * try matching the token before
1209 * proceeding. But for input(),
1210 * there's no matching to consider.
1211 * So convert the EOB_ACT_LAST_MATCH
1212 * to EOB_ACT_END_OF_FILE.
1215 /* Reset buffer status. */
1216 yyrestart(yyin );
1218 /*FALLTHROUGH*/
1220 case EOB_ACT_END_OF_FILE:
1222 if ( yywrap( ) )
1223 return EOF;
1225 if ( ! (yy_did_buffer_switch_on_eof) )
1226 YY_NEW_FILE;
1227 #ifdef __cplusplus
1228 return yyinput();
1229 #else
1230 return input();
1231 #endif
1234 case EOB_ACT_CONTINUE_SCAN:
1235 (yy_c_buf_p) = (yytext_ptr) + offset;
1236 break;
1241 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1242 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1243 (yy_hold_char) = *++(yy_c_buf_p);
1245 return c;
1247 #endif /* ifndef YY_NO_INPUT */
1249 /** Immediately switch to a different input stream.
1250 * @param input_file A readable stream.
1252 * @note This function does not reset the start condition to @c INITIAL .
1254 void yyrestart (FILE * input_file )
1257 if ( ! YY_CURRENT_BUFFER ){
1258 yyensure_buffer_stack ();
1259 YY_CURRENT_BUFFER_LVALUE =
1260 yy_create_buffer(yyin,YY_BUF_SIZE );
1263 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1264 yy_load_buffer_state( );
1267 /** Switch to a different input buffer.
1268 * @param new_buffer The new input buffer.
1271 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1274 /* TODO. We should be able to replace this entire function body
1275 * with
1276 * yypop_buffer_state();
1277 * yypush_buffer_state(new_buffer);
1279 yyensure_buffer_stack ();
1280 if ( YY_CURRENT_BUFFER == new_buffer )
1281 return;
1283 if ( YY_CURRENT_BUFFER )
1285 /* Flush out information for old buffer. */
1286 *(yy_c_buf_p) = (yy_hold_char);
1287 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1288 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1291 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1292 yy_load_buffer_state( );
1294 /* We don't actually know whether we did this switch during
1295 * EOF (yywrap()) processing, but the only time this flag
1296 * is looked at is after yywrap() is called, so it's safe
1297 * to go ahead and always set it.
1299 (yy_did_buffer_switch_on_eof) = 1;
1302 static void yy_load_buffer_state (void)
1304 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1305 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1306 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1307 (yy_hold_char) = *(yy_c_buf_p);
1310 /** Allocate and initialize an input buffer state.
1311 * @param file A readable stream.
1312 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1314 * @return the allocated buffer state.
1316 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1318 YY_BUFFER_STATE b;
1320 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1321 if ( ! b )
1322 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1324 b->yy_buf_size = size;
1326 /* yy_ch_buf has to be 2 characters longer than the size given because
1327 * we need to put in 2 end-of-buffer characters.
1329 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1330 if ( ! b->yy_ch_buf )
1331 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1333 b->yy_is_our_buffer = 1;
1335 yy_init_buffer(b,file );
1337 return b;
1340 /** Destroy the buffer.
1341 * @param b a buffer created with yy_create_buffer()
1344 void yy_delete_buffer (YY_BUFFER_STATE b )
1347 if ( ! b )
1348 return;
1350 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1351 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1353 if ( b->yy_is_our_buffer )
1354 yyfree((void *) b->yy_ch_buf );
1356 yyfree((void *) b );
1359 /* Initializes or reinitializes a buffer.
1360 * This function is sometimes called more than once on the same buffer,
1361 * such as during a yyrestart() or at EOF.
1363 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1366 int oerrno = errno;
1368 yy_flush_buffer(b );
1370 b->yy_input_file = file;
1371 b->yy_fill_buffer = 1;
1373 /* If b is the current buffer, then yy_init_buffer was _probably_
1374 * called from yyrestart() or through yy_get_next_buffer.
1375 * In that case, we don't want to reset the lineno or column.
1377 if (b != YY_CURRENT_BUFFER){
1378 b->yy_bs_lineno = 1;
1379 b->yy_bs_column = 0;
1382 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1384 errno = oerrno;
1387 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1388 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1391 void yy_flush_buffer (YY_BUFFER_STATE b )
1393 if ( ! b )
1394 return;
1396 b->yy_n_chars = 0;
1398 /* We always need two end-of-buffer characters. The first causes
1399 * a transition to the end-of-buffer state. The second causes
1400 * a jam in that state.
1402 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1403 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1405 b->yy_buf_pos = &b->yy_ch_buf[0];
1407 b->yy_at_bol = 1;
1408 b->yy_buffer_status = YY_BUFFER_NEW;
1410 if ( b == YY_CURRENT_BUFFER )
1411 yy_load_buffer_state( );
1414 /** Pushes the new state onto the stack. The new state becomes
1415 * the current state. This function will allocate the stack
1416 * if necessary.
1417 * @param new_buffer The new state.
1420 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1422 if (new_buffer == NULL)
1423 return;
1425 yyensure_buffer_stack();
1427 /* This block is copied from yy_switch_to_buffer. */
1428 if ( YY_CURRENT_BUFFER )
1430 /* Flush out information for old buffer. */
1431 *(yy_c_buf_p) = (yy_hold_char);
1432 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1433 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1436 /* Only push if top exists. Otherwise, replace top. */
1437 if (YY_CURRENT_BUFFER)
1438 (yy_buffer_stack_top)++;
1439 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1441 /* copied from yy_switch_to_buffer. */
1442 yy_load_buffer_state( );
1443 (yy_did_buffer_switch_on_eof) = 1;
1446 /** Removes and deletes the top of the stack, if present.
1447 * The next element becomes the new top.
1450 void yypop_buffer_state (void)
1452 if (!YY_CURRENT_BUFFER)
1453 return;
1455 yy_delete_buffer(YY_CURRENT_BUFFER );
1456 YY_CURRENT_BUFFER_LVALUE = NULL;
1457 if ((yy_buffer_stack_top) > 0)
1458 --(yy_buffer_stack_top);
1460 if (YY_CURRENT_BUFFER) {
1461 yy_load_buffer_state( );
1462 (yy_did_buffer_switch_on_eof) = 1;
1466 /* Allocates the stack if it does not exist.
1467 * Guarantees space for at least one push.
1469 static void yyensure_buffer_stack (void)
1471 yy_size_t num_to_alloc;
1473 if (!(yy_buffer_stack)) {
1475 /* First allocation is just for 2 elements, since we don't know if this
1476 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1477 * immediate realloc on the next call.
1479 num_to_alloc = 1;
1480 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1481 (num_to_alloc * sizeof(struct yy_buffer_state*)
1483 if ( ! (yy_buffer_stack) )
1484 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1486 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1488 (yy_buffer_stack_max) = num_to_alloc;
1489 (yy_buffer_stack_top) = 0;
1490 return;
1493 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1495 /* Increase the buffer to prepare for a possible push. */
1496 int grow_size = 8 /* arbitrary grow size */;
1498 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1499 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1500 ((yy_buffer_stack),
1501 num_to_alloc * sizeof(struct yy_buffer_state*)
1503 if ( ! (yy_buffer_stack) )
1504 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1506 /* zero only the new slots.*/
1507 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1508 (yy_buffer_stack_max) = num_to_alloc;
1512 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1513 * @param base the character buffer
1514 * @param size the size in bytes of the character buffer
1516 * @return the newly allocated buffer state object.
1518 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1520 YY_BUFFER_STATE b;
1522 if ( size < 2 ||
1523 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1524 base[size-1] != YY_END_OF_BUFFER_CHAR )
1525 /* They forgot to leave room for the EOB's. */
1526 return 0;
1528 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1529 if ( ! b )
1530 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1532 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1533 b->yy_buf_pos = b->yy_ch_buf = base;
1534 b->yy_is_our_buffer = 0;
1535 b->yy_input_file = 0;
1536 b->yy_n_chars = b->yy_buf_size;
1537 b->yy_is_interactive = 0;
1538 b->yy_at_bol = 1;
1539 b->yy_fill_buffer = 0;
1540 b->yy_buffer_status = YY_BUFFER_NEW;
1542 yy_switch_to_buffer(b );
1544 return b;
1547 /** Setup the input buffer state to scan a string. The next call to yylex() will
1548 * scan from a @e copy of @a str.
1549 * @param yystr a NUL-terminated string to scan
1551 * @return the newly allocated buffer state object.
1552 * @note If you want to scan bytes that may contain NUL values, then use
1553 * yy_scan_bytes() instead.
1555 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1558 return yy_scan_bytes(yystr,strlen(yystr) );
1561 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1562 * scan from a @e copy of @a bytes.
1563 * @param yybytes the byte buffer to scan
1564 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1566 * @return the newly allocated buffer state object.
1568 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
1570 YY_BUFFER_STATE b;
1571 char *buf;
1572 yy_size_t n;
1573 yy_size_t i;
1575 /* Get memory for full buffer, including space for trailing EOB's. */
1576 n = _yybytes_len + 2;
1577 buf = (char *) yyalloc(n );
1578 if ( ! buf )
1579 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1581 for ( i = 0; i < _yybytes_len; ++i )
1582 buf[i] = yybytes[i];
1584 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1586 b = yy_scan_buffer(buf,n );
1587 if ( ! b )
1588 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1590 /* It's okay to grow etc. this buffer, and we should throw it
1591 * away when we're done.
1593 b->yy_is_our_buffer = 1;
1595 return b;
1598 #ifndef YY_EXIT_FAILURE
1599 #define YY_EXIT_FAILURE 2
1600 #endif
1602 static void yy_fatal_error (yyconst char* msg )
1604 (void) fprintf( stderr, "%s\n", msg );
1605 exit( YY_EXIT_FAILURE );
1608 /* Redefine yyless() so it works in section 3 code. */
1610 #undef yyless
1611 #define yyless(n) \
1612 do \
1614 /* Undo effects of setting up yytext. */ \
1615 int yyless_macro_arg = (n); \
1616 YY_LESS_LINENO(yyless_macro_arg);\
1617 yytext[yyleng] = (yy_hold_char); \
1618 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1619 (yy_hold_char) = *(yy_c_buf_p); \
1620 *(yy_c_buf_p) = '\0'; \
1621 yyleng = yyless_macro_arg; \
1623 while ( 0 )
1625 /* Accessor methods (get/set functions) to struct members. */
1627 /** Get the current line number.
1630 int yyget_lineno (void)
1633 return yylineno;
1636 /** Get the input stream.
1639 FILE *yyget_in (void)
1641 return yyin;
1644 /** Get the output stream.
1647 FILE *yyget_out (void)
1649 return yyout;
1652 /** Get the length of the current token.
1655 yy_size_t yyget_leng (void)
1657 return yyleng;
1660 /** Get the current token.
1664 char *yyget_text (void)
1666 return yytext;
1669 /** Set the current line number.
1670 * @param line_number
1673 void yyset_lineno (int line_number )
1676 yylineno = line_number;
1679 /** Set the input stream. This does not discard the current
1680 * input buffer.
1681 * @param in_str A readable stream.
1683 * @see yy_switch_to_buffer
1685 void yyset_in (FILE * in_str )
1687 yyin = in_str ;
1690 void yyset_out (FILE * out_str )
1692 yyout = out_str ;
1695 int yyget_debug (void)
1697 return yy_flex_debug;
1700 void yyset_debug (int bdebug )
1702 yy_flex_debug = bdebug ;
1705 static int yy_init_globals (void)
1707 /* Initialization is the same as for the non-reentrant scanner.
1708 * This function is called from yylex_destroy(), so don't allocate here.
1711 (yy_buffer_stack) = 0;
1712 (yy_buffer_stack_top) = 0;
1713 (yy_buffer_stack_max) = 0;
1714 (yy_c_buf_p) = (char *) 0;
1715 (yy_init) = 0;
1716 (yy_start) = 0;
1718 /* Defined in main.c */
1719 #ifdef YY_STDINIT
1720 yyin = stdin;
1721 yyout = stdout;
1722 #else
1723 yyin = (FILE *) 0;
1724 yyout = (FILE *) 0;
1725 #endif
1727 /* For future reference: Set errno on error, since we are called by
1728 * yylex_init()
1730 return 0;
1733 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1734 int yylex_destroy (void)
1737 /* Pop the buffer stack, destroying each element. */
1738 while(YY_CURRENT_BUFFER){
1739 yy_delete_buffer(YY_CURRENT_BUFFER );
1740 YY_CURRENT_BUFFER_LVALUE = NULL;
1741 yypop_buffer_state();
1744 /* Destroy the stack itself. */
1745 yyfree((yy_buffer_stack) );
1746 (yy_buffer_stack) = NULL;
1748 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1749 * yylex() is called, initialization will occur. */
1750 yy_init_globals( );
1752 return 0;
1756 * Internal utility routines.
1759 #ifndef yytext_ptr
1760 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1762 register int i;
1763 for ( i = 0; i < n; ++i )
1764 s1[i] = s2[i];
1766 #endif
1768 #ifdef YY_NEED_STRLEN
1769 static int yy_flex_strlen (yyconst char * s )
1771 register int n;
1772 for ( n = 0; s[n]; ++n )
1775 return n;
1777 #endif
1779 void *yyalloc (yy_size_t size )
1781 return (void *) malloc( size );
1784 void *yyrealloc (void * ptr, yy_size_t size )
1786 /* The cast to (char *) in the following accommodates both
1787 * implementations that use char* generic pointers, and those
1788 * that use void* generic pointers. It works with the latter
1789 * because both ANSI C and C++ allow castless assignment from
1790 * any pointer type to void*, and deal with argument conversions
1791 * as though doing an assignment.
1793 return (void *) realloc( (char *) ptr, size );
1796 void yyfree (void * ptr )
1798 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1801 #define YYTABLES_NAME "yytables"
1803 #line 63 "/usr/src/usr.bin/m4/tokenizer.l"
1807 int32_t
1808 number(void)
1810 long l;
1812 errno = 0;
1813 l = strtol(yytext, NULL, 0);
1814 if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) ||
1815 l > INT32_MAX || l < INT32_MIN) {
1816 fprintf(stderr, "m4: numeric overflow in expr: %s\n", yytext);
1818 return l;
1821 int32_t
1822 parse_radix(void)
1824 long base;
1825 char *next;
1826 long l;
1827 int d;
1829 l = 0;
1830 base = strtol(yytext + 2, &next, 0);
1831 if (base > 36 || next == NULL) {
1832 fprintf(stderr, "m4: error in number %s\n", yytext);
1833 } else {
1834 next++;
1835 while (*next != 0) {
1836 if (*next >= '0' && *next <= '9')
1837 d = *next - '0';
1838 else if (*next >= 'a' && *next <= 'z')
1839 d = *next - 'a' + 10;
1840 else {
1841 assert(*next >= 'A' && *next <= 'Z');
1842 d = *next - 'A' + 10;
1844 if (d >= base) {
1845 fprintf(stderr,
1846 "m4: error in number %s\n", yytext);
1847 return 0;
1849 l = base * l + d;
1850 next++;
1853 return l;