1 /* $NetBSD: yylex.c,v 1.4 2014/10/30 18:44:05 christos Exp $ */
3 /* yylex - scanner front-end for flex */
5 /* Copyright (c) 1990 The Regents of the University of California. */
6 /* All rights reserved. */
8 /* This code is derived from software contributed to Berkeley by */
11 /* The United States Government has rights in this work pursuant */
12 /* to contract no. DE-AC03-76SF00098 between the United States */
13 /* Department of Energy and the University of California. */
15 /* This file is part of flex. */
17 /* Redistribution and use in source and binary forms, with or without */
18 /* modification, are permitted provided that the following conditions */
21 /* 1. Redistributions of source code must retain the above copyright */
22 /* notice, this list of conditions and the following disclaimer. */
23 /* 2. Redistributions in binary form must reproduce the above copyright */
24 /* notice, this list of conditions and the following disclaimer in the */
25 /* documentation and/or other materials provided with the distribution. */
27 /* Neither the name of the University nor the names of its contributors */
28 /* may be used to endorse or promote products derived from this software */
29 /* without specific prior written permission. */
31 /* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR */
32 /* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED */
33 /* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
36 __RCSID("$NetBSD: yylex.c,v 1.4 2014/10/30 18:44:05 christos Exp $");
42 /* yylex - scan for a regular expression token */
48 static int beglin
= false;
53 toktype
= flexscan ();
55 if (toktype
== EOF
|| toktype
== 0) {
59 synerr (_("premature EOF"));
70 fprintf (stderr
, "%d\t", num_rules
+ 1);
95 (void) putc (toktype
, stderr
);
99 (void) putc ('\n', stderr
);
107 fputs ("%s", stderr
);
111 fputs ("%x", stderr
);
115 fputs ("%%\n", stderr
);
117 /* We set beglin to be true so we'll start
118 * writing out numbers as we echo rules.
119 * flexscan() has already assigned sectnum.
127 fprintf (stderr
, "'%s'", nmstr
);
152 fprintf (stderr
, "\\%c", yylval
);
156 if (!isascii (yylval
) || !isprint (yylval
))
159 (unsigned int) yylval
);
161 (void) putc (yylval
, stderr
);
168 fprintf (stderr
, "%d", yylval
);
172 fprintf (stderr
, "[%d]", yylval
);
176 fprintf (stderr
, "<<EOF>>");
180 fprintf (stderr
, "%s ", yytext
);
197 fprintf (stderr
, "%s", yytext
);
201 fprintf (stderr
, _("End Marker\n"));
207 ("*Something Weird* - tok: %d val: %d\n"),