Use the same location.hh and position.hh in all parsers.

* src/misc/location.hh, src/misc/position.hh: New files,
from Bison 2.7.
* src/misc/Makefile.am: Distribute them.
* src/eltlparse/Makefile.am, src/eltlparse/eltlparse.yy,
src/eltlparse/parsedecl.hh, src/eltlparse/public.hh,
src/kripkeparse/Makefile.am, src/kripkeparse/kripkeparse.yy,
src/kripkeparse/parsedecl.hh, src/kripkeparse/public.hh,
src/ltlparse/Makefile.am, src/ltlparse/fmterror.cc,
src/ltlparse/ltlparse.yy, src/ltlparse/parsedecl.hh,
src/ltlparse/public.hh, src/neverparse/Makefile.am,
src/neverparse/neverclaimparse.yy, src/neverparse/parsedecl.hh,
src/neverparse/public.hh, src/tgbaparse/Makefile.am,
src/tgbaparse/parsedecl.hh, src/tgbaparse/public.hh,
src/tgbaparse/tgbaparse.yy: Adjust to use and include
misc/location.hh.
* NEWS: Mention this change.
This commit is contained in:
Alexandre Duret-Lutz 2013-06-28 18:12:10 +02:00
parent a0f5d53ea4
commit 8c2d7fcb7f
25 changed files with 436 additions and 125 deletions

View file

@ -1,4 +1,4 @@
## Copyright (C) 2011 Laboratoire de Recherche et Développement de
## Copyright (C) 2011, 2013 Laboratoire de Recherche et Développement de
## l'Epita (LRDE).
##
## This file is part of Spot, a model checking library.
@ -22,10 +22,7 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS:-Werror=)
kripkeparsedir = $(pkgincludedir)/kripkeparse
kripkeparse_HEADERS = \
public.hh \
location.hh \
position.hh
kripkeparse_HEADERS = public.hh
noinst_LTLIBRARIES = libkripkeparse.la
@ -33,8 +30,6 @@ KRIPKEPARSE_YY = kripkeparse.yy
FROM_KRIPKEPARSE_YY_MAIN = kripkeparse.cc
FROM_KRIPKEPARSE_YY_OTHERS = \
stack.hh \
position.hh \
location.hh \
kripkeparse.hh
FROM_KRIPKEPARSE_YY = \

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE)
// Copyright (C) 2011, 2012, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
@ -24,6 +24,7 @@
%name-prefix "kripkeyy"
%debug
%error-verbose
%define api.location.type "spot::location"
%code requires
{
@ -54,9 +55,6 @@ typedef std::map<std::string, bdd> formula_cache;
%code
{
#include "kripke/kripkeexplicit.hh"
/* Unfortunately Bison 2.3 uses the same guards in all parsers :( */
#undef BISON_POSITION_HH
#undef BISON_LOCATION_HH
#include "ltlparse/public.hh"
#include <map>
@ -117,7 +115,7 @@ strident "," condition "," follow_list ";"
i != pel.end(); ++i)
{
//Adjust the diagnostic to the current position.
location here = @3;
spot::location here = @3;
here.end.line = here.begin.line + i->first.end.line - 1;
here.end.column =
here.begin.column + i->first.end.column;
@ -209,8 +207,8 @@ namespace spot
if (kripkeyyopen(name))
{
error_list.push_back
(kripke_parse_error(kripkeyy::location(),
std::string("Cannot open file ") + name));
(kripke_parse_error(spot::location(),
std::string("Cannot open file ") + name));
return 0;
}
formula_cache fcache;

View file

@ -1,4 +1,5 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -22,11 +23,11 @@
# include <string>
# include "kripkeparse.hh"
# include "location.hh"
# include "misc/location.hh"
# define YY_DECL \
int kripkeyylex (kripkeyy::parser::semantic_type *yylval, \
kripkeyy::location *yylloc)
spot::location *yylloc)
YY_DECL;

View file

@ -1,4 +1,4 @@
// Copyright (C) 2011 Laboratoire de Recherche et Developpement
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement
// de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -21,10 +21,7 @@
# define SPOT_KRIPKEPARSE_PUBLIC_HH
# include "kripke/kripkeexplicit.hh"
// Unfortunately Bison 2.3 uses the same guards in all parsers :(
# undef BISON_LOCATION_HH
# undef BISON_POSITION_HH
# include "kripkeparse/location.hh"
# include "misc/location.hh"
# include "ltlenv/defaultenv.hh"
# include <string>
# include <list>
@ -35,7 +32,7 @@ namespace spot
{
/// \brief A parse diagnostic with its location.
typedef std::pair<kripkeyy::location, std::string> kripke_parse_error;
typedef std::pair<location, std::string> kripke_parse_error;
/// \brief A list of parser diagnostics, as filled by parse.
typedef std::list<kripke_parse_error> kripke_parse_error_list;