config_lex.l revision 1.3 1 /* $NetBSD: config_lex.l,v 1.3 2003/08/06 18:07:53 jmmv Exp $ */
2
3 /*
4 * Copyright (c) 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julio M. Merino Vidal.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
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
17 * permission.
18 *
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.
30 */
31
32 %{
33
34 #include <sys/cdefs.h>
35
36 #ifndef lint
37 __RCSID("$NetBSD: config_lex.l,v 1.3 2003/08/06 18:07:53 jmmv Exp $");
38 #endif /* not lint */
39
40 #include <stdio.h>
41 #include <string.h>
42 #include <sys/time.h>
43 #include <dev/wscons/wsconsio.h>
44
45 #include "wsmoused.h"
46 #include "config_yacc.h"
47
48 extern int yyline;
49
50 extern int yyerror(const char *fmt, ...);
51 int yylex(void);
52
53 %}
54
55 %option noyywrap
56
57 STRING [\$A-Za-z\.\/_\-0-9]*
58 SP_STRING [\$A-Za-z\.\/_\-0-9 ]*
59 MODE_PROPS device|fifo|lefthanded|modes|nodaemon|pidfile|slowdown_x|slowdown_y|ttystat|xconsole
60 EVENT_PROPS button|do
61
62 %%
63
64 #.*$ /* Eat up comments */
65 [ \t]+ /* Eat up whitespace */
66 \n { yyline++; }
67
68 = { return TK_EQUAL; }
69 ; { return TK_EOL; }
70 "{" { return TK_LBRACE; }
71 "}" { return TK_RBRACE; }
72 event { return TK_EVENT; }
73 mode { return TK_MODE; }
74 {EVENT_PROPS} { yylval.string = strdup(yytext); return TK_EVENTPROP; }
75 {MODE_PROPS} { yylval.string = strdup(yytext); return TK_MODEPROP; }
76 \"{SP_STRING}\" { yylval.string = strdup(yytext + 1);
77 yylval.string[strlen(yytext) - 2] = '\0'; return TK_STRING; }
78 {STRING} { yylval.string = strdup(yytext); return TK_STRING; }
79
80 . { yyerror("illegal token `%s'", yytext); }
81