diff --git a/Makefile.am b/Makefile.am index a8c1414..7d1bffe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,6 +28,7 @@ AM_CFLAGS = \ $(BASE_CFLAGS) \ $(XMALLOC_ZERO_CFLAGS) +AM_LFLAGS = -o lex.yy.c AM_YFLAGS = -d xkbcommonincludedir = $(includedir)/xkbcommon diff --git a/src/xkbcomp/parser-priv.h b/src/xkbcomp/parser-priv.h index 17db6ed..98a97e9 100644 --- a/src/xkbcomp/parser-priv.h +++ b/src/xkbcomp/parser-priv.h @@ -43,6 +43,6 @@ void scanner_error(YYLTYPE *loc, void *scanner, const char *msg); int -yylex(YYSTYPE *val, YYLTYPE *loc, void *scanner); +_xkbcommon_lex(YYSTYPE *val, YYLTYPE *loc, void *scanner); #endif diff --git a/src/xkbcomp/parser.y b/src/xkbcomp/parser.y index e1bf18e..bb1bb82 100644 --- a/src/xkbcomp/parser.y +++ b/src/xkbcomp/parser.y @@ -30,7 +30,7 @@ #include "parser-priv.h" static void -yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg) +_xkbcommon_error(struct YYLTYPE *loc, struct parser_param *param, const char *msg) { scanner_error(loc, param->scanner, msg); } @@ -38,6 +38,7 @@ yyerror(struct YYLTYPE *loc, struct parser_param *param, const char *msg) #define scanner param->scanner %} +%name-prefix "_xkbcommon_" %define api.pure %locations %lex-param { void *scanner } diff --git a/src/xkbcomp/scanner.l b/src/xkbcomp/scanner.l index 95fcaa1..283d07e 100644 --- a/src/xkbcomp/scanner.l +++ b/src/xkbcomp/scanner.l @@ -53,6 +53,7 @@ scanner_error_extra(struct YYLTYPE *loc, struct scanner_extra *extra, } while (0) %} +%option prefix="_xkbcommon_" %option reentrant %option extra-type="struct scanner_extra *" %option bison-bridge bison-locations @@ -279,9 +280,9 @@ XkbParseString(struct xkb_context *ctx, const char *string, return false; state = yy_scan_string(string, param.scanner); - ret = yyparse(¶m); + ret = _xkbcommon_parse(¶m); yy_delete_buffer(state, param.scanner); - yylex_destroy(param.scanner); + _xkbcommon_lex_destroy(param.scanner); free(extra.scanFile); if (ret != 0) return false; @@ -315,9 +316,9 @@ XkbParseFile(struct xkb_context *ctx, FILE *file, if (!extra.scanFile) return false; - yyset_in(file, param.scanner); - ret = yyparse(¶m); - yylex_destroy(param.scanner); + _xkbcommon_set_in(file, param.scanner); + ret = _xkbcommon_parse(¶m); + _xkbcommon_lex_destroy(param.scanner); free(extra.scanFile); if (ret != 0) return false;