1 /* $NetBSD: config_lex.l,v 1.2 2003/03/04 22:31:15 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 Merino. 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.2 2003/03/04 22:31:15 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 MODE_PROPS device|fifo|lefthanded|nodaemon|pidfile|slowdown_x|slowdown_y|ttystat|xconsole 59 EVENT_PROPS button|do 60 61 %% 62 63 #.*$ /* Eat up comments */ 64 [ \t]+ /* Eat up whitespace */ 65 \n { yyline++; } 66 67 = { return TK_EQUAL; } 68 ; { return TK_EOL; } 69 "{" { return TK_LBRACE; } 70 "}" { return TK_RBRACE; } 71 event { return TK_EVENT; } 72 mode { return TK_MODE; } 73 {EVENT_PROPS} { yylval.string = strdup(yytext); return TK_EVENTPROP; } 74 {MODE_PROPS} { yylval.string = strdup(yytext); return TK_MODEPROP; } 75 {STRING} { yylval.string = strdup(yytext); return TK_STRING; } 76 77 . { yyerror("illegal token `%s'", yytext); } 78