diff --git a/NEWS b/NEWS index e61b41118..ac6e541c4 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ New in spot 1.1.4a (not relased) + * All the parsers implemented in Spot now use the same type + to store locations. + * Cleanup of exported symbols All symbols in the library now have hidden visibility on ELF systems. diff --git a/src/eltlparse/Makefile.am b/src/eltlparse/Makefile.am index fbd15b1ef..91f6bba7a 100644 --- a/src/eltlparse/Makefile.am +++ b/src/eltlparse/Makefile.am @@ -1,5 +1,6 @@ -## Copyright (C) 2008, 2011 Laboratoire de Recherche et Développement -## de l'Epita (LRDE). +## -*- coding: utf-8 -*- +## Copyright (C) 2008, 2011, 2013 Laboratoire de Recherche et +## Développement de l'Epita (LRDE). ## ## This file is part of Spot, a model checking library. ## @@ -28,8 +29,6 @@ ELTLPARSE_YY = eltlparse.yy FROM_ELTLPARSE_YY_MAIN = eltlparse.cc FROM_ELTLPARSE_YY_OTHERS = \ stack.hh \ - position.hh \ - location.hh \ eltlparse.hh FROM_ELTLPARSE_YY = $(FROM_ELTLPARSE_YY_MAIN) $(FROM_ELTLPARSE_YY_OTHERS) @@ -54,7 +53,5 @@ libeltlparse_la_SOURCES = \ eltlscan.ll \ parsedecl.hh -eltlparse_HEADERS = \ - public.hh \ - location.hh \ - position.hh +eltlparse_HEADERS = public.hh + diff --git a/src/eltlparse/eltlparse.yy b/src/eltlparse/eltlparse.yy index 98b61dfca..e52d1d6a7 100644 --- a/src/eltlparse/eltlparse.yy +++ b/src/eltlparse/eltlparse.yy @@ -1,5 +1,6 @@ -/* Copyright (C) 2008, 2009, 2010, 2011, 2012 Laboratoire de Recherche -** et Développement de l'Epita (LRDE). +/* -*- coding: utf-8 -*- +** Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Laboratoire de +** Recherche et Développement de l'Epita (LRDE). ** ** This file is part of Spot, a model checking library. ** @@ -22,6 +23,7 @@ %name-prefix "eltlyy" %debug %error-verbose +%define api.location.type "spot::location" %code requires { @@ -527,7 +529,7 @@ namespace spot if (flex_open(name)) { error_list.push_back - (parse_error(eltlyy::location(), + (parse_error(spot::location(), spair("-", std::string("Cannot open file ") + name))); return 0; } diff --git a/src/eltlparse/parsedecl.hh b/src/eltlparse/parsedecl.hh index a0d066d26..5bfa7fd7b 100644 --- a/src/eltlparse/parsedecl.hh +++ b/src/eltlparse/parsedecl.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008 Laboratoire de Recherche et Développement +// -*- coding: utf-8 -*- +// Copyright (C) 2008, 2013 Laboratoire de Recherche et Développement // de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -20,11 +21,11 @@ # define SPOT_ELTLPARSE_PARSEDECL_HH #include "eltlparse.hh" -#include "location.hh" +#include "misc/location.hh" # define YY_DECL \ int eltlyylex (eltlyy::parser::semantic_type *yylval, \ - eltlyy::location *yylloc, \ + spot::location *yylloc, \ spot::eltl::parse_error_list_t &pe) YY_DECL; diff --git a/src/eltlparse/public.hh b/src/eltlparse/public.hh index 7852ac5d2..eb5364f6a 100644 --- a/src/eltlparse/public.hh +++ b/src/eltlparse/public.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2008, 2010, 2012 Laboratoire de Recherche et +// Copyright (C) 2008, 2010, 2012, 2013 Laboratoire de Recherche et // Développement de l'Epita (LRDE). // // This file is part of Spot, a model checking library. @@ -21,23 +21,15 @@ # define SPOT_ELTLPARSE_PUBLIC_HH # include "ltlast/formula.hh" -// Unfortunately Bison 2.3 uses the same guards in all parsers :( -# undef BISON_LOCATION_HH -# undef BISON_POSITION_HH # include "ltlenv/defaultenv.hh" # include "ltlast/nfa.hh" -# include "eltlparse/location.hh" +# include "misc/location.hh" # include # include # include # include # include -// namespace -// { -// typedef std::map nfamap; -// } - namespace spot { using namespace ltl; @@ -49,7 +41,7 @@ namespace spot typedef std::pair spair; /// \brief A parse diagnostic >. - typedef std::pair parse_error; + typedef std::pair parse_error; /// \brief A list of parser diagnostics, as filled by parse. typedef std::list parse_error_list; diff --git a/src/kripkeparse/Makefile.am b/src/kripkeparse/Makefile.am index 0dd2e2aae..8b5d531e7 100644 --- a/src/kripkeparse/Makefile.am +++ b/src/kripkeparse/Makefile.am @@ -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 = \ diff --git a/src/kripkeparse/kripkeparse.yy b/src/kripkeparse/kripkeparse.yy index 51f2bf26a..8ceadf7df 100644 --- a/src/kripkeparse/kripkeparse.yy +++ b/src/kripkeparse/kripkeparse.yy @@ -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 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 @@ -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; diff --git a/src/kripkeparse/parsedecl.hh b/src/kripkeparse/parsedecl.hh index d018b15da..7ffc7f589 100644 --- a/src/kripkeparse/parsedecl.hh +++ b/src/kripkeparse/parsedecl.hh @@ -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 # 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; diff --git a/src/kripkeparse/public.hh b/src/kripkeparse/public.hh index f10fdcf07..6320f386e 100644 --- a/src/kripkeparse/public.hh +++ b/src/kripkeparse/public.hh @@ -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 # include @@ -35,7 +32,7 @@ namespace spot { /// \brief A parse diagnostic with its location. - typedef std::pair kripke_parse_error; + typedef std::pair kripke_parse_error; /// \brief A list of parser diagnostics, as filled by parse. typedef std::list kripke_parse_error_list; diff --git a/src/ltlparse/Makefile.am b/src/ltlparse/Makefile.am index ff4f51588..d7f4b6935 100644 --- a/src/ltlparse/Makefile.am +++ b/src/ltlparse/Makefile.am @@ -1,5 +1,5 @@ -## Copyright (C) 2008, 2009, 2010, 2011, 2012 Laboratoire de Recherche -## et Développement de l'Epita (LRDE). +## Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013 Laboratoire de +## Recherche et Développement de l'Epita (LRDE). ## Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris ## 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), ## Université Pierre et Marie Curie. @@ -31,8 +31,6 @@ LTLPARSE_YY = ltlparse.yy FROM_LTLPARSE_YY_MAIN = ltlparse.cc FROM_LTLPARSE_YY_OTHERS = \ stack.hh \ - position.hh \ - location.hh \ ltlparse.hh FROM_LTLPARSE_YY = $(FROM_LTLPARSE_YY_MAIN) $(FROM_LTLPARSE_YY_OTHERS) @@ -60,6 +58,5 @@ libltlparse_la_SOURCES = \ ltlparse_HEADERS = \ ltlfile.hh \ - location.hh \ - public.hh \ - position.hh + public.hh + diff --git a/src/ltlparse/fmterror.cc b/src/ltlparse/fmterror.cc index b0864319f..cafd7374e 100644 --- a/src/ltlparse/fmterror.cc +++ b/src/ltlparse/fmterror.cc @@ -1,5 +1,5 @@ -// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement -// de l'Epita (LRDE). +// Copyright (C) 2010, 2012, 2013 Laboratoire de Recherche et +// Développement de l'Epita (LRDE). // Copyright (C) 2003, 2004, 2005 Laboratoire d'Informatique de Paris // 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), // Université Pierre et Marie Curie. @@ -60,7 +60,7 @@ namespace spot parse_error_list::iterator it; for (it = error_list.begin(); it != error_list.end(); ++it) { - ltlyy::location& l = it->first; + location& l = it->first; l.begin.column = b2u[l.begin.column]; l.end.column = b2u[l.end.column]; } @@ -78,7 +78,7 @@ namespace spot for (it = error_list.begin(); it != error_list.end(); ++it) { os << ">>> " << ltl_string << std::endl; - const ltlyy::location& l = it->first; + const location& l = it->first; unsigned n = 1; for (; n < 4 + l.begin.column; ++n) diff --git a/src/ltlparse/ltlparse.yy b/src/ltlparse/ltlparse.yy index 441232d4c..a430eaae1 100644 --- a/src/ltlparse/ltlparse.yy +++ b/src/ltlparse/ltlparse.yy @@ -1,8 +1,9 @@ -/* Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et -** Développement de l'Epita (LRDE). +/* -*- coding: utf-8 -*- +** Copyright (C) 2009, 2010, 2011, 2012, 2013 Laboratoire de Recherche +** et Développement de l'Epita (LRDE). ** Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de -** Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), -** Université Pierre et Marie Curie. +** Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), +** Université Pierre et Marie Curie. ** ** This file is part of Spot, a model checking library. ** @@ -27,6 +28,7 @@ %error-verbose %expect 0 %lex-param { spot::ltl::parse_error_list& error_list } +%define api.location.type "spot::location" %code requires { @@ -90,7 +92,7 @@ using namespace spot::ltl; const formula* try_recursive_parse(const std::string& str, - const ltlyy::location& location, + const spot::location& location, spot::ltl::environment& env, bool debug, parser_type type, diff --git a/src/ltlparse/parsedecl.hh b/src/ltlparse/parsedecl.hh index 7b0f809af..343c02634 100644 --- a/src/ltlparse/parsedecl.hh +++ b/src/ltlparse/parsedecl.hh @@ -1,7 +1,8 @@ -// Copyright (C) 2010, 2012 Laboratoire de Recherche et Développement de -// l'Epita (LRDE) +// -*- coding: utf-8 -*- +// Copyright (C) 2010, 2012, 2013 Laboratoire de Recherche et +// Développement de l'Epita (LRDE) // Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre +// département Systèmes Répartis Coopératifs (SRC), Université Pierre // et Marie Curie. // // This file is part of Spot, a model checking library. @@ -23,11 +24,11 @@ # define SPOT_LTLPARSE_PARSEDECL_HH #include "ltlparse.hh" -#include "location.hh" +#include "misc/location.hh" # define YY_DECL \ int ltlyylex (ltlyy::parser::semantic_type *yylval, \ - ltlyy::location *yylloc, \ + spot::location *yylloc, \ spot::ltl::parse_error_list& error_list) YY_DECL; diff --git a/src/ltlparse/public.hh b/src/ltlparse/public.hh index 51e90c71d..770890c8a 100644 --- a/src/ltlparse/public.hh +++ b/src/ltlparse/public.hh @@ -24,10 +24,7 @@ # define SPOT_LTLPARSE_PUBLIC_HH # include "ltlast/formula.hh" -// Unfortunately Bison 2.3 uses the same guards in all parsers :( -# undef BISON_LOCATION_HH -# undef BISON_POSITION_HH -# include "ltlparse/location.hh" +# include "misc/location.hh" # include "ltlenv/defaultenv.hh" # include # include @@ -43,7 +40,7 @@ namespace spot #ifndef SWIG /// \brief A parse diagnostic with its location. - typedef std::pair parse_error; + typedef std::pair parse_error; /// \brief A list of parser diagnostics, as filled by parse. typedef std::list parse_error_list; #else diff --git a/src/misc/Makefile.am b/src/misc/Makefile.am index 8cad56c5a..999b2d2d9 100644 --- a/src/misc/Makefile.am +++ b/src/misc/Makefile.am @@ -41,11 +41,13 @@ misc_HEADERS = \ hashfunc.hh \ intvcomp.hh \ intvcmp2.hh \ + location.hh \ ltstr.hh \ minato.hh \ memusage.hh \ mspool.hh \ optionmap.hh \ + position.hh \ random.hh \ timer.hh \ unique_ptr.hh \ diff --git a/src/misc/location.hh b/src/misc/location.hh new file mode 100644 index 000000000..884c3949a --- /dev/null +++ b/src/misc/location.hh @@ -0,0 +1,172 @@ +// Note: this file was comped from A Bison parser, made by GNU Bison +// 2.7.12-4996. It is shared by all the parsers in Spot. Unfortunately, +// at the time of writing there is no Bison option to generate this +// file an update it. + +/* Locations for Bison parsers in C++ + + Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef SPOT_MISC_LOCATION_HH +# define SPOT_MISC_LOCATION_HH + +# include "position.hh" + +namespace spot +{ + /// Abstract a location. + class location + { + public: + + /// Construct a location from \a b to \a e. + location (const position& b, const position& e) + : begin (b) + , end (e) + { + } + + /// Construct a 0-width location in \a p. + explicit location (const position& p = position ()) + : begin (p) + , end (p) + { + } + + /// Construct a 0-width location in \a f, \a l, \a c. + explicit location (std::string* f, + unsigned int l = 1u, + unsigned int c = 1u) + : begin (f, l, c) + , end (f, l, c) + { + } + + + /// Initialization. + void initialize (std::string* f = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + { + begin.initialize (f, l, c); + end = begin; + } + + /** \name Line and Column related manipulators + ** \{ */ + public: + /// Reset initial location to final location. + void step () + { + begin = end; + } + + /// Extend the current location to the COUNT next columns. + void columns (unsigned int count = 1) + { + end += count; + } + + /// Extend the current location to the COUNT next lines. + void lines (unsigned int count = 1) + { + end.lines (count); + } + /** \} */ + + + public: + /// Beginning of the located region. + position begin; + /// End of the located region. + position end; + }; + + /// Join two location objects to create a location. + inline const location operator+ (const location& begin, const location& end) + { + location res = begin; + res.end = end.end; + return res; + } + + /// Add two location objects. + inline const location operator+ (const location& begin, unsigned int width) + { + location res = begin; + res.columns (width); + return res; + } + + /// Add and assign a location. + inline location& operator+= (location& res, unsigned int width) + { + res.columns (width); + return res; + } + + /// Compare two location objects. + inline bool + operator== (const location& loc1, const location& loc2) + { + return loc1.begin == loc2.begin && loc1.end == loc2.end; + } + + /// Compare two location objects. + inline bool + operator!= (const location& loc1, const location& loc2) + { + return !(loc1 == loc2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param loc a reference to the location to redirect + ** + ** Avoid duplicate information. + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const location& loc) + { + position last = loc.end - 1; + ostr << loc.begin; + if (last.filename + && (!loc.begin.filename + || *loc.begin.filename != *last.filename)) + ostr << '-' << last; + else if (loc.begin.line != last.line) + ostr << '-' << last.line << '.' << last.column; + else if (loc.begin.column != last.column) + ostr << '-' << last.column; + return ostr; + } +} + +#endif // SPOT_MISC_LOCATION_HH diff --git a/src/misc/position.hh b/src/misc/position.hh new file mode 100644 index 000000000..98ba6e7b8 --- /dev/null +++ b/src/misc/position.hh @@ -0,0 +1,169 @@ +// Note: this file was comped from A Bison parser, made by GNU Bison +// 2.7.12-4996. It is shared by all the parsers in Spot. Unfortunately, +// at the time of writing there is no Bison option to generate this +// file an update it. + +/* Positions for Bison parsers in C++ + + Copyright (C) 2002-2007, 2009-2013 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +#ifndef SPOT_MISC_POSITION_HH +# define SPOT_MISC_POSITION_HH + +# include // std::max +# include +# include + +# ifndef YY_NULL +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULL nullptr +# else +# define YY_NULL 0 +# endif +# endif + + +namespace spot +{ + + /// Abstract a position. + class position + { + public: + + /// Construct a position. + explicit position (std::string* f = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + : filename (f) + , line (l) + , column (c) + { + } + + + /// Initialization. + void initialize (std::string* fn = YY_NULL, + unsigned int l = 1u, + unsigned int c = 1u) + { + filename = fn; + line = l; + column = c; + } + + /** \name Line and Column related manipulators + ** \{ */ + /// (line related) Advance to the COUNT next lines. + void lines (int count = 1) + { + column = 1u; + line += count; + } + + /// (column related) Advance to the COUNT next columns. + void columns (int count = 1) + { + column = std::max (1u, column + count); + } + /** \} */ + + /// File name to which this position refers. + std::string* filename; + /// Current line number. + unsigned int line; + /// Current column number. + unsigned int column; + }; + + /// Add and assign a position. + inline position& + operator+= (position& res, const int width) + { + res.columns (width); + return res; + } + + /// Add two position objects. + inline const position + operator+ (const position& begin, const int width) + { + position res = begin; + return res += width; + } + + /// Add and assign a position. + inline position& + operator-= (position& res, const int width) + { + return res += -width; + } + + /// Add two position objects. + inline const position + operator- (const position& begin, const int width) + { + return begin + -width; + } + + /// Compare two position objects. + inline bool + operator== (const position& pos1, const position& pos2) + { + return (pos1.line == pos2.line + && pos1.column == pos2.column + && (pos1.filename == pos2.filename + || (pos1.filename && pos2.filename + && *pos1.filename == *pos2.filename))); + } + + /// Compare two position objects. + inline bool + operator!= (const position& pos1, const position& pos2) + { + return !(pos1 == pos2); + } + + /** \brief Intercept output stream redirection. + ** \param ostr the destination output stream + ** \param pos a reference to the position to redirect + */ + template + inline std::basic_ostream& + operator<< (std::basic_ostream& ostr, const position& pos) + { + if (pos.filename) + ostr << *pos.filename << ':'; + return ostr << pos.line << '.' << pos.column; + } + + +} + +#endif // SPOT_MISC_POSITION_HH diff --git a/src/neverparse/Makefile.am b/src/neverparse/Makefile.am index 2219f474f..904807c5e 100644 --- a/src/neverparse/Makefile.am +++ b/src/neverparse/Makefile.am @@ -1,5 +1,6 @@ -## Copyright (C) 2010, 2011 Laboratoire de Recherche et Développement -## de l'Epita (LRDE). +## -*- coding: utf-8 -*- +## Copyright (C) 2010, 2011, 2013 Laboratoire de Recherche et +## Développement de l'Epita (LRDE). ## ## This file is part of Spot, a model checking library. ## @@ -22,10 +23,7 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS:-Werror=) neverparsedir = $(pkgincludedir)/neverparse -neverparse_HEADERS = \ - public.hh \ - location.hh \ - position.hh +neverparse_HEADERS = public.hh noinst_LTLIBRARIES = libneverparse.la @@ -33,8 +31,6 @@ NEVERCLAIMPARSE_YY = neverclaimparse.yy FROM_NEVERCLAIMPARSE_YY_MAIN = neverclaimparse.cc FROM_NEVERCLAIMPARSE_YY_OTHERS = \ stack.hh \ - position.hh \ - location.hh \ neverclaimparse.hh FROM_NEVERCLAIMPARSE_YY = $(FROM_NEVERCLAIMPARSE_YY_MAIN) $(FROM_NEVERCLAIMPARSE_YY_OTHERS) diff --git a/src/neverparse/neverclaimparse.yy b/src/neverparse/neverclaimparse.yy index 926f041e8..8d32440b8 100644 --- a/src/neverparse/neverclaimparse.yy +++ b/src/neverparse/neverclaimparse.yy @@ -25,6 +25,7 @@ %debug %error-verbose %lex-param { spot::neverclaim_parse_error_list& error_list } +%define api.location.type "spot::location" %code requires { @@ -49,9 +50,6 @@ %code { #include "ltlast/constant.hh" - /* Unfortunately Bison 2.3 uses the same guards in all parsers :( */ -#undef BISON_POSITION_HH -#undef BISON_LOCATION_HH #include "ltlparse/public.hh" /* neverclaimparse.hh and parsedecl.hh include each other recursively. @@ -234,7 +232,7 @@ src_dest: formula opt_dest i != pel.end(); ++i) { // Adjust the diagnostic to the current position. - location here = @1; + spot::location here = @1; here.end.line = here.begin.line + i->first.end.line - 1; here.end.column = here.begin.column + i->first.end.column -1; here.begin.line += i->first.begin.line - 1; @@ -276,7 +274,7 @@ namespace spot if (neverclaimyyopen(name)) { error_list.push_back - (neverclaim_parse_error(neverclaimyy::location(), + (neverclaim_parse_error(spot::location(), std::string("Cannot open file ") + name)); return 0; } diff --git a/src/neverparse/parsedecl.hh b/src/neverparse/parsedecl.hh index f701c2dac..6724c0828 100644 --- a/src/neverparse/parsedecl.hh +++ b/src/neverparse/parsedecl.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement +// -*- coding: utf-8 -*- +// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement // de l'EPITA. // // This file is part of Spot, a model checking library. @@ -21,11 +22,11 @@ #include #include "neverclaimparse.hh" -#include "location.hh" +#include "misc/location.hh" # define YY_DECL \ int neverclaimyylex(neverclaimyy::parser::semantic_type *yylval, \ - neverclaimyy::location *yylloc, \ + spot::location *yylloc, \ spot::neverclaim_parse_error_list& error_list) YY_DECL; diff --git a/src/neverparse/public.hh b/src/neverparse/public.hh index 90873f873..acc95c11a 100644 --- a/src/neverparse/public.hh +++ b/src/neverparse/public.hh @@ -1,5 +1,6 @@ -// Copyright (C) 2010 Laboratoire de Recherche et Développement de -// l'Epita (LRDE). +// -*- coding: utf-8 -*- +// Copyright (C) 2010, 2013 Laboratoire de Recherche et Développement +// de l'Epita (LRDE). // // This file is part of Spot, a model checking library. // @@ -20,10 +21,7 @@ # define SPOT_NEVERPARSE_PUBLIC_HH # include "tgba/tgbaexplicit.hh" -// Unfortunately Bison 2.3 uses the same guards in all parsers :( -# undef BISON_LOCATION_HH -# undef BISON_POSITION_HH -# include "neverparse/location.hh" +# include "misc/location.hh" # include "ltlenv/defaultenv.hh" # include # include @@ -36,7 +34,7 @@ namespace spot /// @{ /// \brief A parse diagnostic with its location. - typedef std::pair neverclaim_parse_error; + typedef std::pair neverclaim_parse_error; /// \brief A list of parser diagnostics, as filled by parse. typedef std::list neverclaim_parse_error_list; diff --git a/src/tgbaparse/Makefile.am b/src/tgbaparse/Makefile.am index 2b40c4b1f..eeb67ce86 100644 --- a/src/tgbaparse/Makefile.am +++ b/src/tgbaparse/Makefile.am @@ -1,8 +1,9 @@ -## Copyright (C) 2008, 2009, 2011 Laboratoire de Recherche et -## Développement de l'Epita (LRDE). +## -*- coding: utf-8 -*- +## Copyright (C) 2008, 2009, 2011, 2013 Laboratoire de Recherche et +## Développement de l'Epita (LRDE). ## Copyright (C) 2003, 2004, 2006 Laboratoire d'Informatique de -## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), -## Université Pierre et Marie Curie. +## Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), +## Université Pierre et Marie Curie. ## ## This file is part of Spot, a model checking library. ## @@ -25,10 +26,7 @@ AM_CXXFLAGS = $(WARNING_CXXFLAGS:-Werror=) tgbaparsedir = $(pkgincludedir)/tgbaparse -tgbaparse_HEADERS = \ - public.hh \ - location.hh \ - position.hh +tgbaparse_HEADERS = public.hh noinst_LTLIBRARIES = libtgbaparse.la @@ -36,8 +34,6 @@ TGBAPARSE_YY = tgbaparse.yy FROM_TGBAPARSE_YY_MAIN = tgbaparse.cc FROM_TGBAPARSE_YY_OTHERS = \ stack.hh \ - position.hh \ - location.hh \ tgbaparse.hh FROM_TGBAPARSE_YY = $(FROM_TGBAPARSE_YY_MAIN) $(FROM_TGBAPARSE_YY_OTHERS) diff --git a/src/tgbaparse/parsedecl.hh b/src/tgbaparse/parsedecl.hh index 2517ae37d..727f542c6 100644 --- a/src/tgbaparse/parsedecl.hh +++ b/src/tgbaparse/parsedecl.hh @@ -1,6 +1,7 @@ -// Copyright (C) 2003, 2005 Laboratoire d'Informatique de Paris 6 (LIP6), -// département Systèmes Répartis Coopératifs (SRC), Université Pierre -// et Marie Curie. +// -*- coding: utf-8 -*- +// Copyright (C) 2003, 2005, 2013 Laboratoire d'Informatique de Paris +// 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), +// Université Pierre et Marie Curie. // // This file is part of Spot, a model checking library. // @@ -22,11 +23,11 @@ #include #include "tgbaparse.hh" -#include "location.hh" +#include "misc/location.hh" # define YY_DECL \ int tgbayylex (tgbayy::parser::semantic_type *yylval, \ - tgbayy::location *yylloc) + spot::location *yylloc) YY_DECL; namespace spot diff --git a/src/tgbaparse/public.hh b/src/tgbaparse/public.hh index 2b95d2c7d..85e9837eb 100644 --- a/src/tgbaparse/public.hh +++ b/src/tgbaparse/public.hh @@ -1,5 +1,5 @@ // -*- coding: utf-8 -*- -// Copyright (C) 2009, 2012 Laboratoire de Recherche et Développement +// Copyright (C) 2009, 2012, 2013 Laboratoire de Recherche et Développement // de l'Epita. // Copyright (C) 2003, 2004, 2005, 2006 Laboratoire // d'Informatique de Paris 6 (LIP6), département Systèmes Répartis @@ -24,10 +24,7 @@ # define SPOT_TGBAPARSE_PUBLIC_HH # include "tgba/tgbaexplicit.hh" -// Unfortunately Bison 2.3 uses the same guards in all parsers :( -# undef BISON_LOCATION_HH -# undef BISON_POSITION_HH -# include "tgbaparse/location.hh" +# include "misc/location.hh" # include "ltlenv/defaultenv.hh" # include # include @@ -41,7 +38,7 @@ namespace spot #ifndef SWIG /// \brief A parse diagnostic with its location. - typedef std::pair tgba_parse_error; + typedef std::pair tgba_parse_error; /// \brief A list of parser diagnostics, as filled by parse. typedef std::list tgba_parse_error_list; #else diff --git a/src/tgbaparse/tgbaparse.yy b/src/tgbaparse/tgbaparse.yy index 8978b5397..38580c4bb 100644 --- a/src/tgbaparse/tgbaparse.yy +++ b/src/tgbaparse/tgbaparse.yy @@ -1,5 +1,5 @@ /* -*- coding: utf-8 -*- -** Copyright (C) 2009, 2010, 2012 Laboratoire de Recherche et +** Copyright (C) 2009, 2010, 2012, 2013 Laboratoire de Recherche et ** Développement de l'Epita (LRDE). ** Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de ** Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC), @@ -26,6 +26,7 @@ %name-prefix "tgbayy" %debug %error-verbose +%define api.location.type "spot::location" %code requires { @@ -55,9 +56,6 @@ typedef std::map formula_cache; %code { #include "ltlast/constant.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 @@ -119,7 +117,7 @@ line: strident ',' strident ',' condition ',' acc_list ';' i != pel.end(); ++i) { // Adjust the diagnostic to the current position. - location here = @5; + spot::location here = @5; here.end.line = here.begin.line + i->first.end.line - 1; here.end.column = here.begin.column + i->first.end.column; @@ -239,7 +237,7 @@ namespace spot if (tgbayyopen(name)) { error_list.push_back - (tgba_parse_error(tgbayy::location(), + (tgba_parse_error(spot::location(), std::string("Cannot open file ") + name)); return 0; }