Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Spot
Spot
Commits
38f7cac8
Commit
38f7cac8
authored
Oct 22, 2004
by
Alexandre Duret-Lutz
Browse files
* src/ltlvisit/tostring.cc (to_spin_string_visitor): Move to
anonymous namespace.
parent
91b9682b
Changes
2
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
38f7cac8
2004-10-22 Alexandre Duret-Lutz <adl@src.lip6.fr>
* src/ltlvisit/tostring.cc (to_spin_string_visitor): Move to
anonymous namespace.
2004-10-21 Alexandre Duret-Lutz <adl@src.lip6.fr>
2004-10-21 Alexandre Duret-Lutz <adl@src.lip6.fr>
* wrap/python/Makefile.am (_spot_la_SOURCES): Add spot_wrap.h.
* wrap/python/Makefile.am (_spot_la_SOURCES): Add spot_wrap.h.
...
...
src/ltlvisit/tostring.cc
View file @
38f7cac8
...
@@ -185,7 +185,135 @@ namespace spot
...
@@ -185,7 +185,135 @@ namespace spot
std
::
ostream
&
os_
;
std
::
ostream
&
os_
;
bool
top_level_
;
bool
top_level_
;
};
};
}
class
to_spin_string_visitor
:
public
to_string_visitor
{
public:
to_spin_string_visitor
(
std
::
ostream
&
os
)
:
to_string_visitor
(
os
)
{
}
virtual
~
to_spin_string_visitor
()
{
}
void
visit
(
const
binop
*
bo
)
{
bool
top_level
=
top_level_
;
top_level_
=
false
;
if
(
!
top_level
)
os_
<<
"("
;
switch
(
bo
->
op
())
{
case
binop
::
Xor
:
os_
<<
"(!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && "
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
") || ("
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && !"
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
")"
;
break
;
case
binop
::
Implies
:
os_
<<
"!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" || "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
case
binop
::
Equiv
:
os_
<<
"("
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && "
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
") || (!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && !"
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
")"
;
case
binop
::
U
:
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" U "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
case
binop
::
R
:
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" V "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
}
if
(
!
top_level
)
os_
<<
")"
;
}
void
visit
(
const
unop
*
uo
)
{
// The parser treats X0, and X1 as atomic propositions. So
// make sure we output X(0) and X(1).
bool
need_parent
=
false
;
switch
(
uo
->
op
())
{
case
unop
::
Not
:
os_
<<
"!"
;
break
;
case
unop
::
X
:
need_parent
=
!!
dynamic_cast
<
const
constant
*>
(
uo
->
child
());
os_
<<
"X"
;
break
;
case
unop
::
F
:
os_
<<
"<>"
;
break
;
case
unop
::
G
:
os_
<<
"[]"
;
break
;
}
top_level_
=
false
;
if
(
need_parent
)
os_
<<
"("
;
uo
->
child
()
->
accept
(
*
this
);
if
(
need_parent
)
os_
<<
")"
;
}
void
visit
(
const
multop
*
mo
)
{
bool
top_level
=
top_level_
;
top_level_
=
false
;
if
(
!
top_level
)
os_
<<
"("
;
unsigned
max
=
mo
->
size
();
mo
->
nth
(
0
)
->
accept
(
*
this
);
const
char
*
ch
=
" "
;
switch
(
mo
->
op
())
{
case
multop
::
Or
:
ch
=
" || "
;
break
;
case
multop
::
And
:
ch
=
" && "
;
break
;
}
for
(
unsigned
n
=
1
;
n
<
max
;
++
n
)
{
os_
<<
ch
;
mo
->
nth
(
n
)
->
accept
(
*
this
);
}
if
(
!
top_level
)
os_
<<
")"
;
}
};
}
// anonymous
std
::
ostream
&
std
::
ostream
&
to_string
(
const
formula
*
f
,
std
::
ostream
&
os
)
to_string
(
const
formula
*
f
,
std
::
ostream
&
os
)
...
@@ -203,133 +331,6 @@ namespace spot
...
@@ -203,133 +331,6 @@ namespace spot
return
os
.
str
();
return
os
.
str
();
}
}
class
to_spin_string_visitor
:
public
to_string_visitor
{
public:
to_spin_string_visitor
(
std
::
ostream
&
os
)
:
to_string_visitor
(
os
)
{
}
virtual
~
to_spin_string_visitor
()
{
}
void
visit
(
const
binop
*
bo
)
{
bool
top_level
=
top_level_
;
top_level_
=
false
;
if
(
!
top_level
)
os_
<<
"("
;
switch
(
bo
->
op
())
{
case
binop
::
Xor
:
os_
<<
"(!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && "
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
") || ("
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && !"
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
")"
;
break
;
case
binop
::
Implies
:
os_
<<
"!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" || "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
case
binop
::
Equiv
:
os_
<<
"("
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && "
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
") || (!"
;
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" && !"
;
bo
->
second
()
->
accept
(
*
this
);
os_
<<
")"
;
case
binop
::
U
:
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" U "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
case
binop
::
R
:
bo
->
first
()
->
accept
(
*
this
);
os_
<<
" V "
;
bo
->
second
()
->
accept
(
*
this
);
break
;
}
if
(
!
top_level
)
os_
<<
")"
;
}
void
visit
(
const
unop
*
uo
)
{
// The parser treats X0, and X1 as atomic propositions. So
// make sure we output X(0) and X(1).
bool
need_parent
=
false
;
switch
(
uo
->
op
())
{
case
unop
::
Not
:
os_
<<
"!"
;
break
;
case
unop
::
X
:
need_parent
=
!!
dynamic_cast
<
const
constant
*>
(
uo
->
child
());
os_
<<
"X"
;
break
;
case
unop
::
F
:
os_
<<
"<>"
;
break
;
case
unop
::
G
:
os_
<<
"[]"
;
break
;
}
top_level_
=
false
;
if
(
need_parent
)
os_
<<
"("
;
uo
->
child
()
->
accept
(
*
this
);
if
(
need_parent
)
os_
<<
")"
;
}
void
visit
(
const
multop
*
mo
)
{
bool
top_level
=
top_level_
;
top_level_
=
false
;
if
(
!
top_level
)
os_
<<
"("
;
unsigned
max
=
mo
->
size
();
mo
->
nth
(
0
)
->
accept
(
*
this
);
const
char
*
ch
=
" "
;
switch
(
mo
->
op
())
{
case
multop
::
Or
:
ch
=
" || "
;
break
;
case
multop
::
And
:
ch
=
" && "
;
break
;
}
for
(
unsigned
n
=
1
;
n
<
max
;
++
n
)
{
os_
<<
ch
;
mo
->
nth
(
n
)
->
accept
(
*
this
);
}
if
(
!
top_level
)
os_
<<
")"
;
}
};
std
::
ostream
&
std
::
ostream
&
to_spin_string
(
const
formula
*
f
,
std
::
ostream
&
os
)
to_spin_string
(
const
formula
*
f
,
std
::
ostream
&
os
)
{
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment