Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Pragma-related functions.
Synopsis
- extractPragmasFromCode :: String -> [(String, String)]
- extractPragmaNameAndElement :: String -> Maybe (String, String)
- pragmaRegex :: Regex
Documentation
extractPragmasFromCode Source #
:: String | |
-> [(String, String)] |
|
Extracts all pragmas from the given source code.
FIXME: The function is slow because it lexicographically analyzes the
given source code. An alternative way is to use regular expressions.
However, this method cannot determine if what appears to be a pragma is
really a pragma, or requires complex regular expressions. For example,
{-nn{-# LANGUAGE CPP #-}nn-}
is not a pragma, but is likely to be
recognized as such.
extractPragmaNameAndElement Source #
:: String | |
-> Maybe (String, String) |
|
Extracts the pragma's name and its element from the given pragma.
This function returns a Nothing
if it fails to extract them.
pragmaRegex :: Regex Source #
A regex to match against a pragma.