• Alexandre Duret-Lutz's avatar
    ltlparse: add a lenient parsing mode · 86dac4aa
    Alexandre Duret-Lutz authored
    Spin 6 supports formulas such as []<>(a < b) so that atomic properties
    need not be specified using #define.  Of course we don't want to
    implement all the syntax of Spin in our LTL parser because other tools
    may have different syntaxes for their atomic propositions.  The
    lenient mode tells the scanner to return any (...), {...}, or {...}!
    block as a single token.  The parser will try to recursively parse
    this block as a LTL/SERE formula, and if this fails, it will consider
    the block to be an atomic proposition.  The drawback is that most
    syntax errors will no be considered to be atomic propositions.  For
    instance (a U b U) is a single atomic proposition in lenient mode, and
    a syntax error in default mode.
    * src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll,
    src/ltlparse/parsedecl.hh, src/ltlparse/public.hh: Add a
    lenient parsing mode.  Simplify the lexer using yy_scan_string.
    * src/bin/common_finput.cc: Add a --lenient option.
    * src/ltltest/lenient.test: New file.
    * src/ltltest/Makefile.am: Add it.
    * src/neverparse/neverclaimparse.yy: Parse the guards in lenient mode.
    * src/tgbatest/neverclaimread.test: Adjust.
    * src/ltlvisit/tostring.cc: When outputing a formula in Spin's syntax,
    output (a < b) instead of "a < b".
    * src/misc/escape.cc, src/misc/escape.hh (trim): New helper function.