Initial import from FreeBSD RELENG_4:
[games.git] / usr.sbin / pcvt / kbdio / lex.l
1 %{
2 /*
3  * Copyright (c) 1994 Joerg Wunsch
4  *
5  * All rights reserved.
6  *
7  * This program is free software.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by Joerg Wunsch
20  * 4. The name of the developer may not be used to endorse or promote
21  *    products derived from this software without specific prior written
22  *    permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27  * IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ident "$FreeBSD: src/usr.sbin/pcvt/kbdio/lex.l,v 1.6 1999/09/06 07:39:30 peter Exp $"
37
38 /*
39  * $Log: lex.l,v $
40  * Revision 1.2  1994/09/18  19:48:45  j
41  * Added the symbolic values for kbd cmd byte.
42  *
43  * Revision 1.1  1994/09/18  12:57:13  j
44  * Initial revision
45  *
46  *
47  */
48
49 #include <stdio.h>
50 #include <stdlib.h>
51
52 #include "y.tab.h"
53
54 extern YYSTYPE yylval;
55
56 %}
57
58 D       [0-9a-fA-F]
59
60 %%
61
62 all             { return ALL; }
63 cmd             { return CMD; }
64 data            { return DATA; }
65 defaults        { return DEFAULTS; }
66 echo            { return ECHOC; }
67 enable          { return ENABLE; }
68 expr            { return EXPR; }
69 help            { return HELP; }
70 id              { return ID; }
71 led             { return LED; }
72 make            { return MAKE; }
73 only            { return ONLY; }
74 release         { return RELEASE; }
75 resend          { return RESEND; }
76 reset           { return RESET; }
77 scan            { return SCAN; }
78 status          { return STATUS; }
79 typematic       { return TYPEMATIC; }
80 what            { return WHAT; }
81
82                 /* numeric values */
83 clklow          { yylval.num = 0x10; return NUM; }
84 ignpar          { yylval.num = 0x20; return NUM; }
85 irq             { yylval.num = 0x01; return NUM; }
86 ovrinh          { yylval.num = 0x08; return NUM; }
87 scconv          { yylval.num = 0x40; return NUM; }
88 test            { yylval.num = 0x04; return NUM; }
89
90 {D}({D}*)\.     { sscanf(yytext, "%d", &yylval.num); return NUM; }
91
92 {D}({D}*)       { sscanf(yytext, "%x", &yylval.num); return NUM; }
93
94 [ \t]           { /* ignore */ }
95
96 \n              { return NEWLINE; }
97
98 .               { return yytext[0]; }