#endif
#define DEBUG_VAR parseDebug
#include "parseutils.h"
+#include "xkbmisc.h"
+#include <X11/Xlib.h>
#include <X11/keysym.h>
-#include <X11/extensions/XKBgeomcommon.h>
#include <stdlib.h>
unsigned int parseDebug;
XkbFile *file;
}
%type <ival> Number Integer Float SignedNumber
-%type <uval> XkbCompositeType FileType MergeMode OptMergeMode KeySym
+%type <uval> XkbCompositeType FileType MergeMode OptMergeMode
%type <uval> DoodadType Flag Flags OptFlags
-%type <str> KeyName MapName OptMapName
+%type <str> KeyName MapName OptMapName KeySym
%type <sval> FieldSpec Ident Element String
%type <any> DeclList Decl
%type <expr> OptExprList ExprList Expr Term Lhs Terminal ArrayInit
{
if ($1==MergeAltForm) {
yyerror("cannot use 'alternate' to include other maps");
- $$= &IncludeCreate(scanStr,MergeDefault)->common;
+ $$= &IncludeCreate(scanBuf,MergeDefault)->common;
}
else {
- $$= &IncludeCreate(scanStr,$1)->common;
+ $$= &IncludeCreate(scanBuf,$1)->common;
}
}
;
;
InterpretMatch : KeySym PLUS Expr
- { $$= InterpCreate((KeySym)$1,$3); }
+ { $$= InterpCreate($1, $3); }
| KeySym
- { $$= InterpCreate((KeySym)$1,NULL); }
+ { $$= InterpCreate($1, NULL); }
;
VarDeclList : VarDeclList VarDecl
;
KeySymList : KeySymList COMMA KeySym
- { $$= AppendKeysymList($1,(KeySym)$3); }
+ { $$= AppendKeysymList($1,$3); }
| KeySym
- { $$= CreateKeysymList((KeySym)$1); }
+ { $$= CreateKeysymList($1); }
;
-KeySym : IDENT
+KeySym : IDENT { $$= strdup(scanBuf); }
+ | SECTION { $$= strdup("section"); }
+ | Integer
{
- KeySym sym;
- if (LookupKeysym(scanStr,&sym))
- $$= sym;
+ if ($1 < 10) { /* XK_0 .. XK_9 */
+ $$= malloc(2);
+ $$[0]= $1 + '0';
+ $$[1]= '\0';
+ }
else {
- char buf[120];
- snprintf(buf, sizeof(buf),
- "expected keysym, got %s",
- uStringText(scanStr));
- yyerror(buf);
- yynerrs++;
- $$= NoSymbol;
+ $$= malloc(17);
+ snprintf($$, 17, "%x", $1);
}
}
- | SECTION
- {
- $$= XK_section;
- }
- | Integer
- {
- if ($1<10) $$= $1+'0'; /* XK_0 .. XK_9 */
- else $$= $1;
- }
;
SignedNumber : MINUS Number { $$= -$2; }
Integer : INTEGER { $$= scanInt; }
;
-KeyName : KEYNAME { $$= scanStr; scanStr= NULL; }
+KeyName : KEYNAME { $$= strdup(scanBuf); }
;
-Ident : IDENT { $$= XkbcInternAtom(scanStr,False); }
+Ident : IDENT { $$= XkbcInternAtom(scanBuf,False); }
| DEFAULT { $$= XkbcInternAtom("default",False); }
;
-String : STRING { $$= XkbcInternAtom(scanStr,False); }
+String : STRING { $$= XkbcInternAtom(scanBuf,False); }
;
OptMapName : MapName { $$= $1; }
| { $$= NULL; }
;
-MapName : STRING { $$= scanStr; scanStr= NULL; }
+MapName : STRING { $$= strdup(scanBuf); }
;
%%
void
if (warningLevel>0) {
(void)fprintf(stderr,"%s: line %d of %s\n",s,lineNum,
(scanFile?scanFile:"(unknown)"));
- if ((scanStr)&&(warningLevel>3))
- (void)fprintf(stderr,"last scanned symbol is: %s\n",scanStr);
+ if ((warningLevel>3))
+ (void)fprintf(stderr,"last scanned symbol is: %s\n",scanBuf);
}
return;
}