BNFC-2.9.0: A compiler front-end generator.
Safe HaskellNone
LanguageHaskell2010

BNFC.Backend.C.CFtoFlexC

Synopsis

Documentation

cf2flex :: String -> CF -> (String, SymMap) Source #

Entrypoint.

preludeForBuffer :: String -> [String] Source #

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

commentStates :: [String] Source #

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

lexComments :: Maybe String -> ([(String, String)], [String]) -> Doc Source #

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.

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

lexStrings :: String -> String -> String -> [String] Source #

Lexing of strings, converting escaped characters.

lexChars :: String -> String -> [String] Source #

Lexing of characters, converting escaped characters.