aboutsummaryrefslogtreecommitdiff
path: root/xkbcomp
diff options
context:
space:
mode:
Diffstat (limited to 'xkbcomp')
-rw-r--r--xkbcomp/parseutils.c2
-rw-r--r--xkbcomp/parseutils.h3
-rw-r--r--xkbcomp/xkbcomp.c2
-rw-r--r--xkbcomp/xkbparse.y10
-rw-r--r--xkbcomp/xkbscan.c10
5 files changed, 21 insertions, 6 deletions
diff --git a/xkbcomp/parseutils.c b/xkbcomp/parseutils.c
index 025e1ef3f..4b2a3e605 100644
--- a/xkbcomp/parseutils.c
+++ b/xkbcomp/parseutils.c
@@ -802,7 +802,7 @@ XKBParseFile(FILE * file, XkbFile ** pRtrn)
{
if (file)
{
- yyin = file;
+ scan_set_file(file);
rtrnValue = NULL;
if (yyparse() == 0)
{
diff --git a/xkbcomp/parseutils.h b/xkbcomp/parseutils.h
index 8b8a6c11d..8c381d408 100644
--- a/xkbcomp/parseutils.h
+++ b/xkbcomp/parseutils.h
@@ -198,11 +198,10 @@ extern int yywrap(void);
extern int yylex(void);
extern int yyparse(void);
+extern void scan_set_file(FILE *file);
extern int setScanState(char * /* file */ ,
int /* line */
);
-extern FILE *yyin;
-
#endif /* XKBPARSE_H */
diff --git a/xkbcomp/xkbcomp.c b/xkbcomp/xkbcomp.c
index c418ac196..834c777ee 100644
--- a/xkbcomp/xkbcomp.c
+++ b/xkbcomp/xkbcomp.c
@@ -883,7 +883,7 @@ main(int argc, char *argv[])
XkbFileInfo result;
Status status;
- yyin = stdin;
+ scan_set_file(stdin);
uSetEntryFile(NullString);
uSetDebugFile(NullString);
uSetErrorFile(NullString);
diff --git a/xkbcomp/xkbparse.y b/xkbcomp/xkbparse.y
index d2b23b0e3..87dd07f20 100644
--- a/xkbcomp/xkbparse.y
+++ b/xkbcomp/xkbparse.y
@@ -145,7 +145,7 @@ unsigned int parseDebug;
%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
+%type <expr> OptExprList ExprList Expr Term Lhs Terminal ArrayInit KeySyms
%type <expr> OptKeySymList KeySymList Action ActionList Coord CoordList
%type <var> VarDecl VarDeclList SymbolsBody SymbolsVarDecl
%type <vmod> VModDecl VModDefList VModDef
@@ -721,8 +721,12 @@ OptKeySymList : KeySymList { $$= $1; }
KeySymList : KeySymList COMMA KeySym
{ $$= AppendKeysymList($1,$3); }
+ | KeySymList COMMA KeySyms
+ { $$= AppendKeysymList($1,strdup("NoSymbol")); }
| KeySym
{ $$= CreateKeysymList($1); }
+ | KeySyms
+ { $$= CreateKeysymList(strdup("NoSymbol")); }
;
KeySym : IDENT { $$= strdup(scanBuf); }
@@ -734,6 +738,10 @@ KeySym : IDENT { $$= strdup(scanBuf); }
}
;
+KeySyms : OBRACE KeySymList CBRACE
+ { $$= $2; }
+ ;
+
SignedNumber : MINUS Number { $$= -$2; }
| Number { $$= $1; }
;
diff --git a/xkbcomp/xkbscan.c b/xkbcomp/xkbscan.c
index 4fb575536..3aa77472a 100644
--- a/xkbcomp/xkbscan.c
+++ b/xkbcomp/xkbscan.c
@@ -37,7 +37,7 @@
unsigned int scanDebug;
-FILE *yyin = NULL;
+static FILE *yyin;
static char scanFileBuf[1024] = {0};
char *scanFile = scanFileBuf;
@@ -269,6 +269,14 @@ tokText(int tok)
}
#endif
+void
+scan_set_file(FILE *file)
+{
+ readBufLen = 0;
+ readBufPos = 0;
+ yyin = file;
+}
+
static int
scanchar(void)
{