Commit 8ab42269 authored by Camil Staps's avatar Camil Staps 🐧

Clean.PrettyPrint: Documentation

parent 0254e494
definition module CleanPrettyPrint
/**
* Pretty-printer for types in the Clean compiler
*/
from syntax import
:: AType,
:: ParsedDefinition,
......@@ -8,6 +12,13 @@ from syntax import
:: Type,
:: TypeContext
/**
* Pretty-printer
*
* @var The type to print
* @param The value to print
* @result A string representation of the parameter
*/
class cpp t :: t -> String
instance cpp
......
......@@ -6,4 +6,8 @@ from syntax import :: ParsedExpr, :: Rhs, :: OptGuardedAlts
instance print ParsedExpr, Rhs
compound_rhs :: OptGuardedAlts -> Bool // True iff no guards or #-lets
/**
* True iff the right-hand side is a GuardedAlts or UnguardedExpr with at least
* one ewl_node.
*/
compound_rhs :: OptGuardedAlts -> Bool
definition module CleanPrettyPrint.Util
from StdOverloaded import class zero, class +++(+++)
/**
* Utility functions for the pretty-printer. Normally, these need not be used
* directly, as the cpp class in CleanPrettyPrint is sufficient for most use
* cases.
*/
from StdList import isEmpty
from StdOverloaded import class zero, class +++(+++)
:: CPPState =
{ cpp_indent :: Int
, cpp_parens :: Bool
}
:: CPPState
= { cpp_indent :: Int
, cpp_parens :: Bool
}
:: PrintList = PrintNil
| E.t u: (:+:) infixl 0 t u & print t & print u
:: PrintList
= PrintNil
| E.t u: (:+:) infixl 0 t u & print t & print u
class print t where
print :: CPPState t -> String
......
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