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;
50 %option case-insensitive
61 \" s = scanBuf; BEGIN(S_STR);
62 \< s = scanBuf; BEGIN(S_KEY);
64 <S_STR>\" BEGIN(INITIAL); *s = '\0'; return STRING;
65 <S_KEY>\> BEGIN(INITIAL); *s = '\0'; return KEYNAME;
67 <S_STR,S_KEY>\\[0-7]{1,3} {
68 /* octal escape sequence */
71 (void) sscanf( yytext + 1, "%o", &result );
74 fprintf(stderr, "Illegal octal escape %s\n", yytext);
81 <S_STR,S_KEY>\\[0-9]+ {
82 fprintf(stderr, "Illegal octal escape %s\n", yytext);
86 <S_STR,S_KEY>\\n *s++ = '\n';
87 <S_STR,S_KEY>\\t *s++ = '\t';
88 <S_STR,S_KEY>\\r *s++ = '\r';
89 <S_STR,S_KEY>\\b *s++ = '\b';
90 <S_STR,S_KEY>\\f *s++ = '\f';
91 <S_STR,S_KEY>\\v *s++ = '\v';
92 <S_STR,S_KEY>\\e *s++ = '\033';
94 <S_STR,S_KEY>. *s++ = yytext[0];
96 xkb_keymap return XKB_KEYMAP;
97 xkb_keycodes return XKB_KEYCODES;
98 xkb_types return XKB_TYPES;
99 xkb_symbols return XKB_SYMBOLS;
100 xkb_compat return XKB_COMPATMAP;
101 xkb_compat_map return XKB_COMPATMAP;
102 xkb_compatibility return XKB_COMPATMAP;
103 xkb_compatibility_map return XKB_COMPATMAP;
104 xkb_geometry return XKB_GEOMETRY;
105 xkb_semantics return XKB_SEMANTICS;
106 xkb_layout return XKB_LAYOUT;
107 include return INCLUDE;
108 override return OVERRIDE;
109 augment return AUGMENT;
110 replace return REPLACE;
111 alternate return ALTERNATE;
112 partial return PARTIAL;
113 default return DEFAULT;
114 hidden return HIDDEN;
115 virtual_modifiers return VIRTUAL_MODS;
117 interpret return INTERPRET;
118 action return ACTION_TOK;
122 modmap return MODIFIER_MAP;
123 mod_map return MODIFIER_MAP;
124 modifier_map return MODIFIER_MAP;
125 indicator return INDICATOR;
129 section return SECTION;
130 overlay return OVERLAY;
132 outline return OUTLINE;
135 virtual return VIRTUAL;
136 alphanumeric_keys return ALPHANUMERIC_KEYS;
137 modifier_keys return MODIFIER_KEYS;
138 keypad_keys return KEYPAD_KEYS;
139 function_keys return FUNCTION_KEYS;
140 alternate_group return ALTERNATE_GROUP;
142 [a-zA-Z_][a-zA-Z_0-9]* memcpy(scanBuf, yytext, yyleng + 1); return IDENT;
147 scanInt = strtol(yytext, &end, 0);
153 scanInt = strtod(yytext, &end) * XkbGeomPtsPerMM;
177 <<EOF>> return END_OF_FILE;
184 yyerror(const char *s)
186 if (warningLevel>0) {
187 (void)fprintf(stderr,"%s: line %d of %s\n",s,yylineno,
188 (scanFile?scanFile:"(unknown)"));
189 if ((warningLevel>3))
190 (void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
195 void setScanState(char *file, int lineno)
200 scanFile = strdup(file);
204 XKBParseString(const char *string, XkbFile ** pRtrn)
206 YY_BUFFER_STATE state;
212 state = yy_scan_string(string);
217 yy_delete_buffer(state);
218 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
220 CheckDefaultMap(rtrnValue);
227 XKBParseFile(FILE * file, XkbFile ** pRtrn)
237 CheckDefaultMap(rtrnValue);