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
68ce5b26
Commit
68ce5b26
authored
Oct 05, 2007
by
Pietro Abate
Browse files
[r2003-03-10 12:11:46 by cvscast] Empty log message
Original author: cvscast Date: 2003-03-10 12:11:46+00:00
parent
af677b2a
Changes
1
Hide whitespace changes
Inline
Side-by-side
runtime/run_dispatch.ml
View file @
68ce5b26
...
...
@@ -34,6 +34,22 @@ let make_result_char ch (code,r) =
)
r
in
(
code
,
ret
)
let
tail_string
i
j
s
q
=
if
i
+
1
=
j
then
q
else
String
(
i
+
1
,
j
,
s
,
q
)
let
make_result_string
i
j
s
q
r1
r2
(
code
,
r
)
=
let
ret
=
Array
.
map
(
function
|
Catch
->
String
(
i
,
j
,
s
,
q
)
|
Const
c
->
const
c
|
Left
n
->
if
(
n
<
0
)
then
Char
(
Chars
.
mk_char
s
.
[
i
])
else
r1
.
(
n
)
|
Right
m
->
if
(
m
<
0
)
then
tail_string
i
j
s
q
else
r2
.
(
m
)
|
Recompose
(
n
,
m
)
->
Pair
((
if
(
n
<
0
)
then
Char
(
Chars
.
mk_char
s
.
[
i
])
else
r1
.
(
n
))
,
(
if
(
m
<
0
)
then
tail_string
i
j
s
q
else
r2
.
(
m
)))
)
r
in
(
code
,
ret
)
let
rec
run_disp_basic
v
f
=
function
|
[(
_
,
r
)]
->
make_result_basic
v
r
|
(
t
,
r
)
::
rem
->
if
f
t
then
make_result_basic
v
r
else
run_disp_basic
v
f
rem
...
...
@@ -153,11 +169,11 @@ and run_disp_string_char d ch =
and
run_disp_string2
r1
i
j
s
q
=
function
|
Impossible
->
assert
false
|
Ignore
r
->
make_result_
prod
Absent
(* *)
r1
Absent
dummy_r
Absent
r
make_result_
string
i
j
s
q
r1
dummy_r
r
|
TailCall
d2
->
run_disp_string_loop
i
j
s
q
d2
|
Dispatch
(
d2
,
b2
)
->
let
(
code2
,
r2
)
=
run_disp_string_loop
i
j
s
q
d2
in
make_result_
prod
Absent
(* *)
r1
Absent
r2
Absent
b2
.
(
code2
)
make_result_
string
i
j
s
q
r1
r2
b2
.
(
code2
)
and
run_disp_string_loop
i
j
s
q
d
=
match
actions
d
with
|
AIgnore
r
->
make_result_basic
Absent
r
...
...
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