1 /* yylex - scanner front-end for flex */
4 * Copyright (c) 1990 The Regents of the University of California.
7 * This code is derived from software contributed to Berkeley by
10 * The United States Government has rights in this work pursuant
11 * to contract no. DE-AC03-76SF00098 between the United States
12 * Department of Energy and the University of California.
14 * Redistribution and use in source and binary forms are permitted provided
15 * that: (1) source distributions retain this entire copyright notice and
16 * comment, and (2) distributions including binaries display the following
17 * acknowledgement: ``This product includes software developed by the
18 * University of California, Berkeley and its contributors'' in the
19 * documentation or other materials provided with the distribution and in
20 * all advertising materials mentioning features or use of this software.
21 * Neither the name of the University nor the names of its contributors may
22 * be used to endorse or promote products derived from this software without
23 * specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
25 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
26 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
31 "@(#) $Id: yylex.c,v 1.2 1994/06/24 10:57:35 ceriel Exp $ (LBL)";
39 /* ANSI C does not guarantee that isascii() is defined */
41 #define isascii(c) ((c) <= 0177)
45 /* yylex - scan for a regular expression token
51 * token - return token found
58 static int beglin = false;
65 if ( toktype == EOF || toktype == 0 )
71 synerr( "premature EOF" );
76 else if ( sectnum == 2 )
90 fprintf( stderr, "%d\t", num_rules + 1 );
116 (void) putc( toktype, stderr );
120 (void) putc( '\n', stderr );
128 fputs( "%s", stderr );
132 fputs( "%x", stderr );
136 (void) putc( ' ', stderr );
140 fputs( "%%\n", stderr );
142 /* we set beglin to be true so we'll start
143 * writing out numbers as we echo rules. flexscan() has
144 * already assigned sectnum
153 fprintf( stderr, "'%s'", nmstr );
179 fprintf( stderr, "\\%c", yylval );
183 if ( ! isascii( yylval ) || ! isprint( yylval ) )
184 fprintf( stderr, "\\%.3o", yylval );
186 (void) putc( yylval, stderr );
193 fprintf( stderr, "%d", yylval );
197 fprintf( stderr, "[%d]", yylval );
201 fprintf( stderr, "<<EOF>>" );
205 fprintf( stderr, "End Marker" );
209 fprintf( stderr, "*Something Weird* - tok: %d val: %d\n",