-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate menhir parser and elaborator tests #1220
Changes from 250 commits
af03c40
8aff486
951d4a2
97c5187
3bc4227
191639e
db3b918
cdfc8ad
d3a5995
8ecd025
16b7e4a
e3060a7
6b13317
0448846
595c6f7
2ba24df
a4d7a93
76d1ef8
b10b8ac
cd8ae48
a33b30d
27be64a
971945c
d9d07f9
cc2b5dc
4aed0bc
33cb84a
d91c550
56ceaf8
834a803
8af6998
3317133
a783dd5
d27ff09
e81fbdb
5b71bd9
dfa56af
aefea80
196c910
d8bdd8f
ffe5ef9
47ffe3e
de59c41
9246a07
cf736fa
b7481c7
cf7b720
804aada
079754b
b852d0f
4c4eeb9
850d247
935f842
dab05cb
dc51508
f2e14fe
dd7dd80
39d077f
ce26173
01d6f3a
9a3b5dd
aef64e9
15a82a0
4a2fe8b
00ab1de
be06410
6b1c3b0
51ec3c4
ed962c0
9d2b7db
f5886c3
efdbdc7
17880ce
d8f2652
eb5ba2b
1cc26f6
6b36552
574c359
8b79893
c3de67f
ac4e9f9
c5861cd
1aec2b9
a265eb8
ff2aa0f
d444d6e
ad1ffec
decb9ec
807dc8f
993ad15
033bda3
13e968f
24a4588
6d816f4
8335bfe
a01348a
93251b8
f202efd
115d4e2
b5ed4c3
6391f8e
497ea3f
a6f0f03
3ea7cb5
3b72ec2
66de4a3
5d2c5e8
286352d
87729b9
a76f253
3d06374
cfc4180
be85171
7904db5
94bec54
f450850
f96e3d2
e7f8e61
aa34712
773583f
5bb8b18
97dd32d
abfccdf
7929bcc
dbdc108
1465aa5
a7aa733
9e997a3
978e65e
5ecdfc6
d7423f1
a860c6a
4e5379c
8c3b753
542f10f
ee3b6bf
f90e146
f988005
91476cb
60f5709
d13e07c
92b9d5d
36307a9
bef0026
e2f5f72
8288d7a
c77d065
3d11a0d
428faaa
956fb32
39f2999
ca2a0c0
5b2f3cf
ff0b325
a96659c
4cd1e56
e7af810
b1da56a
0710524
20bcba5
d762a74
9eac896
1e44f9c
d535f5e
ed36809
0e3353d
57b3e8b
4a79a14
8436063
9c31795
cb0dac7
dbc4d47
5970942
524547f
d5db2df
80f744f
bd9fd3c
9839e5e
0bba4b1
54e19f4
f5595e7
618a4d9
c9556ef
f3e4349
d0a7a76
680a25c
419f9e3
1f06f00
21d34fe
bea13f7
21bcfbf
28d60bd
cfda148
88341f3
2936215
9fd16cc
1ce5144
d508eec
0059289
c485ea5
d8bf5e1
56b3291
30e0af4
896224d
3b3087b
6f38eb6
ad9ddfa
44caaa0
57de33c
a7c80e9
57b0a1d
ebe9380
dd4dffa
db04947
5cdb818
d220808
423d874
8deebf7
ccda1d2
109f130
64d1a04
ea51395
98e7730
ce23f3f
acc2fca
926ab68
7472c64
24ebb17
6618e86
35ddd72
9620c17
ae1ae3d
ce578a3
a5b5421
6a84653
aca41b9
4d013f8
d716511
10aa238
d1b3a06
89059bf
c706b4b
0990fb1
0444c53
323eb58
3146477
c06d6c8
02776a7
1eb2a56
e75499a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,7 +166,7 @@ let rec exp_to_pretty = (~settings: Settings.t, exp: Exp.t): pretty => { | |
| Int(n) => text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Int.to_string(n)) | ||
// TODO: do floats print right? | ||
| Float(f) => | ||
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Float.to_string(f)) | ||
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, Printf.sprintf("%f", f)) | ||
| String(s) => | ||
text_to_pretty(exp |> Exp.rep_id, Sort.Exp, "\"" ++ s ++ "\"") | ||
// TODO: Make sure types are correct | ||
|
@@ -445,11 +445,12 @@ let rec exp_to_pretty = (~settings: Settings.t, exp: Exp.t): pretty => { | |
@ ( | ||
List.map2( | ||
(id, (p, e)) => | ||
settings.inline | ||
? [] | ||
: [Secondary(Secondary.mk_newline(Id.mk()))] | ||
@ [mk_form("rule", id, [p])] | ||
@ (e |> fold_if(settings.fold_case_clauses)), | ||
( | ||
settings.inline | ||
? [] : [Secondary(Secondary.mk_newline(Id.mk()))] | ||
) | ||
@ [mk_form("rule", id, [p])] | ||
@ (e |> fold_if(settings.fold_case_clauses)), | ||
Comment on lines
+448
to
+453
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is also solved in #1450 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Merging either PR first is fine. |
||
ids, | ||
rs, | ||
) | ||
|
@@ -475,7 +476,7 @@ and pat_to_pretty = (~settings: Settings.t, pat: Pat.t): pretty => { | |
| Var(v) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, v) | ||
| Int(n) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Int.to_string(n)) | ||
| Float(f) => | ||
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Float.to_string(f)) | ||
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Printf.sprintf("%f", f)) | ||
| Bool(b) => text_to_pretty(pat |> Pat.rep_id, Sort.Pat, Bool.to_string(b)) | ||
| String(s) => | ||
text_to_pretty(pat |> Pat.rep_id, Sort.Pat, "\"" ++ s ++ "\"") | ||
|
@@ -543,11 +544,28 @@ and typ_to_pretty = (~settings: Settings.t, typ: Typ.t): pretty => { | |
let go = typ_to_pretty(~settings: Settings.t); | ||
let go_constructor: ConstructorMap.variant(Typ.t) => pretty = | ||
fun | ||
| Variant(c, ids, None) => text_to_pretty(List.hd(ids), Sort.Typ, c) | ||
| Variant(c, ids, None) => { | ||
text_to_pretty( | ||
Option.value(~default=Id.invalid, ListUtil.hd_opt(ids)), | ||
Sort.Typ, | ||
c, | ||
); | ||
} | ||
| Variant(c, ids, Some(x)) => { | ||
let+ constructor = | ||
text_to_pretty(List.hd(List.tl(ids)), Sort.Typ, c); | ||
constructor @ [mk_form("ap_typ", List.hd(ids), [go(x)])]; | ||
text_to_pretty( | ||
Option.value(~default=Id.invalid, ListUtil.nth_opt(1, ids)), | ||
Sort.Typ, | ||
c, | ||
); | ||
constructor | ||
@ [ | ||
mk_form( | ||
"ap_typ", | ||
Option.value(~default=Id.invalid, ListUtil.hd_opt(ids)), | ||
[go(x)], | ||
), | ||
]; | ||
} | ||
| BadEntry(x) => go(x); | ||
switch (typ |> Typ.term_of) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes it consistent with Precedence.re