Commit b3ae0c44 authored by Camil Staps's avatar Camil Staps 🐧

Clean.PrettyPrint: Minor improvements

parent 6cc17193
......@@ -64,5 +64,5 @@ where
_ = ""
print st (ID_Instance cls _ (ts, tcs))
= print st (cls :+: join_start st " " ts :+: if (isEmpty tcs) "" (" | " +++ join st " & " tcs))
print st _
= abort "UNKNOWN_IMPORTDECLARATION"
print st (ID_Generic id _)
= print st ("generic " :+: id)
......@@ -41,10 +41,12 @@ where
(Yes t) = " :: " :+: t
No = PrintNil
print st (PD_NodeDef _ l r)
= print st (l :+: " = " :+: r)
= print {st & cpp_parens=False} (l :+: " = " :+: r)
print st (PD_Function _ id isinfix args rhs fk)
= print st (id` :+: join_start st " " args :+: if show_eq eq "" :+: rhs)
= print stnp (id` :+: join_start stp " " args :+: if show_eq eq "" :+: rhs)
where
stnp = {st & cpp_parens=False}
stp = {st & cpp_parens=True}
id` = if isinfix ("(" :+: id :+: ")") (id :+: PrintNil)
show_eq = not (compound_rhs rhs.rhs_alts)
eq = case fk of FK_Macro = " :== "; _ = " = "
......
......@@ -21,7 +21,7 @@ where
where
rest = print st a +++ ":" +++ print st b +++ "]"
print st (PE_List pes)
= printp {st & cpp_parens=True} pes
= printp st (print {st & cpp_parens=True} pes)
print st (PE_Ident id)
= print st id
print st (PE_QualifiedIdent id s)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment