diff options
Diffstat (limited to 'app/xkbcomp/xkbparse.y')
-rw-r--r-- | app/xkbcomp/xkbparse.y | 55 |
1 files changed, 19 insertions, 36 deletions
diff --git a/app/xkbcomp/xkbparse.y b/app/xkbcomp/xkbparse.y index 52afa2b80..d73b92a27 100644 --- a/app/xkbcomp/xkbparse.y +++ b/app/xkbcomp/xkbparse.y @@ -1,4 +1,3 @@ -/* $Xorg: xkbparse.y,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +23,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.11tsi Exp $ */ %token END_OF_FILE 0 @@ -100,6 +98,7 @@ #include <X11/extensions/XKBgeom.h> #include <stdlib.h> +unsigned int parseDebug; %} %right EQUALS @@ -137,9 +136,9 @@ 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 @@ -312,10 +311,10 @@ Decl : OptMergeMode VarDecl { 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; } } ; @@ -375,9 +374,9 @@ InterpretDecl : INTERPRET InterpretMatch OBRACE ; InterpretMatch : KeySym PLUS Expr - { $$= InterpCreate((KeySym)$1,$3); } + { $$= InterpCreate(XStringToKeysym($1), $3); } | KeySym - { $$= InterpCreate((KeySym)$1,NULL); } + { $$= InterpCreate(XStringToKeysym($1), NULL); } ; VarDeclList : VarDeclList VarDecl @@ -717,33 +716,17 @@ OptKeySymList : KeySymList { $$= $1; } ; KeySymList : KeySymList COMMA KeySym - { $$= AppendKeysymList($1,(KeySym)$3); } + { $$= AppendKeysymList($1,$3); } | KeySym - { $$= CreateKeysymList((KeySym)$1); } + { $$= CreateKeysymList($1); } ; -KeySym : IDENT - { - KeySym sym; - if (LookupKeysym(scanStr,&sym)) - $$= sym; - else { - char buf[120]; - sprintf(buf,"expected keysym, got %s", - uStringText(scanStr)); - yyerror(buf); - yynerrs++; - $$= NoSymbol; - } - } - | SECTION - { - $$= XK_section; - } +KeySym : IDENT { $$= strdup(scanBuf); } + | SECTION { $$= strdup("section"); } | Integer { - if ($1<10) $$= $1+'0'; /* XK_0 .. XK_9 */ - else $$= $1; + if ($1<10) { $$= malloc(2); $$[0]= '0' + $1; $$[1]= '\0'; } + else { $$= malloc(19); snprintf($$, 19, "0x%x", $1); } } ; @@ -761,21 +744,21 @@ Float : FLOAT { $$= scanInt; } Integer : INTEGER { $$= scanInt; } ; -KeyName : KEYNAME { $$= scanStr; scanStr= NULL; } +KeyName : KEYNAME { $$= strdup(scanBuf); } ; -Ident : IDENT { $$= XkbInternAtom(NULL,scanStr,False); } +Ident : IDENT { $$= XkbInternAtom(NULL,scanBuf,False); } | DEFAULT { $$= XkbInternAtom(NULL,"default",False); } ; -String : STRING { $$= XkbInternAtom(NULL,scanStr,False); } +String : STRING { $$= XkbInternAtom(NULL,scanBuf,False); } ; OptMapName : MapName { $$= $1; } | { $$= NULL; } ; -MapName : STRING { $$= scanStr; scanStr= NULL; } +MapName : STRING { $$= strdup(scanBuf); } ; %% void @@ -784,8 +767,8 @@ yyerror(const char *s) 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; } |