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.C.CFtoFlexC

  • 1 type
  • 12 values
  • PackageBNFC-2.9.5
  • Exports13
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceCFtoFlexC.hs
valuepreludeForBuffer :: String -> [String]
#

Part of the lexer prelude needed when string literals are to be lexed. Defines an interface to the Buffer.

valuecommentStates :: [String]
#

If we have several block comments, we need different COMMENT lexing states.

valuelexComments :: ([(String, String)], [String]) -> Doc
#

Create flex rules for single-line and multi-lines comments. The first argument is an optional namespace (for C++); the second argument is the set of comment delimiters as returned by BNFC.CF.comments.

This function is only compiling the results of applying either lexSingleComment or lexMultiComment on each comment delimiter or pair of delimiters.

Example1 expression
lexComments ([("{-","-}")],["--"])<INITIAL>"--"[^\n]* /* skip */; /* BNFC: comment "--" */<INITIAL>"{-" BEGIN COMMENT; /* BNFC: block comment "{-" "-}" */<COMMENT>"-}" BEGIN INITIAL;<COMMENT>.    /* skip */;<COMMENT>[\n] /* skip */;