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
94822f79
Commit
94822f79
authored
May 13, 2011
by
Jérôme Maloberti
Browse files
Added const and end suffix to services.
parent
41e26c72
Changes
1
Hide whitespace changes
Inline
Side-by-side
types/types.ml
View file @
94822f79
...
...
@@ -1824,7 +1824,11 @@ end
module
Service
=
struct
type
service_attributs
=
{
mutable
suffix
:
bool
}
type
service_attributs
=
{
mutable
suffix
:
bool
;
mutable
const
:
bool
;
mutable
end_suffix
:
bool
}
let
prepare
t
=
let
t
=
Print
.
uniq
t
in
let
t
=
Print
.
prepare
t
in
...
...
@@ -1874,13 +1878,20 @@ struct
|
Print
.
Char
c
->
assert
false
|
Print
.
Regexp
r
->
convert_regexp
name
r
|
Print
.
Xml
(
tag
,
attr
,
t
)
->
let
flags
=
{
suffix
=
false
}
in
let
flags
=
{
suffix
=
false
;
const
=
false
;
end_suffix
=
false
}
in
(
convert_attrs
flags
attr
;
let
res
=
convert
t
(
convert_tag
tag
)
in
if
flags
.
suffix
then
TSuffix
(
true
,
res
)
let
tagname
=
convert_tag
tag
in
let
res
=
convert
t
tagname
in
if
flags
.
const
then
TConst
tagname
else
res
if
flags
.
end_suffix
then
TESuffix
tagname
else
if
flags
.
suffix
then
TSuffix
(
true
,
res
)
else
res
)
|
_
->
assert
false
and
convert_regexp
name
=
function
...
...
@@ -1920,6 +1931,8 @@ struct
trace
(
"convert_record:"
^
attr_label
);
match
attr_label
with
|
"suffix"
->
flags
.
suffix
<-
true
|
"const"
->
flags
.
const
<-
true
|
"end_suffix"
->
flags
.
end_suffix
<-
true
|
_
->
output_string
stderr
(
"Bad attribute name:"
^
attr_label
^
"
\n
"
)
(* Label.print_attr l opt (do_print_slot 0) t *)
...
...
@@ -1948,12 +1961,14 @@ struct
|
TFloat
n
->
"TFloat("
^
n
^
")"
|
TBool
n
->
"TBool("
^
n
^
")"
|
TString
n
->
"TString("
^
n
^
")"
|
TConst
n
->
"TConst("
^
n
^
")"
|
TProd
(
e1
,
e2
)
->
"TProd("
^
(
aux
e1
)
^
","
^
(
aux
e2
)
^
")"
|
TOption
e
->
"TOption("
^
(
aux
e
)
^
")"
|
TSet
e
->
"TSet("
^
(
aux
e
)
^
")"
|
TUnit
->
"TUnit()"
|
TSum
(
e1
,
e2
)
->
"TSum("
^
(
aux
e1
)
^
","
^
(
aux
e2
)
^
")"
|
TSuffix
(
b
,
e
)
->
"TSuffix("
^
(
bool_to_string
b
)
^
","
^
(
aux
e
)
^
")"
|
TESuffix
n
->
"TESuffix("
^
n
^
")"
|
_
->
" unknown "
in
aux
t
;;
end
...
...
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