* src/ltlparse/ltlparse.yy (OP_POST_NEG, OP_POST_POS): New tokens.
(subformula): Recognize `ATOMIC_PROP OP_POST_POS' and `ATOMIC_PROP OP_POST_NEG'. * src/ltlparse/ltlscan.ll: Introduce the not_prop start condition, to restrict the set of atomic propositions allowed in places where they are not expected. Make `true' and `false' case insensitive. * src/ltltest/parse.test, src/ltltest/tostring.test: More cases. * src/ltlvisit/tostring.cc (to_string_visitor): Quote atomic propositions equal to "true" or "false".
This commit is contained in:
parent
4f96a9fc14
commit
60a3b4ed72
6 changed files with 125 additions and 34 deletions
|
|
@ -82,7 +82,7 @@ using namespace spot::ltl;
|
|||
%token <str> ATOMIC_PROP "atomic proposition" OP_NOT "not operator"
|
||||
%token CONST_TRUE "constant true" CONST_FALSE "constant false"
|
||||
%token END_OF_INPUT "end of formula"
|
||||
|
||||
%token OP_POST_NEG "negative suffix" OP_POST_POS "positive suffix"
|
||||
|
||||
/* Priorities. */
|
||||
|
||||
|
|
@ -97,9 +97,11 @@ using namespace spot::ltl;
|
|||
%nonassoc OP_F OP_G
|
||||
%nonassoc OP_X
|
||||
|
||||
/* Not has the most important priority. */
|
||||
/* Not has the most important priority after Wring's `=0' and `=1'. */
|
||||
%nonassoc OP_NOT
|
||||
|
||||
%nonassoc OP_POST_NEG OP_POST_POS
|
||||
|
||||
%type <ltl> result subformula
|
||||
|
||||
/* At the time of writing (2004-01-05) there is a bug in CVS Bison: if
|
||||
|
|
@ -152,6 +154,41 @@ subformula: ATOMIC_PROP
|
|||
else
|
||||
delete $1;
|
||||
}
|
||||
| ATOMIC_PROP OP_POST_POS
|
||||
{
|
||||
$$ = parse_environment.require(*$1);
|
||||
if (! $$)
|
||||
{
|
||||
std::string s = "unknown atomic proposition `";
|
||||
s += *$1;
|
||||
s += "' in environment `";
|
||||
s += parse_environment.name();
|
||||
s += "'";
|
||||
error_list.push_back(parse_error(@1, s));
|
||||
delete $1;
|
||||
YYERROR;
|
||||
}
|
||||
else
|
||||
delete $1;
|
||||
}
|
||||
| ATOMIC_PROP OP_POST_NEG
|
||||
{
|
||||
$$ = parse_environment.require(*$1);
|
||||
if (! $$)
|
||||
{
|
||||
std::string s = "unknown atomic proposition `";
|
||||
s += *$1;
|
||||
s += "' in environment `";
|
||||
s += parse_environment.name();
|
||||
s += "'";
|
||||
error_list.push_back(parse_error(@1, s));
|
||||
delete $1;
|
||||
YYERROR;
|
||||
}
|
||||
else
|
||||
delete $1;
|
||||
$$ = unop::instance(unop::Not, $$);
|
||||
}
|
||||
| CONST_TRUE
|
||||
{ $$ = constant::true_instance(); }
|
||||
| CONST_FALSE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue