ltlparse: rename the main functions

parse         -> parse_infix_psl
parse_lbt     -> parse_prefix_ltl
parse_sere    -> parse_infix_sere
parse_boolean -> parse_infix_boolean

Fixes #87.

* src/ltlparse/ltlparse.yy, src/ltlparse/public.hh:
Do the above changes.
* doc/mainpage.dox, doc/org/tut01.org, iface/ltsmin/modelcheck.cc,
src/bin/common_finput.cc, src/hoaparse/hoaparse.yy,
src/kripkeparse/kripkeparse.yy, src/tests/checkpsl.cc,
src/tests/checkta.cc, src/tests/complementation.cc,
src/tests/consterm.cc, src/tests/emptchk.cc, src/tests/equalsf.cc,
src/tests/kind.cc, src/tests/length.cc, src/tests/ltl2tgba.cc,
src/tests/ltlprod.cc, src/tests/ltlrel.cc, src/tests/randtgba.cc,
src/tests/readltl.cc, src/tests/reduc.cc, src/tests/syntimpl.cc,
src/tests/tostring.cc, wrap/python/ajax/spot.in,
wrap/python/tests/alarm.py, wrap/python/tests/interdep.py,
wrap/python/tests/ltl2tgba.py, wrap/python/tests/ltlparse.py: Adjust.
This commit is contained in:
Alexandre Duret-Lutz 2015-06-03 09:03:50 +02:00
parent aedce8101c
commit 98790f5345
29 changed files with 118 additions and 113 deletions

View file

@ -79,11 +79,10 @@ const spot::ltl::formula*
parse_formula(const std::string& s, spot::ltl::parse_error_list& pel)
{
if (lbt_input)
return spot::ltl::parse_lbt(s, pel);
return spot::ltl::parse_prefix_ltl(s, pel);
else
return spot::ltl::parse(s, pel,
spot::ltl::default_environment::instance(),
false, lenient);
return spot::ltl::parse_infix_psl
(s, pel, spot::ltl::default_environment::instance(), false, lenient);
}
job_processor::job_processor()

View file

@ -1212,8 +1212,8 @@ nc-formula: nc-formula-or-ident
if (i == res.fcache.end())
{
spot::ltl::parse_error_list pel;
auto f = spot::ltl::parse_boolean(*$1, pel, *res.env,
debug_level(), true);
auto f = spot::ltl::parse_infix_boolean(*$1, pel, *res.env,
debug_level(), true);
for (auto& j: pel)
{
// Adjust the diagnostic to the current position.
@ -1391,7 +1391,7 @@ lbtt-acc: { $$ = 0U; }
lbtt-guard: STRING
{
spot::ltl::parse_error_list pel;
auto* f = spot::ltl::parse_lbt(*$1, pel, *res.env);
auto* f = spot::ltl::parse_prefix_ltl(*$1, pel, *res.env);
if (!f || !pel.empty())
{
std::string s = "failed to parse guard: ";

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
@ -110,7 +110,8 @@ strident "," condition "," follow_list ";"
if (i == fcache.end())
{
parse_error_list pel;
const formula* f = spot::ltl::parse(*$3, pel, parse_environment);
const formula* f = spot::ltl::parse_infix_boolean(*$3, pel,
parse_environment);
for (parse_error_list::iterator i = pel.begin();
i != pel.end(); ++i)
{

View file

@ -91,7 +91,7 @@ using namespace spot::ltl;
enum parser_type { parser_ltl, parser_bool, parser_sere };
const formula*
static const formula*
try_recursive_parse(const std::string& str,
const spot::location& location,
spot::ltl::environment& env,
@ -125,13 +125,13 @@ using namespace spot::ltl;
switch (type)
{
case parser_sere:
f = spot::ltl::parse_sere(str, suberror, env, debug, true);
f = spot::ltl::parse_infix_sere(str, suberror, env, debug, true);
break;
case parser_bool:
f = spot::ltl::parse_boolean(str, suberror, env, debug, true);
f = spot::ltl::parse_infix_boolean(str, suberror, env, debug, true);
break;
case parser_ltl:
f = spot::ltl::parse(str, suberror, env, debug, true);
f = spot::ltl::parse_infix_psl(str, suberror, env, debug, true);
break;
}
@ -996,10 +996,10 @@ namespace spot
namespace ltl
{
const formula*
parse(const std::string& ltl_string,
parse_error_list& error_list,
environment& env,
bool debug, bool lenient)
parse_infix_psl(const std::string& ltl_string,
parse_error_list& error_list,
environment& env,
bool debug, bool lenient)
{
const formula* result = 0;
flex_set_buffer(ltl_string,
@ -1013,10 +1013,10 @@ namespace spot
}
const formula*
parse_boolean(const std::string& ltl_string,
parse_error_list& error_list,
environment& env,
bool debug, bool lenient)
parse_infix_boolean(const std::string& ltl_string,
parse_error_list& error_list,
environment& env,
bool debug, bool lenient)
{
const formula* result = 0;
flex_set_buffer(ltl_string,
@ -1030,7 +1030,7 @@ namespace spot
}
const formula*
parse_lbt(const std::string& ltl_string,
parse_prefix_ltl(const std::string& ltl_string,
parse_error_list& error_list,
environment& env,
bool debug)
@ -1047,11 +1047,11 @@ namespace spot
}
const formula*
parse_sere(const std::string& sere_string,
parse_error_list& error_list,
environment& env,
bool debug,
bool lenient)
parse_infix_sere(const std::string& sere_string,
parse_error_list& error_list,
environment& env,
bool debug,
bool lenient)
{
const formula* result = 0;
flex_set_buffer(sere_string,
@ -1068,12 +1068,12 @@ namespace spot
parse_formula(const std::string& ltl_string, environment& env)
{
parse_error_list pel;
const formula* f = parse(ltl_string, pel, env);
const formula* f = parse_infix_psl(ltl_string, pel, env);
std::ostringstream s;
if (format_parse_errors(s, ltl_string, pel))
{
parse_error_list pel2;
const formula* g = parse_lbt(ltl_string, pel2, env);
const formula* g = parse_prefix_ltl(ltl_string, pel2, env);
if (pel2.empty())
return g;
else

View file

@ -66,11 +66,12 @@ namespace spot
///
/// \warning This function is not reentrant.
SPOT_API
const formula* parse(const std::string& ltl_string,
parse_error_list& error_list,
environment& env = default_environment::instance(),
bool debug = false,
bool lenient = false);
const formula* parse_infix_psl(const std::string& ltl_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false,
bool lenient = false);
/// \brief Build a Boolean formula from a string.
/// \param ltl_string The string to parse.
@ -91,12 +92,12 @@ namespace spot
///
/// \warning This function is not reentrant.
SPOT_API
const formula* parse_boolean(const std::string& ltl_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false,
bool lenient = false);
const formula* parse_infix_boolean(const std::string& ltl_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false,
bool lenient = false);
/// \brief Build a formula from an LTL string in LBT's format.
/// \param ltl_string The string to parse.
@ -118,16 +119,18 @@ namespace spot
///
/// \warning This function is not reentrant.
SPOT_API
const formula* parse_lbt(const std::string& ltl_string,
parse_error_list& error_list,
environment& env = default_environment::instance(),
bool debug = false);
const formula* parse_prefix_ltl(const std::string& ltl_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false);
/// \brief A simple wrapper to parse() and parse_lbt().
/// \brief A simple wrapper to parse_infix_psl() and parse_prefix_ltl().
///
/// This is mostly meant for interactive use. It first tries parse(); if
/// this fails it tries parse_lbt(); and if both fails it returns the errors
/// of the first call to parse() as a parse_error exception.
/// This is mostly meant for interactive use. It first tries
/// parse_infix_psl(); if this fails it tries parse_prefix_ltl();
/// and if both fails it returns the errors of the first call to
/// parse_infix_psl() as a parse_error exception.
SPOT_API const formula*
parse_formula(const std::string& ltl_string,
environment& env = default_environment::instance());
@ -151,12 +154,12 @@ namespace spot
///
/// \warning This function is not reentrant.
SPOT_API
const formula* parse_sere(const std::string& sere_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false,
bool lenient = false);
const formula* parse_infix_sere(const std::string& sere_string,
parse_error_list& error_list,
environment& env =
default_environment::instance(),
bool debug = false,
bool lenient = false);
/// \brief Format diagnostics produced by spot::ltl::parse
/// or spot::ltl::ratexp

View file

@ -62,7 +62,7 @@ main(int argc, char** argv)
continue;
spot::ltl::parse_error_list pe;
auto fpos = spot::ltl::parse(s, pe);
auto fpos = spot::ltl::parse_infix_psl(s, pe);
if (spot::ltl::format_parse_errors(std::cerr, s, pe))
return 2;

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2014 Laboratoire de Recherche et Développement de
// l'Epita (LRDE).
// Copyright (C) 2014, 2015 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -85,7 +85,7 @@ main(int argc, char** argv)
continue;
spot::ltl::parse_error_list pe;
auto f = spot::ltl::parse(s, pe);
auto f = spot::ltl::parse_infix_psl(s, pe);
if (spot::ltl::format_parse_errors(std::cerr, s, pe))
return 2;

View file

@ -149,7 +149,7 @@ int main(int argc, char* argv[])
else if (print_formula)
{
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
auto* f1 = spot::ltl::parse_infix_psl(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
@ -169,7 +169,7 @@ int main(int argc, char* argv[])
if (formula)
{
spot::ltl::parse_error_list p1;
f1 = spot::ltl::parse(file, p1);
f1 = spot::ltl::parse_infix_psl(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;
@ -227,7 +227,7 @@ int main(int argc, char* argv[])
else
{
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(file, p1);
auto* f1 = spot::ltl::parse_infix_psl(file, p1);
if (spot::ltl::format_parse_errors(std::cerr, file, p1))
return 2;

View file

@ -60,7 +60,7 @@ main(int argc, char **argv)
ss >> expected;
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse_sere(form, p1);
auto* f1 = spot::ltl::parse_infix_sere(form, p1);
if (spot::ltl::format_parse_errors(std::cerr, form, p1))
return 2;

View file

@ -91,7 +91,7 @@ main(int argc, char** argv)
int runs = atoi(tokens[0].c_str());
spot::ltl::parse_error_list pe;
auto f = spot::ltl::parse(tokens[1], pe);
auto f = spot::ltl::parse_infix_psl(tokens[1], pe);
if (spot::ltl::format_parse_errors(std::cerr, tokens[1], pe))
return 2;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 Laboratoire de
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2015 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),
@ -100,7 +100,7 @@ main(int argc, char** argv)
}
spot::ltl::parse_error_list p2;
const spot::ltl::formula* f2 = spot::ltl::parse(formulas[size - 1], p2);
auto* f2 = spot::ltl::parse_infix_psl(formulas[size - 1], p2);
if (spot::ltl::format_parse_errors(std::cerr, formulas[size - 1], p2))
return 2;
@ -109,7 +109,7 @@ main(int argc, char** argv)
{
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(formulas[n], p1);
auto* f1 = spot::ltl::parse_infix_psl(formulas[n], p1);
if (check_first &&
spot::ltl::format_parse_errors(std::cerr, formulas[n], p1))

View file

@ -60,7 +60,7 @@ main(int argc, char **argv)
std::getline(ss, expected);
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(form, p1);
auto* f1 = spot::ltl::parse_infix_psl(form, p1);
if (spot::ltl::format_parse_errors(std::cerr, form, p1))
return 2;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2012 Laboratoire de Recherche et Developement de
// Copyright (C) 2012, 2015 Laboratoire de Recherche et Developement de
// l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -46,7 +46,7 @@ main(int argc, char **argv)
}
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
auto* f1 = spot::ltl::parse_infix_psl(argv[1], p1);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
return 2;

View file

@ -958,7 +958,7 @@ checked_main(int argc, char** argv)
{
spot::ltl::parse_error_list pel;
tm.start("parsing formula");
f = spot::ltl::parse(input, pel, env, debug_opt);
f = spot::ltl::parse_infix_psl(input, pel, env, debug_opt);
tm.stop("parsing formula");
exit_code = spot::ltl::format_parse_errors(std::cerr, input, pel);
}

View file

@ -48,13 +48,13 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::parse_error_list pel1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], pel1, env);
auto* f1 = spot::ltl::parse_infix_psl(argv[1], pel1, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::ltl::parse_error_list pel2;
const spot::ltl::formula* f2 = spot::ltl::parse(argv[2], pel2, env);
auto* f2 = spot::ltl::parse_infix_psl(argv[2], pel2, env);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], pel2))
return 2;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2013, 2014 Laboratoire de Recherche et Developement
// Copyright (C) 2013, 2014, 2015 Laboratoire de Recherche et Developement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -39,7 +39,7 @@ main(int argc, char **argv)
syntax(argv[0]);
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
auto* f1 = spot::ltl::parse_infix_psl(argv[1], p1);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
return 2;

View file

@ -872,7 +872,7 @@ main(int argc, char** argv)
else if (input == "")
break;
spot::ltl::parse_error_list pel;
const spot::ltl::formula* f = spot::ltl::parse(input, pel, env);
auto* f = spot::ltl::parse_infix_psl(input, pel, env);
if (spot::ltl::format_parse_errors(std::cerr, input, pel))
{
exit_code = 1;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et
// Copyright (C) 2008, 2009, 2012, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -75,8 +75,7 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::ltl::parse_error_list pel;
const spot::ltl::formula* f = spot::ltl::parse(argv[formula_index],
pel, env, debug);
auto* f = spot::ltl::parse_infix_psl(argv[formula_index], pel, env, debug);
exit_code =
spot::ltl::format_parse_errors(std::cerr, argv[formula_index], pel);

View file

@ -180,14 +180,14 @@ main(int argc, char** argv)
while (input == "");
spot::ltl::parse_error_list p1;
f1 = spot::ltl::parse(input, p1);
f1 = spot::ltl::parse_infix_psl(input, p1);
if (spot::ltl::format_parse_errors(std::cerr, input, p1))
return 2;
}
else
{
spot::ltl::parse_error_list p1;
f1 = spot::ltl::parse(argv[2], p1);
f1 = spot::ltl::parse_infix_psl(argv[2], p1);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], p1))
return 2;
}
@ -201,7 +201,7 @@ main(int argc, char** argv)
}
spot::ltl::parse_error_list p2;
f2 = spot::ltl::parse(argv[3], p2);
f2 = spot::ltl::parse_infix_psl(argv[3], p2);
if (spot::ltl::format_parse_errors(std::cerr, argv[3], p2))
return 2;
}

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014 Laboratoire de
// Copyright (C) 2008, 2009, 2010, 2011, 2012, 2014, 2015 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6
// (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
@ -48,13 +48,13 @@ main(int argc, char** argv)
int opt = atoi(argv[1]);
spot::ltl::parse_error_list p1;
const spot::ltl::formula* ftmp1 = spot::ltl::parse(argv[2], p1);
auto* ftmp1 = spot::ltl::parse_infix_psl(argv[2], p1);
if (spot::ltl::format_parse_errors(std::cerr, argv[2], p1))
return 2;
spot::ltl::parse_error_list p2;
const spot::ltl::formula* ftmp2 = spot::ltl::parse(argv[3], p2);
auto* ftmp2 = spot::ltl::parse_infix_psl(argv[3], p2);
if (spot::ltl::format_parse_errors(std::cerr, argv[3], p2))
return 2;

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2008, 2009, 2012 Laboratoire de Recherche et
// Copyright (C) 2008, 2009, 2012, 2015 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
@ -41,7 +41,7 @@ main(int argc, char **argv)
syntax(argv[0]);
spot::ltl::parse_error_list p1;
const spot::ltl::formula* f1 = spot::ltl::parse(argv[1], p1);
auto* f1 = spot::ltl::parse_infix_psl(argv[1], p1);
if (spot::ltl::format_parse_errors(std::cerr, argv[1], p1))
return 2;
@ -52,7 +52,7 @@ main(int argc, char **argv)
std::string f1s = spot::ltl::to_string(f1);
std::cout << f1s << std::endl;
const spot::ltl::formula* f2 = spot::ltl::parse(f1s, p1);
auto* f2 = spot::ltl::parse_infix_psl(f1s, p1);
if (spot::ltl::format_parse_errors(std::cerr, f1s, p1))
return 2;