style: avoid %{...%} in our parser

* src/parse-gram.y (%{...%}): Split in %code and %code requires.
* src/location.h: Add missing includes for self containedness.
This commit is contained in:
Akim Demaille
2013-04-18 15:11:53 +02:00
parent 827aca04eb
commit 3f21a394f4
2 changed files with 26 additions and 19 deletions

View File

@@ -20,6 +20,10 @@
#ifndef LOCATION_H_ #ifndef LOCATION_H_
# define LOCATION_H_ # define LOCATION_H_
# include <stdbool.h>
# include <stdio.h>
# include <string.h> /* strcmp */
# include "uniqstr.h" # include "uniqstr.h"
/* A boundary between two characters. */ /* A boundary between two characters. */

View File

@@ -1,4 +1,4 @@
%{/* Bison Grammar Parser -*- C -*- /* Bison Grammar Parser -*- C -*-
Copyright (C) 2002-2013 Free Software Foundation, Inc. Copyright (C) 2002-2013 Free Software Foundation, Inc.
@@ -17,6 +17,14 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */ along with this program. If not, see <http://www.gnu.org/licenses/>. */
%code requires
{
#include "symlist.h"
#include "symtab.h"
}
%code
{
#include <config.h> #include <config.h>
#include "system.h" #include "system.h"
@@ -29,15 +37,10 @@
#include "named-ref.h" #include "named-ref.h"
#include "quotearg.h" #include "quotearg.h"
#include "reader.h" #include "reader.h"
#include "symlist.h"
#include "symtab.h"
#include "scan-gram.h" #include "scan-gram.h"
#include "scan-code.h" #include "scan-code.h"
#include "xmemdup0.h" #include "xmemdup0.h"
%}
%code
{
static int current_prec = 0; static int current_prec = 0;
static location current_lhs_location; static location current_lhs_location;
static named_ref *current_lhs_named_ref; static named_ref *current_lhs_named_ref;