BNFC-2.9.2: A compiler front-end generator.
Safe HaskellNone




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


data ParserMode Source #


CParser Bool String

C (False) or C++ no STL (True) mode, with name to use as prefix.

CppParser InPackage String

C++ mode, with optional package name

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 :: ([(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 ([("{-","-}")],["--"])
<INITIAL>"--"[^\n]* /* skip */; /* BNFC: comment "--" */
<INITIAL>"{-" BEGIN COMMENT; /* BNFC: block comment "{-" "-}" */
<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.