HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

ModuleBNFC-2.9.5Haskell2010

BNFC.Backend.Common.StrUtils

  • 2 values
  • PackageBNFC-2.9.5
  • Exports2
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceStrUtils.hs

Function that, given an input string, renders it either as a char (if it has legth 1) or a string. It should also excape characters correctly. The first returned value is the type of the string: either C for char or S for string. (used in the C printer to choose the right rendering function) e.g. >>> renderCharOrString "a" (C,"a") >>> renderCharOrString "abc" (S,""abc"") >>> renderCharOrString "'" (C,"\\'") >>> renderCharOrString ""\'" (S,""\"\\\'"")

valueescapeChars :: String -> String
#

Helper function that escapes characters in strings >>> escapeChars "\" "\\" >>> escapeChars """ "\"" >>> escapeChars "'" "\'"