* HACKING, Makefile.am, configure.ac, m4/gccwarn.m4,
src/Makefile.am, src/ltlast/Makefile.am, src/ltlast/allnodes.hh, src/ltlast/atomic_prop.cc, src/ltlast/atomic_prop.hh, src/ltlast/binop.cc, src/ltlast/binop.hh, src/ltlast/constant.cc, src/ltlast/constant.hh, src/ltlast/formulae.hh, src/ltlast/multop.cc, src/ltlast/multop.hh, src/ltlast/predecl.hh, src/ltlast/unop.cc, src/ltlast/unop.hh, src/ltlast/visitor.hh, src/ltlparse/Makefile.am, src/ltlparse/ltlparse.yy, src/ltlparse/ltlscan.ll, src/ltlparse/parsedecl.hh, src/ltlparse/public.hh, src/ltlvisit/Makefile.am, src/ltlvisit/dotty.cc, src/ltlvisit/dotty.hh, src/ltlvisit/dump.cc, src/ltlvisit/dump.hh, src/ltlvisit/rewrite.cc, src/ltlvisit/rewrite.hh, src/ltltest/Makefile.am, src/ltltest/defs.in, src/ltltest/readltl.cc, src/ltltest/parse.test, src/ltltest/parseerr.test, src/misc/Makefile.am, src/misc/const_sel.hh: New files.
This commit is contained in:
parent
ababb9ff93
commit
f0a8d0aeb3
46 changed files with 1818 additions and 0 deletions
71
src/ltlparse/ltlscan.ll
Normal file
71
src/ltlparse/ltlscan.ll
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
%option noyywrap
|
||||
|
||||
%{
|
||||
#include <string>
|
||||
#include "parsedecl.hh"
|
||||
|
||||
/* Hack Flex so we read from a string instead of reading from a file. */
|
||||
# define YY_INPUT(buf, result, max_size) \
|
||||
do { \
|
||||
result = (max_size < to_parse_size) ? max_size : to_parse_size; \
|
||||
memcpy(buf, to_parse, result); \
|
||||
to_parse_size -= result; \
|
||||
to_parse += result; \
|
||||
} while (0);
|
||||
|
||||
#define YY_USER_ACTION \
|
||||
yylloc->columns (yyleng);
|
||||
|
||||
static const char *to_parse = 0;
|
||||
static int to_parse_size = 0;
|
||||
|
||||
void
|
||||
flex_set_buffer(const char *buf)
|
||||
{
|
||||
to_parse = buf;
|
||||
to_parse_size = strlen(to_parse);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
%%
|
||||
|
||||
%{
|
||||
yylloc->step ();
|
||||
%}
|
||||
|
||||
"(" return PAR_OPEN;
|
||||
")" return PAR_CLOSE;
|
||||
|
||||
"!" return OP_NOT;
|
||||
"|"|"+" return OP_OR;
|
||||
"&"|"."|"*" return OP_AND;
|
||||
"^" return OP_XOR;
|
||||
"=>"|"->" return OP_IMPLIES;
|
||||
"<=>"|"<->" return OP_EQUIV;
|
||||
|
||||
/* <>, [], and () are used in Spin. */
|
||||
"F"|"<>" return OP_F;
|
||||
"G"|"[]" return OP_G;
|
||||
"U" return OP_U;
|
||||
"R"|"V" return OP_R;
|
||||
"X"|"()" return OP_X;
|
||||
|
||||
"1"|"true" return CONST_TRUE;
|
||||
"0"|"false" return CONST_FALSE;
|
||||
|
||||
[ \t\n]+ yylloc->step (); /* discard whitespace */
|
||||
|
||||
/* An Atomic propisition cannot start with the letter
|
||||
used by a unary operator (F,G,X), unless this
|
||||
letter is followed by a digit in which case we assume
|
||||
it's an ATOMIC_PROP (even though F0 could be seen as Ffalse). */
|
||||
[a-zA-EH-WYZ_][a-zA-Z0-9_]* |
|
||||
[FGX][0-9_][a-zA-Z0-9_]* {
|
||||
yylval->str = new std::string(yytext);
|
||||
return ATOMIC_PROP;
|
||||
}
|
||||
|
||||
. return *yytext;
|
||||
|
||||
<<EOF>> return END_OF_INPUT;
|
||||
Loading…
Add table
Add a link
Reference in a new issue