]> git.saurik.com Git - bison.git/commitdiff
style: avoid %{...%} in our parser
authorAkim Demaille <akim@lrde.epita.fr>
Thu, 18 Apr 2013 13:11:53 +0000 (15:11 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Thu, 18 Apr 2013 13:11:53 +0000 (15:11 +0200)
* src/parse-gram.y (%{...%}): Split in %code and %code requires.
* src/location.h: Add missing includes for self containedness.

src/location.h
src/parse-gram.y

index 8f1c5ae1df2ee40839d6480ec8946b77b0ea4a07..9c6e53c190b42e8ee379a40bd13b94d218e020a6 100644 (file)
 #ifndef LOCATION_H_
 # define LOCATION_H_
 
+# include <stdbool.h>
+# include <stdio.h>
+# include <string.h> /* strcmp */
+
 # include "uniqstr.h"
 
 /* A boundary between two characters.  */
index 62cee18886ce8bce3d7f02e7533fbd0b882d1b3c..8b57ce80b4c636080c806b1fdf25c5246a0e2a84 100644 (file)
@@ -1,4 +1,4 @@
-%{/* Bison Grammar Parser                             -*- C -*-
+/* Bison Grammar Parser                             -*- C -*-
 
    Copyright (C) 2002-2013 Free Software Foundation, Inc.
 
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <config.h>
-#include "system.h"
-
-#include "c-ctype.h"
-#include "complain.h"
-#include "conflicts.h"
-#include "files.h"
-#include "getargs.h"
-#include "gram.h"
-#include "named-ref.h"
-#include "quotearg.h"
-#include "reader.h"
-#include "symlist.h"
-#include "symtab.h"
-#include "scan-gram.h"
-#include "scan-code.h"
-#include "xmemdup0.h"
-%}
+%code requires
+{
+  #include "symlist.h"
+  #include "symtab.h"
+}
 
 %code
 {
+  #include <config.h>
+  #include "system.h"
+
+  #include "c-ctype.h"
+  #include "complain.h"
+  #include "conflicts.h"
+  #include "files.h"
+  #include "getargs.h"
+  #include "gram.h"
+  #include "named-ref.h"
+  #include "quotearg.h"
+  #include "reader.h"
+  #include "scan-gram.h"
+  #include "scan-code.h"
+  #include "xmemdup0.h"
+
   static int current_prec = 0;
   static location current_lhs_location;
   static named_ref *current_lhs_named_ref;