From c5b95ccf6b5d646850709952e02466053a3ccbca Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Thu, 16 Dec 2004 09:06:08 +0000 Subject: [PATCH] Use #define to handle the %name-prefix. * data/glr.c, data/yacc.c: Comment changes. * data/lalr1.cc (yylex): Use #define to select the name of yylex, so that one can refer to yylex in the parser file, and have it renamed, as is the case with other skeletons. --- ChangeLog | 9 +++++++++ data/glr.c | 3 +-- data/lalr1.cc | 13 +++++++++---- data/yacc.c | 3 +-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa070b79..11f6835a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-12-16 Akim Demaille + + Use #define to handle the %name-prefix. + + * data/glr.c, data/yacc.c: Comment changes. + * data/lalr1.cc (yylex): Use #define to select the name of yylex, + so that one can refer to yylex in the parser file, and have it + renamed, as is the case with other skeletons. + 2004-12-16 Akim Demaille Move lalr1.cc internals into yy*. diff --git a/data/glr.c b/data/glr.c index d99fc70c..5fef464f 100644 --- a/data/glr.c +++ b/data/glr.c @@ -149,8 +149,7 @@ b4_copyright([Skeleton parser for GLR parsing with Bison], [2002, 2003, 2004]) ]b4_identification m4_if(b4_prefix[], [yy], [], -[/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +[/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error diff --git a/data/lalr1.cc b/data/lalr1.cc index 317b4db8..b921b818 100644 --- a/data/lalr1.cc +++ b/data/lalr1.cc @@ -373,8 +373,13 @@ namespace yy @output @output_parser_name@ b4_copyright([C++ Skeleton parser for LALR(1) parsing with Bison], [2002, 2003, 2004]) - -m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[ +m4_if(b4_prefix[], [yy], [], +[ +// Take the name prefix into account. +#define yylex b4_prefix[]lex]) +m4_if(b4_defines_flag, 0, [], +[ +#include @output_header_name@])[ /* A pseudo ostream that takes yydebug_ into account. */ # define YYCDEBUG \ @@ -786,9 +791,9 @@ yy::]b4_parser_class_name[::yylex_ () { YYCDEBUG << "Reading a token: "; #if YYLSP_NEEDED - yylooka_ = ]m4_default(b4_prefix, [yy])[lex (&value, &location); + yylooka_ = yylex (&value, &location); #else - yylooka_ = ]m4_default(b4_prefix, [yy])[lex (&value); + yylooka_ = yylex (&value); #endif } diff --git a/data/yacc.c b/data/yacc.c index 40b1320b..7331b65c 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -153,8 +153,7 @@ b4_copyright([Skeleton parser for Yacc-like parsing with Bison], ]b4_identification m4_if(b4_prefix[], [yy], [], -[/* If NAME_PREFIX is specified substitute the variables and functions - names. */ +[/* Substitute the variable and function names. */ #define yyparse b4_prefix[]parse #define yylex b4_prefix[]lex #define yyerror b4_prefix[]error -- 2.47.2