bison-patches
[Top][All Lists]
Advanced

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

[PATCH 2/7] output: no longer use b4_tokens.


From: Akim Demaille
Subject: [PATCH 2/7] output: no longer use b4_tokens.
Date: Mon, 23 Jul 2012 14:03:20 +0200

* data/glr.c, data/glr.cc, data/lalr1.cc, data/lalr1.java, data/yacc.c:
Since the previous commit, b4_tokens_define and the like no longer need
b4_tokens.
* src/output.c (token_definitions_output): Remove.
---
 TODO            |  5 -----
 data/glr.c      |  2 +-
 data/glr.cc     |  2 +-
 data/lalr1.cc   |  2 +-
 data/lalr1.java |  2 +-
 data/yacc.c     |  2 +-
 src/output.c    | 35 -----------------------------------
 7 files changed, 5 insertions(+), 45 deletions(-)

diff --git a/TODO b/TODO
index 4f628a2..cec1866 100644
--- a/TODO
+++ b/TODO
@@ -2,11 +2,6 @@
 ** Variable names.
 What should we name `variant' and `lex_symbol'?
 
-** Use b4_symbol in all the skeleton
-Move its definition in the more standard places and deploy it in other
-skeletons.  Then remove the older system, including the tables
-generated by output.c
-
 ** Update the documentation on gnu.org
 
 ** Get rid of fake #lines [Bison: ...]
diff --git a/data/glr.c b/data/glr.c
index 37cf1a4..d392622 100644
--- a/data/glr.c
+++ b/data/glr.c
@@ -176,7 +176,7 @@ m4_define([b4_rhs_location],
 m4_define([b4_shared_declarations],
 [b4_declare_yydebug[
 ]b4_percent_code_get([[requires]])[
-]b4_token_enums(b4_tokens)[
+]b4_token_enums[
 ]b4_declare_yylstype[
 ]b4_c_ansi_function_decl(b4_prefix[parse], [int], b4_parse_param)[
 ]b4_percent_code_get([[provides]])[]dnl
diff --git a/data/glr.cc b/data/glr.cc
index 2f986da..81e8027 100644
--- a/data/glr.cc
+++ b/data/glr.cc
@@ -300,7 +300,7 @@ b4_copyright([Skeleton interface for Bison GLR parsers in 
C++],
 
 ]dnl Redirections for glr.c.
 b4_percent_define_flag_if([[global_tokens_and_yystype]],
-[b4_token_defines(b4_tokens)])
+[b4_token_defines])
 [
 #ifndef ]b4_api_PREFIX[STYPE
 # define ]b4_api_PREFIX[STYPE 
]b4_namespace_ref[::]b4_parser_class_name[::semantic_type
diff --git a/data/lalr1.cc b/data/lalr1.cc
index 59b3096..96936bb 100644
--- a/data/lalr1.cc
+++ b/data/lalr1.cc
@@ -333,7 +333,7 @@ b4_public_types_define])[
 ]b4_namespace_close[
 
 ]b4_percent_define_flag_if([[global_tokens_and_yystype]],
-[b4_token_defines(b4_tokens)
+[b4_token_defines
 
 #ifndef ]b4_api_PREFIX[STYPE
  /* Redirection for backward compatibility.  */
diff --git a/data/lalr1.java b/data/lalr1.java
index a40d6c2..9952491 100644
--- a/data/lalr1.java
+++ b/data/lalr1.java
@@ -133,7 +133,7 @@ b4_locations_if([[
     /** Token returned by the scanner to signal the end of its input.  */
     public static final int EOF = 0;
 
-]b4_token_enums(b4_tokens)[
+]b4_token_enums[
 
     ]b4_locations_if([[/**
      * Method to retrieve the beginning position of the last scanned token.
diff --git a/data/yacc.c b/data/yacc.c
index c279ec3..80b7ab5 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -284,7 +284,7 @@ m4_define([b4_shared_declarations],
 [b4_cpp_guard_open([b4_spec_defines_file])[
 ]b4_declare_yydebug[
 ]b4_percent_code_get([[requires]])[
-]b4_token_enums_defines(b4_tokens)[
+]b4_token_enums_defines[
 ]b4_declare_yylstype[
 ]b4_declare_yyparse[
 ]b4_percent_code_get([[provides]])[
diff --git a/src/output.c b/src/output.c
index d656097..26a6e7f 100644
--- a/src/output.c
+++ b/src/output.c
@@ -469,40 +469,6 @@ prepare_symbol_definitions (void)
 }
 
 
-/*--------------------------------------.
-| Output the tokens definition to OUT.  |
-`--------------------------------------*/
-
-static void
-token_definitions_output (FILE *out)
-{
-  int i;
-  char const *sep = "";
-
-  fputs ("m4_define([b4_tokens], \n[", out);
-  for (i = 0; i < ntokens; ++i)
-    {
-      symbol *sym = symbols[i];
-      int number = sym->user_token_number;
-      uniqstr id = symbol_id_get (sym);
-
-      /* At this stage, if there are literal string aliases, they are
-         part of SYMBOLS, so we should not find their aliased symbols
-         here.  */
-      aver (number != USER_NUMBER_HAS_STRING_ALIAS);
-
-      /* Skip error token and tokens without identifier.  */
-      if (sym != errtoken && id)
-        {
-          fprintf (out, "%s[[[%s]], %d]",
-                   sep, id, number);
-          sep = ",\n";
-        }
-    }
-  fputs ("])\n\n", out);
-}
-
-
 static void
 prepare_actions (void)
 {
@@ -561,7 +527,6 @@ muscles_output (FILE *out)
   fputs ("m4_init()\n", out);
   merger_output (out);
   symbol_numbers_output (out);
-  token_definitions_output (out);
   type_names_output (out);
   user_actions_output (out);
   // Must be last.
-- 
1.7.11.2




reply via email to

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