1 /************************************************************
2 Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc.
4 Permission to use, copy, modify, and distribute this
5 software and its documentation for any purpose and without
6 fee is hereby granted, provided that the above copyright
7 notice appear in all copies and that both that copyright
8 notice and this permission notice appear in supporting
9 documentation, and that the name of Silicon Graphics not be
10 used in advertising or publicity pertaining to distribution
11 of the software without specific prior written permission.
12 Silicon Graphics makes no representation about the suitability
13 of this software for any purpose. It is provided "as is"
14 without any express or implied warranty.
16 SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18 AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON
19 GRAPHICS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
20 DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
22 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH
23 THE USE OR PERFORMANCE OF THIS SOFTWARE.
25 ********************************************************/
35 #include "parseutils.h"
38 char *scanFile = NULL;
42 unsigned long scanULong;
51 %option case-insensitive
62 \" s = scanBuf; BEGIN(S_STR);
63 \< s = scanBuf; BEGIN(S_KEY);
65 <S_STR>\" BEGIN(INITIAL); *s = '\0'; return STRING;
66 <S_KEY>\> BEGIN(INITIAL); *s = '\0'; return KEYNAME;
68 <S_STR,S_KEY>\\[0-7]{1,3} {
69 /* octal escape sequence */
72 (void) sscanf( yytext + 1, "%o", &result );
75 fprintf(stderr, "Illegal octal escape %s\n", yytext);
82 <S_STR,S_KEY>\\[0-9]+ {
83 fprintf(stderr, "Illegal octal escape %s\n", yytext);
87 <S_STR,S_KEY>\\n *s++ = '\n';
88 <S_STR,S_KEY>\\t *s++ = '\t';
89 <S_STR,S_KEY>\\r *s++ = '\r';
90 <S_STR,S_KEY>\\b *s++ = '\b';
91 <S_STR,S_KEY>\\f *s++ = '\f';
92 <S_STR,S_KEY>\\v *s++ = '\v';
93 <S_STR,S_KEY>\\e *s++ = '\033';
95 <S_STR,S_KEY>. *s++ = yytext[0];
97 xkb_keymap return XKB_KEYMAP;
98 xkb_keycodes return XKB_KEYCODES;
99 xkb_types return XKB_TYPES;
100 xkb_symbols return XKB_SYMBOLS;
101 xkb_compat return XKB_COMPATMAP;
102 xkb_compat_map return XKB_COMPATMAP;
103 xkb_compatibility return XKB_COMPATMAP;
104 xkb_compatibility_map return XKB_COMPATMAP;
105 xkb_geometry return XKB_GEOMETRY;
106 xkb_semantics return XKB_SEMANTICS;
107 xkb_layout return XKB_LAYOUT;
108 include return INCLUDE;
109 override return OVERRIDE;
110 augment return AUGMENT;
111 replace return REPLACE;
112 alternate return ALTERNATE;
113 partial return PARTIAL;
114 default return DEFAULT;
115 hidden return HIDDEN;
116 virtual_modifiers return VIRTUAL_MODS;
118 interpret return INTERPRET;
119 action return ACTION_TOK;
123 modmap return MODIFIER_MAP;
124 mod_map return MODIFIER_MAP;
125 modifier_map return MODIFIER_MAP;
126 indicator return INDICATOR;
130 section return SECTION;
131 overlay return OVERLAY;
133 outline return OUTLINE;
136 virtual return VIRTUAL;
137 alphanumeric_keys return ALPHANUMERIC_KEYS;
138 modifier_keys return MODIFIER_KEYS;
139 keypad_keys return KEYPAD_KEYS;
140 function_keys return FUNCTION_KEYS;
141 alternate_group return ALTERNATE_GROUP;
143 [a-zA-Z_][a-zA-Z_0-9]* memcpy(scanBuf, yytext, yyleng + 1); return IDENT;
148 scanInt = strtol(yytext, &end, 0);
149 scanULong = strtoul(yytext, &end, 0);
155 scanInt = strtod(yytext, &end) * XkbGeomPtsPerMM;
179 <<EOF>> return END_OF_FILE;
186 yyerror(const char *s)
188 if (warningLevel>0) {
189 (void)fprintf(stderr,"%s: line %d of %s\n",s,yylineno,
190 (scanFile?scanFile:"(unknown)"));
191 if ((warningLevel>3))
192 (void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
197 void setScanState(char *file, int lineno)
202 scanFile = strdup(file);
206 XKBParseString(const char *string, XkbFile ** pRtrn)
208 YY_BUFFER_STATE state;
214 state = yy_scan_string(string);
219 yy_delete_buffer(state);
220 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
222 CheckDefaultMap(rtrnValue);
229 XKBParseFile(FILE * file, XkbFile ** pRtrn)
239 CheckDefaultMap(rtrnValue);