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
cduce
cduce
Commits
48411ba4
Commit
48411ba4
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2006-09-09 20:16:08 by afrisch] Print regexp of the form [ t? ... ]
Original author: afrisch Date: 2006-09-09 20:16:08+00:00
parent
b480a9dd
Changes
3
Hide whitespace changes
Inline
Side-by-side
misc/pretty.ml
View file @
48411ba4
...
...
@@ -497,9 +497,12 @@ module Decompile(H : TABLE)(S : S) = struct
let
s
=
slot
n
in
if
not
s
.
ok
then
(
s
.
ok
<-
true
;
let
(
tr
,
f
)
=
trans
n
in
if
f
then
add_trans
s
final
epsilon
;
List
.
iter
(
fun
(
l
,
dst
)
->
add_trans
s
(
conv
dst
)
(
rtrans
l
))
tr
;
match
trans
n
with
|
`T
(
tr
,
f
)
->
if
f
then
add_trans
s
final
epsilon
;
List
.
iter
(
fun
(
l
,
dst
)
->
add_trans
s
(
conv
dst
)
(
rtrans
l
))
tr
|
`Eps
(
l
,
dst
)
->
add_trans
s
(
conv
dst
)
(
alt
(
rtrans
l
)
epsilon
)
);
s
in
...
...
misc/pretty.mli
View file @
48411ba4
...
...
@@ -26,5 +26,7 @@ end
module
Decompile
(
X
:
TABLE
)(
S
:
S
)
:
sig
val
decompile
:
(
X
.
key
->
(
S
.
t
*
X
.
key
)
list
*
bool
)
->
X
.
key
->
S
.
t
regexp
val
decompile
:
(
X
.
key
->
[
`T
of
(
S
.
t
*
X
.
key
)
list
*
bool
|
`Eps
of
S
.
t
*
X
.
key
]
)
->
X
.
key
->
S
.
t
regexp
end
types/types.ml
View file @
48411ba4
...
...
@@ -1544,8 +1544,26 @@ struct
let
tr
=
Product
.
get
t
in
let
tr
=
Product
.
clean_normal
tr
in
let
tr
=
List
.
map
(
fun
(
l
,
t
)
->
prepare
l
,
t
)
tr
in
tr
,
Atoms
.
contains
nil_atom
t
.
atoms
)
let
eps
=
Atoms
.
contains
nil_atom
t
.
atoms
in
let
tr_cons
=
List
.
map
(
fun
(
li
,
ti
)
->
(
cons
li
,
cons
ti
))
tr
in
try
let
(
l0
,
t0
)
=
List
.
find
(
fun
((
l0
,
t0
)
as
tr0
)
->
let
t''
=
List
.
fold_left
(
fun
accu
((
li
,
ti
)
as
tri
)
->
if
tr0
==
tri
then
accu
else
cup
accu
(
times
li
ti
)
)
(
if
eps
then
nil_type
else
empty
)
tr_cons
in
equiv
(
descr
t0
)
t''
)
tr_cons
in
`Eps
(
prepare
(
descr
l0
)
,
descr
t0
)
with
Not_found
->
let
tr
=
List
.
map
(
fun
(
l
,
t
)
->
prepare
l
,
t
)
tr
in
`T
(
tr
,
eps
))
d
let
gen
=
ref
0
...
...
Write
Preview
Markdown
is supported
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