1 /* $NetBSD: config_lex.l,v 1.6 2009/10/28 22:49:38 christos Exp $ */
4 * Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. The name authors may not be used to endorse or promote products
16 * derived from this software without specific prior written
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
20 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/cdefs.h>
37 __RCSID("$NetBSD: config_lex.l,v 1.6 2009/10/28 22:49:38 christos Exp $");
43 #include <dev/wscons/wsconsio.h>
46 #include "config_yacc.h"
50 extern int yyerror(const char *fmt, ...);
56 %option noyywrap noinput nounput
58 STRING [\$A-Za-z\.\/_\-0-9]*
59 SP_STRING [\$A-Za-z\.\/_\-0-9 ]*
60 MODE_PROPS button_[0-9]+_down|button_[0-9]+_up|device|fifo|lefthanded|modes|nodaemon|pidfile|slowdown_x|slowdown_y|ttystat|xconsole|xconsole_delay
64 #.*$ /* Eat up comments */
65 [ \t]+ /* Eat up whitespace */
68 = { return TK_EQUAL; }
70 "{" { return TK_LBRACE; }
71 "}" { return TK_RBRACE; }
72 mode { return TK_MODE; }
73 {MODE_PROPS} { yylval.string = strdup(yytext); return TK_MODEPROP; }
74 \"{SP_STRING}\" { yylval.string = strdup(yytext + 1);
75 yylval.string[strlen(yytext) - 2] = '\0'; return TK_STRING; }
76 {STRING} { yylval.string = strdup(yytext); return TK_STRING; }
78 . { yyerror("illegal token `%s'", yytext); }