help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

change from %name-prefix "prefix" to %define api.prefix {prefix}


From: Jörg Ullmann
Subject: change from %name-prefix "prefix" to %define api.prefix {prefix}
Date: Mon, 28 Aug 2023 14:27:31 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0

Is there a way to tell the new '%define api.prefix {prefix}' to act like the old 
'%name-prefix "prefix"'?

If I try to change it, I really come into trouble with the string we are using as prefix: "Spark::SetDefaultParser" because of the "::" in the name. It ends up with:

.../Parser.hpp:176:14: warning: extra tokens at end of #ifndef directive
  176 | #ifndef SPARK::SETDEFAULTPARSERDEBUG

Because the c++ preprocessor does not like the "::".

The old '%name-prefix "prefix"' does not rename the types and macros, including YYDEBUG, YYTOKENTYPE, yytokentype, YYSTYPE, YYLTYPE, etc. It is just using YYDEBUG and the new one builds a lot of macro stuff with the prefix string around the YYDEBUG.

It would be great to have an option for the new api.prefix to do it in this old 
way.

https://lists.gnu.org/archive/html/help-bison/2019-02/msg00001.html
https://www.gnu.org/software/bison/manual/html_node/Multiple-Parsers.html

I can not rename the prefix to something like Spark_SetDefaultParser because it is also used as namespace and end up with a mess like this:
.../Parser.hpp:188:namespace Spark_SetDefaultParser {
.../Parser.hpp:202:    typedef SPARK_SETDEFAULTPARSERSTYPE value_type;

Thank you in advise! Jorg

Attachment: ullmann.vcf
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]