Commit 676ab41f authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

ltlparse: diagnose empty (...) block in lenient mode.

* src/ltlparse/ltlparse.yy (try_recursive_parse): Diagnose
empty strings.
* src/ltltest/lenient.test: Add tests.
parent ff0eada8
......@@ -108,6 +108,14 @@ using namespace spot::ltl;
// Otherwise, we convert the string into an atomic proposition
// (it's up to the environment to check the syntax of this
// proposition, and maybe reject it).
if (str.empty())
{
error_list.push_back(parse_error(location,
"unexpected empty block"));
return 0;
}
spot::ltl::parse_error_list suberror;
const spot::ltl::formula* f;
if (sere)
......@@ -802,7 +810,7 @@ subformula: booleanatom
delete $1;
if (!$$)
YYERROR;
$$ = binop::instance(binop::EConcat, $$,
$$ = binop::instance(binop::EConcat, $$,
constant::true_instance());
}
......
......@@ -33,6 +33,7 @@ cat >input <<EOF
(((a < b ) U ({( b == c - 1 )})))
((((( a < b))) U ( b == c - 1)))
((((( a < b))) U { b == c - 1}!))
()a
EOF
cat >expected <<EOF
......@@ -44,7 +45,13 @@ cat >expected <<EOF
"a < b" U "b == c - 1"
"a < b" U "b == c - 1"
"a < b" U "b == c - 1"
Xa
EOF
run 0 $ltlfilt --lenient input > output
cmp output expected
run 2 $ltlfilt --lenient -f 'F( )' 2> stderr
grep 'unexpected empty block' stderr
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment