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
572d9553
Commit
572d9553
authored
Sep 26, 2010
by
Jérôme Maloberti
Browse files
Applied patch from Stefan Lampe for ocaml stub of constructors with multiple parameters.
parent
6378071b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ocamliface/mlstub.ml
View file @
572d9553
...
...
@@ -37,6 +37,16 @@ let id s =
(* Printf.eprintf "*** %S\n" s; *)
aux
0
let
consId
s
=
let
rec
aux
i
:
Ast
.
ident
=
try
let
j
=
String
.
index_from
s
i
'.'
in
<:
ident
<
$
uid
:
String
.
sub
s
i
(
j
-
i
)
$.$
aux
(
j
+
1
)
$
>>
with
Not_found
->
<:
ident
<
$
uid
:
String
.
sub
s
i
(
String
.
length
s
-
i
)
$
>>
in
aux
0
let
rec
typ
t
=
try
IntHash
.
find
memo_typ
t
.
uid
with
Not_found
->
...
...
@@ -393,9 +403,17 @@ and to_ml_descr e = function
let
vars
=
mk_vars
tl
in
let
x
=
mk_var
()
in
<:
match_case
<
(
$
str
:
String
.
escaped
lab
$,
Some
$
lid
:
x
$
)
->
$
matches
<:
expr
<
$
lid
:
x
$
>>
(*
$matches <:expr< $lid:x$ >>
<:expr< $id:id (p ^ lab)$ $tuple_to_ml tl vars$ >>
vars
$
>>
vars$ >> *)
$
matches
<:
expr
<
$
lid
:
x
$
>>
(
List
.
fold_left
(
fun
x
(
t
,
id
)
->
Ast
.
ExApp
(
_loc
,
x
,
<:
expr
<$
to_ml
<:
expr
<
$
lid
:
id
$
>>
t
$>>
))
<:
expr
<
$
id
:
consId
(
p
^
lab
)
$
>>
(
List
.
combine
tl
vars
))
vars
$
>>
)
l
in
let
cases
=
cases
@
[
<:
match_case
<
_
->
assert
False
>>
]
in
pmatch
<:
expr
<
Value
.
get_variant
$
e
$
>>
cases
...
...
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