Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions common to different backends.
Synopsis
- unicodeAndSymbols :: CF -> [String]
- asciiKeywords :: CF -> [String]
- flexEps :: String
- renderListSepByPrecedence :: Doc -> (String -> Doc) -> [(Integer, String)] -> Doc
Documentation
unicodeAndSymbols :: CF -> [String] Source #
asciiKeywords :: CF -> [String] Source #
renderListSepByPrecedence Source #
:: Doc | Name of the coercion level variable |
-> (String -> Doc) | render function |
-> [(Integer, String)] | separators by precedence |
-> Doc |
Helper function for c-like languages that generates the code printing the list separator according to the given precedence level:
>>>
let my_render c = "my_render(\"" <> text c <> "\")"
>>>
renderListSepByPrecedence "x" my_render []
>>>
renderListSepByPrecedence "x" my_render [(0,",")]
my_render(",");
>>>
renderListSepByPrecedence "x" my_render [(3,";"), (1, "--")]
switch(x) { case 3: my_render(";"); break; default: my_render("--"); }