Re: [PATCH 4/5] Use CHAR_LITERAL instead of CHAR because MSVC defines CHAR

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>

> Le 30 juil. 2020 à 20:53, [email protected] a écrit :
> 
> From: Anonymous Maarten <[email protected]>

Installed as follows.

commit 91d6807a9d6112b568d67e1def941afa1c79c065
Author: Maarten De Braekeleer <[email protected]>
Date:   Thu Jul 30 20:53:34 2020 +0200

  portability: use CHAR_LITERAL instead of CHAR because MSVC defines CHAR

  * src/parse-gram.y, src/scan-gram.l: here.

diff --git a/src/parse-gram.y b/src/parse-gram.y
index 351da393..cd706263 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -214,7 +214,7 @@
 BRACED_CODE       "{...}"
 BRACED_PREDICATE  "%?{...}"
 BRACKETED_ID      _("[identifier]")
-  CHAR              _("character literal")
+  CHAR_LITERAL      _("character literal")
 COLON             ":"
 EPILOGUE          _("epilogue")
 EQUAL             "="
@@ -232,7 +232,7 @@
%code pre-printer  {tron (yyo);}
%code post-printer {troff (yyo);}

-%type <unsigned char> CHAR
+%type <unsigned char> CHAR_LITERAL
%printer { fputs (char_name ($$), yyo); } <unsigned char>

%type <char*> "{...}" "%?{...}" "%{...%}" EPILOGUE STRING TSTRING
@@ -765,7 +765,7 @@ value:
id:
 ID
   { $$ = symbol_from_uniqstr ($1, @1); }
-| CHAR
+| CHAR_LITERAL
   {
     const char *var = "api.token.raw";
     if (current_class == nterm_sym)
diff --git a/src/scan-gram.l b/src/scan-gram.l
index bd367fa5..f957f137 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -615,9 +615,9 @@ eqopt    ({sp}=)?
     }
   else
     {
-        val->CHAR = last_string[0];
+        val->CHAR_LITERAL = last_string[0];
       STRING_FREE ();
-        return CHAR;
+        return CHAR_LITERAL;
     }
 }
 {eol}     unexpected_newline (token_start, "'");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.