bison-patches
[Top][All Lists]
Advanced

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

Re: [PATCH 3/5] Use INT_LITERAL instead of INT because MSVC defines INT


From: Akim Demaille
Subject: Re: [PATCH 3/5] Use INT_LITERAL instead of INT because MSVC defines INT
Date: Sat, 1 Aug 2020 20:27:08 +0200


> Le 30 juil. 2020 à 20:53, anonymous.maarten@gmail.com a écrit :
> 
> From: Anonymous Maarten <anonymous.maarten@gmail.com>

Thanks.  Installed as follows.  It is a "trivial" patch, no need for a 
disclaimer.  However I'd prefer that you sign it, is that OK for you?

commit b5c4f7cfa8d9c5d35b41da7bd0e7d5075c340160
Author: Maarten De Braekeleer <maarten.debraekeleer@gmail.com>
Date:   Thu Jul 30 20:53:33 2020 +0200

    portability: use INT_LITERAL instead of INT because MSVC defines INT
    
    * src/parse-gram.y, src/scan-gram.l: here.

diff --git a/src/parse-gram.y b/src/parse-gram.y
index 269f776e..351da393 100644
--- a/src/parse-gram.y
+++ b/src/parse-gram.y
@@ -249,7 +249,7 @@
 %printer { fprintf (yyo, "%%%s", $$); } PERCENT_FLAG
 %printer { fprintf (yyo, "<%s>", $$); } TAG tag
 
-%token <int> INT _("integer literal")
+%token <int> INT_LITERAL _("integer literal")
 %printer { fprintf (yyo, "%d", $$); } <int>
 
 %type <symbol*> id id_colon string_as_id symbol token_decl token_decl_for_prec
@@ -342,8 +342,8 @@ prologue_declaration:
 | "%defines"                       { defines_flag = true; }
 | "%defines" STRING                { handle_defines ($2); }
 | "%error-verbose"                 { handle_error_verbose (&@$, $1); }
-| "%expect" INT                    { expected_sr_conflicts = $2; }
-| "%expect-rr" INT                 { expected_rr_conflicts = $2; }
+| "%expect" INT_LITERAL            { expected_sr_conflicts = $2; }
+| "%expect-rr" INT_LITERAL         { expected_rr_conflicts = $2; }
 | "%file-prefix" STRING            { handle_file_prefix (&@$, &@1, $1, $2); }
 | "%glr-parser"
     {
@@ -561,7 +561,7 @@ token_decl:
 %type <int> int.opt;
 int.opt:
   %empty  { $$ = -1; }
-| INT
+| INT_LITERAL
 ;
 
 %type <symbol*> alias;
@@ -703,13 +703,13 @@ rhs:
     { grammar_current_rule_empty_set (@2); }
 | rhs "%prec" symbol
     { grammar_current_rule_prec_set ($3, @3); }
-| rhs "%dprec" INT
+| rhs "%dprec" INT_LITERAL
     { grammar_current_rule_dprec_set ($3, @3); }
 | rhs "%merge" TAG
     { grammar_current_rule_merge_set ($3, @3); }
-| rhs "%expect" INT
+| rhs "%expect" INT_LITERAL
     { grammar_current_rule_expect_sr ($3, @3); }
-| rhs "%expect-rr" INT
+| rhs "%expect-rr" INT_LITERAL
     { grammar_current_rule_expect_rr ($3, @3); }
 ;
 
diff --git a/src/scan-gram.l b/src/scan-gram.l
index ad2904ce..bd367fa5 100644
--- a/src/scan-gram.l
+++ b/src/scan-gram.l
@@ -322,8 +322,8 @@ eqopt    ({sp}=)?
     BEGIN SC_AFTER_IDENTIFIER;
   }
 
-  {int}      RETURN_VALUE (INT, scan_integer (yytext, 10, *loc));
-  {xint}     RETURN_VALUE (INT, scan_integer (yytext, 16, *loc));
+  {int}      RETURN_VALUE (INT_LITERAL, scan_integer (yytext, 10, *loc));
+  {xint}     RETURN_VALUE (INT_LITERAL, scan_integer (yytext, 16, *loc));
 
   /* Identifiers may not start with a digit.  Yet, don't silently
      accept "1FOO" as "1 FOO".  */
@@ -934,9 +934,9 @@ convert_ucn_to_byte (char const *ucn)
 }
 
 
-/*---------------------------------------------------------------------.
-| Handle '#line INT( "FILE")?\n'.  ARGS has already skipped '#line '.  |
-`---------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------.
+| Handle '#line INT_LITERAL( "FILE")?\n'.  ARGS has already skipped '#line '. |
+`----------------------------------------------------------------------------*/
 
 static void
 handle_syncline (char *args, location loc)




reply via email to

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