tl: add support for ##n and ##[i:j] from SVA

* spot/tl/formula.cc, spot/tl/formula.hh (formula::sugar_delay): New
function to implement this operator as syntactic sugar.
* spot/parsetl/parsetl.yy, spot/parsetl/scantl.ll: Parse it.
* doc/tl/tl.tex: Document the syntactic sugar rules and precedence.
* tests/core/sugar.test: Add tests.
* NEWS: Mention this new feature.
This commit is contained in:
Alexandre Duret-Lutz 2019-05-04 21:50:59 +02:00
parent 00f70257db
commit 60d488b30c
7 changed files with 213 additions and 27 deletions

View file

@ -1,5 +1,5 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2015-2018 Laboratoire de Recherche et Développement
// Copyright (C) 2015-2019 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
@ -1220,18 +1220,29 @@ namespace spot
/// \brief Create a SERE equivalent to b[->min..max]
///
/// The operator does not exist: it is handled as sugar by the parser
/// and the printer. This functions is used by the parser to create
/// the equivalent SERE.
/// The operator does not exist: it is handled as syntactic sugar
/// by the parser and the printer. This function is used by the
/// parser to create the equivalent SERE.
static formula sugar_goto(const formula& b, uint8_t min, uint8_t max);
/// Create the SERE b[=min..max]
///
/// The operator does not exist: it is handled as sugar by the parser
/// and the printer. This functions is used by the parser to create
/// the equivalent SERE.
/// The operator does not exist: it is handled as syntactic sugar
/// by the parser and the printer. This function is used by the
/// parser to create the equivalent SERE.
static formula sugar_equal(const formula& b, uint8_t min, uint8_t max);
/// Create the SERE a ##[n:m] b
///
/// This ##[n:m] operator comes from SVA. When n=m, it is simply
/// written ##n.
///
/// The operator does not exist in Spot it is handled as syntactic
/// sugar by the parser. This function is used by the parser to
/// create the equivalent SERE.
static formula sugar_delay(const formula& a, const formula& b,
unsigned min, unsigned max);
#ifndef SWIG
/// \brief Return the underlying pointer to the formula.
///