From: Akim Demaille Date: Thu, 18 Apr 2013 13:11:53 +0000 (+0200) Subject: style: avoid %{...%} in our parser X-Git-Tag: v2.7.90~20 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/3f21a394f481c829831592adcf3ea040f87805ee?hp=827aca04ebd852b63087d80d8e420bb325bb9bd5 style: avoid %{...%} in our parser * src/parse-gram.y (%{...%}): Split in %code and %code requires. * src/location.h: Add missing includes for self containedness. --- diff --git a/src/location.h b/src/location.h index 8f1c5ae1..9c6e53c1 100644 --- a/src/location.h +++ b/src/location.h @@ -20,6 +20,10 @@ #ifndef LOCATION_H_ # define LOCATION_H_ +# include +# include +# include /* strcmp */ + # include "uniqstr.h" /* A boundary between two characters. */ diff --git a/src/parse-gram.y b/src/parse-gram.y index 62cee188..8b57ce80 100644 --- a/src/parse-gram.y +++ b/src/parse-gram.y @@ -1,4 +1,4 @@ -%{/* Bison Grammar Parser -*- C -*- +/* Bison Grammar Parser -*- C -*- Copyright (C) 2002-2013 Free Software Foundation, Inc. @@ -17,27 +17,30 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include -#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 + #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;