[vlc-devel] [PATCH 1/2] CSSGrammar: refactor lex/parse-param

Alexandre Janniaux ajanni at videolabs.io
Tue Mar 10 00:58:29 CET 2020


Scanner is used by both lexer and parser, so %param allows binding to
both, and css_parser is only used by the parser so there is no need to
declare it in the yylex function. As the function was not correctly
exposed to the lexer code, it was leading to different prototype for
both generated compile unit.
---
 modules/codec/webvtt/CSSGrammar.y | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/modules/codec/webvtt/CSSGrammar.y b/modules/codec/webvtt/CSSGrammar.y
index f9d7fd06b0..e51b132525 100644
--- a/modules/codec/webvtt/CSSGrammar.y
+++ b/modules/codec/webvtt/CSSGrammar.y
@@ -28,10 +28,9 @@
  */
 %define api.pure full
 
-%parse-param { yyscan_t scanner }
+%param { yyscan_t scanner }
 %parse-param { vlc_css_parser_t *css_parser }
-%lex-param   { yyscan_t scanner }
-%lex-param   { vlc_css_parser_t *css_parser }
+
 
 %{
 #ifdef HAVE_CONFIG_H
@@ -64,7 +63,7 @@ typedef void* yyscan_t;
 
 %{
 /* See bison pure calling */
-#define YY_DECL int yylex(union YYSTYPE *, yyscan_t, vlc_css_parser_t *)
+#define YY_DECL int yylex(union YYSTYPE *, yyscan_t)
 YY_DECL;
 
 static int yyerror(yyscan_t scanner, vlc_css_parser_t *p, const char *msg)
-- 
2.25.1



More information about the vlc-devel mailing list