HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

ModuleBNFC-2.9.6.3Haskell2010

BNFC.Backend.Common.StrUtils

Synopsis
  • PackageBNFC-2.9.6.3
  • 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,""\"\\\'"")

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