* src/ltlparse/ltlscan.ll: Use ltlyy as %prefix.
* src/ltlparse/parsedecl.hh (YY_DECL): Rename yylex to ltlyylex. * src/ltlparse/ltlparse.yy: Define yylex as ltlyylex.
This commit is contained in:
parent
c4c90de3f6
commit
3fb593e542
5 changed files with 61 additions and 49 deletions
|
|
@ -1,3 +1,9 @@
|
||||||
|
2003-06-04 Alexandre Duret-Lutz <aduret@src.lip6.fr>
|
||||||
|
|
||||||
|
* src/ltlparse/ltlscan.ll: Use ltlyy as %prefix.
|
||||||
|
* src/ltlparse/parsedecl.hh (YY_DECL): Rename yylex to ltlyylex.
|
||||||
|
* src/ltlparse/ltlparse.yy: Define yylex as ltlyylex.
|
||||||
|
|
||||||
2003-06-03 Alexandre Duret-Lutz <adl@gnu.org>
|
2003-06-03 Alexandre Duret-Lutz <adl@gnu.org>
|
||||||
|
|
||||||
* src/tgba/dictunion.cc, src/tgba/ltl2tgba.cc,
|
* src/tgba/dictunion.cc, src/tgba/ltl2tgba.cc,
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@ extern spot::ltl::formula* result;
|
||||||
before parsedecl.hh uses it. */
|
before parsedecl.hh uses it. */
|
||||||
#include "parsedecl.hh"
|
#include "parsedecl.hh"
|
||||||
using namespace spot::ltl;
|
using namespace spot::ltl;
|
||||||
|
|
||||||
|
/* Ugly hack so that Bison use ltlyylex, not yylex.
|
||||||
|
(%name-prefix doesn't work for the lalr1.cc skeleton
|
||||||
|
at the time of writing.) */
|
||||||
|
#define yylex ltlyylex
|
||||||
%}
|
%}
|
||||||
|
|
||||||
/* Logical operators. */
|
/* Logical operators. */
|
||||||
|
|
@ -55,31 +60,31 @@ using namespace spot::ltl;
|
||||||
|
|
||||||
%%
|
%%
|
||||||
result: ltl_formula END_OF_INPUT
|
result: ltl_formula END_OF_INPUT
|
||||||
{ result = $$ = $1;
|
{ result = $$ = $1;
|
||||||
YYACCEPT;
|
YYACCEPT;
|
||||||
}
|
}
|
||||||
| many_errors END_OF_INPUT
|
| many_errors END_OF_INPUT
|
||||||
{ error_list.push_back(parse_error(@1,
|
{ error_list.push_back(parse_error(@1,
|
||||||
"couldn't parse anything sensible"));
|
"couldn't parse anything sensible"));
|
||||||
result = $$ = 0;
|
result = $$ = 0;
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
| END_OF_INPUT
|
| END_OF_INPUT
|
||||||
{ error_list.push_back(parse_error(@1, "empty input"));
|
{ error_list.push_back(parse_error(@1, "empty input"));
|
||||||
result = $$ = 0;
|
result = $$ = 0;
|
||||||
YYABORT;
|
YYABORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
many_errors_diagnosed : many_errors
|
many_errors_diagnosed : many_errors
|
||||||
{ error_list.push_back(parse_error(@1,
|
{ error_list.push_back(parse_error(@1,
|
||||||
"unexpected input ignored")); }
|
"unexpected input ignored")); }
|
||||||
|
|
||||||
ltl_formula: subformula
|
ltl_formula: subformula
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
| many_errors_diagnosed subformula
|
| many_errors_diagnosed subformula
|
||||||
{ $$ = $2; }
|
{ $$ = $2; }
|
||||||
| ltl_formula many_errors_diagnosed
|
| ltl_formula many_errors_diagnosed
|
||||||
{ $$ = $1; }
|
{ $$ = $1; }
|
||||||
|
|
||||||
many_errors: error
|
many_errors: error
|
||||||
| many_errors error
|
| many_errors error
|
||||||
|
|
@ -105,91 +110,91 @@ subformula: ATOMIC_PROP
|
||||||
delete $1;
|
delete $1;
|
||||||
}
|
}
|
||||||
| CONST_TRUE
|
| CONST_TRUE
|
||||||
{ $$ = constant::true_instance(); }
|
{ $$ = constant::true_instance(); }
|
||||||
| CONST_FALSE
|
| CONST_FALSE
|
||||||
{ $$ = constant::false_instance(); }
|
{ $$ = constant::false_instance(); }
|
||||||
| PAR_OPEN subformula PAR_CLOSE
|
| PAR_OPEN subformula PAR_CLOSE
|
||||||
{ $$ = $2; }
|
{ $$ = $2; }
|
||||||
| PAR_OPEN error PAR_CLOSE
|
| PAR_OPEN error PAR_CLOSE
|
||||||
{ error_list.push_back(parse_error(@$,
|
{ error_list.push_back(parse_error(@$,
|
||||||
"treating this parenthetical block as false"));
|
"treating this parenthetical block as false"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| PAR_OPEN subformula many_errors PAR_CLOSE
|
| PAR_OPEN subformula many_errors PAR_CLOSE
|
||||||
{ error_list.push_back(parse_error(@3,
|
{ error_list.push_back(parse_error(@3,
|
||||||
"unexpected input ignored"));
|
"unexpected input ignored"));
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| OP_NOT subformula
|
| OP_NOT subformula
|
||||||
{ $$ = unop::instance(unop::Not, $2); }
|
{ $$ = unop::instance(unop::Not, $2); }
|
||||||
| subformula OP_AND subformula
|
| subformula OP_AND subformula
|
||||||
{ $$ = multop::instance(multop::And, $1, $3); }
|
{ $$ = multop::instance(multop::And, $1, $3); }
|
||||||
| subformula OP_AND error
|
| subformula OP_AND error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_AND"));
|
"missing right operand for OP_AND"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_OR subformula
|
| subformula OP_OR subformula
|
||||||
{ $$ = multop::instance(multop::Or, $1, $3); }
|
{ $$ = multop::instance(multop::Or, $1, $3); }
|
||||||
| subformula OP_OR error
|
| subformula OP_OR error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_OR"));
|
"missing right operand for OP_OR"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_XOR subformula
|
| subformula OP_XOR subformula
|
||||||
{ $$ = binop::instance(binop::Xor, $1, $3); }
|
{ $$ = binop::instance(binop::Xor, $1, $3); }
|
||||||
| subformula OP_XOR error
|
| subformula OP_XOR error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_XOR"));
|
"missing right operand for OP_XOR"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_IMPLIES subformula
|
| subformula OP_IMPLIES subformula
|
||||||
{ $$ = binop::instance(binop::Implies, $1, $3); }
|
{ $$ = binop::instance(binop::Implies, $1, $3); }
|
||||||
| subformula OP_IMPLIES error
|
| subformula OP_IMPLIES error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_IMPLIES"));
|
"missing right operand for OP_IMPLIES"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_EQUIV subformula
|
| subformula OP_EQUIV subformula
|
||||||
{ $$ = binop::instance(binop::Equiv, $1, $3); }
|
{ $$ = binop::instance(binop::Equiv, $1, $3); }
|
||||||
| subformula OP_EQUIV error
|
| subformula OP_EQUIV error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_EQUIV"));
|
"missing right operand for OP_EQUIV"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_U subformula
|
| subformula OP_U subformula
|
||||||
{ $$ = binop::instance(binop::U, $1, $3); }
|
{ $$ = binop::instance(binop::U, $1, $3); }
|
||||||
| subformula OP_U error
|
| subformula OP_U error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_U"));
|
"missing right operand for OP_U"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| subformula OP_R subformula
|
| subformula OP_R subformula
|
||||||
{ $$ = binop::instance(binop::R, $1, $3); }
|
{ $$ = binop::instance(binop::R, $1, $3); }
|
||||||
| subformula OP_R error
|
| subformula OP_R error
|
||||||
{
|
{
|
||||||
destroy($1);
|
destroy($1);
|
||||||
error_list.push_back(parse_error(@2,
|
error_list.push_back(parse_error(@2,
|
||||||
"missing right operand for OP_R"));
|
"missing right operand for OP_R"));
|
||||||
$$ = constant::false_instance();
|
$$ = constant::false_instance();
|
||||||
}
|
}
|
||||||
| OP_F subformula
|
| OP_F subformula
|
||||||
{ $$ = unop::instance(unop::F, $2); }
|
{ $$ = unop::instance(unop::F, $2); }
|
||||||
| OP_G subformula
|
| OP_G subformula
|
||||||
{ $$ = unop::instance(unop::G, $2); }
|
{ $$ = unop::instance(unop::G, $2); }
|
||||||
| OP_X subformula
|
| OP_X subformula
|
||||||
{ $$ = unop::instance(unop::X, $2); }
|
{ $$ = unop::instance(unop::X, $2); }
|
||||||
// | subformula many_errors
|
// | subformula many_errors
|
||||||
// { error_list->push_back(parse_error(@2,
|
// { error_list->push_back(parse_error(@2,
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
|
%option prefix="ltlyy"
|
||||||
|
%option outfile="lex.yy.c"
|
||||||
|
|
||||||
%{
|
%{
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,9 @@
|
||||||
#include "location.hh"
|
#include "location.hh"
|
||||||
|
|
||||||
# define YY_DECL \
|
# define YY_DECL \
|
||||||
int yylex (yystype *yylval, yy::Location *yylloc)
|
int ltlyylex (yystype *yylval, yy::Location *yylloc)
|
||||||
YY_DECL;
|
YY_DECL;
|
||||||
|
|
||||||
void flex_set_buffer(const char *buf);
|
void flex_set_buffer(const char *buf);
|
||||||
|
|
||||||
#endif // SPOT_LTLPARSE_PARSEDECL_HH
|
#endif // SPOT_LTLPARSE_PARSEDECL_HH
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue