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

[email protected]
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
From: Anonymous Maarten <[email protected]>

---
 src/parse-gram.c | 20 ++++++++++----------
 src/parse-gram.h |  6 +++---
 src/parse-gram.y | 14 +++++++-------
 src/scan-gram.l  | 10 +++++-----
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/src/parse-gram.c b/src/parse-gram.c
index 1eaaf794..40a58fd5 100644
--- a/src/parse-gram.c
+++ b/src/parse-gram.c
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.6.90.  */
+/* A Bison parser, made by GNU Bison 3.7.12-ec397-dirty.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
@@ -49,7 +49,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.6.90"
+#define YYBISON_VERSION "3.7.12-ec397-dirty"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -162,7 +162,7 @@ enum yysymbol_kind_t
   YYSYMBOL_TAG = 54,                       /* "<tag>"  */
   YYSYMBOL_TAG_ANY = 55,                   /* "<*>"  */
   YYSYMBOL_TAG_NONE = 56,                  /* "<>"  */
-  YYSYMBOL_INT = 57,                       /* "integer literal"  */
+  YYSYMBOL_INT_LITERAL = 57,               /* "integer literal"  */
   YYSYMBOL_PERCENT_PARAM = 58,             /* "%param"  */
   YYSYMBOL_PERCENT_UNION = 59,             /* "%union"  */
   YYSYMBOL_PERCENT_EMPTY = 60,             /* "%empty"  */
@@ -1139,8 +1139,8 @@ tron (yyo);
          { fprintf (yyo, "<%s>", ((*yyvaluep).TAG)); }
         break;
 
-    case YYSYMBOL_INT: /* "integer literal"  */
-         { fprintf (yyo, "%d", ((*yyvaluep).INT)); }
+    case YYSYMBOL_INT_LITERAL: /* "integer literal"  */
+         { fprintf (yyo, "%d", ((*yyvaluep).INT_LITERAL)); }
         break;
 
     case YYSYMBOL_PERCENT_PARAM: /* "%param"  */
@@ -2087,11 +2087,11 @@ yyreduce:
     break;
 
   case 12: /* prologue_declaration: "%expect" "integer literal"  */
-                                   { expected_sr_conflicts = (yyvsp[0].INT); }
+                                   { expected_sr_conflicts = (yyvsp[0].INT_LITERAL); }
     break;
 
   case 13: /* prologue_declaration: "%expect-rr" "integer literal"  */
-                                   { expected_rr_conflicts = (yyvsp[0].INT); }
+                                   { expected_rr_conflicts = (yyvsp[0].INT_LITERAL); }
     break;
 
   case 14: /* prologue_declaration: "%file-prefix" "string"  */
@@ -2506,7 +2506,7 @@ yyreduce:
     break;
 
   case 105: /* rhs: rhs "%dprec" "integer literal"  */
-    { grammar_current_rule_dprec_set ((yyvsp[0].INT), (yylsp[0])); }
+    { grammar_current_rule_dprec_set ((yyvsp[0].INT_LITERAL), (yylsp[0])); }
     break;
 
   case 106: /* rhs: rhs "%merge" "<tag>"  */
@@ -2514,11 +2514,11 @@ yyreduce:
     break;
 
   case 107: /* rhs: rhs "%expect" "integer literal"  */
-    { grammar_current_rule_expect_sr ((yyvsp[0].INT), (yylsp[0])); }
+    { grammar_current_rule_expect_sr ((yyvsp[0].INT_LITERAL), (yylsp[0])); }
     break;
 
   case 108: /* rhs: rhs "%expect-rr" "integer literal"  */
-    { grammar_current_rule_expect_rr ((yyvsp[0].INT), (yylsp[0])); }
+    { grammar_current_rule_expect_rr ((yyvsp[0].INT_LITERAL), (yylsp[0])); }
     break;
 
   case 109: /* named_ref.opt: %empty  */
diff --git a/src/parse-gram.h b/src/parse-gram.h
index 739b91b6..b77fbbcf 100644
--- a/src/parse-gram.h
+++ b/src/parse-gram.h
@@ -1,4 +1,4 @@
-/* A Bison parser, made by GNU Bison 3.6.90.  */
+/* A Bison parser, made by GNU Bison 3.7.12-ec397-dirty.  */
 
 /* Bison interface for Yacc-like parsers in C
 
@@ -136,7 +136,7 @@ extern int gram_debug;
     TAG = 54,                      /* "<tag>"  */
     TAG_ANY = 55,                  /* "<*>"  */
     TAG_NONE = 56,                 /* "<>"  */
-    INT = 57,                      /* "integer literal"  */
+    INT_LITERAL = 57,              /* "integer literal"  */
     PERCENT_PARAM = 58,            /* "%param"  */
     PERCENT_UNION = 59,            /* "%union"  */
     PERCENT_EMPTY = 60             /* "%empty"  */
@@ -156,7 +156,7 @@ union GRAM_STYPE
   char* EPILOGUE;                          /* "epilogue"  */
   char* PROLOGUE;                          /* "%{...%}"  */
   code_props_type code_props_type;         /* code_props_type  */
-  int INT;                                 /* "integer literal"  */
+  int INT_LITERAL;                         /* "integer literal"  */
   int yykind_82;                           /* int.opt  */
   named_ref* yykind_95;                    /* named_ref.opt  */
   param_type PERCENT_PARAM;                /* "%param"  */
diff --git a/src/parse-gram.y b/src/parse-gram.y
index fc046f60..782817dd 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)
-- 
2.21.3
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.