Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
why3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nils Fitinghoff
why3
Commits
47f6a44c
Commit
47f6a44c
authored
Sep 11, 2018
by
Mário Pereira
Browse files
Options
Downloads
Patches
Plain Diff
OCaml printer: pattern priting protected by parentheses.
This closes issue #181.
parent
c7690747
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mlw/ocaml_printer.ml
+10
-7
10 additions, 7 deletions
src/mlw/ocaml_printer.ml
with
10 additions
and
7 deletions
src/mlw/ocaml_printer.ml
+
10
−
7
View file @
47f6a44c
...
@@ -229,17 +229,19 @@ module Print = struct
...
@@ -229,17 +229,19 @@ module Print = struct
List
.
filter
(
fun
e
->
not
(
rs_ghost
e
))
itd
.
itd_fields
List
.
filter
(
fun
e
->
not
(
rs_ghost
e
))
itd
.
itd_fields
|
_
->
[]
|
_
->
[]
let
rec
print_pat
info
fmt
=
function
let
rec
print_pat
?
(
paren
=
false
)
info
fmt
=
function
|
Pwild
->
|
Pwild
->
fprintf
fmt
"_"
fprintf
fmt
"_"
|
Pvar
{
vs_name
=
id
}
->
|
Pvar
{
vs_name
=
id
}
->
(
print_lident
info
)
fmt
id
(
print_lident
info
)
fmt
id
|
Pas
(
p
,
{
vs_name
=
id
})
->
|
Pas
(
p
,
{
vs_name
=
id
})
->
fprintf
fmt
"%a as %a"
(
print_pat
info
)
p
(
print_lident
info
)
id
fprintf
fmt
(
protect_on
paren
"%a as %a"
)
(
print_pat
info
)
p
(
print_lident
info
)
id
|
Por
(
p1
,
p2
)
->
|
Por
(
p1
,
p2
)
->
fprintf
fmt
"%a | %a"
(
print_pat
info
)
p1
(
print_pat
info
)
p2
fprintf
fmt
(
protect_on
paren
"%a | %a"
)
(
print_pat
info
)
p1
(
print_pat
info
)
p2
|
Ptuple
pl
->
|
Ptuple
pl
->
fprintf
fmt
"(%a)"
(
print_list
comma
(
print_pat
info
))
pl
fprintf
fmt
"(%a)"
(
print_list
comma
(
print_pat
~
paren
:
true
info
))
pl
|
Papp
(
ls
,
pl
)
->
|
Papp
(
ls
,
pl
)
->
match
query_syntax
info
.
info_syn
ls
.
ls_name
,
pl
with
match
query_syntax
info
.
info_syn
ls
.
ls_name
,
pl
with
|
Some
s
,
_
->
|
Some
s
,
_
->
...
@@ -248,9 +250,10 @@ module Print = struct
...
@@ -248,9 +250,10 @@ module Print = struct
let
pjl
=
let
rs
=
restore_rs
ls
in
get_record
info
rs
in
let
pjl
=
let
rs
=
restore_rs
ls
in
get_record
info
rs
in
match
pjl
with
match
pjl
with
|
[]
->
print_papp
info
ls
fmt
pl
|
[]
->
print_papp
info
ls
fmt
pl
|
pjl
->
fprintf
fmt
"@[<hov 2>{ %a }@]"
|
pjl
->
(
print_list2
semi
equal
(
print_rs
info
)
(
print_pat
info
))
fprintf
fmt
(
protect_on
paren
"@[<hov 2>{ %a }@]"
)
(
pjl
,
pl
)
(
print_list2
semi
equal
(
print_rs
info
)
(
print_pat
~
paren
:
true
info
))
(
pjl
,
pl
)
and
print_papp
info
ls
fmt
=
function
and
print_papp
info
ls
fmt
=
function
|
[]
->
fprintf
fmt
"%a"
(
print_uident
info
)
ls
.
ls_name
|
[]
->
fprintf
fmt
"%a"
(
print_uident
info
)
ls
.
ls_name
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment