Add _xkbcommon_ prefix to parser and lexer symbols Signed-off-by: Daniel Stone <daniel@fooishbar.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
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;