cpphs 1.3 → 1.5
raw patch · 112 files changed
+13655/−307 lines, 112 filesnew-uploaderbinary-addedPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Language.Preprocessor.Cpphs: CpphsAnsi :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsLayout :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsMacro :: (String, String) -> CpphsOption
- Language.Preprocessor.Cpphs: CpphsNoLine :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsNoMacro :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsPath :: String -> CpphsOption
- Language.Preprocessor.Cpphs: CpphsStrip :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsText :: CpphsOption
- Language.Preprocessor.Cpphs: CpphsUnlit :: CpphsOption
- Language.Preprocessor.Cpphs: data CpphsOption
- Language.Preprocessor.Cpphs: parseOption :: String -> Maybe CpphsOption
+ Language.Preprocessor.Cpphs: BoolOptions :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> BoolOptions
+ Language.Preprocessor.Cpphs: CpphsOptions :: [FilePath] -> [FilePath] -> [(String, String)] -> [String] -> BoolOptions -> CpphsOptions
+ Language.Preprocessor.Cpphs: ansi :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: boolopts :: CpphsOptions -> BoolOptions
+ Language.Preprocessor.Cpphs: data BoolOptions
+ Language.Preprocessor.Cpphs: data CpphsOptions
+ Language.Preprocessor.Cpphs: defaultBoolOptions :: BoolOptions
+ Language.Preprocessor.Cpphs: defaultCpphsOptions :: CpphsOptions
+ Language.Preprocessor.Cpphs: defines :: CpphsOptions -> [(String, String)]
+ Language.Preprocessor.Cpphs: includes :: CpphsOptions -> [String]
+ Language.Preprocessor.Cpphs: infiles :: CpphsOptions -> [FilePath]
+ Language.Preprocessor.Cpphs: lang :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: layout :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: literate :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: locations :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: macros :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: outfiles :: CpphsOptions -> [FilePath]
+ Language.Preprocessor.Cpphs: parseOptions :: [String] -> Either String CpphsOptions
+ Language.Preprocessor.Cpphs: pragma :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: strip :: BoolOptions -> Bool
+ Language.Preprocessor.Cpphs: warnings :: BoolOptions -> Bool
- Language.Preprocessor.Cpphs: cppIfdef :: FilePath -> [(String, String)] -> [String] -> Bool -> Bool -> String -> [(Posn, String)]
+ Language.Preprocessor.Cpphs: cppIfdef :: FilePath -> [(String, String)] -> [String] -> BoolOptions -> String -> [(Posn, String)]
- Language.Preprocessor.Cpphs: macroPass :: [(String, String)] -> Bool -> Bool -> Bool -> Bool -> [(Posn, String)] -> String
+ Language.Preprocessor.Cpphs: macroPass :: [(String, String)] -> BoolOptions -> [(Posn, String)] -> String
- Language.Preprocessor.Cpphs: runCpphs :: [CpphsOption] -> FilePath -> String -> IO String
+ Language.Preprocessor.Cpphs: runCpphs :: CpphsOptions -> FilePath -> String -> String
Files
- CHANGELOG +7/−0
- Language/Preprocessor/Cpphs.hs +7/−2
- Language/Preprocessor/Cpphs/CppIfdef.hs +113/−76
- Language/Preprocessor/Cpphs/HashDefine.hs +11/−4
- Language/Preprocessor/Cpphs/MacroPass.hs +60/−45
- Language/Preprocessor/Cpphs/Options.hs +110/−31
- Language/Preprocessor/Cpphs/ReadFirst.hs +10/−19
- Language/Preprocessor/Cpphs/RunCpphs.hs +9/−17
- Language/Preprocessor/Cpphs/Tokenise.hs +18/−19
- Makefile +1/−1
- README +5/−4
- cpphs.cabal +2/−2
- cpphs.hs +28/−49
- docs/cpphs/Language-Preprocessor-Cpphs-CppIfdef.html +226/−0
- docs/cpphs/Language-Preprocessor-Cpphs-HashDefine.html +691/−0
- docs/cpphs/Language-Preprocessor-Cpphs-MacroPass.html +315/−0
- docs/cpphs/Language-Preprocessor-Cpphs-Options.html +647/−0
- docs/cpphs/Language-Preprocessor-Cpphs-Position.html +631/−0
- docs/cpphs/Language-Preprocessor-Cpphs-ReadFirst.html +216/−0
- docs/cpphs/Language-Preprocessor-Cpphs-RunCpphs.html +114/−0
- docs/cpphs/Language-Preprocessor-Cpphs-SymTab.html +432/−0
- docs/cpphs/Language-Preprocessor-Cpphs-Tokenise.html +508/−0
- docs/cpphs/Language-Preprocessor-Cpphs.html +856/−0
- docs/cpphs/Language-Preprocessor-Unlit.html +154/−0
- docs/cpphs/Language/Preprocessor/Cpphs.html +25/−0
- docs/cpphs/Language/Preprocessor/Cpphs/CppIfdef.html +267/−0
- docs/cpphs/Language/Preprocessor/Cpphs/HashDefine.html +108/−0
- docs/cpphs/Language/Preprocessor/Cpphs/MacroPass.html +129/−0
- docs/cpphs/Language/Preprocessor/Cpphs/Options.html +135/−0
- docs/cpphs/Language/Preprocessor/Cpphs/Position.html +81/−0
- docs/cpphs/Language/Preprocessor/Cpphs/ReadFirst.html +54/−0
- docs/cpphs/Language/Preprocessor/Cpphs/RunCpphs.html +26/−0
- docs/cpphs/Language/Preprocessor/Cpphs/SymTab.html +87/−0
- docs/cpphs/Language/Preprocessor/Cpphs/Tokenise.html +257/−0
- docs/cpphs/Language/Preprocessor/Unlit.html +71/−0
- docs/cpphs/Main.html +360/−0
- docs/cpphs/Text-ParserCombinators-HuttonMeijer.html +1563/−0
- docs/cpphs/Text/ParserCombinators/HuttonMeijer.html +219/−0
- docs/cpphs/cpphs.html +109/−0
- docs/cpphs/doc-index-43.html +146/−0
- docs/cpphs/doc-index-A.html +188/−0
- docs/cpphs/doc-index-B.html +180/−0
- docs/cpphs/doc-index-C.html +264/−0
- docs/cpphs/doc-index-D.html +216/−0
- docs/cpphs/doc-index-E.html +170/−0
- docs/cpphs/doc-index-F.html +154/−0
- docs/cpphs/doc-index-H.html +146/−0
- docs/cpphs/doc-index-I.html +230/−0
- docs/cpphs/doc-index-J.html +146/−0
- docs/cpphs/doc-index-L.html +234/−0
- docs/cpphs/doc-index-M.html +190/−0
- docs/cpphs/doc-index-N.html +194/−0
- docs/cpphs/doc-index-O.html +172/−0
- docs/cpphs/doc-index-P.html +230/−0
- docs/cpphs/doc-index-R.html +172/−0
- docs/cpphs/doc-index-S.html +240/−0
- docs/cpphs/doc-index-T.html +178/−0
- docs/cpphs/doc-index-U.html +154/−0
- docs/cpphs/doc-index-V.html +146/−0
- docs/cpphs/doc-index-W.html +156/−0
- docs/cpphs/doc-index.html +132/−0
- docs/cpphs/haddock.css +260/−0
- docs/cpphs/haddock.js +15/−0
- docs/cpphs/haskell_icon.gif binary
- docs/cpphs/index.html +255/−0
- docs/cpphs/minus.gif binary
- docs/cpphs/plus.gif binary
- docs/index.html +50/−20
- tests/expect10 +1/−2
- tests/expect15 +1/−2
- tests/expect15a +6/−0
- tests/expect22 +1/−2
- tests/expect27 +1/−1
- tests/expect32 +2/−0
- tests/expect33 +1/−0
- tests/expect34 +11/−0
- tests/expect35 +12/−0
- tests/expect36 +12/−0
- tests/expect36a +12/−0
- tests/expect36b +13/−0
- tests/expect37 +11/−0
- tests/expect37a +11/−0
- tests/expect38 +8/−0
- tests/expect39 +5/−0
- tests/expect4 +1/−2
- tests/expect40 +8/−0
- tests/expect40a +7/−0
- tests/expect41 +6/−0
- tests/expect42 +5/−0
- tests/expect43 +6/−0
- tests/expect5 +0/−1
- tests/expect7 +2/−4
- tests/expect9 +1/−2
- tests/fasta +7/−0
- tests/fasta2 +6/−0
- tests/hashjoin +5/−0
- tests/igloo +10/−0
- tests/igloo2 +11/−0
- tests/igloo3 +11/−0
- tests/igloo3a +11/−0
- tests/igloo3b +12/−0
- tests/igloo4 +10/−0
- tests/igloo4a +10/−0
- tests/indirect-a +2/−0
- tests/mauke +7/−0
- tests/mauke2 +4/−0
- tests/param +5/−0
- tests/runtests +19/−2
- tests/tmp-cpp +48/−0
- tests/tmp-cpphs +45/−0
- tests/wrongline +4/−0
- tests/wrongline2 +4/−0
CHANGELOG view
@@ -1,3 +1,10 @@+Version 1.4+-----------+ * Added a "--pragma" option to retain #pragma in the output.+ * Fixed a number of obscure corner cases involving the interaction of+ multiple features e.g. foo##__LINE__.+ * Added the "--nowarn" option.+ Version 1.3 ----------- * Added a "--cpp" option for drop-in compatibility with standard cpp.
Language/Preprocessor/Cpphs.hs view
@@ -11,9 +11,14 @@ -- Include the interface that is exported ----------------------------------------------------------------------------- -module Language.Preprocessor.Cpphs (runCpphs, cppIfdef, macroPass, CpphsOption(..), parseOption) where+module Language.Preprocessor.Cpphs+ ( runCpphs, cppIfdef, macroPass, CpphsOptions(..), BoolOptions(..)+ , parseOptions, defaultCpphsOptions, defaultBoolOptions+ ) where import Language.Preprocessor.Cpphs.CppIfdef(cppIfdef) import Language.Preprocessor.Cpphs.MacroPass(macroPass) import Language.Preprocessor.Cpphs.RunCpphs(runCpphs)-import Language.Preprocessor.Cpphs.Options(CpphsOption(..), parseOption)+import Language.Preprocessor.Cpphs.Options+ (CpphsOptions(..), BoolOptions(..), parseOptions+ ,defaultCpphsOptions,defaultBoolOptions)
Language/Preprocessor/Cpphs/CppIfdef.hs view
@@ -13,7 +13,7 @@ ----------------------------------------------------------------------------- module Language.Preprocessor.Cpphs.CppIfdef- ( cppIfdef -- :: FilePath -> [(String,String)] -> [String] -> Bool -> Bool+ ( cppIfdef -- :: FilePath -> [(String,String)] -> [String] -> Options -- -> String -> [(Posn,String)] ) where @@ -21,31 +21,36 @@ import Language.Preprocessor.Cpphs.SymTab import Text.ParserCombinators.HuttonMeijer -- import HashDefine-import Language.Preprocessor.Cpphs.Position (Posn,newfile,newline,newlines,cppline,newpos)+import Language.Preprocessor.Cpphs.Position (Posn,newfile,newline,newlines+ ,cppline,newpos) import Language.Preprocessor.Cpphs.ReadFirst (readFirst) import Language.Preprocessor.Cpphs.Tokenise (linesCpp,reslash)+import Language.Preprocessor.Cpphs.Options (BoolOptions(..))+import Language.Preprocessor.Cpphs.HashDefine(HashDefine(..),parseHashDefine+ ,expandMacro)+import Language.Preprocessor.Cpphs.MacroPass (preDefine,defineMacro) import Char (isDigit) import Numeric (readHex,readOct,readDec) import System.IO.Unsafe (unsafePerformIO) import IO (hPutStrLn,stderr) + -- | Run a first pass of cpp, evaluating \#ifdef's and processing \#include's, -- whilst taking account of \#define's and \#undef's as we encounter them. cppIfdef :: FilePath -- ^ File for error reports -> [(String,String)] -- ^ Pre-defined symbols and their values -> [String] -- ^ Search path for \#includes- -> Bool -- ^ Leave \#define and \#undef in output?- -> Bool -- ^ Place \#line droppings in output?+ -> BoolOptions -- ^ Options controlling output style -> String -- ^ The input file content -> [(Posn,String)] -- ^ The file after processing (in lines)-cppIfdef fp syms search leave locat =- cpp posn defs search leave locat Keep . (cppline posn:) . linesCpp+cppIfdef fp syms search options =+ cpp posn defs search options Keep . (cppline posn:) . linesCpp where posn = newfile fp- defs = foldr insertST emptyST syms--- Notice that the symbol table is a very simple one mapping strings--- to strings. This pass does not need anything more elaborate, in--- particular it is not required to deal with any parameterised macros.+ defs = preDefine options syms+-- Previous versions had a very simple symbol table mapping strings+-- to strings. Now the #ifdef pass uses a more elaborate table, in+-- particular to deal with parameterised macros in conditionals. -- | Internal state for whether lines are being kept or dropped.@@ -55,62 +60,66 @@ data KeepState = Keep | Drop Int Bool -- | Return just the list of lines that the real cpp would decide to keep.-cpp :: Posn -> SymTab String -> [String] -> Bool -> Bool -> KeepState+cpp :: Posn -> SymTab HashDefine -> [String] -> BoolOptions -> KeepState -> [String] -> [(Posn,String)]-cpp _ _ _ _ _ _ [] = []+cpp _ _ _ _ _ [] = [] -cpp p syms path leave ln Keep (l@('#':x):xs) =+cpp p syms path options Keep (l@('#':x):xs) = let ws = words x cmd = head ws- sym = head (tail ws)+ line = tail ws+ sym = head (tail ws) rest = tail (tail ws)- val = maybe "1" id (un rest)+ def = defineMacro options (sym++" "++ maybe "1" id (un rest)) un v = if null v then Nothing else Just (unwords v)- down = if definedST sym syms then (Drop 1 False) else Keep- up = if definedST sym syms then Keep else (Drop 1 False)- keep str = if gatherDefined p syms str then Keep else (Drop 1 False)- skipn cpp' p' syms' path' ud xs' =+ keepIf p = if p then Keep else (Drop 1 False)+ skipn syms' ud xs' = let n = 1 + length (filter (=='\n') l) in- (if leave then ((p,reslash l):) else (replicate n (p,"") ++)) $- cpp' (newlines n p') syms' path' leave ln ud xs'+ (if macros options then ((p,reslash l):)+ else (replicate n (p,"") ++)) $+ cpp (newlines n p) syms' path options ud xs' in case cmd of- "define" -> skipn cpp p (insertST (sym,val) syms) path Keep xs- "undef" -> skipn cpp p (deleteST sym syms) path Keep xs- "ifndef" -> skipn cpp p syms path down xs- "ifdef" -> skipn cpp p syms path up xs- "if" -> skipn cpp p syms path (keep (unwords (tail ws))) xs- "else" -> skipn cpp p syms path (Drop 1 False) xs- "elif" -> skipn cpp p syms path (Drop 1 True) xs- "endif" -> skipn cpp p syms path Keep xs- "pragma" -> skipn cpp p syms path Keep xs- ('!':_) -> skipn cpp p syms path Keep xs -- \#!runhs scripts+ "define" -> skipn (insertST def syms) Keep xs+ "undef" -> skipn (deleteST sym syms) Keep xs+ "ifndef" -> skipn syms (keepIf (not (definedST sym syms))) xs+ "ifdef" -> skipn syms (keepIf (definedST sym syms)) xs+ "if" -> skipn syms (keepIf (gatherDefined p syms (unwords line))) xs+ "else" -> skipn syms (Drop 1 False) xs+ "elif" -> skipn syms (Drop 1 True) xs+ "endif" -> skipn syms Keep xs+ "pragma" -> skipn syms Keep xs+ ('!':_) -> skipn syms Keep xs -- \#!runhs scripts "include"-> let (inc,content) =- unsafePerformIO (readFirst (unwords (tail ws))- p path syms)+ unsafePerformIO (readFirst (file syms (unwords line))+ p path+ (warnings options)) in- cpp p syms path leave ln Keep (("#line 1 "++show inc)+ cpp p syms path options Keep (("#line 1 "++show inc) : linesCpp content- ++ cppline p :"": xs)- "warning"-> unsafePerformIO $ do+ ++ cppline (newline p): xs)+ "warning"-> if warnings options then unsafePerformIO $ do hPutStrLn stderr (l++"\nin "++show p)- return $ skipn cpp p syms path Keep xs+ return $ skipn syms Keep xs+ else skipn syms Keep xs "error" -> error (l++"\nin "++show p) "line" | all isDigit sym- -> (if ln then ((p,l):) else id) $+ -> (if locations options then ((p,l):) else id) $ cpp (newpos (read sym) (un rest) p)- syms path leave ln Keep xs+ syms path options Keep xs n | all isDigit n- -> (if ln then ((p,l):) else id) $+ -> (if locations options then ((p,l):) else id) $ cpp (newpos (read n) (un (tail ws)) p)- syms path leave ln Keep xs+ syms path options Keep xs | otherwise- -> unsafePerformIO $ do+ -> if warnings options then unsafePerformIO $ do hPutStrLn stderr ("Warning: unknown directive #"++n ++"\nin "++show p) return $- ((p,l): cpp (newline p) syms path leave ln Keep xs)+ ((p,l): cpp (newline p) syms path options Keep xs)+ else+ ((p,l): cpp (newline p) syms path options Keep xs) -cpp p syms path leave ln (Drop n b) (('#':x):xs) =+cpp p syms path options (Drop n b) (('#':x):xs) = let ws = words x cmd = head ws delse | n==1 && b = Drop 1 b@@ -118,41 +127,40 @@ | otherwise = Drop n b dend | n==1 = Keep | otherwise = Drop (n-1) b- keep str | n==1 = if not b && gatherDefined p syms str then Keep- else (Drop 1) b+ delif s | n==1 && not b && gatherDefined p syms s+ = Keep | otherwise = Drop n b- skipn cpp' p' syms' path' ud xs' =+ skipn ud xs' = let n' = 1 + length (filter (=='\n') x) in replicate n' (p,"")- ++ cpp' (newlines n' p') syms' path' leave ln ud xs'+ ++ cpp (newlines n' p) syms path options ud xs' in if cmd == "ifndef" || cmd == "if" ||- cmd == "ifdef" then skipn cpp p syms path (Drop (n+1) b) xs- else if cmd == "elif" then skipn cpp p syms path- (keep (unwords (tail ws))) xs- else if cmd == "else" then skipn cpp p syms path delse xs- else if cmd == "endif" then skipn cpp p syms path dend xs- else skipn cpp p syms path (Drop n b) xs+ cmd == "ifdef" then skipn (Drop (n+1) b) xs+ else if cmd == "elif" then skipn (delif (unwords (tail ws))) xs+ else if cmd == "else" then skipn delse xs+ else if cmd == "endif" then skipn dend xs+ else skipn (Drop n b) xs -- define, undef, include, error, warning, pragma, line -cpp p syms path leave ln Keep (x:xs) =+cpp p syms path options Keep (x:xs) = let p' = newline p in seq p' $- (p,x): cpp p' syms path leave ln Keep xs-cpp p syms path leave ln d@(Drop _ _) (_:xs) =+ (p,x): cpp p' syms path options Keep xs+cpp p syms path options d@(Drop _ _) (_:xs) = let p' = newline p in seq p' $- (p,""): cpp p' syms path leave ln d xs+ (p,""): cpp p' syms path options d xs -----gatherDefined :: Posn -> SymTab String -> String -> Bool+gatherDefined :: Posn -> SymTab HashDefine -> String -> Bool gatherDefined p st inp = case papply (parseBoolExp st) inp of [] -> error ("Cannot parse #if directive in file "++show p) [(b,_)] -> b _ -> error ("Ambiguous parse for #if directive in file "++show p) -parseBoolExp :: SymTab String -> Parser Bool+parseBoolExp :: SymTab HashDefine -> Parser Bool parseBoolExp st = do a <- parseExp1 st skip (string "||")@@ -161,7 +169,7 @@ +++ parseExp1 st -parseExp1 :: SymTab String -> Parser Bool+parseExp1 :: SymTab HashDefine -> Parser Bool parseExp1 st = do a <- parseExp0 st skip (string "&&")@@ -170,34 +178,28 @@ +++ parseExp0 st -parseExp0 :: SymTab String -> Parser Bool+parseExp0 :: SymTab HashDefine -> Parser Bool parseExp0 st = do skip (string "defined")- sym <- bracket (skip (char '(')) (skip (many1 alphanum)) (skip (char ')'))+ sym <- parens parseSym return (definedST sym st) +++- do bracket (skip (char '(')) (parseBoolExp st) (skip (char ')'))+ do parens (parseBoolExp st) +++ do skip (char '!') a <- parseExp0 st return (not a) +++- do sym1 <- skip (many1 alphanum)+ do sym1 <- parseSymOrCall st op <- parseOp st- sym2 <- skip (many1 alphanum)- let val1 = convert sym1 st- let val2 = convert sym2 st- return (op val1 val2)+ sym2 <- parseSymOrCall st+ return (op (safeRead sym1) (safeRead sym2)) +++- do sym <- skip (many1 alphanum)- case convert sym st of+ do sym <- parseSymOrCall st+ case safeRead sym of 0 -> return False _ -> return True where- convert sym st' =- case lookupST sym st' of- Nothing -> safeRead sym- (Just a) -> safeRead a safeRead s = case s of '0':'x':s' -> number readHex s'@@ -208,7 +210,7 @@ [] -> 0 :: Integer ((n,_):_) -> n :: Integer -parseOp :: SymTab String -> Parser (Integer -> Integer -> Bool)+parseOp :: SymTab HashDefine -> Parser (Integer -> Integer -> Bool) parseOp _ = do skip (string ">=") return (>=)@@ -227,3 +229,38 @@ +++ do skip (string "!=") return (/=)++parseSymOrCall :: SymTab HashDefine -> Parser String+parseSymOrCall st =+ do sym <- skip parseSym+ args <- parens (parseSymOrCall st `sepby` skip (char ','))+ return (convert sym args)+ ++++ do sym <- skip parseSym+ return (convert sym [])+ where+ convert sym args =+ case lookupST sym st of+ Nothing -> sym+ Just (a@SymbolReplacement{}) -> recursivelyExpand st (replacement a)+ Just (a@MacroExpansion{}) -> expandMacro a args False++recursivelyExpand :: SymTab HashDefine -> String -> String+recursivelyExpand st inp =+ case papply (parseSymOrCall st) inp of+ [(b,_)] -> b+ _ -> inp++parseSym :: Parser String+parseSym = many1 (alphanum+++char '\''+++char '`')++parens p = bracket (skip (char '(')) (skip p) (skip (char ')'))++-- | Determine filename in \#include+file :: SymTab HashDefine -> String -> String+file st name =+ case name of+ ('"':ns) -> init ns+ ('<':ns) -> init ns+ _ -> let ex = recursivelyExpand st name in+ if ex == name then name else file st ex
Language/Preprocessor/Cpphs/HashDefine.hs view
@@ -24,6 +24,8 @@ data HashDefine = LineDrop { name :: String }+ | Pragma+ { name :: String } | SymbolReplacement { name :: String , replacement :: String@@ -68,15 +70,17 @@ | otherwise = xss skip [] = [] command ("line":xs) = Just (LineDrop ("#line"++concat xs))+ command ("pragma":xs) = Just (Pragma ("#pragma"++concat xs)) command ("define":xs) = Just (((define . skip) xs) { linebreaks=count def }) command ("undef":xs) = Just (((undef . skip) xs) { linebreaks=count def }) command _ = Nothing undef (sym:_) = symbolReplacement { name=sym, replacement=sym } define (sym:xs) = case {-skip-} xs of ("(":ys) -> (macroHead sym [] . skip) ys- ys -> symbolReplacement- { name=sym- , replacement=chop (skip ys) }+ ys -> symbolReplacement+ { name=sym+ , replacement = concatMap snd+ (classifyRhs [] (chop (skip ys))) } macroHead sym args (",":xs) = (macroHead sym args . skip) xs macroHead sym args (")":xs) = MacroExpansion { name =sym , arguments = reverse args@@ -91,10 +95,13 @@ x `elem` args = (Str,x): classifyRhs args xs classifyRhs args ("##":xs) | ansi = classifyRhs args xs+ classifyRhs args (s:"##":s':xs)+ | ansi && all isSpace s && all isSpace s'+ = classifyRhs args xs classifyRhs args (word:xs) | word `elem` args = (Arg,word): classifyRhs args xs | otherwise = (Text,word): classifyRhs args xs classifyRhs _ [] = [] count = length . filter (=='\n') . concat- chop = concat . reverse . dropWhile (all isSpace) . reverse+ chop = reverse . dropWhile (all isSpace) . reverse
Language/Preprocessor/Cpphs/MacroPass.hs view
@@ -15,12 +15,16 @@ module Language.Preprocessor.Cpphs.MacroPass ( macroPass , preDefine+ , defineMacro ) where import Language.Preprocessor.Cpphs.HashDefine (HashDefine(..), expandMacro)-import Language.Preprocessor.Cpphs.Tokenise (tokenise, WordStyle(..), parseMacroCall)-import Language.Preprocessor.Cpphs.SymTab (SymTab, lookupST, insertST, emptyST)+import Language.Preprocessor.Cpphs.Tokenise (tokenise, WordStyle(..)+ , parseMacroCall)+import Language.Preprocessor.Cpphs.SymTab (SymTab, lookupST, insertST+ , emptyST) import Language.Preprocessor.Cpphs.Position (Posn, newfile, filename, lineno)+import Language.Preprocessor.Cpphs.Options (BoolOptions(..)) import System.IO.Unsafe (unsafePerformIO) import Time (getClockTime, toCalendarTime, formatCalendarTime) import Locale (defaultTimeLocale)@@ -28,19 +32,17 @@ noPos :: Posn noPos = newfile "preDefined" --- | Walk through the document, replacing calls of macros with their expanded RHS.+-- | Walk through the document, replacing calls of macros with the expanded RHS. macroPass :: [(String,String)] -- ^ Pre-defined symbols and their values- -> Bool -- ^ Strip C-comments?- -> Bool -- ^ Accept \# and \## operators?- -> Bool -- ^ Retain layout in macros?- -> Bool -- ^ Input language (Haskell\/not)+ -> BoolOptions -- ^ Options that alter processing style -> [(Posn,String)] -- ^ The input file content -> String -- ^ The file after processing-macroPass syms strip hashes layout language =+macroPass syms options = safetail -- to remove extra "\n" inserted below . concat- . macroProcess layout language (preDefine hashes language syms)- . tokenise strip hashes language+ . macroProcess (pragma options) (layout options) (lang options)+ (preDefine options syms)+ . tokenise (strip options) (ansi options) (lang options) . ((noPos,""):) -- ensure recognition of "\n#" at start of file where safetail [] = []@@ -48,16 +50,19 @@ -- | Turn command-line definitions (from @-D@) into 'HashDefine's.-preDefine :: Bool -> Bool -> [(String,String)] -> SymTab HashDefine-preDefine hashes lang defines =- foldr (insertST.defval) emptyST defines- where- defval (s,d) =- let (Cmd (Just hd):_) = tokenise True hashes lang- [(noPos,"\n#define "++s++" "++d++"\n")]- in (name hd, hd)+preDefine :: BoolOptions -> [(String,String)] -> SymTab HashDefine+preDefine options defines =+ foldr (insertST . defineMacro options . (\ (s,d)-> s++" "++d))+ emptyST defines +-- | Turn a string representing a macro definition into a 'HashDefine'.+defineMacro :: BoolOptions -> String -> (String,HashDefine)+defineMacro opts s =+ let (Cmd (Just hd):_) = tokenise True (ansi opts) (lang opts)+ [(noPos,"\n#define "++s++"\n")]+ in (name hd, hd) + -- | Trundle through the document, one word at a time, using the WordStyle -- classification introduced by 'tokenise' to decide whether to expand a -- word or macro. Encountering a \#define or \#undef causes that symbol to@@ -65,49 +70,59 @@ -- are discarded and replaced with blanks, except for \#line markers. -- All valid identifiers are checked for the presence of a definition -- of that name in the symbol table, and if so, expanded appropriately.-macroProcess :: Bool -> Bool -> SymTab HashDefine -> [WordStyle] -> [String]-macroProcess _ _ _ [] = []-macroProcess y l st (Other x: ws) = x: macroProcess y l st ws-macroProcess y l st (Cmd Nothing: ws) = "\n": macroProcess y l st ws-macroProcess y l st (Cmd (Just (LineDrop x)): ws)= "\n":x:macroProcess y l st ws-macroProcess layout lang st (Cmd (Just hd): ws) =+-- (Bool arguments are: keep pragmas? retain layout? haskell language?)+macroProcess :: Bool -> Bool -> Bool -> SymTab HashDefine -> [WordStyle]+ -> [String]+macroProcess _ _ _ _ [] = []+macroProcess p y l st (Other x: ws) = x: macroProcess p y l st ws+macroProcess p y l st (Cmd Nothing: ws) = "\n": macroProcess p y l st ws+macroProcess p y l st (Cmd (Just (LineDrop x)): ws)+ = "\n":x:macroProcess p y l st ws+macroProcess pragma y l st (Cmd (Just (Pragma x)): ws)+ | pragma = "\n":x:macroProcess pragma y l st ws+ | otherwise = "\n": macroProcess pragma y l st ws+macroProcess p layout lang st (Cmd (Just hd): ws) = let n = 1 + linebreaks hd in- replicate n "\n" ++ macroProcess layout lang (insertST (name hd, hd) st) ws-macroProcess layout lang st (Ident p x: ws) =+ replicate n "\n" ++macroProcess p layout lang (insertST (name hd, hd) st) ws+macroProcess pr layout lang st (Ident p x: ws) = case x of- "__FILE__" -> show (filename p): macroProcess layout lang st ws- "__LINE__" -> show (lineno p): macroProcess layout lang st ws+ "__FILE__" -> show (filename p): macroProcess pr layout lang st ws+ "__LINE__" -> show (lineno p): macroProcess pr layout lang st ws "__DATE__" -> formatCalendarTime defaultTimeLocale "\"%d %b %Y\"" (unsafePerformIO (getClockTime>>=toCalendarTime)):- macroProcess layout lang st ws+ macroProcess pr layout lang st ws "__TIME__" -> formatCalendarTime defaultTimeLocale "\"%H:%M:%S\"" (unsafePerformIO (getClockTime>>=toCalendarTime)):- macroProcess layout lang st ws+ macroProcess pr layout lang st ws _ -> case lookupST x st of- Nothing -> x: macroProcess layout lang st ws+ Nothing -> x: macroProcess pr layout lang st ws Just hd -> case hd of- SymbolReplacement _ r _ ->+ SymbolReplacement {replacement=r} ->+ let r' = if layout then r else filter (/='\n') r in -- one-level expansion only:- -- r: macroProcess layout st ws+ -- r' : macroProcess layout st ws -- multi-level expansion:- let r' = if layout then r else filter (/='\n') r in- macroProcess layout lang st+ macroProcess pr layout lang st (tokenise True False lang [(p,r')] ++ ws)- MacroExpansion _ _ _ _ ->- case parseMacroCall ws of- Nothing -> x: macroProcess layout lang st ws+ MacroExpansion {} ->+ case parseMacroCall p ws of+ Nothing -> x: macroProcess pr layout lang st ws Just (args,ws') -> if length args /= length (arguments hd) then- x: macroProcess layout lang st ws- else -- one-level expansion only:- -- expandMacro hd args layout:+ x: macroProcess pr layout lang st ws+ else let args' = map (concat+ . macroProcess pr layout+ lang st)+ args in+ -- one-level expansion only:+ -- expandMacro hd args' layout: -- macroProcess layout st ws' -- multi-level expansion:- macroProcess layout lang st- (tokenise True False lang- [(p,expandMacro hd args layout)]- ++ ws')+ macroProcess pr layout lang st+ (tokenise True False lang+ [(p,expandMacro hd args' layout)]+ ++ ws')
Language/Preprocessor/Cpphs/Options.hs view
@@ -11,45 +11,124 @@ -- This module deals with Cpphs options and parsing them ----------------------------------------------------------------------------- -module Language.Preprocessor.Cpphs.Options(CpphsOption(..), parseOption) where+module Language.Preprocessor.Cpphs.Options+ ( CpphsOptions(..)+ , BoolOptions(..)+ , parseOptions+ , defaultCpphsOptions+ , defaultBoolOptions+ ) where import Maybe -data CpphsOption- = CpphsNoMacro- | CpphsNoLine- | CpphsText- | CpphsStrip- | CpphsAnsi- | CpphsLayout- | CpphsUnlit- | CpphsMacro (String,String)- | CpphsPath String+-- | Cpphs options structure.+data CpphsOptions = CpphsOptions + { infiles :: [FilePath]+ , outfiles :: [FilePath]+ , defines :: [(String,String)]+ , includes :: [String]+ , boolopts :: BoolOptions+ }++-- | Default options.+defaultCpphsOptions :: CpphsOptions+defaultCpphsOptions = CpphsOptions { infiles = [], outfiles = []+ , defines = [], includes = []+ , boolopts = defaultBoolOptions }++-- | Options representable as Booleans.+data BoolOptions = BoolOptions+ { macros :: Bool -- ^ Leave \#define and \#undef in output of ifdef?+ , locations :: Bool -- ^ Place \#line droppings in output?+ , pragma :: Bool -- ^ Keep \#pragma in final output?+ , strip :: Bool -- ^ Remove C comments everywhere?+ , lang :: Bool -- ^ Lex input as Haskell code?+ , ansi :: Bool -- ^ Permit stringise # and catenate ## operators?+ , layout :: Bool -- ^ Retain newlines in macro expansions?+ , literate :: Bool -- ^ Remove literate markup?+ , warnings :: Bool -- ^ Issue warnings?+ }++-- | Default settings of boolean options.+defaultBoolOptions :: BoolOptions+defaultBoolOptions = BoolOptions { macros = True, locations = True+ , pragma = False, strip = False+ , lang = True, ansi = False+ , layout = False, literate = False+ , warnings = True }++-- | Raw command-line options. This is an internal intermediate data+-- structure, used during option parsing only.+data RawOption+ = NoMacro+ | NoLine+ | Pragma+ | Text+ | Strip+ | Ansi+ | Layout+ | Unlit+ | SuppressWarnings+ | Macro (String,String)+ | Path String deriving (Eq, Show)- - -flags :: [(String, CpphsOption)]-flags = [ ("--nomacro", CpphsNoMacro)- , ("--noline", CpphsNoLine)- , ("--text", CpphsText)- , ("--strip", CpphsStrip)- , ("--hashes", CpphsAnsi)- , ("--layout", CpphsLayout)- , ("--unlit", CpphsUnlit)- ] +flags :: [(String, RawOption)]+flags = [ ("--nomacro", NoMacro)+ , ("--noline", NoLine)+ , ("--pragma", Pragma)+ , ("--text", Text)+ , ("--strip", Strip)+ , ("--hashes", Ansi)+ , ("--layout", Layout)+ , ("--unlit", Unlit)+ , ("--nowarn", SuppressWarnings)+ ] -parseOption :: String -> Maybe CpphsOption-parseOption x | isJust a = Just $ fromJust a+-- | Parse a single raw command-line option. Parse failure is indicated by+-- result Nothing.+rawOption :: String -> Maybe RawOption+rawOption x | isJust a = a where a = lookup x flags--parseOption ('-':'D':xs) = Just $ CpphsMacro (s, if null d then "1" else tail d)+rawOption ('-':'D':xs) = Just $ Macro (s, if null d then "1" else tail d) where (s,d) = break (=='=') xs- -parseOption ('-':'I':xs) = Just $ CpphsPath $ trail "/\\" xs+rawOption ('-':'I':xs) = Just $ Path $ trailing "/\\" xs+rawOption _ = Nothing -parseOption _ = Nothing+trailing :: (Eq a) => [a] -> [a] -> [a]+trailing xs = reverse . dropWhile (`elem`xs) . reverse -trail :: (Eq a) => [a] -> [a] -> [a]-trail xs = reverse . dropWhile (`elem`xs) . reverse+-- | Convert a list of RawOption to a BoolOptions structure.+boolOpts :: [RawOption] -> BoolOptions+boolOpts opts =+ BoolOptions+ { macros = not (NoMacro `elem` opts)+ , locations = not (NoLine `elem` opts)+ , pragma = Pragma `elem` opts+ , strip = Strip `elem` opts+ , lang = not (Text `elem` opts)+ , ansi = Ansi `elem` opts+ , layout = Layout `elem` opts+ , literate = Unlit `elem` opts+ , warnings = not (SuppressWarnings `elem` opts)+ } +-- | Parse all command-line options.+parseOptions :: [String] -> Either String CpphsOptions+parseOptions xs = f ([], [], []) xs+ where+ f (opts, ins, outs) (('-':'O':x):xs) = f (opts, ins, x:outs) xs+ f (opts, ins, outs) (x@('-':_):xs) = case rawOption x of+ Nothing -> Left x+ Just a -> f (a:opts, ins, outs) xs+ f (opts, ins, outs) (x:xs) = f (opts, normalise x:ins, outs) xs+ f (opts, ins, outs) [] =+ Right CpphsOptions { infiles = reverse ins+ , outfiles = reverse outs+ , defines = [ x | Macro x <- reverse opts ]+ , includes = [ x | Path x <- reverse opts ]+ , boolopts = boolOpts opts+ }+ normalise ('/':'/':filepath) = normalise ('/':filepath)+ normalise (x:filepath) = x:normalise filepath+ normalise [] = []
Language/Preprocessor/Cpphs/ReadFirst.hs view
@@ -18,8 +18,8 @@ import IO (hPutStrLn, stderr) import Directory (doesFileExist) import List (intersperse)+import Monad (when) import Language.Preprocessor.Cpphs.Position (Posn,directory)-import Language.Preprocessor.Cpphs.SymTab (SymTab,lookupST) -- | Attempt to read the given file from any location within the search path. -- The first location found is returned, together with the file content.@@ -28,35 +28,26 @@ readFirst :: String -- ^ filename -> Posn -- ^ inclusion point -> [String] -- ^ search path- -> SymTab String -- ^ \#defined symbols+ -> Bool -- ^ report warnings? -> IO ( FilePath , String ) -- ^ discovered filepath, and file contents -readFirst name demand path syms =+readFirst name demand path warn = try (cons dd (".":path)) where dd = directory demand cons x xs = if null x then xs else x:xs- realname = real name syms try [] = do- hPutStrLn stderr ("Warning: Can't find file \""++realname- ++"\" in directories\n\t"- ++concat (intersperse "\n\t" (cons dd (".":path)))- ++"\n Asked for by: "++show demand)- return ("missing file: "++realname,"")+ when warn $+ hPutStrLn stderr ("Warning: Can't find file \""++name+ ++"\" in directories\n\t"+ ++concat (intersperse "\n\t" (cons dd (".":path)))+ ++"\n Asked for by: "++show demand)+ return ("missing file: "++name,"") try (p:ps) = do- let file = p++'/':realname+ let file = p++'/':name ok <- doesFileExist file if not ok then try ps else do content <- readFile file return (file,content)--real :: String -> SymTab String -> String-real name syms = case name of- ('"':ns) -> init ns- ('<':ns) -> init ns- _ -> case lookupST name syms of- Nothing -> name- Just f -> real f syms-
Language/Preprocessor/Cpphs/RunCpphs.hs view
@@ -9,25 +9,17 @@ import Language.Preprocessor.Cpphs.CppIfdef (cppIfdef) import Language.Preprocessor.Cpphs.MacroPass(macroPass)-import Language.Preprocessor.Cpphs.Options(CpphsOption(..), parseOption)+import Language.Preprocessor.Cpphs.Options (CpphsOptions(..), BoolOptions(..)) import Language.Preprocessor.Unlit as Unlit (unlit) -runCpphs :: [CpphsOption] -> FilePath -> String -> IO String-runCpphs opts filename input = do- let ds = [x | CpphsMacro x <- opts]- is = [x | CpphsPath x <- opts]- macro = not (CpphsNoMacro `elem` opts)- locat = not (CpphsNoLine `elem` opts)- lang = not (CpphsText `elem` opts)- strip = CpphsStrip `elem` opts- ansi = CpphsAnsi `elem` opts- layout= CpphsLayout `elem` opts- unlit = CpphsUnlit `elem` opts+runCpphs :: CpphsOptions -> FilePath -> String -> String+runCpphs options filename input =+ let bools = boolopts options - let pass1 = cppIfdef filename ds is macro locat input- pass2 = macroPass ds strip ansi layout lang pass1- result = if not macro then unlines (map snd pass1) else pass2- pass3 = if unlit then Unlit.unlit filename result else result+ pass1 = cppIfdef filename (defines options) (includes options) bools input+ pass2 = macroPass (defines options) bools pass1+ result= if not (macros bools) then unlines (map snd pass1) else pass2+ pass3 = if literate bools then Unlit.unlit filename else id - return pass3+ in pass3 result
Language/Preprocessor/Cpphs/Tokenise.hs view
@@ -120,9 +120,8 @@ haskell pre@(Pred pred ws) acc p ls (x:xs) | pred x = haskell pre (x:acc) p ls xs- | otherwise = ws p (reverse acc):- haskell Any [] p ls (x:xs)- haskell (Pred _ ws) acc p [] [] = ws p (reverse acc): []+ haskell (Pred _ ws) acc p ls xs = ws p (reverse acc):+ haskell Any [] p ls xs haskell (String c) acc p ls ('\\':x:xs) | x=='\\' = haskell (String c) ('\\':'\\':acc) p ls xs | x==c = haskell (String c) (c:'\\':acc) p ls xs@@ -176,8 +175,7 @@ | otherwise = lexcpp Any (x:w) l ls xs lexcpp pre@(Pred pred _) w l ls (x:xs) | pred x = lexcpp pre (x:w) l ls xs- | otherwise = lexcpp Any [] (w*/*l) ls (x:xs)- lexcpp (Pred _ _) w l [] [] = lexcpp Any [] (w*/*l) [] "\n"+ lexcpp (Pred _ _) w l ls xs = lexcpp Any [] (w*/*l) ls xs lexcpp (String c) w l ls ('\\':x:xs) | x=='\\' = lexcpp (String c) ('\\':'\\':w) l ls xs | x==c = lexcpp (String c) (c:'\\':w) l ls xs@@ -194,7 +192,7 @@ = lexcpp Any [] (w*/*l) ls xs lexcpp (NestComment n) w l ls (_:xs) = lexcpp (NestComment n) (' ':w) l ls xs- lexcpp mode w l ((p,l'):ls) [] = cpp mode next w l pos ls ('\n':l')+ lexcpp mode w l ((p,l'):ls) [] = cpp mode next w l p ls ('\n':l') lexcpp _ _ _ [] [] = [] -- rules to lex non-Haskell, non-cpp text@@ -215,9 +213,8 @@ plaintext Any acc p ls (x:xs) = plaintext Any (x:acc) p ls xs plaintext pre@(Pred pred ws) acc p ls (x:xs) | pred x = plaintext pre (x:acc) p ls xs- | otherwise = ws p (reverse acc):- plaintext Any [] p ls (x:xs)- plaintext (Pred _ ws) acc p [] [] = ws p (reverse acc): []+ plaintext (Pred _ ws) acc p ls xs = ws p (reverse acc):+ plaintext Any [] p ls xs plaintext CComment acc p ls ('*':'/':xs) = emit (" "++acc) $ plaintext Any [] p ls xs plaintext CComment acc p ls (_:xs) = plaintext CComment (' ':acc) p ls xs@@ -236,22 +233,24 @@ -- add a reversed word to the accumulator "" */* l = l w */* l = reverse w : l+ -- help out broken Haskell compilers which need balanced numbers of C+ -- comments in order to do import chasing :-) -----> */* -- | Parse a possible macro call, returning argument list and remaining input-parseMacroCall :: [WordStyle] -> Maybe ([String],[WordStyle])-parseMacroCall = call . skip+parseMacroCall :: Posn -> [WordStyle] -> Maybe ([[WordStyle]],[WordStyle])+parseMacroCall p = call . skip where skip (Other x:xs) | all isSpace x = skip xs skip xss = xss call (Other "(":xs) = (args (0::Int) [] [] . skip) xs call _ = Nothing- args 0 w acc (Other ",":xs) = args 0 [] (addone w acc) (skip xs)- args n w acc (Other "(":xs) = args (n+1) ("(":w) acc xs- args 0 w acc (Other ")":xs) = Just (reverse (addone w acc), xs)- args n w acc (Other ")":xs) = args (n-1) (")":w) acc xs- args n w acc (Ident _ var:xs) = args n (var:w) acc xs- args n w acc (Other var:xs) = args n (var:w) acc xs- args _ _ _ _ = Nothing- addone w acc = concat (reverse (dropWhile (all isSpace) w)): acc+ args 0 w acc ( Other ")" :xs) = Just (reverse (addone w acc), xs)+ args 0 w acc ( Other "," :xs) = args 0 [] (addone w acc) (skip xs)+ args n w acc (x@(Other "("):xs) = args (n+1) (x:w) acc xs+ args n w acc (x@(Other ")"):xs) = args (n-1) (x:w) acc xs+ args n w acc ( Ident _ v :xs) = args n (Ident p v:w) acc xs+ args n w acc (x@(Other _) :xs) = args n (x:w) acc xs+ args _ _ _ _ = Nothing+ addone w acc = reverse (skip w): acc
Makefile view
@@ -1,5 +1,5 @@ LIBRARY = cpphs-VERSION = 1.3+VERSION = 1.5 DIRS = Language/Preprocessor/Cpphs \ Text/ParserCombinators
README view
@@ -1,5 +1,5 @@-This directory contains 'cpphs', a simplified re-implementation of cpp,-the C pre-processor, in Haskell.+This directory contains 'cpphs', a simplified but robust+re-implementation of cpp, the C pre-processor, in Haskell. TO BUILD --------@@ -14,7 +14,8 @@ USAGE ----- cpphs [filename | -Dsym | -Dsym=val | -Ipath]+ [-Ofile]- [--nomacro|--noline|--strip|--text|--hashes|--layout|--unlit]*+ [ --nomacro | --noline | --nowarn | --strip | --pragma |+ --text | --hashes | --layout | --unlit ]* [ --cpp compatopts ] For fuller details, see docs/index.html@@ -27,7 +28,7 @@ COPYRIGHT ----------Copyright (c) 2004-2006 Malcolm Wallace (Malcolm.Wallace@cs.york.ac.uk)+Copyright (c) 2004-2007 Malcolm Wallace (Malcolm.Wallace@cs.york.ac.uk) except for Text.ParserCombinators.HuttonMeijer (Copyright (c) 1995 Graham Hutton and Erik Meijer).
cpphs.cabal view
@@ -1,6 +1,6 @@ Name: cpphs-Version: 1.3-Copyright: 2004-6, Malcolm Wallace+Version: 1.5+Copyright: 2004-7, Malcolm Wallace Build-Depends: base, haskell98 License: LGPL License-File: LICENCE-LGPL
cpphs.hs view
@@ -13,15 +13,13 @@ import System ( getArgs, getProgName, exitWith, ExitCode(..) ) import Maybe-import Language.Preprocessor.Cpphs ( runCpphs, CpphsOption, parseOption )+import Language.Preprocessor.Cpphs ( runCpphs, CpphsOptions(..), parseOptions ) import IO ( stdout, IOMode(WriteMode), openFile, hPutStr, hFlush, hClose ) import Monad ( when ) import List ( isPrefixOf ) - version :: String-version = "1.3"-+version = "1.5" main :: IO () main = do@@ -35,48 +33,49 @@ when ("--help" `elem` args) (do putStrLn ("Usage: "++prog ++" [file ...] [ -Dsym | -Dsym=val | -Ipath ]* [-Ofile]\n"- ++"\t\t[--nomacro] [--noline] [--text]"- ++" [--strip] [--hashes] [--layout]"- ++" [--unlit] [--cpp]")+ ++"\t\t[--nomacro] [--noline] [--pragma] [--text]\n"+ ++"\t\t[--strip] [--hashes] [--layout] [--unlit]\n"+ ++"\t\t[ --cpp std-cpp-options ]") exitWith ExitSuccess) let parsedArgs = parseOptions args- Right (opts, ins, outs) = parsedArgs+ options = fromRight parsedArgs+ ins = infiles options+ outs = outfiles options out = listToMaybe outs when (isLeft parsedArgs)- (do putStrLn $ "Unknown option, for valid options try "- ++prog++" --help\n"++fromLeft parsedArgs+ (do putStrLn $ "Unknown option "++fromLeft parsedArgs+ ++", for valid options try "++prog++" --help\n" exitWith (ExitFailure 1)) when (length outs > 1) (do putStrLn $ "At most one output file (-O) can be specified" exitWith (ExitFailure 2))- if null ins then execute opts out Nothing- else mapM_ (execute opts out) (map Just ins)+ if null ins then execute options out Nothing+ else mapM_ (execute options out) (map Just ins) +-- | Execute the preprocessor.+-- If the filepath is Nothing then default to stdout\/stdin as appropriate.+execute :: CpphsOptions -> Maybe FilePath -> Maybe FilePath -> IO ()+execute opts ofile infile =+ let (filename, readIt) = case infile of+ Just x -> (x, readFile x)+ Nothing -> ("stdin", getContents)+ output Nothing x = do putStr x; hFlush stdout+ output (Just f) x = writeFile f x+ in do contents <- readIt+ output ofile (runCpphs opts filename contents) isLeft (Left _) = True isLeft _ = False -fromLeft (Left x) = x---- | Parse the list of options--- Return either Right (options, input files, output files)--- or Left invalid flag-parseOptions :: [String] -> Either String ([CpphsOption], [FilePath], [FilePath])-parseOptions xs = f ([], [], []) xs- where- f (opts, ins, outs) (('-':'O':x):xs) = f (opts, ins, x:outs) xs- f (opts, ins, outs) (x@('-':_):xs) = case parseOption x of- Nothing -> Left x- Just a -> f (a:opts, ins, outs) xs- f (opts, ins, outs) (x:xs) = f (opts, x:ins, outs) xs- f (opts, ins, outs) [] = Right (reverse opts, reverse ins, reverse outs)-+fromLeft (Left x) = x+fromRight (Right x) = x --- | Parse a list of options, remaining compatible with cpp if possible+-- | Convert commandline options to remain compatible with cpp. -- Based on a shell script cpphs.compat-data ConvertArgs = ConvertArgs {traditional :: Bool, strip :: Bool, infile :: String, outfile :: String}+data ConvertArgs = ConvertArgs { traditional, strip :: Bool+ , infile, outfile :: String } convertArgs :: [String] -> [String] convertArgs xs = f (ConvertArgs False True "-" "-") xs@@ -107,23 +106,3 @@ ["-O" ++ outfile e | outfile e /= "-"] ---- | Execute the preprocessor,--- using the given options; an output path; and an input path.--- If the filepath is Nothing then default to stdout\/stdin as appropriate.-execute :: [CpphsOption] -> Maybe FilePath -> Maybe FilePath -> IO ()-execute opts output input =- let (filename, action) =- case input of- Just x -> (x, readFile x)- Nothing -> ("stdin", getContents)- in- do contents <- action- result <- runCpphs opts filename contents- case output of- Nothing -> do putStr result- hFlush stdout- Just x -> do h <- openFile x WriteMode- hPutStr h result- hFlush h- hClose h
+ docs/cpphs/Language-Preprocessor-Cpphs-CppIfdef.html view
@@ -0,0 +1,226 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.CppIfdef</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/CppIfdef.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.CppIfdef</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Perform a cpp.first-pass, gathering #define's and evaluating #ifdef's.+ and #include's.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3AcppIfdef"+>cppIfdef</A+> :: FilePath -> [(String, String)] -> [String] -> <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> String -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AcppIfdef"+></A+><B+>cppIfdef</B+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/CppIfdef.html#cppIfdef"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="arg"+>:: FilePath</TD+><TD CLASS="rdoc"+>File for error reports+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(String, String)]</TD+><TD CLASS="rdoc"+>Pre-defined symbols and their values+</TD+></TR+><TR+><TD CLASS="arg"+>-> [String]</TD+><TD CLASS="rdoc"+>Search path for #includes+</TD+></TR+><TR+><TD CLASS="arg"+>-> <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+>Options controlling output style+</TD+></TR+><TR+><TD CLASS="arg"+>-> String</TD+><TD CLASS="rdoc"+>The input file content+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+><TD CLASS="rdoc"+>The file after processing (in lines)+</TD+></TR+><TR+><TD CLASS="ndoc" COLSPAN="2"+>Run a first pass of cpp, evaluating #ifdef's and processing #include's,+ whilst taking account of #define's and #undef's as we encounter them.+</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-HashDefine.html view
@@ -0,0 +1,691 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.HashDefine</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/HashDefine.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.HashDefine</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>What structures are declared in a #define.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3AHashDefine"+>HashDefine</A+> </TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+>= <A HREF="#v%3ALineDrop"+>LineDrop</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aname"+>name</A+> :: String</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3APragma"+>Pragma</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aname"+>name</A+> :: String</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3ASymbolReplacement"+>SymbolReplacement</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aname"+>name</A+> :: String</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Areplacement"+>replacement</A+> :: String</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alinebreaks"+>linebreaks</A+> :: Int</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3AMacroExpansion"+>MacroExpansion</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aname"+>name</A+> :: String</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aarguments"+>arguments</A+> :: [String]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aexpansion"+>expansion</A+> :: [(<A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AArgOrText"+>ArgOrText</A+>, String)]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alinebreaks"+>linebreaks</A+> :: Int</TD+></TR+></TABLE+>}</TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3AArgOrText"+>ArgOrText</A+> </TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+>= <A HREF="#v%3AArg"+>Arg</A+></TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3AText"+>Text</A+></TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3AStr"+>Str</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AexpandMacro"+>expandMacro</A+> :: <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+> -> [String] -> Bool -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AparseHashDefine"+>parseHashDefine</A+> :: Bool -> [String] -> Maybe <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3AHashDefine"+></A+><B+>HashDefine</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/HashDefine.html#HashDefine"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3ALineDrop"+></A+><B+>LineDrop</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Aname"+></A+><B+>name</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3APragma"+></A+><B+>Pragma</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Aname"+></A+><B+>name</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3ASymbolReplacement"+></A+><B+>SymbolReplacement</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Aname"+></A+><B+>name</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Areplacement"+></A+><B+>replacement</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alinebreaks"+></A+><B+>linebreaks</B+> :: Int</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3AMacroExpansion"+></A+><B+>MacroExpansion</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Aname"+></A+><B+>name</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aarguments"+></A+><B+>arguments</B+> :: [String]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aexpansion"+></A+><B+>expansion</B+> :: [(<A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AArgOrText"+>ArgOrText</A+>, String)]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alinebreaks"+></A+><B+>linebreaks</B+> :: Int</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:HashDefine')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:HashDefine" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Eq <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+></TR+><TR+><TD CLASS="decl"+>Show <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3AArgOrText"+></A+><B+>ArgOrText</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/HashDefine.html#ArgOrText"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Macro expansion text is divided into sections, each of which is classified+ as one of three kinds: a formal argument (Arg), plain text (Text),+ or a stringised formal argument (Str).+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3AArg"+></A+><B+>Arg</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3AText"+></A+><B+>Text</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3AStr"+></A+><B+>Str</B+></TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:ArgOrText')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:ArgOrText" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Eq <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AArgOrText"+>ArgOrText</A+></TD+></TR+><TR+><TD CLASS="decl"+>Show <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AArgOrText"+>ArgOrText</A+></TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AexpandMacro"+></A+><B+>expandMacro</B+> :: <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+> -> [String] -> Bool -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/HashDefine.html#expandMacro"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Expand an instance of a macro.+ Precondition: got a match on the macro name.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AparseHashDefine"+></A+><B+>parseHashDefine</B+> :: Bool -> [String] -> Maybe <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/HashDefine.html#parseHashDefine"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Parse a #define, or #undef, ignoring other # directives+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-MacroPass.html view
@@ -0,0 +1,315 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.MacroPass</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/MacroPass.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.MacroPass</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Perform a cpp.second-pass, accumulating #define's and #undef's,+ whilst doing symbol replacement and macro expansion.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3AmacroPass"+>macroPass</A+> :: [(String, String)] -> <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)] -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3ApreDefine"+>preDefine</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> [(String, String)] -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefineMacro"+>defineMacro</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> String -> (String, <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+>)</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AmacroPass"+></A+><B+>macroPass</B+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/MacroPass.html#macroPass"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="arg"+>:: [(String, String)]</TD+><TD CLASS="rdoc"+>Pre-defined symbols and their values+</TD+></TR+><TR+><TD CLASS="arg"+>-> <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+>Options that alter processing style+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+><TD CLASS="rdoc"+>The input file content+</TD+></TR+><TR+><TD CLASS="arg"+>-> String</TD+><TD CLASS="rdoc"+>The file after processing+</TD+></TR+><TR+><TD CLASS="ndoc" COLSPAN="2"+>Walk through the document, replacing calls of macros with the expanded RHS.+</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3ApreDefine"+></A+><B+>preDefine</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> [(String, String)] -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/MacroPass.html#preDefine"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Turn command-line definitions (from <TT+>-D</TT+>) into <TT+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TT+>s.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefineMacro"+></A+><B+>defineMacro</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+> -> String -> (String, <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+>)</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/MacroPass.html#defineMacro"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Turn a string representing a macro definition into a <TT+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+></TT+>.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-Options.html view
@@ -0,0 +1,647 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.Options</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.Options</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>This module deals with Cpphs options and parsing them+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3ACpphsOptions"+>CpphsOptions</A+> = <A HREF="#v%3ACpphsOptions"+>CpphsOptions</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Ainfiles"+>infiles</A+> :: [FilePath]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aoutfiles"+>outfiles</A+> :: [FilePath]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Adefines"+>defines</A+> :: [(String, String)]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aincludes"+>includes</A+> :: [String]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aboolopts"+>boolopts</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3ABoolOptions"+>BoolOptions</A+> = <A HREF="#v%3ABoolOptions"+>BoolOptions</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Amacros"+>macros</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alocations"+>locations</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Apragma"+>pragma</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Astrip"+>strip</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alang"+>lang</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aansi"+>ansi</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alayout"+>layout</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aliterate"+>literate</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Awarnings"+>warnings</A+> :: Bool</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AparseOptions"+>parseOptions</A+> :: [String] -> Either String <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefaultCpphsOptions"+>defaultCpphsOptions</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefaultBoolOptions"+>defaultBoolOptions</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3ACpphsOptions"+></A+><B+>CpphsOptions</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html#CpphsOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Cpphs options structure.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3ACpphsOptions"+></A+><B+>CpphsOptions</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Ainfiles"+></A+><B+>infiles</B+> :: [FilePath]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aoutfiles"+></A+><B+>outfiles</B+> :: [FilePath]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Adefines"+></A+><B+>defines</B+> :: [(String, String)]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aincludes"+></A+><B+>includes</B+> :: [String]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aboolopts"+></A+><B+>boolopts</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3ABoolOptions"+></A+><B+>BoolOptions</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html#BoolOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Options representable as Booleans.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3ABoolOptions"+></A+><B+>BoolOptions</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Amacros"+></A+><B+>macros</B+> :: Bool</TD+><TD CLASS="rdoc"+>Leave #define and #undef in output of ifdef?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alocations"+></A+><B+>locations</B+> :: Bool</TD+><TD CLASS="rdoc"+>Place #line droppings in output?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Apragma"+></A+><B+>pragma</B+> :: Bool</TD+><TD CLASS="rdoc"+>Keep #pragma in final output?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Astrip"+></A+><B+>strip</B+> :: Bool</TD+><TD CLASS="rdoc"+>Remove C comments everywhere?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alang"+></A+><B+>lang</B+> :: Bool</TD+><TD CLASS="rdoc"+>Lex input as Haskell code?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aansi"+></A+><B+>ansi</B+> :: Bool</TD+><TD CLASS="rdoc"+>Permit stringise <A NAME="%20and%20catenate%20%23"+></A+> operators?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alayout"+></A+><B+>layout</B+> :: Bool</TD+><TD CLASS="rdoc"+>Retain newlines in macro expansions?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aliterate"+></A+><B+>literate</B+> :: Bool</TD+><TD CLASS="rdoc"+>Remove literate markup?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Awarnings"+></A+><B+>warnings</B+> :: Bool</TD+><TD CLASS="rdoc"+>Issue warnings?+</TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AparseOptions"+></A+><B+>parseOptions</B+> :: [String] -> Either String <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html#parseOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Parse all command-line options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefaultCpphsOptions"+></A+><B+>defaultCpphsOptions</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html#defaultCpphsOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Default options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefaultBoolOptions"+></A+><B+>defaultBoolOptions</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Options.html#defaultBoolOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Default settings of boolean options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-Position.html view
@@ -0,0 +1,631 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.Position</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.Position</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Simple file position information, with recursive inclusion points.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3APosn"+>Posn</A+> = <A HREF="#v%3APn"+>Pn</A+> String !Int !Int (Maybe <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>)</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anewfile"+>newfile</A+> :: String -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aaddcol"+>addcol</A+> :: Int -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anewline"+>newline</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Atab"+>tab</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anewlines"+>newlines</A+> :: Int -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anewpos"+>newpos</A+> :: Int -> Maybe String -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Acppline"+>cppline</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Afilename"+>filename</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Alineno"+>lineno</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> Int</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Adirectory"+>directory</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> FilePath</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3APosn"+></A+><B+>Posn</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#Posn"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Source positions contain a filename, line, column, and an+ inclusion point, which is itself another source position,+ recursively.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3APn"+></A+><B+>Pn</B+> String !Int !Int (Maybe <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>)</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Posn')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:Posn" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Eq <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+><TR+><TD CLASS="decl"+>Show <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anewfile"+></A+><B+>newfile</B+> :: String -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#newfile"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Constructor+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aaddcol"+></A+><B+>addcol</B+> :: Int -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#addcol"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Updates+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anewline"+></A+><B+>newline</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#newline"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Atab"+></A+><B+>tab</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#tab"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anewlines"+></A+><B+>newlines</B+> :: Int -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#newlines"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anewpos"+></A+><B+>newpos</B+> :: Int -> Maybe String -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#newpos"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Acppline"+></A+><B+>cppline</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#cppline"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>cpp-style printing+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Afilename"+></A+><B+>filename</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#filename"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Alineno"+></A+><B+>lineno</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> Int</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#lineno"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Projections+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Adirectory"+></A+><B+>directory</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> FilePath</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Position.html#directory"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-ReadFirst.html view
@@ -0,0 +1,216 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.ReadFirst</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/ReadFirst.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.ReadFirst</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Read the first file that matches in a list of search paths.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3AreadFirst"+>readFirst</A+> :: String -> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> [String] -> Bool -> IO (FilePath, String)</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AreadFirst"+></A+><B+>readFirst</B+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/ReadFirst.html#readFirst"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="arg"+>:: String</TD+><TD CLASS="rdoc"+>filename+</TD+></TR+><TR+><TD CLASS="arg"+>-> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+></TD+><TD CLASS="rdoc"+>inclusion point+</TD+></TR+><TR+><TD CLASS="arg"+>-> [String]</TD+><TD CLASS="rdoc"+>search path+</TD+></TR+><TR+><TD CLASS="arg"+>-> Bool</TD+><TD CLASS="rdoc"+>report warnings?+</TD+></TR+><TR+><TD CLASS="arg"+>-> IO (FilePath, String)</TD+><TD CLASS="rdoc"+>discovered filepath, and file contents+</TD+></TR+><TR+><TD CLASS="ndoc" COLSPAN="2"+>Attempt to read the given file from any location within the search path.+ The first location found is returned, together with the file content.+ (The directory of the calling file is always searched first, then+ the current directory, finally any specified search path.)+</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-RunCpphs.html view
@@ -0,0 +1,114 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.RunCpphs</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/RunCpphs.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.RunCpphs</FONT+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3ArunCpphs"+></A+><B+>runCpphs</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+> -> FilePath -> String -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/RunCpphs.html#runCpphs"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-SymTab.html view
@@ -0,0 +1,432 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.SymTab</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.SymTab</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>Stable</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Symbol Table, based on index trees using a hash on the key.+ Keys are always Strings. Stored values can be any type.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>type</SPAN+> <A HREF="#t%3ASymTab"+>SymTab</A+> v = <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3AIndTree"+>IndTree</A+> [(String, v)]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AemptyST"+>emptyST</A+> :: <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AinsertST"+>insertST</A+> :: (String, v) -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdeleteST"+>deleteST</A+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AlookupST"+>lookupST</A+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> Maybe v</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefinedST"+>definedST</A+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> Bool</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3AIndTree"+>IndTree</A+> t</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>type</SPAN+> <A NAME="t%3ASymTab"+></A+><B+>SymTab</B+> v = <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3AIndTree"+>IndTree</A+> [(String, v)]</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#SymTab"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Symbol Table. Stored values are polymorphic, but the keys are+ always strings.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AemptyST"+></A+><B+>emptyST</B+> :: <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#emptyST"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AinsertST"+></A+><B+>insertST</B+> :: (String, v) -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#insertST"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdeleteST"+></A+><B+>deleteST</B+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#deleteST"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AlookupST"+></A+><B+>lookupST</B+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> Maybe v</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#lookupST"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefinedST"+></A+><B+>definedST</B+> :: String -> <A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>SymTab</A+> v -> Bool</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#definedST"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3AIndTree"+></A+><B+>IndTree</B+> t</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/SymTab.html#IndTree"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Index Trees (storing indexes at nodes).+</TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:IndTree')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:IndTree" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Show t => Show (<A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3AIndTree"+>IndTree</A+> t)</TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs-Tokenise.html view
@@ -0,0 +1,508 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs.Tokenise</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs.Tokenise</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>The purpose of this module is to lex a source file (language+ unspecified) into tokens such that cpp can recognise a replaceable+ symbol or macro-use, and do the right thing.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3AlinesCpp"+>linesCpp</A+> :: String -> [String]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Areslash"+>reslash</A+> :: String -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Atokenise"+>tokenise</A+> :: Bool -> Bool -> Bool -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)] -> [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3AWordStyle"+>WordStyle</A+> </TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+>= <A HREF="#v%3AIdent"+>Ident</A+> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> String</TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3AOther"+>Other</A+> String</TD+></TR+><TR+><TD CLASS="decl"+>| <A HREF="#v%3ACmd"+>Cmd</A+> (Maybe <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+>)</TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdeWordStyle"+>deWordStyle</A+> :: <A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+> -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AparseMacroCall"+>parseMacroCall</A+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>] -> Maybe ([[<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>]], [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>])</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AlinesCpp"+></A+><B+>linesCpp</B+> :: String -> [String]</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#linesCpp"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>linesCpp is, broadly speaking, Prelude.lines, except that+ on a line beginning with a #, line continuation characters are+ recognised. In a line continuation, the newline character is+ preserved, but the backslash is not.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Areslash"+></A+><B+>reslash</B+> :: String -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#reslash"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Put back the line-continuation characters.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Atokenise"+></A+><B+>tokenise</B+> :: Bool -> Bool -> Bool -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)] -> [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>]</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#tokenise"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>tokenise is, broadly-speaking, Prelude.words, except that:+ * the input is already divided into lines+ * each word-like <A HREF="token.html"+>token</A+> is categorised as one of {Ident,Other,Cmd}+ * #define's are parsed and returned out-of-band using the Cmd variant+ * All whitespace is preserved intact as tokens.+ * C-comments are converted to white-space (depending on first param)+ * Parens and commas are tokens in their own right.+ * Any cpp line continuations are respected.+ No errors can be raised.+ The inverse of tokenise is (concatMap deWordStyle).+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3AWordStyle"+></A+><B+>WordStyle</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#WordStyle"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Each token is classified as one of Ident, Other, or Cmd:+ * Ident is a word that could potentially match a macro name.+ * Cmd is a complete cpp directive (#define etc).+ * Other is anything else.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3AIdent"+></A+><B+>Ident</B+> <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> String</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3AOther"+></A+><B+>Other</B+> String</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3ACmd"+></A+><B+>Cmd</B+> (Maybe <A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>HashDefine</A+>)</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:WordStyle')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:WordStyle" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Eq <A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+></TD+></TR+><TR+><TD CLASS="decl"+>Show <A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+></TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdeWordStyle"+></A+><B+>deWordStyle</B+> :: <A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+> -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#deWordStyle"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AparseMacroCall"+></A+><B+>parseMacroCall</B+> :: <A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+> -> [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>] -> Maybe ([[<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>]], [<A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>WordStyle</A+>])</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs/Tokenise.html#parseMacroCall"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Parse a possible macro call, returning argument list and remaining input+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Cpphs.html view
@@ -0,0 +1,856 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Cpphs</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Cpphs.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Cpphs</FONT+></TD+><TD ALIGN="right"+><TABLE CLASS="narrow" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="infohead"+>Portability</TD+><TD CLASS="infoval"+>All</TD+></TR+><TR+><TD CLASS="infohead"+>Stability</TD+><TD CLASS="infoval"+>experimental</TD+></TR+><TR+><TD CLASS="infohead"+>Maintainer</TD+><TD CLASS="infoval"+>Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Include the interface that is exported+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3ArunCpphs"+>runCpphs</A+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+> -> FilePath -> String -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AcppIfdef"+>cppIfdef</A+> :: FilePath -> [(String, String)] -> [String] -> <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+> -> String -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AmacroPass"+>macroPass</A+> :: [(String, String)] -> <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+> -> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)] -> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3ACpphsOptions"+>CpphsOptions</A+> = <A HREF="#v%3ACpphsOptions"+>CpphsOptions</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Ainfiles"+>infiles</A+> :: [FilePath]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aoutfiles"+>outfiles</A+> :: [FilePath]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Adefines"+>defines</A+> :: [(String, String)]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aincludes"+>includes</A+> :: [String]</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aboolopts"+>boolopts</A+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3ABoolOptions"+>BoolOptions</A+> = <A HREF="#v%3ABoolOptions"+>BoolOptions</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Amacros"+>macros</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alocations"+>locations</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Apragma"+>pragma</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Astrip"+>strip</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alang"+>lang</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aansi"+>ansi</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Alayout"+>layout</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Aliterate"+>literate</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Awarnings"+>warnings</A+> :: Bool</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AparseOptions"+>parseOptions</A+> :: [String] -> Either String <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefaultCpphsOptions"+>defaultCpphsOptions</A+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AdefaultBoolOptions"+>defaultBoolOptions</A+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3ArunCpphs"+></A+><B+>runCpphs</B+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+> -> FilePath -> String -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#runCpphs"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AcppIfdef"+></A+><B+>cppIfdef</B+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#cppIfdef"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="arg"+>:: FilePath</TD+><TD CLASS="rdoc"+>File for error reports+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(String, String)]</TD+><TD CLASS="rdoc"+>Pre-defined symbols and their values+</TD+></TR+><TR+><TD CLASS="arg"+>-> [String]</TD+><TD CLASS="rdoc"+>Search path for #includes+</TD+></TR+><TR+><TD CLASS="arg"+>-> <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+>Options controlling output style+</TD+></TR+><TR+><TD CLASS="arg"+>-> String</TD+><TD CLASS="rdoc"+>The input file content+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+><TD CLASS="rdoc"+>The file after processing (in lines)+</TD+></TR+><TR+><TD CLASS="ndoc" COLSPAN="2"+>Run a first pass of cpp, evaluating #ifdef's and processing #include's,+ whilst taking account of #define's and #undef's as we encounter them.+</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AmacroPass"+></A+><B+>macroPass</B+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#macroPass"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="arg"+>:: [(String, String)]</TD+><TD CLASS="rdoc"+>Pre-defined symbols and their values+</TD+></TR+><TR+><TD CLASS="arg"+>-> <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+>Options that alter processing style+</TD+></TR+><TR+><TD CLASS="arg"+>-> [(<A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Posn</A+>, String)]</TD+><TD CLASS="rdoc"+>The input file content+</TD+></TR+><TR+><TD CLASS="arg"+>-> String</TD+><TD CLASS="rdoc"+>The file after processing+</TD+></TR+><TR+><TD CLASS="ndoc" COLSPAN="2"+>Walk through the document, replacing calls of macros with the expanded RHS.+</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3ACpphsOptions"+></A+><B+>CpphsOptions</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#CpphsOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Cpphs options structure.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3ACpphsOptions"+></A+><B+>CpphsOptions</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Ainfiles"+></A+><B+>infiles</B+> :: [FilePath]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aoutfiles"+></A+><B+>outfiles</B+> :: [FilePath]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Adefines"+></A+><B+>defines</B+> :: [(String, String)]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aincludes"+></A+><B+>includes</B+> :: [String]</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aboolopts"+></A+><B+>boolopts</B+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3ABoolOptions"+></A+><B+>BoolOptions</B+> </TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#BoolOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Options representable as Booleans.+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3ABoolOptions"+></A+><B+>BoolOptions</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Amacros"+></A+><B+>macros</B+> :: Bool</TD+><TD CLASS="rdoc"+>Leave #define and #undef in output of ifdef?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alocations"+></A+><B+>locations</B+> :: Bool</TD+><TD CLASS="rdoc"+>Place #line droppings in output?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Apragma"+></A+><B+>pragma</B+> :: Bool</TD+><TD CLASS="rdoc"+>Keep #pragma in final output?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Astrip"+></A+><B+>strip</B+> :: Bool</TD+><TD CLASS="rdoc"+>Remove C comments everywhere?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alang"+></A+><B+>lang</B+> :: Bool</TD+><TD CLASS="rdoc"+>Lex input as Haskell code?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aansi"+></A+><B+>ansi</B+> :: Bool</TD+><TD CLASS="rdoc"+>Permit stringise <A NAME="%20and%20catenate%20%23"+></A+> operators?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Alayout"+></A+><B+>layout</B+> :: Bool</TD+><TD CLASS="rdoc"+>Retain newlines in macro expansions?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Aliterate"+></A+><B+>literate</B+> :: Bool</TD+><TD CLASS="rdoc"+>Remove literate markup?+</TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Awarnings"+></A+><B+>warnings</B+> :: Bool</TD+><TD CLASS="rdoc"+>Issue warnings?+</TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AparseOptions"+></A+><B+>parseOptions</B+> :: [String] -> Either String <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#parseOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Parse all command-line options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefaultCpphsOptions"+></A+><B+>defaultCpphsOptions</B+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>CpphsOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#defaultCpphsOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Default options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AdefaultBoolOptions"+></A+><B+>defaultBoolOptions</B+> :: <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>BoolOptions</A+></TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Cpphs.html#defaultBoolOptions"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Default settings of boolean options.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language-Preprocessor-Unlit.html view
@@ -0,0 +1,154 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Language.Preprocessor.Unlit</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Language/Preprocessor/Unlit.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Language.Preprocessor.Unlit</FONT+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+>Part of this code is from <A HREF="Report on the Programming Language Haskell.html"+>Report on the Programming Language Haskell</A+>,+ version 1.2, appendix C.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3Aunlit"+>unlit</A+> :: FilePath -> String -> String</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aunlit"+></A+><B+>unlit</B+> :: FilePath -> String -> String</TD+><TD CLASS="declbut"+><A HREF="Language/Preprocessor/Unlit.html#unlit"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+><TT+><A HREF="Language-Preprocessor-Unlit.html#v%3Aunlit"+>unlit</A+></TT+> takes a filename (for error reports), and transforms the+ given string, to eliminate the literate comments from the program text.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Language/Preprocessor/Cpphs.html view
@@ -0,0 +1,25 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : Language.Preprocessor.Cpphs</font>+<font color=Blue>-- Copyright : 2000-2006 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Include the interface that is exported</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs+ <font color=Cyan>(</font> runCpphs<font color=Cyan>,</font> cppIfdef<font color=Cyan>,</font> macroPass<font color=Cyan>,</font> CpphsOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> parseOptions<font color=Cyan>,</font> defaultCpphsOptions<font color=Cyan>,</font> defaultBoolOptions+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>CppIfdef<font color=Cyan>(</font>cppIfdef<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>MacroPass<font color=Cyan>(</font>macroPass<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>RunCpphs<font color=Cyan>(</font>runCpphs<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Options+ <font color=Cyan>(</font>CpphsOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> parseOptions+ <font color=Cyan>,</font>defaultCpphsOptions<font color=Cyan>,</font>defaultBoolOptions<font color=Cyan>)</font>+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/CppIfdef.html view
@@ -0,0 +1,267 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : CppIfdef</font>+<font color=Blue>-- Copyright : 1999-2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>-- </font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Perform a cpp.first-pass, gathering \#define's and evaluating \#ifdef's.</font>+<font color=Blue>-- and \#include's.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>CppIfdef+ <font color=Cyan>(</font> cppIfdef <font color=Blue>-- :: FilePath -> [(String,String)] -> [String] -> Options</font>+ <font color=Blue>-- -> String -> [(Posn,String)]</font>+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>+++<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>SymTab+<font color=Green><u>import</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>HuttonMeijer+<font color=Blue>-- import HashDefine</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Position <font color=Cyan>(</font>Posn<font color=Cyan>,</font>newfile<font color=Cyan>,</font>newline<font color=Cyan>,</font>newlines+ <font color=Cyan>,</font>cppline<font color=Cyan>,</font>newpos<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>ReadFirst <font color=Cyan>(</font>readFirst<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Tokenise <font color=Cyan>(</font>linesCpp<font color=Cyan>,</font>reslash<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Options <font color=Cyan>(</font>BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>HashDefine<font color=Cyan>(</font>HashDefine<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font>parseHashDefine+ <font color=Cyan>,</font>expandMacro<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>MacroPass <font color=Cyan>(</font>preDefine<font color=Cyan>,</font>defineMacro<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Char <font color=Cyan>(</font>isDigit<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Numeric <font color=Cyan>(</font>readHex<font color=Cyan>,</font>readOct<font color=Cyan>,</font>readDec<font color=Cyan>)</font>+<font color=Green><u>import</u></font> System<font color=Cyan>.</font>IO<font color=Cyan>.</font>Unsafe <font color=Cyan>(</font>unsafePerformIO<font color=Cyan>)</font>+<font color=Green><u>import</u></font> IO <font color=Cyan>(</font>hPutStrLn<font color=Cyan>,</font>stderr<font color=Cyan>)</font>+++<font color=Blue>-- | Run a first pass of cpp, evaluating \#ifdef's and processing \#include's,</font>+<font color=Blue>-- whilst taking account of \#define's and \#undef's as we encounter them.</font>+cppIfdef <font color=Red>::</font> FilePath <font color=Blue>-- ^ File for error reports</font>+ <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Blue>-- ^ Pre-defined symbols and their values</font>+ <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Blue>-- ^ Search path for \#includes</font>+ <font color=Red>-></font> BoolOptions <font color=Blue>-- ^ Options controlling output style</font>+ <font color=Red>-></font> String <font color=Blue>-- ^ The input file content</font>+ <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Blue>-- ^ The file after processing (in lines)</font>+<a name="cppIfdef"></a>cppIfdef fp syms search options <font color=Red>=</font>+ cpp posn defs search options Keep <font color=Cyan>.</font> <font color=Cyan>(</font>cppline posn<font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Cyan>.</font> linesCpp+ <font color=Green><u>where</u></font>+ posn <font color=Red>=</font> newfile fp+ defs <font color=Red>=</font> preDefine options syms+<font color=Blue>-- Previous versions had a very simple symbol table mapping strings</font>+<font color=Blue>-- to strings. Now the #ifdef pass uses a more elaborate table, in</font>+<font color=Blue>-- particular to deal with parameterised macros in conditionals.</font>+++<font color=Blue>-- | Internal state for whether lines are being kept or dropped.</font>+<font color=Blue>-- In @Drop n b@, @n@ is the depth of nesting, @b@ is whether</font>+<font color=Blue>-- we have already succeeded in keeping some lines in a chain of</font>+<font color=Blue>-- @elif@'s</font>+<a name="KeepState"></a><font color=Green><u>data</u></font> KeepState <font color=Red>=</font> Keep <font color=Red>|</font> Drop Int Bool++<font color=Blue>-- | Return just the list of lines that the real cpp would decide to keep.</font>+cpp <font color=Red>::</font> Posn <font color=Red>-></font> SymTab HashDefine <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> BoolOptions <font color=Red>-></font> KeepState+ <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+<a name="cpp"></a>cpp <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>++cpp p syms path options Keep <font color=Cyan>(</font>l<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>let</u></font> ws <font color=Red>=</font> words x+ cmd <font color=Red>=</font> head ws+ line <font color=Red>=</font> tail ws+ sym <font color=Red>=</font> head <font color=Cyan>(</font>tail ws<font color=Cyan>)</font>+ rest <font color=Red>=</font> tail <font color=Cyan>(</font>tail ws<font color=Cyan>)</font>+ def <font color=Red>=</font> defineMacro options <font color=Cyan>(</font>sym<font color=Cyan>++</font><font color=Magenta>" "</font><font color=Cyan>++</font> maybe <font color=Magenta>"1"</font> id <font color=Cyan>(</font>un rest<font color=Cyan>)</font><font color=Cyan>)</font>+ un v <font color=Red>=</font> <font color=Green><u>if</u></font> null v <font color=Green><u>then</u></font> Nothing <font color=Green><u>else</u></font> Just <font color=Cyan>(</font>unwords v<font color=Cyan>)</font>+ keepIf p <font color=Red>=</font> <font color=Green><u>if</u></font> p <font color=Green><u>then</u></font> Keep <font color=Green><u>else</u></font> <font color=Cyan>(</font>Drop <font color=Magenta>1</font> False<font color=Cyan>)</font>+ skipn syms' ud xs' <font color=Red>=</font>+ <font color=Green><u>let</u></font> n <font color=Red>=</font> <font color=Magenta>1</font> <font color=Cyan>+</font> length <font color=Cyan>(</font>filter <font color=Cyan>(</font><font color=Cyan>==</font><font color=Magenta>'\n'</font><font color=Cyan>)</font> l<font color=Cyan>)</font> <font color=Green><u>in</u></font>+ <font color=Cyan>(</font><font color=Green><u>if</u></font> macros options <font color=Green><u>then</u></font> <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>reslash l<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font>+ <font color=Green><u>else</u></font> <font color=Cyan>(</font>replicate n <font color=Cyan>(</font>p<font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font> <font color=Cyan>++</font><font color=Cyan>)</font><font color=Cyan>)</font> <font color=Cyan>$</font>+ cpp <font color=Cyan>(</font>newlines n p<font color=Cyan>)</font> syms' path options ud xs'+ <font color=Green><u>in</u></font> <font color=Green><u>case</u></font> cmd <font color=Green><u>of</u></font>+ <font color=Magenta>"define"</font> <font color=Red>-></font> skipn <font color=Cyan>(</font>insertST def syms<font color=Cyan>)</font> Keep xs+ <font color=Magenta>"undef"</font> <font color=Red>-></font> skipn <font color=Cyan>(</font>deleteST sym syms<font color=Cyan>)</font> Keep xs+ <font color=Magenta>"ifndef"</font> <font color=Red>-></font> skipn syms <font color=Cyan>(</font>keepIf <font color=Cyan>(</font>not <font color=Cyan>(</font>definedST sym syms<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font> xs+ <font color=Magenta>"ifdef"</font> <font color=Red>-></font> skipn syms <font color=Cyan>(</font>keepIf <font color=Cyan>(</font>definedST sym syms<font color=Cyan>)</font><font color=Cyan>)</font> xs+ <font color=Magenta>"if"</font> <font color=Red>-></font> skipn syms <font color=Cyan>(</font>keepIf <font color=Cyan>(</font>gatherDefined p syms <font color=Cyan>(</font>unwords line<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font> xs+ <font color=Magenta>"else"</font> <font color=Red>-></font> skipn syms <font color=Cyan>(</font>Drop <font color=Magenta>1</font> False<font color=Cyan>)</font> xs+ <font color=Magenta>"elif"</font> <font color=Red>-></font> skipn syms <font color=Cyan>(</font>Drop <font color=Magenta>1</font> True<font color=Cyan>)</font> xs+ <font color=Magenta>"endif"</font> <font color=Red>-></font> skipn syms Keep xs+ <font color=Magenta>"pragma"</font> <font color=Red>-></font> skipn syms Keep xs+ <font color=Cyan>(</font><font color=Magenta>'!'</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> skipn syms Keep xs <font color=Blue>-- \#!runhs scripts</font>+ <font color=Magenta>"include"</font><font color=Red>-></font> <font color=Green><u>let</u></font> <font color=Cyan>(</font>inc<font color=Cyan>,</font>content<font color=Cyan>)</font> <font color=Red>=</font>+ unsafePerformIO <font color=Cyan>(</font>readFirst <font color=Cyan>(</font>file syms <font color=Cyan>(</font>unwords line<font color=Cyan>)</font><font color=Cyan>)</font>+ p path+ <font color=Cyan>(</font>warnings options<font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Green><u>in</u></font>+ cpp p syms path options Keep <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>"#line 1 "</font><font color=Cyan>++</font>show inc<font color=Cyan>)</font>+ <font color=Red><b>:</b></font> linesCpp content+ <font color=Cyan>++</font> cppline <font color=Cyan>(</font>newline p<font color=Cyan>)</font><font color=Red><b>:</b></font> xs<font color=Cyan>)</font>+ <font color=Magenta>"warning"</font><font color=Red>-></font> <font color=Green><u>if</u></font> warnings options <font color=Green><u>then</u></font> unsafePerformIO <font color=Cyan>$</font> <font color=Green><u>do</u></font>+ hPutStrLn stderr <font color=Cyan>(</font>l<font color=Cyan>++</font><font color=Magenta>"\nin "</font><font color=Cyan>++</font>show p<font color=Cyan>)</font>+ return <font color=Cyan>$</font> skipn syms Keep xs+ <font color=Green><u>else</u></font> skipn syms Keep xs+ <font color=Magenta>"error"</font> <font color=Red>-></font> error <font color=Cyan>(</font>l<font color=Cyan>++</font><font color=Magenta>"\nin "</font><font color=Cyan>++</font>show p<font color=Cyan>)</font>+ <font color=Magenta>"line"</font> <font color=Red>|</font> all isDigit sym+ <font color=Red>-></font> <font color=Cyan>(</font><font color=Green><u>if</u></font> locations options <font color=Green><u>then</u></font> <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Green><u>else</u></font> id<font color=Cyan>)</font> <font color=Cyan>$</font>+ cpp <font color=Cyan>(</font>newpos <font color=Cyan>(</font>read sym<font color=Cyan>)</font> <font color=Cyan>(</font>un rest<font color=Cyan>)</font> p<font color=Cyan>)</font>+ syms path options Keep xs+ n <font color=Red>|</font> all isDigit n+ <font color=Red>-></font> <font color=Cyan>(</font><font color=Green><u>if</u></font> locations options <font color=Green><u>then</u></font> <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Green><u>else</u></font> id<font color=Cyan>)</font> <font color=Cyan>$</font>+ cpp <font color=Cyan>(</font>newpos <font color=Cyan>(</font>read n<font color=Cyan>)</font> <font color=Cyan>(</font>un <font color=Cyan>(</font>tail ws<font color=Cyan>)</font><font color=Cyan>)</font> p<font color=Cyan>)</font>+ syms path options Keep xs+ <font color=Red>|</font> otherwise+ <font color=Red>-></font> <font color=Green><u>if</u></font> warnings options <font color=Green><u>then</u></font> unsafePerformIO <font color=Cyan>$</font> <font color=Green><u>do</u></font>+ hPutStrLn stderr <font color=Cyan>(</font><font color=Magenta>"Warning: unknown directive #"</font><font color=Cyan>++</font>n+ <font color=Cyan>++</font><font color=Magenta>"\nin "</font><font color=Cyan>++</font>show p<font color=Cyan>)</font>+ return <font color=Cyan>$</font>+ <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font> cpp <font color=Cyan>(</font>newline p<font color=Cyan>)</font> syms path options Keep xs<font color=Cyan>)</font>+ <font color=Green><u>else</u></font>+ <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font> cpp <font color=Cyan>(</font>newline p<font color=Cyan>)</font> syms path options Keep xs<font color=Cyan>)</font>++cpp p syms path options <font color=Cyan>(</font>Drop n b<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>let</u></font> ws <font color=Red>=</font> words x+ cmd <font color=Red>=</font> head ws+ delse <font color=Red>|</font> n<font color=Cyan>==</font><font color=Magenta>1</font> <font color=Cyan>&&</font> b <font color=Red>=</font> Drop <font color=Magenta>1</font> b+ <font color=Red>|</font> n<font color=Cyan>==</font><font color=Magenta>1</font> <font color=Red>=</font> Keep+ <font color=Red>|</font> otherwise <font color=Red>=</font> Drop n b+ dend <font color=Red>|</font> n<font color=Cyan>==</font><font color=Magenta>1</font> <font color=Red>=</font> Keep+ <font color=Red>|</font> otherwise <font color=Red>=</font> Drop <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> b+ delif s <font color=Red>|</font> n<font color=Cyan>==</font><font color=Magenta>1</font> <font color=Cyan>&&</font> not b <font color=Cyan>&&</font> gatherDefined p syms s+ <font color=Red>=</font> Keep+ <font color=Red>|</font> otherwise <font color=Red>=</font> Drop n b+ skipn ud xs' <font color=Red>=</font>+ <font color=Green><u>let</u></font> n' <font color=Red>=</font> <font color=Magenta>1</font> <font color=Cyan>+</font> length <font color=Cyan>(</font>filter <font color=Cyan>(</font><font color=Cyan>==</font><font color=Magenta>'\n'</font><font color=Cyan>)</font> x<font color=Cyan>)</font> <font color=Green><u>in</u></font>+ replicate n' <font color=Cyan>(</font>p<font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font>+ <font color=Cyan>++</font> cpp <font color=Cyan>(</font>newlines n' p<font color=Cyan>)</font> syms path options ud xs'+ <font color=Green><u>in</u></font>+ <font color=Green><u>if</u></font> cmd <font color=Cyan>==</font> <font color=Magenta>"ifndef"</font> <font color=Cyan>||</font>+ cmd <font color=Cyan>==</font> <font color=Magenta>"if"</font> <font color=Cyan>||</font>+ cmd <font color=Cyan>==</font> <font color=Magenta>"ifdef"</font> <font color=Green><u>then</u></font> skipn <font color=Cyan>(</font>Drop <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> b<font color=Cyan>)</font> xs+ <font color=Green><u>else</u></font> <font color=Green><u>if</u></font> cmd <font color=Cyan>==</font> <font color=Magenta>"elif"</font> <font color=Green><u>then</u></font> skipn <font color=Cyan>(</font>delif <font color=Cyan>(</font>unwords <font color=Cyan>(</font>tail ws<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font> xs+ <font color=Green><u>else</u></font> <font color=Green><u>if</u></font> cmd <font color=Cyan>==</font> <font color=Magenta>"else"</font> <font color=Green><u>then</u></font> skipn delse xs+ <font color=Green><u>else</u></font> <font color=Green><u>if</u></font> cmd <font color=Cyan>==</font> <font color=Magenta>"endif"</font> <font color=Green><u>then</u></font> skipn dend xs+ <font color=Green><u>else</u></font> skipn <font color=Cyan>(</font>Drop n b<font color=Cyan>)</font> xs+ <font color=Blue>-- define, undef, include, error, warning, pragma, line</font>++cpp p syms path options Keep <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>let</u></font> p' <font color=Red>=</font> newline p <font color=Green><u>in</u></font> seq p' <font color=Cyan>$</font>+ <font color=Cyan>(</font>p<font color=Cyan>,</font>x<font color=Cyan>)</font><font color=Red><b>:</b></font> cpp p' syms path options Keep xs+cpp p syms path options d<font color=Red>@</font><font color=Cyan>(</font>Drop <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>let</u></font> p' <font color=Red>=</font> newline p <font color=Green><u>in</u></font> seq p' <font color=Cyan>$</font>+ <font color=Cyan>(</font>p<font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font><font color=Red><b>:</b></font> cpp p' syms path options d xs+++<font color=Blue>----</font>+gatherDefined <font color=Red>::</font> Posn <font color=Red>-></font> SymTab HashDefine <font color=Red>-></font> String <font color=Red>-></font> Bool+<a name="gatherDefined"></a>gatherDefined p st inp <font color=Red>=</font>+ <font color=Green><u>case</u></font> papply <font color=Cyan>(</font>parseBoolExp st<font color=Cyan>)</font> inp <font color=Green><u>of</u></font>+ <font color=Red>[</font><font color=Red>]</font> <font color=Red>-></font> error <font color=Cyan>(</font><font color=Magenta>"Cannot parse #if directive in file "</font><font color=Cyan>++</font>show p<font color=Cyan>)</font>+ <font color=Red>[</font><font color=Cyan>(</font>b<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> b+ <font color=Green><u>_</u></font> <font color=Red>-></font> error <font color=Cyan>(</font><font color=Magenta>"Ambiguous parse for #if directive in file "</font><font color=Cyan>++</font>show p<font color=Cyan>)</font>++parseBoolExp <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> Parser Bool+<a name="parseBoolExp"></a>parseBoolExp st <font color=Red>=</font>+ <font color=Green><u>do</u></font> a <font color=Red><-</font> parseExp1 st+ skip <font color=Cyan>(</font>string <font color=Magenta>"||"</font><font color=Cyan>)</font>+ b <font color=Red><-</font> first <font color=Cyan>(</font>skip <font color=Cyan>(</font>parseBoolExp st<font color=Cyan>)</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font>a <font color=Cyan>||</font> b<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ parseExp1 st++parseExp1 <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> Parser Bool+<a name="parseExp1"></a>parseExp1 st <font color=Red>=</font>+ <font color=Green><u>do</u></font> a <font color=Red><-</font> parseExp0 st+ skip <font color=Cyan>(</font>string <font color=Magenta>"&&"</font><font color=Cyan>)</font>+ b <font color=Red><-</font> first <font color=Cyan>(</font>skip <font color=Cyan>(</font>parseExp1 st<font color=Cyan>)</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font>a <font color=Cyan>&&</font> b<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ parseExp0 st++parseExp0 <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> Parser Bool+<a name="parseExp0"></a>parseExp0 st <font color=Red>=</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>string <font color=Magenta>"defined"</font><font color=Cyan>)</font>+ sym <font color=Red><-</font> parens parseSym+ return <font color=Cyan>(</font>definedST sym st<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> parens <font color=Cyan>(</font>parseBoolExp st<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>char <font color=Magenta>'!'</font><font color=Cyan>)</font>+ a <font color=Red><-</font> parseExp0 st+ return <font color=Cyan>(</font>not a<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> sym1 <font color=Red><-</font> parseSymOrCall st+ op <font color=Red><-</font> parseOp st+ sym2 <font color=Red><-</font> parseSymOrCall st+ return <font color=Cyan>(</font>op <font color=Cyan>(</font>safeRead sym1<font color=Cyan>)</font> <font color=Cyan>(</font>safeRead sym2<font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> sym <font color=Red><-</font> parseSymOrCall st+ <font color=Green><u>case</u></font> safeRead sym <font color=Green><u>of</u></font>+ <font color=Magenta>0</font> <font color=Red>-></font> return False+ <font color=Green><u>_</u></font> <font color=Red>-></font> return True+ <font color=Green><u>where</u></font>+ safeRead s <font color=Red>=</font>+ <font color=Green><u>case</u></font> s <font color=Green><u>of</u></font>+ <font color=Magenta>'0'</font><font color=Red><b>:</b></font><font color=Magenta>'x'</font><font color=Red><b>:</b></font>s' <font color=Red>-></font> number readHex s'+ <font color=Magenta>'0'</font><font color=Red><b>:</b></font><font color=Magenta>'o'</font><font color=Red><b>:</b></font>s' <font color=Red>-></font> number readOct s'+ <font color=Green><u>_</u></font> <font color=Red>-></font> number readDec s+ number rd s <font color=Red>=</font>+ <font color=Green><u>case</u></font> rd s <font color=Green><u>of</u></font>+ <font color=Red>[</font><font color=Red>]</font> <font color=Red>-></font> <font color=Magenta>0</font> <font color=Red>::</font> Integer+ <font color=Cyan>(</font><font color=Cyan>(</font>n<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> n <font color=Red>::</font> Integer++parseOp <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> Parser <font color=Cyan>(</font>Integer <font color=Red>-></font> Integer <font color=Red>-></font> Bool<font color=Cyan>)</font>+<a name="parseOp"></a>parseOp <font color=Green><u>_</u></font> <font color=Red>=</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>string <font color=Magenta>">="</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan>>=</font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>char <font color=Magenta>'>'</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan>></font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>string <font color=Magenta>"<="</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan><=</font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>char <font color=Magenta>'<'</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan><</font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>string <font color=Magenta>"=="</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan>==</font><font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> skip <font color=Cyan>(</font>string <font color=Magenta>"!="</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan>/=</font><font color=Cyan>)</font>++parseSymOrCall <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> Parser String+<a name="parseSymOrCall"></a>parseSymOrCall st <font color=Red>=</font>+ <font color=Green><u>do</u></font> sym <font color=Red><-</font> skip parseSym+ args <font color=Red><-</font> parens <font color=Cyan>(</font>parseSymOrCall st <font color=Cyan>`sepby`</font> skip <font color=Cyan>(</font>char <font color=Magenta>','</font><font color=Cyan>)</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font>convert sym args<font color=Cyan>)</font>+ <font color=Cyan>+++</font>+ <font color=Green><u>do</u></font> sym <font color=Red><-</font> skip parseSym+ return <font color=Cyan>(</font>convert sym <font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font>+ <font color=Green><u>where</u></font>+ convert sym args <font color=Red>=</font>+ <font color=Green><u>case</u></font> lookupST sym st <font color=Green><u>of</u></font>+ Nothing <font color=Red>-></font> sym+ Just <font color=Cyan>(</font>a<font color=Red>@</font>SymbolReplacement<font color=Cyan>{</font><font color=Cyan>}</font><font color=Cyan>)</font> <font color=Red>-></font> recursivelyExpand st <font color=Cyan>(</font>replacement a<font color=Cyan>)</font>+ Just <font color=Cyan>(</font>a<font color=Red>@</font>MacroExpansion<font color=Cyan>{</font><font color=Cyan>}</font><font color=Cyan>)</font> <font color=Red>-></font> expandMacro a args False++recursivelyExpand <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> String <font color=Red>-></font> String+<a name="recursivelyExpand"></a>recursivelyExpand st inp <font color=Red>=</font>+ <font color=Green><u>case</u></font> papply <font color=Cyan>(</font>parseSymOrCall st<font color=Cyan>)</font> inp <font color=Green><u>of</u></font>+ <font color=Red>[</font><font color=Cyan>(</font>b<font color=Cyan>,</font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> b+ <font color=Green><u>_</u></font> <font color=Red>-></font> inp++parseSym <font color=Red>::</font> Parser String+<a name="parseSym"></a>parseSym <font color=Red>=</font> many1 <font color=Cyan>(</font>alphanum<font color=Cyan>+++</font>char <font color=Magenta>'\''</font><font color=Cyan>+++</font>char <font color=Magenta>'`'</font><font color=Cyan>)</font>++<a name="parens"></a>parens p <font color=Red>=</font> bracket <font color=Cyan>(</font>skip <font color=Cyan>(</font>char <font color=Magenta>'('</font><font color=Cyan>)</font><font color=Cyan>)</font> <font color=Cyan>(</font>skip p<font color=Cyan>)</font> <font color=Cyan>(</font>skip <font color=Cyan>(</font>char <font color=Magenta>')'</font><font color=Cyan>)</font><font color=Cyan>)</font>++<font color=Blue>-- | Determine filename in \#include</font>+file <font color=Red>::</font> SymTab HashDefine <font color=Red>-></font> String <font color=Red>-></font> String+<a name="file"></a>file st name <font color=Red>=</font>+ <font color=Green><u>case</u></font> name <font color=Green><u>of</u></font>+ <font color=Cyan>(</font><font color=Magenta>'"'</font><font color=Red><b>:</b></font>ns<font color=Cyan>)</font> <font color=Red>-></font> init ns+ <font color=Cyan>(</font><font color=Magenta>'<'</font><font color=Red><b>:</b></font>ns<font color=Cyan>)</font> <font color=Red>-></font> init ns+ <font color=Green><u>_</u></font> <font color=Red>-></font> <font color=Green><u>let</u></font> ex <font color=Red>=</font> recursivelyExpand st name <font color=Green><u>in</u></font>+ <font color=Green><u>if</u></font> ex <font color=Cyan>==</font> name <font color=Green><u>then</u></font> name <font color=Green><u>else</u></font> file st ex+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/HashDefine.html view
@@ -0,0 +1,108 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : HashDefine</font>+<font color=Blue>-- Copyright : 2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- What structures are declared in a \#define.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>+ +<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>HashDefine+ <font color=Cyan>(</font> HashDefine<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> ArgOrText<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> expandMacro+ <font color=Cyan>,</font> parseHashDefine+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Char <font color=Cyan>(</font>isSpace<font color=Cyan>)</font>+<font color=Green><u>import</u></font> List <font color=Cyan>(</font>intersperse<font color=Cyan>)</font>++<a name="HashDefine"></a><font color=Green><u>data</u></font> HashDefine+ <font color=Red>=</font> LineDrop+ <font color=Cyan>{</font> name <font color=Red>::</font> String <font color=Cyan>}</font>+ <font color=Red>|</font> Pragma+ <font color=Cyan>{</font> name <font color=Red>::</font> String <font color=Cyan>}</font>+ <font color=Red>|</font> SymbolReplacement+ <font color=Cyan>{</font> name <font color=Red>::</font> String+ <font color=Cyan>,</font> replacement <font color=Red>::</font> String+ <font color=Cyan>,</font> linebreaks <font color=Red>::</font> Int+ <font color=Cyan>}</font>+ <font color=Red>|</font> MacroExpansion+ <font color=Cyan>{</font> name <font color=Red>::</font> String+ <font color=Cyan>,</font> arguments <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font>+ <font color=Cyan>,</font> expansion <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>ArgOrText<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Cyan>,</font> linebreaks <font color=Red>::</font> Int+ <font color=Cyan>}</font>+ <font color=Green><u>deriving</u></font> <font color=Cyan>(</font>Eq<font color=Cyan>,</font>Show<font color=Cyan>)</font>++<font color=Blue>-- | 'smart' constructor to avoid warnings from ghc (undefined fields)</font>+symbolReplacement <font color=Red>::</font> HashDefine+<a name="symbolReplacement"></a>symbolReplacement <font color=Red>=</font>+ SymbolReplacement+ <font color=Cyan>{</font> name<font color=Red>=</font>undefined<font color=Cyan>,</font> replacement<font color=Red>=</font>undefined<font color=Cyan>,</font> linebreaks<font color=Red>=</font>undefined <font color=Cyan>}</font>++<font color=Blue>-- | Macro expansion text is divided into sections, each of which is classified</font>+<font color=Blue>-- as one of three kinds: a formal argument (Arg), plain text (Text),</font>+<font color=Blue>-- or a stringised formal argument (Str).</font>+<a name="ArgOrText"></a><font color=Green><u>data</u></font> ArgOrText <font color=Red>=</font> Arg <font color=Red>|</font> Text <font color=Red>|</font> Str <font color=Green><u>deriving</u></font> <font color=Cyan>(</font>Eq<font color=Cyan>,</font>Show<font color=Cyan>)</font>++<font color=Blue>-- | Expand an instance of a macro.</font>+<font color=Blue>-- Precondition: got a match on the macro name.</font>+expandMacro <font color=Red>::</font> HashDefine <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Bool <font color=Red>-></font> String+<a name="expandMacro"></a>expandMacro macro parameters layout <font color=Red>=</font>+ <font color=Green><u>let</u></font> env <font color=Red>=</font> zip <font color=Cyan>(</font>arguments macro<font color=Cyan>)</font> parameters+ replace <font color=Cyan>(</font>Arg<font color=Cyan>,</font>s<font color=Cyan>)</font> <font color=Red>=</font> maybe <font color=Cyan>(</font>error <font color=Magenta>"formal param"</font><font color=Cyan>)</font> id <font color=Cyan>(</font>lookup s env<font color=Cyan>)</font>+ replace <font color=Cyan>(</font>Str<font color=Cyan>,</font>s<font color=Cyan>)</font> <font color=Red>=</font> maybe <font color=Cyan>(</font>error <font color=Magenta>"formal param"</font><font color=Cyan>)</font> str <font color=Cyan>(</font>lookup s env<font color=Cyan>)</font>+ replace <font color=Cyan>(</font>Text<font color=Cyan>,</font>s<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>if</u></font> layout <font color=Green><u>then</u></font> s <font color=Green><u>else</u></font> filter <font color=Cyan>(</font><font color=Cyan>/=</font><font color=Magenta>'\n'</font><font color=Cyan>)</font> s+ str s <font color=Red>=</font> <font color=Magenta>'"'</font><font color=Red><b>:</b></font>s<font color=Cyan>++</font><font color=Magenta>"\""</font>+ <font color=Green><u>in</u></font>+ concatMap replace <font color=Cyan>(</font>expansion macro<font color=Cyan>)</font>++<font color=Blue>-- | Parse a \#define, or \#undef, ignoring other \# directives</font>+parseHashDefine <font color=Red>::</font> Bool <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Maybe HashDefine+<a name="parseHashDefine"></a>parseHashDefine ansi def <font color=Red>=</font> <font color=Cyan>(</font>command <font color=Cyan>.</font> skip<font color=Cyan>)</font> def+ <font color=Green><u>where</u></font>+ skip xss<font color=Red>@</font><font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> all isSpace x <font color=Red>=</font> skip xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> xss+ skip <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ command <font color=Cyan>(</font><font color=Magenta>"line"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>(</font>LineDrop <font color=Cyan>(</font><font color=Magenta>"#line"</font><font color=Cyan>++</font>concat xs<font color=Cyan>)</font><font color=Cyan>)</font>+ command <font color=Cyan>(</font><font color=Magenta>"pragma"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>(</font>Pragma <font color=Cyan>(</font><font color=Magenta>"#pragma"</font><font color=Cyan>++</font>concat xs<font color=Cyan>)</font><font color=Cyan>)</font>+ command <font color=Cyan>(</font><font color=Magenta>"define"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>(</font>define <font color=Cyan>.</font> skip<font color=Cyan>)</font> xs<font color=Cyan>)</font> <font color=Cyan>{</font> linebreaks<font color=Red>=</font>count def <font color=Cyan>}</font><font color=Cyan>)</font>+ command <font color=Cyan>(</font><font color=Magenta>"undef"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>(</font>undef <font color=Cyan>.</font> skip<font color=Cyan>)</font> xs<font color=Cyan>)</font> <font color=Cyan>{</font> linebreaks<font color=Red>=</font>count def <font color=Cyan>}</font><font color=Cyan>)</font>+ command <font color=Green><u>_</u></font> <font color=Red>=</font> Nothing+ undef <font color=Cyan>(</font>sym<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> symbolReplacement <font color=Cyan>{</font> name<font color=Red>=</font>sym<font color=Cyan>,</font> replacement<font color=Red>=</font>sym <font color=Cyan>}</font>+ define <font color=Cyan>(</font>sym<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>case</u></font> <font color=Blue>{-skip-}</font> xs <font color=Green><u>of</u></font>+ <font color=Cyan>(</font><font color=Magenta>"("</font><font color=Red><b>:</b></font>ys<font color=Cyan>)</font> <font color=Red>-></font> <font color=Cyan>(</font>macroHead sym <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>.</font> skip<font color=Cyan>)</font> ys+ ys <font color=Red>-></font> symbolReplacement+ <font color=Cyan>{</font> name<font color=Red>=</font>sym+ <font color=Cyan>,</font> replacement <font color=Red>=</font> concatMap snd+ <font color=Cyan>(</font>classifyRhs <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font>chop <font color=Cyan>(</font>skip ys<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font> <font color=Cyan>}</font>+ macroHead sym args <font color=Cyan>(</font><font color=Magenta>","</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>macroHead sym args <font color=Cyan>.</font> skip<font color=Cyan>)</font> xs+ macroHead sym args <font color=Cyan>(</font><font color=Magenta>")"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> MacroExpansion+ <font color=Cyan>{</font> name <font color=Red>=</font>sym <font color=Cyan>,</font> arguments <font color=Red>=</font> reverse args+ <font color=Cyan>,</font> expansion <font color=Red>=</font> classifyRhs args <font color=Cyan>(</font>skip xs<font color=Cyan>)</font>+ <font color=Cyan>,</font> linebreaks <font color=Red>=</font> undefined <font color=Cyan>}</font>+ macroHead sym args <font color=Cyan>(</font>var<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>macroHead sym <font color=Cyan>(</font>var<font color=Red><b>:</b></font>args<font color=Cyan>)</font> <font color=Cyan>.</font> skip<font color=Cyan>)</font> xs+ macroHead sym args <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> error <font color=Cyan>(</font><font color=Magenta>"incomplete macro definition:\n"</font>+ <font color=Cyan>++</font><font color=Magenta>" #define "</font><font color=Cyan>++</font>sym<font color=Cyan>++</font><font color=Magenta>"("</font>+ <font color=Cyan>++</font>concat <font color=Cyan>(</font>intersperse <font color=Magenta>","</font> args<font color=Cyan>)</font><font color=Cyan>)</font>+ classifyRhs args <font color=Cyan>(</font><font color=Magenta>"#"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> ansi <font color=Cyan>&&</font>+ x <font color=Cyan>`elem`</font> args <font color=Red>=</font> <font color=Cyan>(</font>Str<font color=Cyan>,</font>x<font color=Cyan>)</font><font color=Red><b>:</b></font> classifyRhs args xs+ classifyRhs args <font color=Cyan>(</font><font color=Magenta>"##"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> ansi <font color=Red>=</font> classifyRhs args xs+ classifyRhs args <font color=Cyan>(</font>s<font color=Red><b>:</b></font><font color=Magenta>"##"</font><font color=Red><b>:</b></font>s'<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> ansi <font color=Cyan>&&</font> all isSpace s <font color=Cyan>&&</font> all isSpace s'+ <font color=Red>=</font> classifyRhs args xs+ classifyRhs args <font color=Cyan>(</font>word<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> word <font color=Cyan>`elem`</font> args <font color=Red>=</font> <font color=Cyan>(</font>Arg<font color=Cyan>,</font>word<font color=Cyan>)</font><font color=Red><b>:</b></font> classifyRhs args xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> <font color=Cyan>(</font>Text<font color=Cyan>,</font>word<font color=Cyan>)</font><font color=Red><b>:</b></font> classifyRhs args xs+ classifyRhs <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ count <font color=Red>=</font> length <font color=Cyan>.</font> filter <font color=Cyan>(</font><font color=Cyan>==</font><font color=Magenta>'\n'</font><font color=Cyan>)</font> <font color=Cyan>.</font> concat+ chop <font color=Red>=</font> reverse <font color=Cyan>.</font> dropWhile <font color=Cyan>(</font>all isSpace<font color=Cyan>)</font> <font color=Cyan>.</font> reverse++</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/MacroPass.html view
@@ -0,0 +1,129 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : MacroPass</font>+<font color=Blue>-- Copyright : 2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Perform a cpp.second-pass, accumulating \#define's and \#undef's,</font>+<font color=Blue>-- whilst doing symbol replacement and macro expansion.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>MacroPass+ <font color=Cyan>(</font> macroPass+ <font color=Cyan>,</font> preDefine+ <font color=Cyan>,</font> defineMacro+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>HashDefine <font color=Cyan>(</font>HashDefine<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> expandMacro<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Tokenise <font color=Cyan>(</font>tokenise<font color=Cyan>,</font> WordStyle<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> parseMacroCall<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>SymTab <font color=Cyan>(</font>SymTab<font color=Cyan>,</font> lookupST<font color=Cyan>,</font> insertST+ <font color=Cyan>,</font> emptyST<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Position <font color=Cyan>(</font>Posn<font color=Cyan>,</font> newfile<font color=Cyan>,</font> filename<font color=Cyan>,</font> lineno<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Options <font color=Cyan>(</font>BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>)</font>+<font color=Green><u>import</u></font> System<font color=Cyan>.</font>IO<font color=Cyan>.</font>Unsafe <font color=Cyan>(</font>unsafePerformIO<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Time <font color=Cyan>(</font>getClockTime<font color=Cyan>,</font> toCalendarTime<font color=Cyan>,</font> formatCalendarTime<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Locale <font color=Cyan>(</font>defaultTimeLocale<font color=Cyan>)</font>++noPos <font color=Red>::</font> Posn+<a name="noPos"></a>noPos <font color=Red>=</font> newfile <font color=Magenta>"preDefined"</font>++<font color=Blue>-- | Walk through the document, replacing calls of macros with the expanded RHS.</font>+macroPass <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Blue>-- ^ Pre-defined symbols and their values</font>+ <font color=Red>-></font> BoolOptions <font color=Blue>-- ^ Options that alter processing style</font>+ <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Blue>-- ^ The input file content</font>+ <font color=Red>-></font> String <font color=Blue>-- ^ The file after processing</font>+<a name="macroPass"></a>macroPass syms options <font color=Red>=</font>+ safetail <font color=Blue>-- to remove extra "\n" inserted below</font>+ <font color=Cyan>.</font> concat+ <font color=Cyan>.</font> macroProcess <font color=Cyan>(</font>pragma options<font color=Cyan>)</font> <font color=Cyan>(</font>layout options<font color=Cyan>)</font> <font color=Cyan>(</font>lang options<font color=Cyan>)</font>+ <font color=Cyan>(</font>preDefine options syms<font color=Cyan>)</font>+ <font color=Cyan>.</font> tokenise <font color=Cyan>(</font>strip options<font color=Cyan>)</font> <font color=Cyan>(</font>ansi options<font color=Cyan>)</font> <font color=Cyan>(</font>lang options<font color=Cyan>)</font>+ <font color=Cyan>.</font> <font color=Cyan>(</font><font color=Cyan>(</font>noPos<font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font> <font color=Blue>-- ensure recognition of "\n#" at start of file</font>+ <font color=Green><u>where</u></font>+ safetail <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ safetail <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> xs+++<font color=Blue>-- | Turn command-line definitions (from @-D@) into 'HashDefine's.</font>+preDefine <font color=Red>::</font> BoolOptions <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> SymTab HashDefine+<a name="preDefine"></a>preDefine options defines <font color=Red>=</font>+ foldr <font color=Cyan>(</font>insertST <font color=Cyan>.</font> defineMacro options <font color=Cyan>.</font> <font color=Cyan>(</font><font color=Red>\</font> <font color=Cyan>(</font>s<font color=Cyan>,</font>d<font color=Cyan>)</font><font color=Red>-></font> s<font color=Cyan>++</font><font color=Magenta>" "</font><font color=Cyan>++</font>d<font color=Cyan>)</font><font color=Cyan>)</font>+ emptyST defines++<font color=Blue>-- | Turn a string representing a macro definition into a 'HashDefine'.</font>+defineMacro <font color=Red>::</font> BoolOptions <font color=Red>-></font> String <font color=Red>-></font> <font color=Cyan>(</font>String<font color=Cyan>,</font>HashDefine<font color=Cyan>)</font>+<a name="defineMacro"></a>defineMacro opts s <font color=Red>=</font>+ <font color=Green><u>let</u></font> <font color=Cyan>(</font>Cmd <font color=Cyan>(</font>Just hd<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> tokenise True <font color=Cyan>(</font>ansi opts<font color=Cyan>)</font> <font color=Cyan>(</font>lang opts<font color=Cyan>)</font>+ <font color=Red>[</font><font color=Cyan>(</font>noPos<font color=Cyan>,</font><font color=Magenta>"\n#define "</font><font color=Cyan>++</font>s<font color=Cyan>++</font><font color=Magenta>"\n"</font><font color=Cyan>)</font><font color=Red>]</font>+ <font color=Green><u>in</u></font> <font color=Cyan>(</font>name hd<font color=Cyan>,</font> hd<font color=Cyan>)</font>+++<font color=Blue>-- | Trundle through the document, one word at a time, using the WordStyle</font>+<font color=Blue>-- classification introduced by 'tokenise' to decide whether to expand a</font>+<font color=Blue>-- word or macro. Encountering a \#define or \#undef causes that symbol to</font>+<font color=Blue>-- be overwritten in the symbol table. Any other remaining cpp directives</font>+<font color=Blue>-- are discarded and replaced with blanks, except for \#line markers.</font>+<font color=Blue>-- All valid identifiers are checked for the presence of a definition</font>+<font color=Blue>-- of that name in the symbol table, and if so, expanded appropriately.</font>+<font color=Blue>-- (Bool arguments are: keep pragmas? retain layout? haskell language?)</font>+macroProcess <font color=Red>::</font> Bool <font color=Red>-></font> Bool <font color=Red>-></font> Bool <font color=Red>-></font> SymTab HashDefine <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font>+ <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font>+<a name="macroProcess"></a>macroProcess <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+macroProcess p y l st <font color=Cyan>(</font>Other x<font color=Red><b>:</b></font> ws<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> macroProcess p y l st ws+macroProcess p y l st <font color=Cyan>(</font>Cmd Nothing<font color=Red><b>:</b></font> ws<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"\n"</font><font color=Red><b>:</b></font> macroProcess p y l st ws+macroProcess p y l st <font color=Cyan>(</font>Cmd <font color=Cyan>(</font>Just <font color=Cyan>(</font>LineDrop x<font color=Cyan>)</font><font color=Cyan>)</font><font color=Red><b>:</b></font> ws<font color=Cyan>)</font>+ <font color=Red>=</font> <font color=Magenta>"\n"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>macroProcess p y l st ws+macroProcess pragma y l st <font color=Cyan>(</font>Cmd <font color=Cyan>(</font>Just <font color=Cyan>(</font>Pragma x<font color=Cyan>)</font><font color=Cyan>)</font><font color=Red><b>:</b></font> ws<font color=Cyan>)</font>+ <font color=Red>|</font> pragma <font color=Red>=</font> <font color=Magenta>"\n"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>macroProcess pragma y l st ws+ <font color=Red>|</font> otherwise <font color=Red>=</font> <font color=Magenta>"\n"</font><font color=Red><b>:</b></font> macroProcess pragma y l st ws+macroProcess p layout lang st <font color=Cyan>(</font>Cmd <font color=Cyan>(</font>Just hd<font color=Cyan>)</font><font color=Red><b>:</b></font> ws<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>let</u></font> n <font color=Red>=</font> <font color=Magenta>1</font> <font color=Cyan>+</font> linebreaks hd <font color=Green><u>in</u></font>+ replicate n <font color=Magenta>"\n"</font> <font color=Cyan>++</font>macroProcess p layout lang <font color=Cyan>(</font>insertST <font color=Cyan>(</font>name hd<font color=Cyan>,</font> hd<font color=Cyan>)</font> st<font color=Cyan>)</font> ws+macroProcess pr layout lang st <font color=Cyan>(</font>Ident p x<font color=Red><b>:</b></font> ws<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Green><u>case</u></font> x <font color=Green><u>of</u></font>+ <font color=Magenta>"__FILE__"</font> <font color=Red>-></font> show <font color=Cyan>(</font>filename p<font color=Cyan>)</font><font color=Red><b>:</b></font> macroProcess pr layout lang st ws+ <font color=Magenta>"__LINE__"</font> <font color=Red>-></font> show <font color=Cyan>(</font>lineno p<font color=Cyan>)</font><font color=Red><b>:</b></font> macroProcess pr layout lang st ws+ <font color=Magenta>"__DATE__"</font> <font color=Red>-></font> formatCalendarTime defaultTimeLocale <font color=Magenta>"\"%d %b %Y\""</font>+ <font color=Cyan>(</font>unsafePerformIO <font color=Cyan>(</font>getClockTime<font color=Cyan>>>=</font>toCalendarTime<font color=Cyan>)</font><font color=Cyan>)</font><font color=Red><b>:</b></font>+ macroProcess pr layout lang st ws+ <font color=Magenta>"__TIME__"</font> <font color=Red>-></font> formatCalendarTime defaultTimeLocale <font color=Magenta>"\"%H:%M:%S\""</font>+ <font color=Cyan>(</font>unsafePerformIO <font color=Cyan>(</font>getClockTime<font color=Cyan>>>=</font>toCalendarTime<font color=Cyan>)</font><font color=Cyan>)</font><font color=Red><b>:</b></font>+ macroProcess pr layout lang st ws+ <font color=Green><u>_</u></font> <font color=Red>-></font>+ <font color=Green><u>case</u></font> lookupST x st <font color=Green><u>of</u></font>+ Nothing <font color=Red>-></font> x<font color=Red><b>:</b></font> macroProcess pr layout lang st ws+ Just hd <font color=Red>-></font>+ <font color=Green><u>case</u></font> hd <font color=Green><u>of</u></font>+ SymbolReplacement <font color=Cyan>{</font>replacement<font color=Red>=</font>r<font color=Cyan>}</font> <font color=Red>-></font>+ <font color=Green><u>let</u></font> r' <font color=Red>=</font> <font color=Green><u>if</u></font> layout <font color=Green><u>then</u></font> r <font color=Green><u>else</u></font> filter <font color=Cyan>(</font><font color=Cyan>/=</font><font color=Magenta>'\n'</font><font color=Cyan>)</font> r <font color=Green><u>in</u></font>+ <font color=Blue>-- one-level expansion only:</font>+ <font color=Blue>-- r' : macroProcess layout st ws</font>+ <font color=Blue>-- multi-level expansion:</font>+ macroProcess pr layout lang st+ <font color=Cyan>(</font>tokenise True False lang <font color=Red>[</font><font color=Cyan>(</font>p<font color=Cyan>,</font>r'<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Cyan>++</font> ws<font color=Cyan>)</font>+ MacroExpansion <font color=Cyan>{</font><font color=Cyan>}</font> <font color=Red>-></font>+ <font color=Green><u>case</u></font> parseMacroCall p ws <font color=Green><u>of</u></font>+ Nothing <font color=Red>-></font> x<font color=Red><b>:</b></font> macroProcess pr layout lang st ws+ Just <font color=Cyan>(</font>args<font color=Cyan>,</font>ws'<font color=Cyan>)</font> <font color=Red>-></font>+ <font color=Green><u>if</u></font> length args <font color=Cyan>/=</font> length <font color=Cyan>(</font>arguments hd<font color=Cyan>)</font> <font color=Green><u>then</u></font>+ x<font color=Red><b>:</b></font> macroProcess pr layout lang st ws+ <font color=Green><u>else</u></font> <font color=Green><u>let</u></font> args' <font color=Red>=</font> map <font color=Cyan>(</font>concat+ <font color=Cyan>.</font> macroProcess pr layout+ lang st<font color=Cyan>)</font>+ args <font color=Green><u>in</u></font>+ <font color=Blue>-- one-level expansion only:</font>+ <font color=Blue>-- expandMacro hd args' layout:</font>+ <font color=Blue>-- macroProcess layout st ws'</font>+ <font color=Blue>-- multi-level expansion:</font>+ macroProcess pr layout lang st+ <font color=Cyan>(</font>tokenise True False lang+ <font color=Red>[</font><font color=Cyan>(</font>p<font color=Cyan>,</font>expandMacro hd args' layout<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Cyan>++</font> ws'<font color=Cyan>)</font>++</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/Options.html view
@@ -0,0 +1,135 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : Options</font>+<font color=Blue>-- Copyright : 2006 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- This module deals with Cpphs options and parsing them</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Options+ <font color=Cyan>(</font> CpphsOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> parseOptions+ <font color=Cyan>,</font> defaultCpphsOptions+ <font color=Cyan>,</font> defaultBoolOptions+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Maybe++<font color=Blue>-- | Cpphs options structure.</font>+<a name="CpphsOptions"></a><font color=Green><u>data</u></font> CpphsOptions <font color=Red>=</font> CpphsOptions + <font color=Cyan>{</font> infiles <font color=Red>::</font> <font color=Red>[</font>FilePath<font color=Red>]</font>+ <font color=Cyan>,</font> outfiles <font color=Red>::</font> <font color=Red>[</font>FilePath<font color=Red>]</font>+ <font color=Cyan>,</font> defines <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Cyan>,</font> includes <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font>+ <font color=Cyan>,</font> boolopts <font color=Red>::</font> BoolOptions+ <font color=Cyan>}</font>++<font color=Blue>-- | Default options.</font>+defaultCpphsOptions <font color=Red>::</font> CpphsOptions+<a name="defaultCpphsOptions"></a>defaultCpphsOptions <font color=Red>=</font> CpphsOptions <font color=Cyan>{</font> infiles <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>,</font> outfiles <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ <font color=Cyan>,</font> defines <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>,</font> includes <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ <font color=Cyan>,</font> boolopts <font color=Red>=</font> defaultBoolOptions <font color=Cyan>}</font>++<font color=Blue>-- | Options representable as Booleans.</font>+<a name="BoolOptions"></a><font color=Green><u>data</u></font> BoolOptions <font color=Red>=</font> BoolOptions+ <font color=Cyan>{</font> macros <font color=Red>::</font> Bool <font color=Blue>-- ^ Leave \#define and \#undef in output of ifdef?</font>+ <font color=Cyan>,</font> locations <font color=Red>::</font> Bool <font color=Blue>-- ^ Place \#line droppings in output?</font>+ <font color=Cyan>,</font> pragma <font color=Red>::</font> Bool <font color=Blue>-- ^ Keep \#pragma in final output?</font>+ <font color=Cyan>,</font> strip <font color=Red>::</font> Bool <font color=Blue>-- ^ Remove C comments everywhere?</font>+ <font color=Cyan>,</font> lang <font color=Red>::</font> Bool <font color=Blue>-- ^ Lex input as Haskell code?</font>+ <font color=Cyan>,</font> ansi <font color=Red>::</font> Bool <font color=Blue>-- ^ Permit stringise # and catenate ## operators?</font>+ <font color=Cyan>,</font> layout <font color=Red>::</font> Bool <font color=Blue>-- ^ Retain newlines in macro expansions?</font>+ <font color=Cyan>,</font> literate <font color=Red>::</font> Bool <font color=Blue>-- ^ Remove literate markup?</font>+ <font color=Cyan>,</font> warnings <font color=Red>::</font> Bool <font color=Blue>-- ^ Issue warnings?</font>+ <font color=Cyan>}</font>++<font color=Blue>-- | Default settings of boolean options.</font>+defaultBoolOptions <font color=Red>::</font> BoolOptions+<a name="defaultBoolOptions"></a>defaultBoolOptions <font color=Red>=</font> BoolOptions <font color=Cyan>{</font> macros <font color=Red>=</font> True<font color=Cyan>,</font> locations <font color=Red>=</font> True+ <font color=Cyan>,</font> pragma <font color=Red>=</font> False<font color=Cyan>,</font> strip <font color=Red>=</font> False+ <font color=Cyan>,</font> lang <font color=Red>=</font> True<font color=Cyan>,</font> ansi <font color=Red>=</font> False+ <font color=Cyan>,</font> layout <font color=Red>=</font> False<font color=Cyan>,</font> literate <font color=Red>=</font> False+ <font color=Cyan>,</font> warnings <font color=Red>=</font> True <font color=Cyan>}</font>++<font color=Blue>-- | Raw command-line options. This is an internal intermediate data</font>+<font color=Blue>-- structure, used during option parsing only.</font>+<a name="RawOption"></a><font color=Green><u>data</u></font> RawOption+ <font color=Red>=</font> NoMacro+ <font color=Red>|</font> NoLine+ <font color=Red>|</font> Pragma+ <font color=Red>|</font> Text+ <font color=Red>|</font> Strip+ <font color=Red>|</font> Ansi+ <font color=Red>|</font> Layout+ <font color=Red>|</font> Unlit+ <font color=Red>|</font> SuppressWarnings+ <font color=Red>|</font> Macro <font color=Cyan>(</font>String<font color=Cyan>,</font>String<font color=Cyan>)</font>+ <font color=Red>|</font> Path String+ <font color=Green><u>deriving</u></font> <font color=Cyan>(</font>Eq<font color=Cyan>,</font> Show<font color=Cyan>)</font>++flags <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font> RawOption<font color=Cyan>)</font><font color=Red>]</font>+<a name="flags"></a>flags <font color=Red>=</font> <font color=Red>[</font> <font color=Cyan>(</font><font color=Magenta>"--nomacro"</font><font color=Cyan>,</font> NoMacro<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--noline"</font><font color=Cyan>,</font> NoLine<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--pragma"</font><font color=Cyan>,</font> Pragma<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--text"</font><font color=Cyan>,</font> Text<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--strip"</font><font color=Cyan>,</font> Strip<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--hashes"</font><font color=Cyan>,</font> Ansi<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--layout"</font><font color=Cyan>,</font> Layout<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--unlit"</font><font color=Cyan>,</font> Unlit<font color=Cyan>)</font>+ <font color=Cyan>,</font> <font color=Cyan>(</font><font color=Magenta>"--nowarn"</font><font color=Cyan>,</font> SuppressWarnings<font color=Cyan>)</font>+ <font color=Red>]</font>++<font color=Blue>-- | Parse a single raw command-line option. Parse failure is indicated by</font>+<font color=Blue>-- result Nothing.</font>+rawOption <font color=Red>::</font> String <font color=Red>-></font> Maybe RawOption+<a name="rawOption"></a>rawOption x <font color=Red>|</font> isJust a <font color=Red>=</font> a+ <font color=Green><u>where</u></font> a <font color=Red>=</font> lookup x flags+rawOption <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'D'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>$</font> Macro <font color=Cyan>(</font>s<font color=Cyan>,</font> <font color=Green><u>if</u></font> null d <font color=Green><u>then</u></font> <font color=Magenta>"1"</font> <font color=Green><u>else</u></font> tail d<font color=Cyan>)</font>+ <font color=Green><u>where</u></font> <font color=Cyan>(</font>s<font color=Cyan>,</font>d<font color=Cyan>)</font> <font color=Red>=</font> break <font color=Cyan>(</font><font color=Cyan>==</font><font color=Magenta>'='</font><font color=Cyan>)</font> xs+rawOption <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'I'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>$</font> Path <font color=Cyan>$</font> trailing <font color=Magenta>"/\\"</font> xs+rawOption <font color=Green><u>_</u></font> <font color=Red>=</font> Nothing++trailing <font color=Red>::</font> <font color=Cyan>(</font>Eq a<font color=Cyan>)</font> <font color=Red>=></font> <font color=Red>[</font>a<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>a<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>a<font color=Red>]</font>+<a name="trailing"></a>trailing xs <font color=Red>=</font> reverse <font color=Cyan>.</font> dropWhile <font color=Cyan>(</font><font color=Cyan>`elem`</font>xs<font color=Cyan>)</font> <font color=Cyan>.</font> reverse++<font color=Blue>-- | Convert a list of RawOption to a BoolOptions structure.</font>+boolOpts <font color=Red>::</font> <font color=Red>[</font>RawOption<font color=Red>]</font> <font color=Red>-></font> BoolOptions+<a name="boolOpts"></a>boolOpts opts <font color=Red>=</font>+ BoolOptions+ <font color=Cyan>{</font> macros <font color=Red>=</font> not <font color=Cyan>(</font>NoMacro <font color=Cyan>`elem`</font> opts<font color=Cyan>)</font>+ <font color=Cyan>,</font> locations <font color=Red>=</font> not <font color=Cyan>(</font>NoLine <font color=Cyan>`elem`</font> opts<font color=Cyan>)</font>+ <font color=Cyan>,</font> pragma <font color=Red>=</font> Pragma <font color=Cyan>`elem`</font> opts+ <font color=Cyan>,</font> strip <font color=Red>=</font> Strip <font color=Cyan>`elem`</font> opts+ <font color=Cyan>,</font> lang <font color=Red>=</font> not <font color=Cyan>(</font>Text <font color=Cyan>`elem`</font> opts<font color=Cyan>)</font>+ <font color=Cyan>,</font> ansi <font color=Red>=</font> Ansi <font color=Cyan>`elem`</font> opts+ <font color=Cyan>,</font> layout <font color=Red>=</font> Layout <font color=Cyan>`elem`</font> opts+ <font color=Cyan>,</font> literate <font color=Red>=</font> Unlit <font color=Cyan>`elem`</font> opts+ <font color=Cyan>,</font> warnings <font color=Red>=</font> not <font color=Cyan>(</font>SuppressWarnings <font color=Cyan>`elem`</font> opts<font color=Cyan>)</font>+ <font color=Cyan>}</font>++<font color=Blue>-- | Parse all command-line options.</font>+parseOptions <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Either String CpphsOptions+<a name="parseOptions"></a>parseOptions xs <font color=Red>=</font> f <font color=Cyan>(</font><font color=Red>[</font><font color=Red>]</font><font color=Cyan>,</font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>,</font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font> xs+ <font color=Green><u>where</u></font>+ f <font color=Cyan>(</font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'O'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f <font color=Cyan>(</font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> x<font color=Red><b>:</b></font>outs<font color=Cyan>)</font> xs+ f <font color=Cyan>(</font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>case</u></font> rawOption x <font color=Green><u>of</u></font>+ Nothing <font color=Red>-></font> Left x+ Just a <font color=Red>-></font> f <font color=Cyan>(</font>a<font color=Red><b>:</b></font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> xs+ f <font color=Cyan>(</font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f <font color=Cyan>(</font>opts<font color=Cyan>,</font> normalise x<font color=Red><b>:</b></font>ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> xs+ f <font color=Cyan>(</font>opts<font color=Cyan>,</font> ins<font color=Cyan>,</font> outs<font color=Cyan>)</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font>+ Right CpphsOptions <font color=Cyan>{</font> infiles <font color=Red>=</font> reverse ins+ <font color=Cyan>,</font> outfiles <font color=Red>=</font> reverse outs+ <font color=Cyan>,</font> defines <font color=Red>=</font> <font color=Red>[</font> x <font color=Red>|</font> Macro x <font color=Red><-</font> reverse opts <font color=Red>]</font>+ <font color=Cyan>,</font> includes <font color=Red>=</font> <font color=Red>[</font> x <font color=Red>|</font> Path x <font color=Red><-</font> reverse opts <font color=Red>]</font>+ <font color=Cyan>,</font> boolopts <font color=Red>=</font> boolOpts opts+ <font color=Cyan>}</font>+ normalise <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>filepath<font color=Cyan>)</font> <font color=Red>=</font> normalise <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>filepath<font color=Cyan>)</font>+ normalise <font color=Cyan>(</font>x<font color=Red><b>:</b></font>filepath<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font>normalise filepath+ normalise <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/Position.html view
@@ -0,0 +1,81 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : Position</font>+<font color=Blue>-- Copyright : 2000-2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Simple file position information, with recursive inclusion points.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Position+ <font color=Cyan>(</font> Posn<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> newfile+ <font color=Cyan>,</font> addcol<font color=Cyan>,</font> newline<font color=Cyan>,</font> tab<font color=Cyan>,</font> newlines<font color=Cyan>,</font> newpos+ <font color=Cyan>,</font> cppline+ <font color=Cyan>,</font> filename<font color=Cyan>,</font> lineno<font color=Cyan>,</font> directory+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Blue>-- | Source positions contain a filename, line, column, and an</font>+<font color=Blue>-- inclusion point, which is itself another source position,</font>+<font color=Blue>-- recursively.</font>+<a name="Posn"></a><font color=Green><u>data</u></font> Posn <font color=Red>=</font> Pn String <font color=Cyan>!</font>Int <font color=Cyan>!</font>Int <font color=Cyan>(</font>Maybe Posn<font color=Cyan>)</font>+ <font color=Green><u>deriving</u></font> <font color=Cyan>(</font>Eq<font color=Cyan>)</font>++<font color=Green><u>instance</u></font> Show Posn <font color=Green><u>where</u></font>+ showsPrec <font color=Green><u>_</u></font> <font color=Cyan>(</font>Pn f l c i<font color=Cyan>)</font> <font color=Red>=</font> showString f <font color=Cyan>.</font>+ showString <font color=Magenta>" at line "</font> <font color=Cyan>.</font> shows l <font color=Cyan>.</font>+ showString <font color=Magenta>" col "</font> <font color=Cyan>.</font> shows c <font color=Cyan>.</font>+ <font color=Cyan>(</font> <font color=Green><u>case</u></font> i <font color=Green><u>of</u></font>+ Nothing <font color=Red>-></font> id+ Just p <font color=Red>-></font> showString <font color=Magenta>"\n used by "</font> <font color=Cyan>.</font>+ shows p <font color=Cyan>)</font>++<font color=Blue>-- | Constructor</font>+newfile <font color=Red>::</font> String <font color=Red>-></font> Posn+<a name="newfile"></a>newfile name <font color=Red>=</font> Pn name <font color=Magenta>1</font> <font color=Magenta>1</font> Nothing++<font color=Blue>-- | Updates</font>+addcol <font color=Red>::</font> Int <font color=Red>-></font> Posn <font color=Red>-></font> Posn+<a name="addcol"></a>addcol n <font color=Cyan>(</font>Pn f r c i<font color=Cyan>)</font> <font color=Red>=</font> Pn f r <font color=Cyan>(</font>c<font color=Cyan>+</font>n<font color=Cyan>)</font> i++newline<font color=Cyan>,</font> tab <font color=Red>::</font> Posn <font color=Red>-></font> Posn+<font color=Blue>--newline (Pn f r _ i) = Pn f (r+1) 1 i</font>+<a name="newline"></a>newline <font color=Cyan>(</font>Pn f r <font color=Green><u>_</u></font> i<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>let</u></font> r' <font color=Red>=</font> r<font color=Cyan>+</font><font color=Magenta>1</font> <font color=Green><u>in</u></font> r' <font color=Cyan>`seq`</font> Pn f r' <font color=Magenta>1</font> i+<a name="tab"></a>tab <font color=Cyan>(</font>Pn f r c i<font color=Cyan>)</font> <font color=Red>=</font> Pn f r <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>(</font>c<font color=Cyan>`div`</font><font color=Magenta>8</font><font color=Cyan>)</font><font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font><font color=Cyan>*</font><font color=Magenta>8</font><font color=Cyan>)</font> i++newlines <font color=Red>::</font> Int <font color=Red>-></font> Posn <font color=Red>-></font> Posn+<a name="newlines"></a>newlines n <font color=Cyan>(</font>Pn f r <font color=Green><u>_</u></font> i<font color=Cyan>)</font> <font color=Red>=</font> Pn f <font color=Cyan>(</font>r<font color=Cyan>+</font>n<font color=Cyan>)</font> <font color=Magenta>1</font> i++newpos <font color=Red>::</font> Int <font color=Red>-></font> Maybe String <font color=Red>-></font> Posn <font color=Red>-></font> Posn+<a name="newpos"></a>newpos r Nothing <font color=Cyan>(</font>Pn f <font color=Green><u>_</u></font> c i<font color=Cyan>)</font> <font color=Red>=</font> Pn f r c i+newpos r <font color=Cyan>(</font>Just <font color=Cyan>(</font><font color=Magenta>'"'</font><font color=Red><b>:</b></font>f<font color=Cyan>)</font><font color=Cyan>)</font> <font color=Cyan>(</font>Pn <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> c i<font color=Cyan>)</font> <font color=Red>=</font> Pn <font color=Cyan>(</font>init f<font color=Cyan>)</font> r c i+newpos r <font color=Cyan>(</font>Just f<font color=Cyan>)</font> <font color=Cyan>(</font>Pn <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> c i<font color=Cyan>)</font> <font color=Red>=</font> Pn f r c i++<font color=Blue>-- | Projections</font>++lineno <font color=Red>::</font> Posn <font color=Red>-></font> Int+filename <font color=Red>::</font> Posn <font color=Red>-></font> String+directory <font color=Red>::</font> Posn <font color=Red>-></font> FilePath++<a name="lineno"></a>lineno <font color=Cyan>(</font>Pn <font color=Green><u>_</u></font> r <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> r+<a name="filename"></a>filename <font color=Cyan>(</font>Pn f <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> f+<a name="directory"></a>directory <font color=Cyan>(</font>Pn f <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> dirname f+++<font color=Blue>-- | cpp-style printing</font>+cppline <font color=Red>::</font> Posn <font color=Red>-></font> String+<a name="cppline"></a>cppline <font color=Cyan>(</font>Pn f r <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"#line "</font><font color=Cyan>++</font>show r<font color=Cyan>++</font><font color=Magenta>" "</font><font color=Cyan>++</font>show f++ +<font color=Blue>-- | Strip non-directory suffix from file name (analogous to the shell</font>+<font color=Blue>-- command of the same name).</font>+dirname <font color=Red>::</font> String <font color=Red>-></font> String+<a name="dirname"></a>dirname <font color=Red>=</font> reverse <font color=Cyan>.</font> safetail <font color=Cyan>.</font> dropWhile <font color=Cyan>(</font>not<font color=Cyan>.</font><font color=Cyan>(</font><font color=Cyan>`elem`</font><font color=Magenta>"\\/"</font><font color=Cyan>)</font><font color=Cyan>)</font> <font color=Cyan>.</font> reverse+ <font color=Green><u>where</u></font> safetail <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+ safetail <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>x<font color=Cyan>)</font> <font color=Red>=</font> x++</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/ReadFirst.html view
@@ -0,0 +1,54 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : ReadFirst</font>+<font color=Blue>-- Copyright : 2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>-- </font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Read the first file that matches in a list of search paths.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>ReadFirst+ <font color=Cyan>(</font> readFirst+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> IO <font color=Cyan>(</font>hPutStrLn<font color=Cyan>,</font> stderr<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Directory <font color=Cyan>(</font>doesFileExist<font color=Cyan>)</font>+<font color=Green><u>import</u></font> List <font color=Cyan>(</font>intersperse<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Monad <font color=Cyan>(</font>when<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Position <font color=Cyan>(</font>Posn<font color=Cyan>,</font>directory<font color=Cyan>)</font>++<font color=Blue>-- | Attempt to read the given file from any location within the search path.</font>+<font color=Blue>-- The first location found is returned, together with the file content.</font>+<font color=Blue>-- (The directory of the calling file is always searched first, then</font>+<font color=Blue>-- the current directory, finally any specified search path.)</font>+readFirst <font color=Red>::</font> String <font color=Blue>-- ^ filename</font>+ <font color=Red>-></font> Posn <font color=Blue>-- ^ inclusion point</font>+ <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Blue>-- ^ search path</font>+ <font color=Red>-></font> Bool <font color=Blue>-- ^ report warnings?</font>+ <font color=Red>-></font> IO <font color=Cyan>(</font> FilePath+ <font color=Cyan>,</font> String+ <font color=Cyan>)</font> <font color=Blue>-- ^ discovered filepath, and file contents</font>++<a name="readFirst"></a>readFirst name demand path warn <font color=Red>=</font>+ try <font color=Cyan>(</font>cons dd <font color=Cyan>(</font><font color=Magenta>"."</font><font color=Red><b>:</b></font>path<font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Green><u>where</u></font>+ dd <font color=Red>=</font> directory demand+ cons x xs <font color=Red>=</font> <font color=Green><u>if</u></font> null x <font color=Green><u>then</u></font> xs <font color=Green><u>else</u></font> x<font color=Red><b>:</b></font>xs+ try <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Green><u>do</u></font>+ when warn <font color=Cyan>$</font>+ hPutStrLn stderr <font color=Cyan>(</font><font color=Magenta>"Warning: Can't find file \""</font><font color=Cyan>++</font>name+ <font color=Cyan>++</font><font color=Magenta>"\" in directories\n\t"</font>+ <font color=Cyan>++</font>concat <font color=Cyan>(</font>intersperse <font color=Magenta>"\n\t"</font> <font color=Cyan>(</font>cons dd <font color=Cyan>(</font><font color=Magenta>"."</font><font color=Red><b>:</b></font>path<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Cyan>++</font><font color=Magenta>"\n Asked for by: "</font><font color=Cyan>++</font>show demand<font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Magenta>"missing file: "</font><font color=Cyan>++</font>name<font color=Cyan>,</font><font color=Magenta>""</font><font color=Cyan>)</font>+ try <font color=Cyan>(</font>p<font color=Red><b>:</b></font>ps<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>do</u></font>+ <font color=Green><u>let</u></font> file <font color=Red>=</font> p<font color=Cyan>++</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>name+ ok <font color=Red><-</font> doesFileExist file+ <font color=Green><u>if</u></font> not ok <font color=Green><u>then</u></font> try ps+ <font color=Green><u>else</u></font> <font color=Green><u>do</u></font> content <font color=Red><-</font> readFile file+ return <font color=Cyan>(</font>file<font color=Cyan>,</font>content<font color=Cyan>)</font>+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/RunCpphs.html view
@@ -0,0 +1,26 @@+<pre><font color=Blue>{-+-- The main program for cpphs, a simple C pre-processor written in Haskell.++-- Copyright (c) 2004 Malcolm Wallace+-- This file is GPL, although the libraries it uses are either standard+-- Haskell'98 or distributed under the LGPL.+-}</font>+<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>RunCpphs <font color=Cyan>(</font> runCpphs <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>CppIfdef <font color=Cyan>(</font>cppIfdef<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>MacroPass<font color=Cyan>(</font>macroPass<font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Options <font color=Cyan>(</font>CpphsOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> BoolOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>)</font>+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Unlit <font color=Green><u>as</u></font> Unlit <font color=Cyan>(</font>unlit<font color=Cyan>)</font>+++runCpphs <font color=Red>::</font> CpphsOptions <font color=Red>-></font> FilePath <font color=Red>-></font> String <font color=Red>-></font> String+<a name="runCpphs"></a>runCpphs options filename input <font color=Red>=</font>+ <font color=Green><u>let</u></font> bools <font color=Red>=</font> boolopts options++ pass1 <font color=Red>=</font> cppIfdef filename <font color=Cyan>(</font>defines options<font color=Cyan>)</font> <font color=Cyan>(</font>includes options<font color=Cyan>)</font> bools input+ pass2 <font color=Red>=</font> macroPass <font color=Cyan>(</font>defines options<font color=Cyan>)</font> bools pass1+ result<font color=Red>=</font> <font color=Green><u>if</u></font> not <font color=Cyan>(</font>macros bools<font color=Cyan>)</font> <font color=Green><u>then</u></font> unlines <font color=Cyan>(</font>map snd pass1<font color=Cyan>)</font> <font color=Green><u>else</u></font> pass2+ pass3 <font color=Red>=</font> <font color=Green><u>if</u></font> literate bools <font color=Green><u>then</u></font> Unlit<font color=Cyan>.</font>unlit filename <font color=Green><u>else</u></font> id++ <font color=Green><u>in</u></font> pass3 result+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/SymTab.html view
@@ -0,0 +1,87 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : SymTab</font>+<font color=Blue>-- Copyright : 2000-2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>-- </font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : Stable</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- Symbol Table, based on index trees using a hash on the key.</font>+<font color=Blue>-- Keys are always Strings. Stored values can be any type.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>SymTab+ <font color=Cyan>(</font> SymTab+ <font color=Cyan>,</font> emptyST+ <font color=Cyan>,</font> insertST+ <font color=Cyan>,</font> deleteST+ <font color=Cyan>,</font> lookupST+ <font color=Cyan>,</font> definedST+ <font color=Cyan>,</font> IndTree+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Blue>-- | Symbol Table. Stored values are polymorphic, but the keys are</font>+<font color=Blue>-- always strings.</font>+<a name="SymTab"></a><font color=Green><u>type</u></font> SymTab v <font color=Red>=</font> IndTree <font color=Red>[</font><font color=Cyan>(</font>String<font color=Cyan>,</font>v<font color=Cyan>)</font><font color=Red>]</font>++emptyST <font color=Red>::</font> SymTab v+insertST <font color=Red>::</font> <font color=Cyan>(</font>String<font color=Cyan>,</font>v<font color=Cyan>)</font> <font color=Red>-></font> SymTab v <font color=Red>-></font> SymTab v+deleteST <font color=Red>::</font> String <font color=Red>-></font> SymTab v <font color=Red>-></font> SymTab v+lookupST <font color=Red>::</font> String <font color=Red>-></font> SymTab v <font color=Red>-></font> Maybe v+definedST <font color=Red>::</font> String <font color=Red>-></font> SymTab v <font color=Red>-></font> Bool++<a name="emptyST"></a>emptyST <font color=Red>=</font> itgen maxHash <font color=Red>[</font><font color=Red>]</font>+<a name="insertST"></a>insertST <font color=Cyan>(</font>s<font color=Cyan>,</font>v<font color=Cyan>)</font> ss <font color=Red>=</font> itiap <font color=Cyan>(</font>hash s<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Cyan>(</font>s<font color=Cyan>,</font>v<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font> ss id+<a name="deleteST"></a>deleteST s ss <font color=Red>=</font> itiap <font color=Cyan>(</font>hash s<font color=Cyan>)</font> <font color=Cyan>(</font>filter <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>/=</font>s<font color=Cyan>)</font><font color=Cyan>.</font>fst<font color=Cyan>)</font><font color=Cyan>)</font> ss id+<a name="lookupST"></a>lookupST s ss <font color=Red>=</font> <font color=Green><u>let</u></font> vs <font color=Red>=</font> filter <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>==</font>s<font color=Cyan>)</font><font color=Cyan>.</font>fst<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Cyan>(</font>itind <font color=Cyan>(</font>hash s<font color=Cyan>)</font><font color=Cyan>)</font> ss<font color=Cyan>)</font>+ <font color=Green><u>in</u></font> <font color=Green><u>if</u></font> null vs <font color=Green><u>then</u></font> Nothing+ <font color=Green><u>else</u></font> <font color=Cyan>(</font>Just <font color=Cyan>.</font> snd <font color=Cyan>.</font> head<font color=Cyan>)</font> vs+<a name="definedST"></a>definedST s ss <font color=Red>=</font> <font color=Green><u>let</u></font> vs <font color=Red>=</font> filter <font color=Cyan>(</font><font color=Cyan>(</font><font color=Cyan>==</font>s<font color=Cyan>)</font><font color=Cyan>.</font>fst<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Cyan>(</font>itind <font color=Cyan>(</font>hash s<font color=Cyan>)</font><font color=Cyan>)</font> ss<font color=Cyan>)</font>+ <font color=Green><u>in</u></font> <font color=Cyan>(</font>not <font color=Cyan>.</font> null<font color=Cyan>)</font> vs+++<font color=Blue>----</font>+<font color=Blue>-- | Index Trees (storing indexes at nodes).</font>++<a name="IndTree"></a><font color=Green><u>data</u></font> IndTree t <font color=Red>=</font> Leaf t <font color=Red>|</font> Fork Int <font color=Cyan>(</font>IndTree t<font color=Cyan>)</font> <font color=Cyan>(</font>IndTree t<font color=Cyan>)</font>+ <font color=Green><u>deriving</u></font> Show++itgen <font color=Red>::</font> Int <font color=Red>-></font> a <font color=Red>-></font> IndTree a+<a name="itgen"></a>itgen <font color=Magenta>1</font> x <font color=Red>=</font> Leaf x+itgen n x <font color=Red>=</font>+ <font color=Green><u>let</u></font> n' <font color=Red>=</font> n <font color=Cyan>`div`</font> <font color=Magenta>2</font>+ <font color=Green><u>in</u></font> Fork n' <font color=Cyan>(</font>itgen n' x<font color=Cyan>)</font> <font color=Cyan>(</font>itgen <font color=Cyan>(</font>n<font color=Blue>-</font>n'<font color=Cyan>)</font> x<font color=Cyan>)</font>++itiap <font color=Red>::</font> <font color=Blue>--Eval a =></font>+ Int <font color=Red>-></font> <font color=Cyan>(</font>a<font color=Red>-></font>a<font color=Cyan>)</font> <font color=Red>-></font> IndTree a <font color=Red>-></font> <font color=Cyan>(</font>IndTree a <font color=Red>-></font> b<font color=Cyan>)</font> <font color=Red>-></font> b+<a name="itiap"></a>itiap <font color=Green><u>_</u></font> f <font color=Cyan>(</font>Leaf x<font color=Cyan>)</font> k <font color=Red>=</font> <font color=Green><u>let</u></font> fx <font color=Red>=</font> f x <font color=Green><u>in</u></font> <font color=Blue>{-seq fx-}</font> <font color=Cyan>(</font>k <font color=Cyan>(</font>Leaf fx<font color=Cyan>)</font><font color=Cyan>)</font>+itiap i f <font color=Cyan>(</font>Fork n lt rt<font color=Cyan>)</font> k <font color=Red>=</font>+ <font color=Green><u>if</u></font> i<font color=Cyan><</font>n <font color=Green><u>then</u></font>+ itiap i f lt <font color=Cyan>$</font> <font color=Red>\</font>lt' <font color=Red>-></font> k <font color=Cyan>(</font>Fork n lt' rt<font color=Cyan>)</font>+ <font color=Green><u>else</u></font> itiap <font color=Cyan>(</font>i<font color=Blue>-</font>n<font color=Cyan>)</font> f rt <font color=Cyan>$</font> <font color=Red>\</font>rt' <font color=Red>-></font> k <font color=Cyan>(</font>Fork n lt rt'<font color=Cyan>)</font>++itind <font color=Red>::</font> Int <font color=Red>-></font> IndTree a <font color=Red>-></font> a +<a name="itind"></a>itind <font color=Green><u>_</u></font> <font color=Cyan>(</font>Leaf x<font color=Cyan>)</font> <font color=Red>=</font> x+itind i <font color=Cyan>(</font>Fork n lt rt<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>if</u></font> i<font color=Cyan><</font>n <font color=Green><u>then</u></font> itind i lt <font color=Green><u>else</u></font> itind <font color=Cyan>(</font>i<font color=Blue>-</font>n<font color=Cyan>)</font> rt+++<font color=Blue>----</font>+<font color=Blue>-- Hash values</font>++maxHash <font color=Red>::</font> Int <font color=Blue>-- should be prime</font>+<a name="maxHash"></a>maxHash <font color=Red>=</font> <font color=Magenta>101</font>++<a name="Hashable"></a><font color=Green><u>class</u></font> Hashable a <font color=Green><u>where</u></font>+ hashWithMax <font color=Red>::</font> Int <font color=Red>-></font> a <font color=Red>-></font> Int+ hash <font color=Red>::</font> a <font color=Red>-></font> Int+ hash <font color=Red>=</font> hashWithMax maxHash++<font color=Green><u>instance</u></font> Enum a <font color=Red>=></font> Hashable <font color=Red>[</font>a<font color=Red>]</font> <font color=Green><u>where</u></font>+ hashWithMax m <font color=Red>=</font> h <font color=Magenta>0</font>+ <font color=Green><u>where</u></font> h a <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> a+ h a <font color=Cyan>(</font>c<font color=Red><b>:</b></font>cs<font color=Cyan>)</font> <font color=Red>=</font> h <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>17</font><font color=Cyan>*</font><font color=Cyan>(</font>fromEnum c<font color=Cyan>)</font><font color=Cyan>+</font><font color=Magenta>19</font><font color=Cyan>*</font>a<font color=Cyan>)</font><font color=Cyan>`rem`</font>m<font color=Cyan>)</font> cs++<font color=Blue>----</font>+</pre>
+ docs/cpphs/Language/Preprocessor/Cpphs/Tokenise.html view
@@ -0,0 +1,257 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : Tokenise</font>+<font color=Blue>-- Copyright : 2004 Malcolm Wallace</font>+<font color=Blue>-- Licence : LGPL</font>+<font color=Blue>--</font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : experimental</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- The purpose of this module is to lex a source file (language</font>+<font color=Blue>-- unspecified) into tokens such that cpp can recognise a replaceable</font>+<font color=Blue>-- symbol or macro-use, and do the right thing.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>++<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Tokenise+ <font color=Cyan>(</font> linesCpp+ <font color=Cyan>,</font> reslash+ <font color=Cyan>,</font> tokenise+ <font color=Cyan>,</font> WordStyle<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font>+ <font color=Cyan>,</font> deWordStyle+ <font color=Cyan>,</font> parseMacroCall+ <font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Char+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>HashDefine+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs<font color=Cyan>.</font>Position++<font color=Blue>-- | A Mode value describes whether to tokenise a la Haskell, or a la Cpp.</font>+<font color=Blue>-- The main difference is that in Cpp mode we should recognise line</font>+<font color=Blue>-- continuation characters.</font>+<a name="Mode"></a><font color=Green><u>data</u></font> Mode <font color=Red>=</font> Haskell <font color=Red>|</font> Cpp++<font color=Blue>-- | linesCpp is, broadly speaking, Prelude.lines, except that</font>+<font color=Blue>-- on a line beginning with a \#, line continuation characters are</font>+<font color=Blue>-- recognised. In a line continuation, the newline character is</font>+<font color=Blue>-- preserved, but the backslash is not.</font>+linesCpp <font color=Red>::</font> String <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font>+<a name="linesCpp"></a>linesCpp <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+linesCpp <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> x<font color=Cyan>==</font><font color=Magenta>'#'</font> <font color=Red>=</font> tok Cpp <font color=Red>[</font><font color=Magenta>'#'</font><font color=Red>]</font> xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> tok Haskell <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Green><u>where</u></font>+ tok Cpp acc <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>ys<font color=Cyan>)</font> <font color=Red>=</font> tok Cpp <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>acc<font color=Cyan>)</font> ys+ tok <font color=Green><u>_</u></font> acc <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>ys<font color=Cyan>)</font> <font color=Red>=</font> reverse acc<font color=Red><b>:</b></font> tok Cpp <font color=Red>[</font><font color=Magenta>'#'</font><font color=Red>]</font> ys+ tok <font color=Green><u>_</u></font> acc <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>ys<font color=Cyan>)</font> <font color=Red>=</font> reverse acc<font color=Red><b>:</b></font> tok Haskell <font color=Red>[</font><font color=Red>]</font> ys+ tok <font color=Green><u>_</u></font> acc <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> reverse acc<font color=Red><b>:</b></font> <font color=Red>[</font><font color=Red>]</font>+ tok mode acc <font color=Cyan>(</font>y<font color=Red><b>:</b></font>ys<font color=Cyan>)</font> <font color=Red>=</font> tok mode <font color=Cyan>(</font>y<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> ys++<font color=Blue>-- | Put back the line-continuation characters.</font>+reslash <font color=Red>::</font> String <font color=Red>-></font> String+<a name="reslash"></a>reslash <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>reslash xs+reslash <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> reslash xs+reslash <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>++<font color=Blue>----</font>+<font color=Blue>-- | Submodes are required to deal correctly with nesting of lexical</font>+<font color=Blue>-- structures.</font>+<a name="SubMode"></a><font color=Green><u>data</u></font> SubMode <font color=Red>=</font> Any <font color=Red>|</font> Pred <font color=Cyan>(</font>Char<font color=Red>-></font>Bool<font color=Cyan>)</font> <font color=Cyan>(</font>Posn<font color=Red>-></font>String<font color=Red>-></font>WordStyle<font color=Cyan>)</font>+ <font color=Red>|</font> String Char <font color=Red>|</font> LineComment <font color=Red>|</font> NestComment Int+ <font color=Red>|</font> CComment++<font color=Blue>-- | Each token is classified as one of Ident, Other, or Cmd:</font>+<font color=Blue>-- * Ident is a word that could potentially match a macro name.</font>+<font color=Blue>-- * Cmd is a complete cpp directive (\#define etc).</font>+<font color=Blue>-- * Other is anything else.</font>+<a name="WordStyle"></a><font color=Green><u>data</u></font> WordStyle <font color=Red>=</font> Ident Posn String <font color=Red>|</font> Other String <font color=Red>|</font> Cmd <font color=Cyan>(</font>Maybe HashDefine<font color=Cyan>)</font>+ <font color=Green><u>deriving</u></font> <font color=Cyan>(</font>Eq<font color=Cyan>,</font>Show<font color=Cyan>)</font>+other <font color=Red>::</font> Posn <font color=Red>-></font> String <font color=Red>-></font> WordStyle+<a name="other"></a>other <font color=Green><u>_</u></font> s <font color=Red>=</font> Other s++deWordStyle <font color=Red>::</font> WordStyle <font color=Red>-></font> String+<a name="deWordStyle"></a>deWordStyle <font color=Cyan>(</font>Ident <font color=Green><u>_</u></font> i<font color=Cyan>)</font> <font color=Red>=</font> i+deWordStyle <font color=Cyan>(</font>Other i<font color=Cyan>)</font> <font color=Red>=</font> i+deWordStyle <font color=Cyan>(</font>Cmd <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"\n"</font>++<font color=Blue>-- | tokenise is, broadly-speaking, Prelude.words, except that:</font>+<font color=Blue>-- * the input is already divided into lines</font>+<font color=Blue>-- * each word-like "token" is categorised as one of {Ident,Other,Cmd}</font>+<font color=Blue>-- * \#define's are parsed and returned out-of-band using the Cmd variant</font>+<font color=Blue>-- * All whitespace is preserved intact as tokens.</font>+<font color=Blue>-- * C-comments are converted to white-space (depending on first param)</font>+<font color=Blue>-- * Parens and commas are tokens in their own right.</font>+<font color=Blue>-- * Any cpp line continuations are respected.</font>+<font color=Blue>-- No errors can be raised.</font>+<font color=Blue>-- The inverse of tokenise is (concatMap deWordStyle).</font>+tokenise <font color=Red>::</font> Bool <font color=Red>-></font> Bool <font color=Red>-></font> Bool <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font>+<a name="tokenise"></a>tokenise <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+tokenise strip ansi lang <font color=Cyan>(</font><font color=Cyan>(</font>pos<font color=Cyan>,</font>str<font color=Cyan>)</font><font color=Red><b>:</b></font>pos_strs<font color=Cyan>)</font> <font color=Red>=</font>+ <font color=Cyan>(</font><font color=Green><u>if</u></font> lang <font color=Green><u>then</u></font> haskell <font color=Green><u>else</u></font> plaintext<font color=Cyan>)</font> Any <font color=Red>[</font><font color=Red>]</font> pos pos_strs str+ <font color=Green><u>where</u></font>+ <font color=Blue>-- rules to lex Haskell</font>+ haskell <font color=Red>::</font> SubMode <font color=Red>-></font> String <font color=Red>-></font> Posn <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Red>-></font> String <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font>+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font> <font color=Blue>-- emit "\n" $</font>+ cpp Any haskell <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> p ls xs+ <font color=Blue>-- warning: non-maximal munch on comment</font>+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell LineComment <font color=Magenta>"--"</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'{'</font><font color=Red><b>:</b></font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>NestComment <font color=Magenta>0</font><font color=Cyan>)</font> <font color=Magenta>"-{"</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font><font color=Magenta>'*'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Red>|</font>strip <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell CComment <font color=Magenta>" "</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'"'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>String <font color=Magenta>'"'</font><font color=Cyan>)</font> <font color=Red>[</font><font color=Magenta>'"'</font><font color=Red>]</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font><font color=Magenta>'\''</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>String <font color=Magenta>'\''</font><font color=Cyan>)</font> <font color=Magenta>"'"</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> single x <font color=Red>=</font> emit acc <font color=Cyan>$</font> emit <font color=Red>[</font>x<font color=Red>]</font> <font color=Cyan>$</font>+ haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ haskell Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> space x <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>Pred space other<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font>+ p ls xs+ haskell Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> symbol x <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>Pred symbol other<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font>+ p ls xs+ <font color=Blue>-- haskell Any [] p ls (x:xs) | ident0 x = id $</font>+ haskell Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> ident0 x <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ haskell <font color=Cyan>(</font>Pred ident1 Ident<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font>+ p ls xs+ haskell Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> haskell Any <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs++ haskell pre<font color=Red>@</font><font color=Cyan>(</font>Pred pred ws<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> pred x <font color=Red>=</font> haskell pre <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ haskell <font color=Cyan>(</font>Pred <font color=Green><u>_</u></font> ws<font color=Cyan>)</font> acc p ls xs <font color=Red>=</font> ws p <font color=Cyan>(</font>reverse acc<font color=Cyan>)</font><font color=Red><b>:</b></font>+ haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ haskell <font color=Cyan>(</font>String c<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> x<font color=Cyan>==</font><font color=Magenta>'\\'</font> <font color=Red>=</font> haskell <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ <font color=Red>|</font> x<font color=Cyan>==</font>c <font color=Red>=</font> haskell <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font>c<font color=Red><b>:</b></font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ haskell <font color=Cyan>(</font>String c<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> x<font color=Cyan>==</font>c <font color=Red>=</font> emit <font color=Cyan>(</font>c<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> <font color=Cyan>$</font> haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> haskell <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ haskell LineComment acc p ls xs<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font> haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ haskell LineComment acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> haskell LineComment <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ haskell <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font><font color=Magenta>'{'</font><font color=Red><b>:</b></font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>=</font> haskell <font color=Cyan>(</font>NestComment <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Magenta>"-{"</font><font color=Cyan>++</font>acc<font color=Cyan>)</font> p ls xs+ haskell <font color=Cyan>(</font>NestComment <font color=Magenta>0</font><font color=Cyan>)</font> acc p ls <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'}'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>=</font> emit <font color=Cyan>(</font><font color=Magenta>"}-"</font><font color=Cyan>++</font>acc<font color=Cyan>)</font> <font color=Cyan>$</font> haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ haskell <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'}'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>=</font> haskell <font color=Cyan>(</font>NestComment <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Magenta>"}-"</font><font color=Cyan>++</font>acc<font color=Cyan>)</font> p ls xs+ haskell <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> haskell <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font>+ p ls xs+ haskell CComment acc p ls <font color=Cyan>(</font><font color=Magenta>'*'</font><font color=Red><b>:</b></font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit <font color=Cyan>(</font><font color=Magenta>" "</font><font color=Cyan>++</font>acc<font color=Cyan>)</font> <font color=Cyan>$</font>+ haskell Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ haskell CComment acc p ls <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> haskell CComment <font color=Cyan>(</font><font color=Magenta>' '</font><font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ haskell mode acc <font color=Green><u>_</u></font> <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font>ls<font color=Cyan>)</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> haskell mode acc p ls <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>l<font color=Cyan>)</font>+ haskell <font color=Green><u>_</u></font> acc <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font> <font color=Red>[</font><font color=Red>]</font>++ <font color=Blue>-- rules to lex Cpp</font>+ cpp <font color=Red>::</font> SubMode <font color=Red>-></font> <font color=Cyan>(</font>SubMode <font color=Red>-></font> String <font color=Red>-></font> Posn <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Red>-></font> String <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font><font color=Cyan>)</font>+ <font color=Red>-></font> String <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Posn <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Red>-></font> String <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font>+ cpp mode next word line pos remaining input <font color=Red>=</font>+ lexcpp mode word line remaining input+ <font color=Green><u>where</u></font>+ lexcpp Any w l ls <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font><font color=Magenta>'*'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp <font color=Cyan>(</font>NestComment <font color=Magenta>0</font><font color=Cyan>)</font> <font color=Magenta>""</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp Any w l ls <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp LineComment <font color=Magenta>" "</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp Any w l <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l'<font color=Cyan>)</font><font color=Red><b>:</b></font>ls<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font> <font color=Red>=</font> cpp Any next <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Magenta>"\n"</font><font color=Red><b>:</b></font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> p ls l'+ lexcpp Any w l ls <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Magenta>"\n"</font><font color=Red><b>:</b></font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp Any w l ls xs<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> Cmd <font color=Cyan>(</font>parseHashDefine ansi+ <font color=Cyan>(</font>reverse <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font><font color=Cyan>)</font><font color=Cyan>)</font><font color=Red><b>:</b></font>+ next Any <font color=Red>[</font><font color=Red>]</font> pos ls xs+ <font color=Blue>-- lexcpp Any w l ls ('"':xs) = lexcpp (String '"') ['"'] (w*/*l) ls xs</font>+ <font color=Blue>-- lexcpp Any w l ls ('\'':xs) = lexcpp (String '\'') "'" (w*/*l) ls xs</font>+ lexcpp Any w l ls <font color=Cyan>(</font><font color=Magenta>'"'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Magenta>"\""</font><font color=Red><b>:</b></font><font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font><font color=Cyan>)</font> ls xs+ lexcpp Any w l ls <font color=Cyan>(</font><font color=Magenta>'\''</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Magenta>"'"</font><font color=Red><b>:</b></font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font><font color=Cyan>)</font> ls xs+ lexcpp Any <font color=Red>[</font><font color=Red>]</font> l ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> ident0 x <font color=Red>=</font> lexcpp <font color=Cyan>(</font>Pred ident1 Ident<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font> l ls xs+ <font color=Blue>-- lexcpp Any w l ls (x:xs) | ident0 x = lexcpp (Pred ident1 Ident) [x] (w*/*l) ls xs</font>+ lexcpp Any w l ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> single x <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Red>[</font>x<font color=Red>]</font><font color=Red><b>:</b></font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ <font color=Red>|</font> space x <font color=Red>=</font> lexcpp <font color=Cyan>(</font>Pred space other<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ <font color=Red>|</font> symbol x <font color=Red>=</font> lexcpp <font color=Cyan>(</font>Pred symbol other<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> lexcpp Any <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ lexcpp pre<font color=Red>@</font><font color=Cyan>(</font>Pred pred <font color=Green><u>_</u></font><font color=Cyan>)</font> w l ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> pred x <font color=Red>=</font> lexcpp pre <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ lexcpp <font color=Cyan>(</font>Pred <font color=Green><u>_</u></font> <font color=Green><u>_</u></font><font color=Cyan>)</font> w l ls xs <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp <font color=Cyan>(</font>String c<font color=Cyan>)</font> w l ls <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> x<font color=Cyan>==</font><font color=Magenta>'\\'</font> <font color=Red>=</font> lexcpp <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ <font color=Red>|</font> x<font color=Cyan>==</font>c <font color=Red>=</font> lexcpp <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font>c<font color=Red><b>:</b></font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ lexcpp <font color=Cyan>(</font>String c<font color=Cyan>)</font> w l ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> x<font color=Cyan>==</font>c <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Cyan>(</font>c<font color=Red><b>:</b></font>w<font color=Cyan>)</font><font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ <font color=Red>|</font> otherwise <font color=Red>=</font> lexcpp <font color=Cyan>(</font>String c<font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ lexcpp LineComment w l <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l'<font color=Cyan>)</font><font color=Red><b>:</b></font>ls<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font>+ <font color=Red>=</font> cpp LineComment next <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font><font color=Cyan>*/*</font>l<font color=Cyan>)</font> pos ls l'+ lexcpp LineComment w l ls <font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>=</font> lexcpp LineComment <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font><font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp LineComment w l ls xs<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> lexcpp Any w l ls xs+ lexcpp LineComment w l ls <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp LineComment <font color=Cyan>(</font><font color=Magenta>' '</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font> l ls xs+ lexcpp <font color=Cyan>(</font>NestComment <font color=Green><u>_</u></font><font color=Cyan>)</font> w l ls <font color=Cyan>(</font><font color=Magenta>'*'</font><font color=Red><b>:</b></font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>=</font> lexcpp Any <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font>w<font color=Cyan>*/*</font>l<font color=Cyan>)</font> ls xs+ lexcpp <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> w l ls <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> lexcpp <font color=Cyan>(</font>NestComment n<font color=Cyan>)</font> <font color=Cyan>(</font><font color=Magenta>' '</font><font color=Red><b>:</b></font>w<font color=Cyan>)</font> l+ ls xs+ lexcpp mode w l <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l'<font color=Cyan>)</font><font color=Red><b>:</b></font>ls<font color=Cyan>)</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> cpp mode next w l p ls <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>l'<font color=Cyan>)</font>+ lexcpp <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>++ <font color=Blue>-- rules to lex non-Haskell, non-cpp text</font>+ plaintext <font color=Red>::</font> SubMode <font color=Red>-></font> String <font color=Red>-></font> Posn <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>Posn<font color=Cyan>,</font>String<font color=Cyan>)</font><font color=Red>]</font>+ <font color=Red>-></font> String <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font>+ plaintext Any acc p ls <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font> <font color=Blue>-- emit "\n" $</font>+ cpp Any plaintext <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> p ls xs+ plaintext Any acc p ls <font color=Cyan>(</font><font color=Magenta>'/'</font><font color=Red><b>:</b></font><font color=Magenta>'*'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Red>|</font>strip <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ plaintext CComment <font color=Magenta>" "</font> p ls xs+ plaintext Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> single x <font color=Red>=</font> emit acc <font color=Cyan>$</font> emit <font color=Red>[</font>x<font color=Red>]</font> <font color=Cyan>$</font>+ plaintext Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ plaintext Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> space x <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ plaintext <font color=Cyan>(</font>Pred space other<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font>+ p ls xs+ plaintext Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> ident0 x <font color=Red>=</font> emit acc <font color=Cyan>$</font>+ plaintext <font color=Cyan>(</font>Pred ident1 Ident<font color=Cyan>)</font> <font color=Red>[</font>x<font color=Red>]</font>+ p ls xs+ plaintext Any acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> plaintext Any <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ plaintext pre<font color=Red>@</font><font color=Cyan>(</font>Pred pred ws<font color=Cyan>)</font> acc p ls <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font>+ <font color=Red>|</font> pred x <font color=Red>=</font> plaintext pre <font color=Cyan>(</font>x<font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ plaintext <font color=Cyan>(</font>Pred <font color=Green><u>_</u></font> ws<font color=Cyan>)</font> acc p ls xs <font color=Red>=</font> ws p <font color=Cyan>(</font>reverse acc<font color=Cyan>)</font><font color=Red><b>:</b></font>+ plaintext Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ plaintext CComment acc p ls <font color=Cyan>(</font><font color=Magenta>'*'</font><font color=Red><b>:</b></font><font color=Magenta>'/'</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> emit <font color=Cyan>(</font><font color=Magenta>" "</font><font color=Cyan>++</font>acc<font color=Cyan>)</font> <font color=Cyan>$</font>+ plaintext Any <font color=Red>[</font><font color=Red>]</font> p ls xs+ plaintext CComment acc p ls <font color=Cyan>(</font><font color=Green><u>_</u></font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> plaintext CComment <font color=Cyan>(</font><font color=Magenta>' '</font><font color=Red><b>:</b></font>acc<font color=Cyan>)</font> p ls xs+ plaintext mode acc <font color=Green><u>_</u></font> <font color=Cyan>(</font><font color=Cyan>(</font>p<font color=Cyan>,</font>l<font color=Cyan>)</font><font color=Red><b>:</b></font>ls<font color=Cyan>)</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> plaintext mode acc p ls <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>l<font color=Cyan>)</font>+ plaintext <font color=Green><u>_</u></font> acc <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> emit acc <font color=Cyan>$</font> <font color=Red>[</font><font color=Red>]</font>++ <font color=Blue>-- predicates for lexing Haskell.</font>+ ident0 x <font color=Red>=</font> isAlpha x <font color=Cyan>||</font> x <font color=Cyan>`elem`</font> <font color=Magenta>"_`"</font>+ ident1 x <font color=Red>=</font> isAlphaNum x <font color=Cyan>||</font> x <font color=Cyan>`elem`</font> <font color=Magenta>"'_`"</font>+ symbol x <font color=Red>=</font> x <font color=Cyan>`elem`</font> <font color=Magenta>":!#$%&*+./<=>?@\\^|-~"</font>+ single x <font color=Red>=</font> x <font color=Cyan>`elem`</font> <font color=Magenta>"(),[];{}"</font>+ space x <font color=Red>=</font> x <font color=Cyan>`elem`</font> <font color=Magenta>" \t"</font>+ <font color=Blue>-- emit a token (if there is one) from the accumulator</font>+ emit <font color=Magenta>""</font> <font color=Red>=</font> id+ emit xs <font color=Red>=</font> <font color=Cyan>(</font>Other <font color=Cyan>(</font>reverse xs<font color=Cyan>)</font><font color=Red><b>:</b></font><font color=Cyan>)</font>+ <font color=Blue>-- add a reversed word to the accumulator</font>+ <font color=Magenta>""</font> <font color=Cyan>*/*</font> l <font color=Red>=</font> l+ w <font color=Cyan>*/*</font> l <font color=Red>=</font> reverse w <font color=Red><b>:</b></font> l+ <font color=Blue>-- help out broken Haskell compilers which need balanced numbers of C</font>+ <font color=Blue>-- comments in order to do import chasing :-) -----> */*</font>+++<font color=Blue>-- | Parse a possible macro call, returning argument list and remaining input</font>+parseMacroCall <font color=Red>::</font> Posn <font color=Red>-></font> <font color=Red>[</font>WordStyle<font color=Red>]</font> <font color=Red>-></font> Maybe <font color=Cyan>(</font><font color=Red>[</font><font color=Red>[</font>WordStyle<font color=Red>]</font><font color=Red>]</font><font color=Cyan>,</font><font color=Red>[</font>WordStyle<font color=Red>]</font><font color=Cyan>)</font>+<a name="parseMacroCall"></a>parseMacroCall p <font color=Red>=</font> call <font color=Cyan>.</font> skip+ <font color=Green><u>where</u></font>+ skip <font color=Cyan>(</font>Other x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> all isSpace x <font color=Red>=</font> skip xs+ skip xss <font color=Red>=</font> xss+ call <font color=Cyan>(</font>Other <font color=Magenta>"("</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font>args <font color=Cyan>(</font><font color=Magenta>0</font><font color=Red>::</font>Int<font color=Cyan>)</font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>.</font> skip<font color=Cyan>)</font> xs+ call <font color=Green><u>_</u></font> <font color=Red>=</font> Nothing+ args <font color=Magenta>0</font> w acc <font color=Cyan>(</font> Other <font color=Magenta>")"</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Just <font color=Cyan>(</font>reverse <font color=Cyan>(</font>addone w acc<font color=Cyan>)</font><font color=Cyan>,</font> xs<font color=Cyan>)</font>+ args <font color=Magenta>0</font> w acc <font color=Cyan>(</font> Other <font color=Magenta>","</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> args <font color=Magenta>0</font> <font color=Red>[</font><font color=Red>]</font> <font color=Cyan>(</font>addone w acc<font color=Cyan>)</font> <font color=Cyan>(</font>skip xs<font color=Cyan>)</font>+ args n w acc <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Other <font color=Magenta>"("</font><font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> args <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> acc xs+ args n w acc <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Other <font color=Magenta>")"</font><font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> args <font color=Cyan>(</font>n<font color=Blue>-</font><font color=Magenta>1</font><font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> acc xs+ args n w acc <font color=Cyan>(</font> Ident <font color=Green><u>_</u></font> v <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> args n <font color=Cyan>(</font>Ident p v<font color=Red><b>:</b></font>w<font color=Cyan>)</font> acc xs+ args n w acc <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Other <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> args n <font color=Cyan>(</font>x<font color=Red><b>:</b></font>w<font color=Cyan>)</font> acc xs+ args <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Green><u>_</u></font> <font color=Red>=</font> Nothing+ addone w acc <font color=Red>=</font> reverse <font color=Cyan>(</font>skip w<font color=Cyan>)</font><font color=Red><b>:</b></font> acc++</pre>
+ docs/cpphs/Language/Preprocessor/Unlit.html view
@@ -0,0 +1,71 @@+<pre><font color=Blue>-- | Part of this code is from "Report on the Programming Language Haskell",</font>+<font color=Blue>-- version 1.2, appendix C.</font>+<font color=Green><u>module</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Unlit <font color=Cyan>(</font>unlit<font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Char++<a name="Classified"></a><font color=Green><u>data</u></font> Classified <font color=Red>=</font> Program String <font color=Red>|</font> Blank <font color=Red>|</font> Comment+ <font color=Red>|</font> Include Int String <font color=Red>|</font> Pre String++classify <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>Classified<font color=Red>]</font>+<a name="classify"></a>classify <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>+classify <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> x <font color=Cyan>==</font> <font color=Magenta>"begin{code}"</font> <font color=Red>=</font> Blank <font color=Red><b>:</b></font> allProg xs+ <font color=Green><u>where</u></font> allProg <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font> <font color=Blue>-- Should give an error message,</font>+ <font color=Blue>-- but I have no good position information.</font>+ allProg <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'\\'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> x <font color=Cyan>==</font> <font color=Magenta>"end{code}"</font> <font color=Red>=</font> Blank <font color=Red><b>:</b></font> classify xs+ allProg <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Program x<font color=Red><b>:</b></font>allProg xs+classify <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'>'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Program <font color=Cyan>(</font><font color=Magenta>' '</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font> <font color=Red><b>:</b></font> classify xs+classify <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'#'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font><font color=Green><u>case</u></font> words x <font color=Green><u>of</u></font>+ <font color=Cyan>(</font>line<font color=Red><b>:</b></font>file<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>|</font> all isDigit line+ <font color=Red>-></font> Include <font color=Cyan>(</font>read line<font color=Cyan>)</font> file+ <font color=Green><u>_</u></font> <font color=Red>-></font> Pre x+ <font color=Cyan>)</font> <font color=Red><b>:</b></font> classify xs+classify <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> all isSpace x <font color=Red>=</font> Blank<font color=Red><b>:</b></font>classify xs+classify <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> Comment<font color=Red><b>:</b></font>classify xs++unclassify <font color=Red>::</font> Classified <font color=Red>-></font> String+<a name="unclassify"></a>unclassify <font color=Cyan>(</font>Program s<font color=Cyan>)</font> <font color=Red>=</font> s+unclassify <font color=Cyan>(</font>Pre s<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>'#'</font><font color=Red><b>:</b></font>s+unclassify <font color=Cyan>(</font>Include i f<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>'#'</font><font color=Red><b>:</b></font><font color=Magenta>' '</font><font color=Red><b>:</b></font>show i <font color=Cyan>++</font> <font color=Magenta>' '</font><font color=Red><b>:</b></font>f+unclassify Blank <font color=Red>=</font> <font color=Magenta>""</font>+unclassify Comment <font color=Red>=</font> <font color=Magenta>""</font>++<font color=Blue>-- | 'unlit' takes a filename (for error reports), and transforms the</font>+<font color=Blue>-- given string, to eliminate the literate comments from the program text.</font>+unlit <font color=Red>::</font> FilePath <font color=Red>-></font> String <font color=Red>-></font> String+<a name="unlit"></a>unlit file lhs <font color=Red>=</font> <font color=Cyan>(</font>unlines+ <font color=Cyan>.</font> map unclassify+ <font color=Cyan>.</font> adjacent file <font color=Cyan>(</font><font color=Magenta>0</font><font color=Red>::</font>Int<font color=Cyan>)</font> Blank+ <font color=Cyan>.</font> classify<font color=Cyan>)</font> <font color=Cyan>(</font>inlines lhs<font color=Cyan>)</font>++adjacent <font color=Red>::</font> FilePath <font color=Red>-></font> Int <font color=Red>-></font> Classified <font color=Red>-></font> <font color=Red>[</font>Classified<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>Classified<font color=Red>]</font>+<a name="adjacent"></a>adjacent file <font color=Magenta>0</font> <font color=Green><u>_</u></font> <font color=Cyan>(</font>x <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x <font color=Red><b>:</b></font> adjacent file <font color=Magenta>1</font> x xs <font color=Blue>-- force evaluation of line number</font>+adjacent file n y<font color=Red>@</font><font color=Cyan>(</font>Program <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red>@</font>Comment <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> error <font color=Cyan>(</font>message file n <font color=Magenta>"program"</font> <font color=Magenta>"comment"</font><font color=Cyan>)</font>+adjacent file n y<font color=Red>@</font><font color=Cyan>(</font>Program <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Include i f<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent f i y xs+adjacent file n y<font color=Red>@</font><font color=Cyan>(</font>Program <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Pre <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent file <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> y xs+adjacent file n y<font color=Red>@</font>Comment <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Program <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> error <font color=Cyan>(</font>message file n <font color=Magenta>"comment"</font> <font color=Magenta>"program"</font><font color=Cyan>)</font>+adjacent file n y<font color=Red>@</font>Comment <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Include i f<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent f i y xs+adjacent file n y<font color=Red>@</font>Comment <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Pre <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent file <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> y xs+adjacent file n y<font color=Red>@</font>Blank <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Include i f<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent f i y xs+adjacent file n y<font color=Red>@</font>Blank <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font>Pre <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent file <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> y xs+adjacent file n <font color=Green><u>_</u></font> <font color=Cyan>(</font>x<font color=Red>@</font>next <font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x<font color=Red><b>:</b></font> adjacent file <font color=Cyan>(</font>n<font color=Cyan>+</font><font color=Magenta>1</font><font color=Cyan>)</font> x xs+adjacent file n <font color=Green><u>_</u></font> <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Red>]</font>++message <font color=Red>::</font> String <font color=Red>-></font> Int <font color=Red>-></font> String <font color=Red>-></font> String <font color=Red>-></font> String+<a name="message"></a>message <font color=Magenta>"\"\""</font> n p c <font color=Red>=</font> <font color=Magenta>"Line "</font><font color=Cyan>++</font>show n<font color=Cyan>++</font><font color=Magenta>": "</font><font color=Cyan>++</font>p<font color=Cyan>++</font> <font color=Magenta>" line before "</font><font color=Cyan>++</font>c<font color=Cyan>++</font><font color=Magenta>" line.\n"</font>+message <font color=Red>[</font><font color=Red>]</font> n p c <font color=Red>=</font> <font color=Magenta>"Line "</font><font color=Cyan>++</font>show n<font color=Cyan>++</font><font color=Magenta>": "</font><font color=Cyan>++</font>p<font color=Cyan>++</font> <font color=Magenta>" line before "</font><font color=Cyan>++</font>c<font color=Cyan>++</font><font color=Magenta>" line.\n"</font>+message file n p c <font color=Red>=</font> <font color=Magenta>"In file "</font> <font color=Cyan>++</font> file <font color=Cyan>++</font> <font color=Magenta>" at line "</font><font color=Cyan>++</font>show n<font color=Cyan>++</font><font color=Magenta>": "</font><font color=Cyan>++</font>p<font color=Cyan>++</font> <font color=Magenta>" line before "</font><font color=Cyan>++</font>c<font color=Cyan>++</font><font color=Magenta>" line.\n"</font>+++<font color=Blue>-- Re-implementation of 'lines', for better efficiency (but decreased laziness).</font>+<font color=Blue>-- Also, importantly, accepts non-standard DOS and Mac line ending characters.</font>+inlines <font color=Red>::</font> String <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font>+<a name="inlines"></a>inlines s <font color=Red>=</font> lines' s id+ <font color=Green><u>where</u></font>+ lines' <font color=Red>[</font><font color=Red>]</font> acc <font color=Red>=</font> <font color=Red>[</font>acc <font color=Red>[</font><font color=Red>]</font><font color=Red>]</font>+ lines' <font color=Cyan>(</font><font color=Magenta>'\^M'</font><font color=Red><b>:</b></font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>s<font color=Cyan>)</font> acc <font color=Red>=</font> acc <font color=Red>[</font><font color=Red>]</font> <font color=Red><b>:</b></font> lines' s id <font color=Blue>-- DOS</font>+ lines' <font color=Cyan>(</font><font color=Magenta>'\^M'</font><font color=Red><b>:</b></font>s<font color=Cyan>)</font> acc <font color=Red>=</font> acc <font color=Red>[</font><font color=Red>]</font> <font color=Red><b>:</b></font> lines' s id <font color=Blue>-- MacOS</font>+ lines' <font color=Cyan>(</font><font color=Magenta>'\n'</font><font color=Red><b>:</b></font>s<font color=Cyan>)</font> acc <font color=Red>=</font> acc <font color=Red>[</font><font color=Red>]</font> <font color=Red><b>:</b></font> lines' s id <font color=Blue>-- Unix</font>+ lines' <font color=Cyan>(</font>c<font color=Red><b>:</b></font>s<font color=Cyan>)</font> acc <font color=Red>=</font> lines' s <font color=Cyan>(</font>acc <font color=Cyan>.</font> <font color=Cyan>(</font>c<font color=Red><b>:</b></font><font color=Cyan>)</font><font color=Cyan>)</font>++</pre>
+ docs/cpphs/Main.html view
@@ -0,0 +1,360 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Main</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Main.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Main</FONT+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><A HREF="#v%3Aversion"+>version</A+> :: String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Amain"+>main</A+> :: IO ()</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aexecute"+>execute</A+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+> -> Maybe FilePath -> Maybe FilePath -> IO ()</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>data</SPAN+> <A HREF="#t%3AConvertArgs"+>ConvertArgs</A+> = <A HREF="#v%3AConvertArgs"+>ConvertArgs</A+> {<TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="recfield"+><A HREF="#v%3Atraditional"+>traditional</A+>, <A HREF="#v%3Astrip"+>strip</A+> :: Bool</TD+></TR+><TR+><TD CLASS="recfield"+><A HREF="#v%3Ainfile"+>infile</A+>, <A HREF="#v%3Aoutfile"+>outfile</A+> :: String</TD+></TR+></TABLE+>}</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3AconvertArgs"+>convertArgs</A+> :: [String] -> [String]</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aversion"+></A+><B+>version</B+> :: String</TD+><TD CLASS="declbut"+><A HREF="Main.html#version"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Amain"+></A+><B+>main</B+> :: IO ()</TD+><TD CLASS="declbut"+><A HREF="Main.html#main"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aexecute"+></A+><B+>execute</B+> :: <A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>CpphsOptions</A+> -> Maybe FilePath -> Maybe FilePath -> IO ()</TD+><TD CLASS="declbut"+><A HREF="Main.html#execute"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="doc"+>Execute the preprocessor.+ If the filepath is Nothing then default to stdout/stdin as appropriate.+</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>data</SPAN+> <A NAME="t%3AConvertArgs"+></A+><B+>ConvertArgs</B+> </TD+><TD CLASS="declbut"+><A HREF="Main.html#ConvertArgs"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>Convert commandline options to remain compatible with cpp.+ Based on a shell script cpphs.compat+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="5" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3AConvertArgs"+></A+><B+>ConvertArgs</B+></TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="body" COLSPAN="2"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3Atraditional"+></A+><B+>traditional</B+>, <A NAME="v%3Astrip"+></A+><B+>strip</B+> :: Bool</TD+><TD CLASS="rdoc"+></TD+></TR+><TR+><TD CLASS="arg"+><A NAME="v%3Ainfile"+></A+><B+>infile</B+>, <A NAME="v%3Aoutfile"+></A+><B+>outfile</B+> :: String</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3AconvertArgs"+></A+><B+>convertArgs</B+> :: [String] -> [String]</TD+><TD CLASS="declbut"+><A HREF="Main.html#convertArgs"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Text-ParserCombinators-HuttonMeijer.html view
@@ -0,0 +1,1563 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>Text.ParserCombinators.HuttonMeijer</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html"+>Source code</A+></TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="modulebar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><FONT SIZE="6"+>Text.ParserCombinators.HuttonMeijer</FONT+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Description</TD+></TR+><TR+><TD CLASS="doc"+><P+>Copyright : Graham Hutton (University of Nottingham), Erik Meijer (University of Utrecht)+</P+><P+>Maintainer : Malcolm Wallace <A HREF="Malcolm.Wallace@cs.york.ac.uk"+>Malcolm.Wallace@cs.york.ac.uk</A+>+ Stability : Stable+ Portability : All+</P+><P+>A LIBRARY OF MONADIC PARSER COMBINATORS+</P+><P+>29th July 1996+</P+><P+>Graham Hutton Erik Meijer+ University of Nottingham University of Utrecht+</P+><P+>This Haskell script defines a library of parser combinators, and is+ taken from sections 1-6 of our article <A HREF="Monadic Parser Combinators.html"+>Monadic Parser Combinators</A+>.+ Some changes to the library have been made in the move from Gofer+ to Haskell:+</P+><UL+><LI+> Do notation is used in place of monad comprehension notation;+</LI+><LI+> The parser datatype is defined using <A HREF="newtype.html"+>newtype</A+>, to avoid the overhead+ of tagging and untagging parsers with the P constructor.+</LI+></UL+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Synopsis</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="decl"+><SPAN CLASS="keyword"+>newtype</SPAN+> <A HREF="#t%3AParser"+>Parser</A+> a = <A HREF="#v%3AP"+>P</A+> ([Token] -> [(a, [Token])])</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aitem"+>item</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Token</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Afirst"+>first</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Apapply"+>papply</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> [Token] -> [(a, [Token])]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3A%2B%2B%2B"+>(+++)</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Asat"+>sat</A+> :: (Token -> Bool) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Token</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Amany"+>many</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Amany1"+>many1</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Asepby"+>sepby</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Asepby1"+>sepby1</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Achainl"+>chainl</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Achainl1"+>chainl1</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Achainr"+>chainr</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Achainr1"+>chainr1</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aops"+>ops</A+> :: [(<A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Abracket"+>bracket</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> c -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Achar"+>char</A+> :: Char -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Adigit"+>digit</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Alower"+>lower</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aupper"+>upper</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aletter"+>letter</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aalphanum"+>alphanum</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Astring"+>string</A+> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aident"+>ident</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anat"+>nat</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aint"+>int</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aspaces"+>spaces</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Acomment"+>comment</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Ajunk"+>junk</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Askip"+>skip</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Atoken"+>token</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Anatural"+>natural</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Ainteger"+>integer</A+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Asymbol"+>symbol</A+> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+></TR+><TR+><TD CLASS="s8"+></TD+></TR+><TR+><TD CLASS="decl"+><A HREF="#v%3Aidentifier"+>identifier</A+> :: [String] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="section1"+>Documentation</TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><SPAN CLASS="keyword"+>newtype</SPAN+> <A NAME="t%3AParser"+></A+><B+>Parser</B+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#Parser"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="ndoc"+>The parser monad+</TD+></TR+><TR+><TD CLASS="section4"+>Constructors</TD+></TR+><TR+><TD CLASS="body"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="arg"+><A NAME="v%3AP"+></A+><B+>P</B+> ([Token] -> [(a, [Token])])</TD+><TD CLASS="rdoc"+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section4"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'i:Parser')" ALT="show/hide"+> Instances</TD+></TR+><TR+><TD CLASS="body"+><DIV ID="i:Parser" STYLE="display:block;"+><TABLE CLASS="vanilla" CELLSPACING="1" CELLPADDING="0"+><TR+><TD CLASS="decl"+>Functor <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+></TD+></TR+><TR+><TD CLASS="decl"+>Monad <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+></TD+></TR+><TR+><TD CLASS="decl"+>MonadPlus <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+></TD+></TR+></TABLE+></DIV+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aitem"+></A+><B+>item</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Token</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#item"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Afirst"+></A+><B+>first</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#first"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Apapply"+></A+><B+>papply</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> [Token] -> [(a, [Token])]</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#papply"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3A%2B%2B%2B"+></A+><B+>(+++)</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#%2B%2B%2B"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Asat"+></A+><B+>sat</B+> :: (Token -> Bool) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Token</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#sat"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Amany"+></A+><B+>many</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#many"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Amany1"+></A+><B+>many1</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#many1"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Asepby"+></A+><B+>sepby</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#sepby"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Asepby1"+></A+><B+>sepby1</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> [a]</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#sepby1"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Achainl"+></A+><B+>chainl</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#chainl"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Achainl1"+></A+><B+>chainl1</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#chainl1"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Achainr"+></A+><B+>chainr</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#chainr"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Achainr1"+></A+><B+>chainr1</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> (a -> a -> a) -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#chainr1"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aops"+></A+><B+>ops</B+> :: [(<A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a, b)] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#ops"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Abracket"+></A+><B+>bracket</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> c -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> b</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#bracket"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Achar"+></A+><B+>char</B+> :: Char -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#char"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Adigit"+></A+><B+>digit</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#digit"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Alower"+></A+><B+>lower</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#lower"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aupper"+></A+><B+>upper</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#upper"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aletter"+></A+><B+>letter</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#letter"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aalphanum"+></A+><B+>alphanum</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Char</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#alphanum"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Astring"+></A+><B+>string</B+> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#string"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aident"+></A+><B+>ident</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#ident"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anat"+></A+><B+>nat</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#nat"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aint"+></A+><B+>int</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#int"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aspaces"+></A+><B+>spaces</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#spaces"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Acomment"+></A+><B+>comment</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#comment"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Ajunk"+></A+><B+>junk</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> ()</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#junk"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Askip"+></A+><B+>skip</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#skip"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Atoken"+></A+><B+>token</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> a</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#token"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Anatural"+></A+><B+>natural</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#natural"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Ainteger"+></A+><B+>integer</B+> :: <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> Int</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#integer"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Asymbol"+></A+><B+>symbol</B+> :: String -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#symbol"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="topdecl"+><TABLE CLASS="declbar"+><TR+><TD CLASS="declname"+><A NAME="v%3Aidentifier"+></A+><B+>identifier</B+> :: [String] -> <A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Parser</A+> String</TD+><TD CLASS="declbut"+><A HREF="Text/ParserCombinators/HuttonMeijer.html#identifier"+>Source</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/Text/ParserCombinators/HuttonMeijer.html view
@@ -0,0 +1,219 @@+<pre><font color=Blue>-----------------------------------------------------------------------------</font>+<font color=Blue>-- |</font>+<font color=Blue>-- Module : ParseLib</font>+<font color=Blue>-- Copyright : ...</font>+<font color=Blue>-- Copyright : Graham Hutton (University of Nottingham), Erik Meijer (University of Utrecht)</font>+<font color=Blue>-- </font>+<font color=Blue>-- Maintainer : Malcolm Wallace <Malcolm.Wallace@cs.york.ac.uk></font>+<font color=Blue>-- Stability : Stable</font>+<font color=Blue>-- Portability : All</font>+<font color=Blue>--</font>+<font color=Blue>-- A LIBRARY OF MONADIC PARSER COMBINATORS</font>+<font color=Blue>-- </font>+<font color=Blue>-- 29th July 1996</font>+<font color=Blue>-- </font>+<font color=Blue>-- Graham Hutton Erik Meijer</font>+<font color=Blue>-- University of Nottingham University of Utrecht</font>+<font color=Blue>-- </font>+<font color=Blue>-- This Haskell script defines a library of parser combinators, and is</font>+<font color=Blue>-- taken from sections 1-6 of our article "Monadic Parser Combinators".</font>+<font color=Blue>-- Some changes to the library have been made in the move from Gofer</font>+<font color=Blue>-- to Haskell:</font>+<font color=Blue>-- </font>+<font color=Blue>-- * Do notation is used in place of monad comprehension notation;</font>+<font color=Blue>-- </font>+<font color=Blue>-- * The parser datatype is defined using "newtype", to avoid the overhead</font>+<font color=Blue>-- of tagging and untagging parsers with the P constructor.</font>+<font color=Blue>-----------------------------------------------------------------------------</font>+++<font color=Green><u>module</u></font> Text<font color=Cyan>.</font>ParserCombinators<font color=Cyan>.</font>HuttonMeijer+ <font color=Cyan>(</font>Parser<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> item<font color=Cyan>,</font> first<font color=Cyan>,</font> papply<font color=Cyan>,</font> <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font><font color=Cyan>,</font> sat<font color=Cyan>,</font> <font color=Blue>{-tok,-}</font> many<font color=Cyan>,</font> many1<font color=Cyan>,</font>+ sepby<font color=Cyan>,</font> sepby1<font color=Cyan>,</font> chainl<font color=Cyan>,</font>+ chainl1<font color=Cyan>,</font> chainr<font color=Cyan>,</font> chainr1<font color=Cyan>,</font> ops<font color=Cyan>,</font> bracket<font color=Cyan>,</font> char<font color=Cyan>,</font> digit<font color=Cyan>,</font> lower<font color=Cyan>,</font> upper<font color=Cyan>,</font>+ letter<font color=Cyan>,</font> alphanum<font color=Cyan>,</font> string<font color=Cyan>,</font> ident<font color=Cyan>,</font> nat<font color=Cyan>,</font> int<font color=Cyan>,</font> spaces<font color=Cyan>,</font> comment<font color=Cyan>,</font> junk<font color=Cyan>,</font>+ skip<font color=Cyan>,</font> token<font color=Cyan>,</font> natural<font color=Cyan>,</font> integer<font color=Cyan>,</font> symbol<font color=Cyan>,</font> identifier<font color=Cyan>)</font> <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> Char+<font color=Green><u>import</u></font> Monad++<font color=Green><u>infixr</u></font> <font color=Magenta>5</font> <font color=Cyan>+++</font>++<a name="Token"></a><font color=Green><u>type</u></font> Token <font color=Red>=</font> Char++<font color=Blue>---------------------------------------------------------</font>+<font color=Blue>-- | The parser monad</font>++<font color=Green><u>newtype</u></font> Parser a <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>[</font>Token<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font><font color=Red>[</font>Token<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>++<font color=Green><u>instance</u></font> Functor Parser <font color=Green><u>where</u></font>+ <font color=Blue>-- map :: (a -> b) -> (Parser a -> Parser b)</font>+ fmap f <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>f v<font color=Cyan>,</font> out<font color=Cyan>)</font> <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> p inp<font color=Red>]</font><font color=Cyan>)</font>++<font color=Green><u>instance</u></font> Monad Parser <font color=Green><u>where</u></font>+ <font color=Blue>-- return :: a -> Parser a</font>+ return v <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>v<font color=Cyan>,</font>inp<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>++ <font color=Blue>-- >>= :: Parser a -> (a -> Parser b) -> Parser b</font>+ <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>>>=</font> f <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> concat <font color=Red>[</font>papply <font color=Cyan>(</font>f v<font color=Cyan>)</font> out <font color=Red>|</font> <font color=Cyan>(</font>v<font color=Cyan>,</font>out<font color=Cyan>)</font> <font color=Red><-</font> p inp<font color=Red>]</font><font color=Cyan>)</font>++ <font color=Blue>-- fail :: String -> Parser a</font>+ fail <font color=Green><u>_</u></font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font><font color=Green><u>_</u></font> <font color=Red>-></font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font>++<font color=Green><u>instance</u></font> MonadPlus Parser <font color=Green><u>where</u></font>+ <font color=Blue>-- mzero :: Parser a</font>+ mzero <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font><font color=Green><u>_</u></font> <font color=Red>-></font> <font color=Red>[</font><font color=Red>]</font><font color=Cyan>)</font>++ <font color=Blue>-- mplus :: Parser a -> Parser a -> Parser a</font>+ <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Cyan>`mplus`</font> <font color=Cyan>(</font>P q<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Cyan>(</font>p inp <font color=Cyan>++</font> q inp<font color=Cyan>)</font><font color=Cyan>)</font>++<font color=Blue>-- ------------------------------------------------------------</font>+<font color=Blue>-- * Other primitive parser combinators</font>+<font color=Blue>-- ------------------------------------------------------------</font>++item <font color=Red>::</font> Parser Token+<a name="item"></a>item <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Green><u>case</u></font> inp <font color=Green><u>of</u></font>+ <font color=Red>[</font><font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Red>]</font>+ <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>x<font color=Cyan>,</font>xs<font color=Cyan>)</font><font color=Red>]</font><font color=Cyan>)</font>++first <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a+<a name="first"></a>first <font color=Cyan>(</font>P p<font color=Cyan>)</font> <font color=Red>=</font> P <font color=Cyan>(</font><font color=Red>\</font>inp <font color=Red>-></font> <font color=Green><u>case</u></font> p inp <font color=Green><u>of</u></font>+ <font color=Red>[</font><font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Red>]</font>+ <font color=Cyan>(</font>x<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>-></font> <font color=Red>[</font>x<font color=Red>]</font><font color=Cyan>)</font>++papply <font color=Red>::</font> Parser a <font color=Red>-></font> <font color=Red>[</font>Token<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font><font color=Cyan>(</font>a<font color=Cyan>,</font><font color=Red>[</font>Token<font color=Red>]</font><font color=Cyan>)</font><font color=Red>]</font>+<a name="papply"></a>papply <font color=Cyan>(</font>P p<font color=Cyan>)</font> inp <font color=Red>=</font> p inp++<font color=Blue>-- ------------------------------------------------------------</font>+<font color=Blue>-- * Derived combinators</font>+<font color=Blue>-- ------------------------------------------------------------</font>++<a name="+++"></a><font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a <font color=Red>-></font> Parser a+<a name="p"></a>p <font color=Cyan>+++</font> q <font color=Red>=</font> first <font color=Cyan>(</font>p <font color=Cyan>`mplus`</font> q<font color=Cyan>)</font>++sat <font color=Red>::</font> <font color=Cyan>(</font>Token <font color=Red>-></font> Bool<font color=Cyan>)</font> <font color=Red>-></font> Parser Token+<a name="sat"></a>sat p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> item<font color=Cyan>;</font> <font color=Green><u>if</u></font> p x <font color=Green><u>then</u></font> return x <font color=Green><u>else</u></font> mzero<font color=Cyan>}</font>++<font color=Blue>--tok :: Token -> Parser Token</font>+<font color=Blue>--tok t = do {x <- item; if t==snd x then return t else mzero}</font>++many <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>+<a name="many"></a>many p <font color=Red>=</font> many1 p <font color=Cyan>+++</font> return <font color=Red>[</font><font color=Red>]</font>+<font color=Blue>--many p = force (many1 p +++ return [])</font>++many1 <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>+<a name="many1"></a>many1 p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many p<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>++sepby <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>+<a name="sepby"></a>p <font color=Cyan>`sepby`</font> sep <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`sepby1`</font> sep<font color=Cyan>)</font> <font color=Cyan>+++</font> return <font color=Red>[</font><font color=Red>]</font>++sepby1 <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser <font color=Red>[</font>a<font color=Red>]</font>+<a name="sepby1"></a>p <font color=Cyan>`sepby1`</font> sep <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> xs <font color=Red><-</font> many <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>sep<font color=Cyan>;</font> p<font color=Cyan>}</font><font color=Cyan>)</font><font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>++chainl <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> a <font color=Red>-></font> Parser a+<a name="chainl"></a>chainl p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainl1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v++chainl1 <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> Parser a+<a name="chainl1"></a>p <font color=Cyan>`chainl1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>+ <font color=Green><u>where</u></font>+ rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>f <font color=Red><-</font> op<font color=Cyan>;</font> y <font color=Red><-</font> p<font color=Cyan>;</font> rest <font color=Cyan>(</font>f x y<font color=Cyan>)</font><font color=Cyan>}</font>+ <font color=Cyan>+++</font> return x++chainr <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> a <font color=Red>-></font> Parser a+<a name="chainr"></a>chainr p op v <font color=Red>=</font> <font color=Cyan>(</font>p <font color=Cyan>`chainr1`</font> op<font color=Cyan>)</font> <font color=Cyan>+++</font> return v++chainr1 <font color=Red>::</font> Parser a <font color=Red>-></font> Parser <font color=Cyan>(</font>a <font color=Red>-></font> a <font color=Red>-></font> a<font color=Cyan>)</font> <font color=Red>-></font> Parser a+<a name="chainr1"></a>p <font color=Cyan>`chainr1`</font> op <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> p<font color=Cyan>;</font> rest x<font color=Cyan>}</font>+ <font color=Green><u>where</u></font>+ rest x <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>f <font color=Red><-</font> op<font color=Cyan>;</font> y <font color=Red><-</font> p <font color=Cyan>`chainr1`</font> op<font color=Cyan>;</font> return <font color=Cyan>(</font>f x y<font color=Cyan>)</font><font color=Cyan>}</font>+ <font color=Cyan>+++</font> return x++ops <font color=Red>::</font> <font color=Red>[</font><font color=Cyan>(</font>Parser a<font color=Cyan>,</font> b<font color=Cyan>)</font><font color=Red>]</font> <font color=Red>-></font> Parser b+<a name="ops"></a>ops xs <font color=Red>=</font> foldr1 <font color=Cyan>(</font><font color=Cyan>+++</font><font color=Cyan>)</font> <font color=Red>[</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>p<font color=Cyan>;</font> return op<font color=Cyan>}</font> <font color=Red>|</font> <font color=Cyan>(</font>p<font color=Cyan>,</font>op<font color=Cyan>)</font> <font color=Red><-</font> xs<font color=Red>]</font>++bracket <font color=Red>::</font> Parser a <font color=Red>-></font> Parser b <font color=Red>-></font> Parser c <font color=Red>-></font> Parser b+<a name="bracket"></a>bracket open p close <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>open<font color=Cyan>;</font> x <font color=Red><-</font> p<font color=Cyan>;</font> close<font color=Cyan>;</font> return x<font color=Cyan>}</font>++<font color=Blue>-- ------------------------------------------------------------</font>+<font color=Blue>-- * Useful parsers</font>+<font color=Blue>-- ------------------------------------------------------------</font>++char <font color=Red>::</font> Char <font color=Red>-></font> Parser Char+<a name="char"></a>char x <font color=Red>=</font> sat <font color=Cyan>(</font><font color=Red>\</font>y <font color=Red>-></font> x <font color=Cyan>==</font> y<font color=Cyan>)</font>++digit <font color=Red>::</font> Parser Char+<a name="digit"></a>digit <font color=Red>=</font> sat isDigit++lower <font color=Red>::</font> Parser Char+<a name="lower"></a>lower <font color=Red>=</font> sat isLower++upper <font color=Red>::</font> Parser Char+<a name="upper"></a>upper <font color=Red>=</font> sat isUpper++letter <font color=Red>::</font> Parser Char+<a name="letter"></a>letter <font color=Red>=</font> sat isAlpha++alphanum <font color=Red>::</font> Parser Char+<a name="alphanum"></a>alphanum <font color=Red>=</font> sat isAlphaNum <font color=Cyan>+++</font> char <font color=Magenta>'_'</font>++string <font color=Red>::</font> String <font color=Red>-></font> Parser String+<a name="string"></a>string <font color=Magenta>""</font> <font color=Red>=</font> return <font color=Magenta>""</font>+string <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>char x<font color=Cyan>;</font> string xs<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>++ident <font color=Red>::</font> Parser String+<a name="ident"></a>ident <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> lower<font color=Cyan>;</font> xs <font color=Red><-</font> many alphanum<font color=Cyan>;</font> return <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font><font color=Cyan>}</font>++nat <font color=Red>::</font> Parser Int+<a name="nat"></a>nat <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> digit<font color=Cyan>;</font> return <font color=Cyan>(</font>fromEnum x <font color=Blue>-</font> fromEnum <font color=Magenta>'0'</font><font color=Cyan>)</font><font color=Cyan>}</font> <font color=Cyan>`chainl1`</font> return op+ <font color=Green><u>where</u></font>+ m <font color=Cyan>`op`</font> n <font color=Red>=</font> <font color=Magenta>10</font><font color=Cyan>*</font>m <font color=Cyan>+</font> n++int <font color=Red>::</font> Parser Int+<a name="int"></a>int <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>char <font color=Magenta>'-'</font><font color=Cyan>;</font> n <font color=Red><-</font> nat<font color=Cyan>;</font> return <font color=Cyan>(</font><font color=Blue>-</font>n<font color=Cyan>)</font><font color=Cyan>}</font> <font color=Cyan>+++</font> nat++<font color=Blue>-- ------------------------------------------------------------</font>+<font color=Blue>-- * Lexical combinators</font>+<font color=Blue>-- ------------------------------------------------------------</font>++spaces <font color=Red>::</font> Parser <font color=Cyan>(</font><font color=Cyan>)</font>+<a name="spaces"></a>spaces <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>many1 <font color=Cyan>(</font>sat isSpace<font color=Cyan>)</font><font color=Cyan>;</font> return <font color=Cyan>(</font><font color=Cyan>)</font><font color=Cyan>}</font>++comment <font color=Red>::</font> Parser <font color=Cyan>(</font><font color=Cyan>)</font>+<font color=Blue>--comment = do {string "--"; many (sat (\x -> x /= '\n')); return ()}</font>+<font color=Blue>--comment = do </font>+<font color=Blue>-- _ <- string "--"</font>+<font color=Blue>-- _ <- many (sat (\x -> x /= '\n'))</font>+<font color=Blue>-- return ()</font>+<a name="comment"></a>comment <font color=Red>=</font> <font color=Green><u>do</u></font>+ bracket <font color=Cyan>(</font>string <font color=Magenta>"/*"</font><font color=Cyan>)</font> <font color=Cyan>(</font>many item<font color=Cyan>)</font> <font color=Cyan>(</font>string <font color=Magenta>"*/"</font><font color=Cyan>)</font>+ return <font color=Cyan>(</font><font color=Cyan>)</font>++junk <font color=Red>::</font> Parser <font color=Cyan>(</font><font color=Cyan>)</font>+<a name="junk"></a>junk <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>many <font color=Cyan>(</font>spaces <font color=Cyan>+++</font> comment<font color=Cyan>)</font><font color=Cyan>;</font> return <font color=Cyan>(</font><font color=Cyan>)</font><font color=Cyan>}</font>++skip <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a+<a name="skip"></a>skip p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>junk<font color=Cyan>;</font> p<font color=Cyan>}</font>++token <font color=Red>::</font> Parser a <font color=Red>-></font> Parser a+<a name="token"></a>token p <font color=Red>=</font> <font color=Green><u>do</u></font> <font color=Cyan>{</font>v <font color=Red><-</font> p<font color=Cyan>;</font> junk<font color=Cyan>;</font> return v<font color=Cyan>}</font>++<font color=Blue>-- ------------------------------------------------------------</font>+<font color=Blue>-- * Token parsers</font>+<font color=Blue>-- ------------------------------------------------------------</font>++natural <font color=Red>::</font> Parser Int+<a name="natural"></a>natural <font color=Red>=</font> token nat++integer <font color=Red>::</font> Parser Int+<a name="integer"></a>integer <font color=Red>=</font> token int++symbol <font color=Red>::</font> String <font color=Red>-></font> Parser String+<a name="symbol"></a>symbol xs <font color=Red>=</font> token <font color=Cyan>(</font>string xs<font color=Cyan>)</font>++identifier <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> Parser String+<a name="identifier"></a>identifier ks <font color=Red>=</font> token <font color=Cyan>(</font><font color=Green><u>do</u></font> <font color=Cyan>{</font>x <font color=Red><-</font> ident<font color=Cyan>;</font>+ <font color=Green><u>if</u></font> not <font color=Cyan>(</font>elem x ks<font color=Cyan>)</font> <font color=Green><u>then</u></font> return x+ <font color=Green><u>else</u></font> return mzero<font color=Cyan>}</font><font color=Cyan>)</font>++<font color=Blue>------------------------------------------------------------------------------</font>+</pre>
+ docs/cpphs/cpphs.html view
@@ -0,0 +1,109 @@+<pre><font color=Blue>{-+-- The main program wrapper for cpphs, a simple C pre-processor+-- written in Haskell.++-- Author: Malcolm Wallace, 2004+-- This file is licensed under the GPL. Note however, that all other+-- modules used by it are either distributed under the LGPL, or are Haskell'98.+--+-- Thus, when compiled as a standalone executable, this program will fall+-- under the GPL.+-}</font>+<font color=Green><u>module</u></font> Main <font color=Green><u>where</u></font>++<font color=Green><u>import</u></font> System <font color=Cyan>(</font> getArgs<font color=Cyan>,</font> getProgName<font color=Cyan>,</font> exitWith<font color=Cyan>,</font> ExitCode<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font> <font color=Cyan>)</font>+<font color=Green><u>import</u></font> Maybe+<font color=Green><u>import</u></font> Language<font color=Cyan>.</font>Preprocessor<font color=Cyan>.</font>Cpphs <font color=Cyan>(</font> runCpphs<font color=Cyan>,</font> CpphsOptions<font color=Cyan>(</font><font color=Red>..</font><font color=Cyan>)</font><font color=Cyan>,</font> parseOptions <font color=Cyan>)</font>+<font color=Green><u>import</u></font> IO <font color=Cyan>(</font> stdout<font color=Cyan>,</font> IOMode<font color=Cyan>(</font>WriteMode<font color=Cyan>)</font><font color=Cyan>,</font> openFile<font color=Cyan>,</font> hPutStr<font color=Cyan>,</font> hFlush<font color=Cyan>,</font> hClose <font color=Cyan>)</font>+<font color=Green><u>import</u></font> Monad <font color=Cyan>(</font> when <font color=Cyan>)</font>+<font color=Green><u>import</u></font> List <font color=Cyan>(</font> isPrefixOf <font color=Cyan>)</font>++version <font color=Red>::</font> String+<a name="version"></a>version <font color=Red>=</font> <font color=Magenta>"1.5"</font>++main <font color=Red>::</font> IO <font color=Cyan>(</font><font color=Cyan>)</font>+<a name="main"></a>main <font color=Red>=</font> <font color=Green><u>do</u></font>+ args <font color=Red><-</font> getArgs+ args <font color=Red><-</font> return <font color=Cyan>$</font> <font color=Green><u>if</u></font> <font color=Magenta>"--cpp"</font> <font color=Cyan>`elem`</font> args <font color=Green><u>then</u></font> convertArgs args <font color=Green><u>else</u></font> args+ + prog <font color=Red><-</font> getProgName+ when <font color=Cyan>(</font><font color=Magenta>"--version"</font> <font color=Cyan>`elem`</font> args<font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Green><u>do</u></font> putStrLn <font color=Cyan>(</font>prog<font color=Cyan>++</font><font color=Magenta>" "</font><font color=Cyan>++</font>version<font color=Cyan>)</font>+ exitWith ExitSuccess<font color=Cyan>)</font>+ when <font color=Cyan>(</font><font color=Magenta>"--help"</font> <font color=Cyan>`elem`</font> args<font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Green><u>do</u></font> putStrLn <font color=Cyan>(</font><font color=Magenta>"Usage: "</font><font color=Cyan>++</font>prog+ <font color=Cyan>++</font><font color=Magenta>" [file ...] [ -Dsym | -Dsym=val | -Ipath ]* [-Ofile]\n"</font>+ <font color=Cyan>++</font><font color=Magenta>"\t\t[--nomacro] [--noline] [--pragma] [--text]\n"</font>+ <font color=Cyan>++</font><font color=Magenta>"\t\t[--strip] [--hashes] [--layout] [--unlit]\n"</font>+ <font color=Cyan>++</font><font color=Magenta>"\t\t[ --cpp std-cpp-options ]"</font><font color=Cyan>)</font>+ exitWith ExitSuccess<font color=Cyan>)</font>++ <font color=Green><u>let</u></font> parsedArgs <font color=Red>=</font> parseOptions args+ options <font color=Red>=</font> fromRight parsedArgs+ ins <font color=Red>=</font> infiles options+ outs <font color=Red>=</font> outfiles options+ out <font color=Red>=</font> listToMaybe outs+ + when <font color=Cyan>(</font>isLeft parsedArgs<font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Green><u>do</u></font> putStrLn <font color=Cyan>$</font> <font color=Magenta>"Unknown option "</font><font color=Cyan>++</font>fromLeft parsedArgs+ <font color=Cyan>++</font><font color=Magenta>", for valid options try "</font><font color=Cyan>++</font>prog<font color=Cyan>++</font><font color=Magenta>" --help\n"</font>+ exitWith <font color=Cyan>(</font>ExitFailure <font color=Magenta>1</font><font color=Cyan>)</font><font color=Cyan>)</font>+ when <font color=Cyan>(</font>length outs <font color=Cyan>></font> <font color=Magenta>1</font><font color=Cyan>)</font>+ <font color=Cyan>(</font><font color=Green><u>do</u></font> putStrLn <font color=Cyan>$</font> <font color=Magenta>"At most one output file (-O) can be specified"</font>+ exitWith <font color=Cyan>(</font>ExitFailure <font color=Magenta>2</font><font color=Cyan>)</font><font color=Cyan>)</font>+ <font color=Green><u>if</u></font> null ins <font color=Green><u>then</u></font> execute options out Nothing+ <font color=Green><u>else</u></font> mapM_ <font color=Cyan>(</font>execute options out<font color=Cyan>)</font> <font color=Cyan>(</font>map Just ins<font color=Cyan>)</font>++<font color=Blue>-- | Execute the preprocessor.</font>+<font color=Blue>-- If the filepath is Nothing then default to stdout\/stdin as appropriate.</font>+execute <font color=Red>::</font> CpphsOptions <font color=Red>-></font> Maybe FilePath <font color=Red>-></font> Maybe FilePath <font color=Red>-></font> IO <font color=Cyan>(</font><font color=Cyan>)</font>+<a name="execute"></a>execute opts ofile infile <font color=Red>=</font>+ <font color=Green><u>let</u></font> <font color=Cyan>(</font>filename<font color=Cyan>,</font> readIt<font color=Cyan>)</font> <font color=Red>=</font> <font color=Green><u>case</u></font> infile <font color=Green><u>of</u></font>+ Just x <font color=Red>-></font> <font color=Cyan>(</font>x<font color=Cyan>,</font> readFile x<font color=Cyan>)</font>+ Nothing <font color=Red>-></font> <font color=Cyan>(</font><font color=Magenta>"stdin"</font><font color=Cyan>,</font> getContents<font color=Cyan>)</font>+ output Nothing x <font color=Red>=</font> <font color=Green><u>do</u></font> putStr x<font color=Cyan>;</font> hFlush stdout+ output <font color=Cyan>(</font>Just f<font color=Cyan>)</font> x <font color=Red>=</font> writeFile f x+ <font color=Green><u>in</u></font> <font color=Green><u>do</u></font> contents <font color=Red><-</font> readIt+ output ofile <font color=Cyan>(</font>runCpphs opts filename contents<font color=Cyan>)</font>++<a name="isLeft"></a>isLeft <font color=Cyan>(</font>Left <font color=Green><u>_</u></font><font color=Cyan>)</font> <font color=Red>=</font> True+isLeft <font color=Green><u>_</u></font> <font color=Red>=</font> False++<a name="fromLeft"></a>fromLeft <font color=Cyan>(</font>Left x<font color=Cyan>)</font> <font color=Red>=</font> x+<a name="fromRight"></a>fromRight <font color=Cyan>(</font>Right x<font color=Cyan>)</font> <font color=Red>=</font> x++<font color=Blue>-- | Convert commandline options to remain compatible with cpp.</font>+<font color=Blue>-- Based on a shell script cpphs.compat</font>+<a name="ConvertArgs"></a><font color=Green><u>data</u></font> ConvertArgs <font color=Red>=</font> ConvertArgs <font color=Cyan>{</font> traditional<font color=Cyan>,</font> strip <font color=Red>::</font> Bool+ <font color=Cyan>,</font> infile<font color=Cyan>,</font> outfile <font color=Red>::</font> String <font color=Cyan>}</font>++convertArgs <font color=Red>::</font> <font color=Red>[</font>String<font color=Red>]</font> <font color=Red>-></font> <font color=Red>[</font>String<font color=Red>]</font>+<a name="convertArgs"></a>convertArgs xs <font color=Red>=</font> f <font color=Cyan>(</font>ConvertArgs False True <font color=Magenta>"-"</font> <font color=Magenta>"-"</font><font color=Cyan>)</font> xs+ <font color=Green><u>where</u></font>+ flg <font color=Red>=</font> <font color=Magenta>"DUI"</font>+ + f e <font color=Cyan>(</font><font color=Red>[</font><font color=Magenta>'-'</font><font color=Cyan>,</font>r<font color=Red>]</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> r <font color=Cyan>`elem`</font> flg <font color=Red>=</font> <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>r<font color=Red><b>:</b></font>x<font color=Cyan>)</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font>x<font color=Red>@</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>r<font color=Red><b>:</b></font><font color=Green><u>_</u></font><font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> r <font color=Cyan>`elem`</font> flg <font color=Red>=</font> x <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Magenta>"-o"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'O'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'o'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font><font color=Magenta>'O'</font><font color=Red><b>:</b></font>drop <font color=Magenta>2</font> x<font color=Cyan>)</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> <font color=Magenta>"ansi"</font> <font color=Cyan>`isPrefixOf`</font> x <font color=Red>=</font> f e<font color=Cyan>{</font>traditional<font color=Red>=</font>False<font color=Cyan>}</font> xs+ <font color=Red>|</font> <font color=Magenta>"traditional"</font> <font color=Cyan>`isPrefixOf`</font> x <font color=Red>=</font> f e<font color=Cyan>{</font>traditional<font color=Red>=</font>True<font color=Cyan>}</font> xs+ <font color=Red>|</font> <font color=Magenta>"std"</font> <font color=Cyan>`isPrefixOf`</font> x <font color=Red>=</font> f e xs <font color=Blue>-- ignore language spec</font>+ f e <font color=Cyan>(</font><font color=Magenta>"-x"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f e xs <font color=Blue>-- ignore langauge spec</font>+ f e <font color=Cyan>(</font><font color=Magenta>"-include"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> x <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Magenta>"-P"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"--noline"</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>|</font> x <font color=Cyan>==</font> <font color=Magenta>"-C"</font> <font color=Cyan>||</font> x <font color=Cyan>==</font> <font color=Magenta>"-CC"</font> <font color=Red>=</font> f e<font color=Cyan>{</font>strip<font color=Red>=</font>False<font color=Cyan>}</font> xs+ f e <font color=Cyan>(</font><font color=Magenta>"-A"</font><font color=Red><b>:</b></font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f e xs <font color=Blue>-- strip assertions</font>+ f e <font color=Cyan>(</font><font color=Magenta>"--help"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"--help"</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Magenta>"--version"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"--version"</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Magenta>"-version"</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> <font color=Magenta>"--version"</font> <font color=Red><b>:</b></font> f e xs+ f e <font color=Cyan>(</font><font color=Cyan>(</font><font color=Magenta>'-'</font><font color=Red><b>:</b></font>x<font color=Cyan>)</font><font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f e xs <font color=Blue>-- strip all other flags</font>+ f e <font color=Cyan>(</font>x<font color=Red><b>:</b></font>xs<font color=Cyan>)</font> <font color=Red>=</font> f <font color=Cyan>(</font><font color=Green><u>if</u></font> infile e <font color=Cyan>==</font> <font color=Magenta>"-"</font> <font color=Green><u>then</u></font> e<font color=Cyan>{</font>infile<font color=Red>=</font>x<font color=Cyan>}</font> <font color=Green><u>else</u></font> e<font color=Cyan>{</font>outfile<font color=Red>=</font>x<font color=Cyan>}</font><font color=Cyan>)</font> xs+ + f e <font color=Red>[</font><font color=Red>]</font> <font color=Red>=</font> <font color=Red>[</font><font color=Magenta>"--hashes"</font> <font color=Red>|</font> not <font color=Cyan>(</font>traditional e<font color=Cyan>)</font><font color=Red>]</font> <font color=Cyan>++</font>+ <font color=Red>[</font><font color=Magenta>"--strip"</font> <font color=Red>|</font> strip e<font color=Red>]</font> <font color=Cyan>++</font>+ <font color=Red>[</font>infile e<font color=Red>]</font> <font color=Cyan>++</font>+ <font color=Red>[</font><font color=Magenta>"-O"</font> <font color=Cyan>++</font> outfile e <font color=Red>|</font> outfile e <font color=Cyan>/=</font> <font color=Magenta>"-"</font><font color=Red>]</font>+++</pre>
+ docs/cpphs/doc-index-43.html view
@@ -0,0 +1,146 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (+)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>+++</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3A%2B%2B%2B"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-A.html view
@@ -0,0 +1,188 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (A)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Arg</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AArg"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>ArgOrText</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AArgOrText"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>addcol</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Aaddcol"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>alphanum</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aalphanum"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>ansi</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Aansi"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Aansi"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>arguments</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3Aarguments"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-B.html view
@@ -0,0 +1,180 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (B)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry" COLSPAN="2"+>BoolOptions</TD+></TR+><TR+><TD CLASS="indexannot"+>1 (Type/Class)</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ABoolOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#t%3ABoolOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexannot"+>2 (Data Constructor)</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3ABoolOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3ABoolOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>boolopts</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Aboolopts"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Aboolopts"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>bracket</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Abracket"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-C.html view
@@ -0,0 +1,264 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (C)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Cmd</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3ACmd"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry" COLSPAN="2"+>ConvertArgs</TD+></TR+><TR+><TD CLASS="indexannot"+>1 (Type/Class)</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#t%3AConvertArgs"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexannot"+>2 (Data Constructor)</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3AConvertArgs"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry" COLSPAN="2"+>CpphsOptions</TD+></TR+><TR+><TD CLASS="indexannot"+>1 (Type/Class)</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#t%3ACpphsOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#t%3ACpphsOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexannot"+>2 (Data Constructor)</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3ACpphsOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3ACpphsOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>chainl</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainl"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>chainl1</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainl1"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>chainr</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainr"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>chainr1</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achainr1"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>char</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Achar"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>comment</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Acomment"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>convertArgs</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3AconvertArgs"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>cppIfdef</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-CppIfdef.html#v%3AcppIfdef"+>Language.Preprocessor.Cpphs.CppIfdef</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3AcppIfdef"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>cppline</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Acppline"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-D.html view
@@ -0,0 +1,216 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (D)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>deWordStyle</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3AdeWordStyle"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>defaultBoolOptions</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3AdefaultBoolOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3AdefaultBoolOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>defaultCpphsOptions</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3AdefaultCpphsOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3AdefaultCpphsOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>defineMacro</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-MacroPass.html#v%3AdefineMacro"+>Language.Preprocessor.Cpphs.MacroPass</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>definedST</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#v%3AdefinedST"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>defines</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Adefines"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Adefines"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>deleteST</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#v%3AdeleteST"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>digit</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Adigit"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>directory</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Adirectory"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-E.html view
@@ -0,0 +1,170 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (E)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>emptyST</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#v%3AemptyST"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>execute</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Aexecute"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>expandMacro</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AexpandMacro"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>expansion</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3Aexpansion"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-F.html view
@@ -0,0 +1,154 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (F)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>filename</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Afilename"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>first</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Afirst"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-H.html view
@@ -0,0 +1,146 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (H)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>HashDefine</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#t%3AHashDefine"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-I.html view
@@ -0,0 +1,230 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (I)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Ident</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3AIdent"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>IndTree</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3AIndTree"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>ident</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aident"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>identifier</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aidentifier"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>includes</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Aincludes"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Aincludes"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>infile</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Ainfile"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>infiles</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Ainfiles"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Ainfiles"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>insertST</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#v%3AinsertST"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>int</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aint"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>integer</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Ainteger"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>item</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aitem"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-J.html view
@@ -0,0 +1,146 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (J)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>junk</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Ajunk"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-L.html view
@@ -0,0 +1,234 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (L)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>LineDrop</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3ALineDrop"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>lang</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Alang"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Alang"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>layout</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Alayout"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Alayout"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>letter</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aletter"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>linebreaks</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3Alinebreaks"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>lineno</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Alineno"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>linesCpp</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3AlinesCpp"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>literate</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Aliterate"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Aliterate"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>locations</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Alocations"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Alocations"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>lookupST</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#v%3AlookupST"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>lower</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Alower"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-M.html view
@@ -0,0 +1,190 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (M)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>MacroExpansion</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AMacroExpansion"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>macroPass</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-MacroPass.html#v%3AmacroPass"+>Language.Preprocessor.Cpphs.MacroPass</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3AmacroPass"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>macros</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Amacros"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Amacros"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>main</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Amain"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>many</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Amany"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>many1</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Amany1"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-N.html view
@@ -0,0 +1,194 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (N)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>name</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3Aname"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>nat</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Anat"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>natural</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Anatural"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>newfile</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Anewfile"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>newline</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Anewline"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>newlines</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Anewlines"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>newpos</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Anewpos"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-O.html view
@@ -0,0 +1,172 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (O)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Other</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3AOther"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>ops</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aops"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>outfile</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Aoutfile"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>outfiles</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Aoutfiles"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Aoutfiles"+>Language.Preprocessor.Cpphs</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-P.html view
@@ -0,0 +1,230 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (P)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>P</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3AP"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>Parser</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#t%3AParser"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>Pn</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3APn"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>Posn</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#t%3APosn"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>Pragma</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3APragma"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>papply</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Apapply"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>parseHashDefine</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AparseHashDefine"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>parseMacroCall</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3AparseMacroCall"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>parseOptions</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3AparseOptions"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3AparseOptions"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>pragma</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Apragma"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Apragma"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>preDefine</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-MacroPass.html#v%3ApreDefine"+>Language.Preprocessor.Cpphs.MacroPass</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-R.html view
@@ -0,0 +1,172 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (R)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>readFirst</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-ReadFirst.html#v%3AreadFirst"+>Language.Preprocessor.Cpphs.ReadFirst</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>replacement</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3Areplacement"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>reslash</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3Areslash"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>runCpphs</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-RunCpphs.html#v%3ArunCpphs"+>Language.Preprocessor.Cpphs.RunCpphs</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3ArunCpphs"+>Language.Preprocessor.Cpphs</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-S.html view
@@ -0,0 +1,240 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (S)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Str</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AStr"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>SymTab</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html#t%3ASymTab"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>SymbolReplacement</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3ASymbolReplacement"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>sat</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asat"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>sepby</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asepby"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>sepby1</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asepby1"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>skip</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Askip"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>spaces</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aspaces"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>string</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Astring"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry" COLSPAN="2"+>strip</TD+></TR+><TR+><TD CLASS="indexannot"+>1 (Function)</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Astrip"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Astrip"+>Language.Preprocessor.Cpphs</A+></TD+></TR+><TR+><TD CLASS="indexannot"+>2 (Function)</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Astrip"+>Main</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>symbol</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Asymbol"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-T.html view
@@ -0,0 +1,178 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (T)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>Text</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html#v%3AText"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>tab</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Position.html#v%3Atab"+>Language.Preprocessor.Cpphs.Position</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>token</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Atoken"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>tokenise</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#v%3Atokenise"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>traditional</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Atraditional"+>Main</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-U.html view
@@ -0,0 +1,154 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (U)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>unlit</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Unlit.html#v%3Aunlit"+>Language.Preprocessor.Unlit</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>upper</TD+><TD CLASS="indexlinks"+><A HREF="Text-ParserCombinators-HuttonMeijer.html#v%3Aupper"+>Text.ParserCombinators.HuttonMeijer</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-V.html view
@@ -0,0 +1,146 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (V)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>version</TD+><TD CLASS="indexlinks"+><A HREF="Main.html#v%3Aversion"+>Main</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index-W.html view
@@ -0,0 +1,156 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index (W)</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD CLASS="indexentry"+>WordStyle</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html#t%3AWordStyle"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+></TR+><TR+><TD CLASS="indexentry"+>warnings</TD+><TD CLASS="indexlinks"+><A HREF="Language-Preprocessor-Cpphs-Options.html#v%3Awarnings"+>Language.Preprocessor.Cpphs.Options</A+>, <A HREF="Language-Preprocessor-Cpphs.html#v%3Awarnings"+>Language.Preprocessor.Cpphs</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/doc-index.html view
@@ -0,0 +1,132 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs (Index)</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Index</TD+></TR+><TR+><TD+><TABLE CELLPADDING="0" CELLSPACING="5"+><TR+><TD+><A HREF="doc-index-A.html"+>A</A+></TD+><TD+><A HREF="doc-index-B.html"+>B</A+></TD+><TD+><A HREF="doc-index-C.html"+>C</A+></TD+><TD+><A HREF="doc-index-D.html"+>D</A+></TD+><TD+><A HREF="doc-index-E.html"+>E</A+></TD+><TD+><A HREF="doc-index-F.html"+>F</A+></TD+><TD+><A HREF="doc-index-H.html"+>H</A+></TD+><TD+><A HREF="doc-index-I.html"+>I</A+></TD+><TD+><A HREF="doc-index-J.html"+>J</A+></TD+><TD+><A HREF="doc-index-L.html"+>L</A+></TD+><TD+><A HREF="doc-index-M.html"+>M</A+></TD+><TD+><A HREF="doc-index-N.html"+>N</A+></TD+><TD+><A HREF="doc-index-O.html"+>O</A+></TD+><TD+><A HREF="doc-index-P.html"+>P</A+></TD+><TD+><A HREF="doc-index-R.html"+>R</A+></TD+><TD+><A HREF="doc-index-S.html"+>S</A+></TD+><TD+><A HREF="doc-index-T.html"+>T</A+></TD+><TD+><A HREF="doc-index-U.html"+>U</A+></TD+><TD+><A HREF="doc-index-V.html"+>V</A+></TD+><TD+><A HREF="doc-index-W.html"+>W</A+></TD+><TD+><A HREF="doc-index-43.html"+>+</A+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/haddock.css view
@@ -0,0 +1,260 @@+/* -------- Global things --------- */++BODY { + background-color: #ffffff;+ color: #000000;+ font-family: sans-serif;+ } ++A:link { color: #0000e0; text-decoration: none }+A:visited { color: #0000a0; text-decoration: none }+A:hover { background-color: #e0e0ff; text-decoration: none }++TABLE.vanilla {+ width: 100%;+ border-width: 0px;+ /* I can't seem to specify cellspacing or cellpadding properly using CSS... */+}++TABLE.vanilla2 {+ border-width: 0px;+}++/* <TT> font is a little too small in MSIE */+TT { font-size: 100%; }+PRE { font-size: 100%; }++LI P { margin: 0pt } ++TD {+ border-width: 0px;+}++TABLE.narrow {+ border-width: 0px;+}++TD.s8 { height: 8px; }+TD.s15 { height: 15px; }++SPAN.keyword { text-decoration: underline; }++/* Resize the buttom image to match the text size */+IMG.coll { width : 0.75em; height: 0.75em; margin-bottom: 0; margin-right: 0.5em }++/* --------- Contents page ---------- */++DIV.node {+ padding-left: 3em;+}++DIV.cnode {+ padding-left: 1.75em;+}++SPAN.pkg {+ position: absolute;+ left: 50em;+}++/* --------- Documentation elements ---------- */++TD.children {+ padding-left: 25px;+ }++TD.synopsis {+ padding: 2px;+ background-color: #f0f0f0;+ font-family: monospace+ }++TD.decl { + padding: 2px;+ background-color: #f0f0f0; + font-family: monospace;+ vertical-align: top;+ }++TD.topdecl {+ padding: 2px;+ background-color: #f0f0f0;+ font-family: monospace;+ vertical-align: top;+}++TABLE.declbar {+ border-spacing: 0px;+ }++TD.declname {+ width: 100%;+ }++TD.declbut {+ padding-left: 5px;+ padding-right: 5px;+ border-left-width: 1px;+ border-left-color: #000099;+ border-left-style: solid;+ white-space: nowrap;+ font-size: small;+ }++/* + arg is just like decl, except that wrapping is not allowed. It is+ used for function and constructor arguments which have a text box+ to the right, where if wrapping is allowed the text box squashes up+ the declaration by wrapping it.+*/+TD.arg { + padding: 2px;+ background-color: #f0f0f0; + font-family: monospace;+ vertical-align: top;+ white-space: nowrap;+ }++TD.recfield { padding-left: 20px }++TD.doc { + padding-top: 2px;+ padding-left: 10px;+ }++TD.ndoc { + padding: 2px;+ }++TD.rdoc { + padding: 2px;+ padding-left: 10px;+ width: 100%;+ }++TD.body { + padding-left: 10px+ }++TD.pkg {+ width: 100%;+ padding-left: 10px+}++TD.indexentry {+ vertical-align: top;+ padding-right: 10px+ }++TD.indexannot {+ vertical-align: top;+ padding-left: 20px;+ white-space: nowrap+ }++TD.indexlinks {+ width: 100%+ }++/* ------- Section Headings ------- */++TD.section1 {+ padding-top: 15px;+ font-weight: bold;+ font-size: 150%+ }++TD.section2 {+ padding-top: 10px;+ font-weight: bold;+ font-size: 130%+ }++TD.section3 {+ padding-top: 5px;+ font-weight: bold;+ font-size: 110%+ }++TD.section4 {+ font-weight: bold;+ font-size: 100%+ }++/* -------------- The title bar at the top of the page */++TD.infohead {+ color: #ffffff;+ font-weight: bold;+ padding-right: 10px;+ text-align: left;+}++TD.infoval {+ color: #ffffff;+ padding-right: 10px;+ text-align: left;+}++TD.topbar {+ background-color: #000099;+ padding: 5px;+}++TD.title {+ color: #ffffff;+ padding-left: 10px;+ width: 100%+ }++TD.topbut {+ padding-left: 5px;+ padding-right: 5px;+ border-left-width: 1px;+ border-left-color: #ffffff;+ border-left-style: solid;+ white-space: nowrap;+ }++TD.topbut A:link {+ color: #ffffff+ }++TD.topbut A:visited {+ color: #ffff00+ }++TD.topbut A:hover {+ background-color: #6060ff;+ }++TD.topbut:hover {+ background-color: #6060ff+ }++TD.modulebar { + background-color: #0077dd;+ padding: 5px;+ border-top-width: 1px;+ border-top-color: #ffffff;+ border-top-style: solid;+ }++/* --------- The page footer --------- */++TD.botbar {+ background-color: #000099;+ color: #ffffff;+ padding: 5px+ }+TD.botbar A:link {+ color: #ffffff;+ text-decoration: underline+ }+TD.botbar A:visited {+ color: #ffff00+ }+TD.botbar A:hover {+ background-color: #6060ff+ }+
+ docs/cpphs/haddock.js view
@@ -0,0 +1,15 @@+// Haddock JavaScript utilities+function toggle(button,id)+{+ var n = document.getElementById(id).style;+ if (n.display == "none")+ {+ button.src = "minus.gif";+ n.display = "block";+ }+ else+ {+ button.src = "plus.gif";+ n.display = "none";+ }+}
+ docs/cpphs/haskell_icon.gif view
binary file changed (absent → 911 bytes)
+ docs/cpphs/index.html view
@@ -0,0 +1,255 @@+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">+<!--Rendered using the Haskell Html Library v0.2-->+<HTML+><HEAD+><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"+><TITLE+>cpphs</TITLE+><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css"+><SCRIPT SRC="haddock.js" TYPE="text/javascript"+></SCRIPT+></HEAD+><BODY+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD CLASS="topbar"+><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0"+><TR+><TD+><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" "+></TD+><TD CLASS="title"+>cpphs</TD+><TD CLASS="topbut"+><A HREF="index.html"+>Contents</A+></TD+><TD CLASS="topbut"+><A HREF="doc-index.html"+>Index</A+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="section1"+>Modules</TD+></TR+><TR+><TD+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0"+><TR+><TD STYLE="width: 50em"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:0')" ALT="show/hide"+>Language</TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:0" STYLE="display:block;"+><TR+><TD STYLE="width: 48em"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:1')" ALT="show/hide"+>Preprocessor</TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:1" STYLE="display:block;"+><TR+><TD STYLE="width: 46em"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:2')" ALT="show/hide"+><A HREF="Language-Preprocessor-Cpphs.html"+>Language.Preprocessor.Cpphs</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:2" STYLE="display:block;"+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-CppIfdef.html"+>Language.Preprocessor.Cpphs.CppIfdef</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-HashDefine.html"+>Language.Preprocessor.Cpphs.HashDefine</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-MacroPass.html"+>Language.Preprocessor.Cpphs.MacroPass</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-Options.html"+>Language.Preprocessor.Cpphs.Options</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-Position.html"+>Language.Preprocessor.Cpphs.Position</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-ReadFirst.html"+>Language.Preprocessor.Cpphs.ReadFirst</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-RunCpphs.html"+>Language.Preprocessor.Cpphs.RunCpphs</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-SymTab.html"+>Language.Preprocessor.Cpphs.SymTab</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 44em"+><A HREF="Language-Preprocessor-Cpphs-Tokenise.html"+>Language.Preprocessor.Cpphs.Tokenise</A+></TD+><TD+></TD+><TD+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 46em"+><A HREF="Language-Preprocessor-Unlit.html"+>Language.Preprocessor.Unlit</A+></TD+><TD+></TD+><TD+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD STYLE="padding-left: 1.25em;width: 50em"+><A HREF="Main.html"+>Main</A+></TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="width: 50em"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:3')" ALT="show/hide"+>Text</TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:3" STYLE="display:block;"+><TR+><TD STYLE="width: 48em"+><IMG SRC="minus.gif" CLASS="coll" ONCLICK="toggle(this,'n:4')" ALT="show/hide"+>ParserCombinators</TD+><TD+></TD+><TD+></TD+></TR+><TR+><TD STYLE="padding: 0; padding-left: 2em" COLSPAN="3"+><TABLE CLASS="vanilla2" CELLSPACING="0" CELLPADDING="0" ID="n:4" STYLE="display:block;"+><TR+><TD STYLE="padding-left: 1.25em;width: 46em"+><A HREF="Text-ParserCombinators-HuttonMeijer.html"+>Text.ParserCombinators.HuttonMeijer</A+></TD+><TD+></TD+><TD+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+></TABLE+></TD+></TR+><TR+><TD CLASS="s15"+></TD+></TR+><TR+><TD CLASS="botbar"+>Produced by <A HREF="http://www.haskell.org/haddock/"+>Haddock</A+> version 0.8</TD+></TR+></TABLE+></BODY+></HTML+>
+ docs/cpphs/minus.gif view
binary file changed (absent → 56 bytes)
+ docs/cpphs/plus.gif view
binary file changed (absent → 59 bytes)
docs/index.html view
@@ -58,13 +58,12 @@ <li> conditional compilation only (--nomacro), <li> and full macro-expansion (default). </ul>-In <tt>--nomacro</tt> mode, cpphs performs only conditional-compilation actions, namely <tt>#include</tt>'s, <tt>#if</tt>'s,-and <tt>#ifdef</tt>'s are processed according to text-replacement-definitions (both command-line and internal), but no parameterised-macro expansion is performed. In full compatibility mode (the-default), textual replacements and macro expansions are also processed-in the remaining body of non-cpp text.+In <tt>--nomacro</tt> mode, cpphs performs only conditional compilation+actions, namely <tt>#include</tt>'s, <tt>#if</tt>'s, and+<tt>#ifdef</tt>'s are processed according to text-replacement+definitions and macro expansions (both command-line and internal).+In full compatibility mode (the default), textual replacements and macro+expansions are also processed in the remaining body of non-cpp text. <p> Source language features:@@ -77,6 +76,7 @@ <tr><td>#undef</td> <td>in-line revocation of definitions</td></tr> <tr><td>#include</td><td>file inclusion</td></tr> <tr><td>#line</td> <td>line number directives</td></tr>+<tr><td>#pragma</td> <td>cpp pragmas (ignored)</td></tr> <tr><td>\\n</td> <td>line continuations within all # directives</td></tr> <tr><td>/**/</td> <td>token catenation within a macro definition</td></tr> <tr><td>##</td> <td>ANSI-style token catenation</td></tr>@@ -113,7 +113,8 @@ <p> <center><pre> Usage: cpphs [ filename | -Dsym | -Dsym=val | -Ipath ]+ [-Ofile]- [--nomacro|--noline|--strip|--text|--hashes|--layout|--unlit]*+ [--nomacro] [--noline] [--nowarn] [--pragma] [--strip]+ [--text] [--hashes] [--layout] [--unlit] [ --cpp compatopts ] cpphs --version </pre></center>@@ -140,6 +141,10 @@ <td>only process #ifdef's and #include's, do not expand macros</td></tr> <tr><td>--noline</td> <td>remove #line droppings from the output</td></tr>+<tr><td>--nowarn</td>+ <td>suppress messages from missing #include files, or #warning</td></tr>+<tr><td>--pragma</td>+ <td>retain #pragma in the output (normally removed)</td></tr> <tr><td>--strip</td> <td>convert C-style comments to whitespace, even outside cpp directives</td></tr>@@ -173,24 +178,21 @@ <p> <b>Current stable version:</b>+ <p>-cpphs-1.3, release date 2006.10.09<br>+cpphs-1.5, release date 2007.06.05<br> By HTTP:-<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.3.tar.gz">.tar.gz</a>,-<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.3.zip">.zip</a>.-<a href="http://www.cs.york.ac.uk/fp/cpphs-1.3-win32.zip">Windows binary</a>,+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.5.tar.gz">.tar.gz</a>,+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.5.zip">.zip</a>.+<a href="http://www.cs.york.ac.uk/fp/cpphs-1.5-win32.zip">Windows binary</a>, <a href="http://www.haskell.org/fedora/">Fedora package</a>, <a href="http://packages.gentoo.org/packages/?category=dev-haskell;name=cpphs">Gentoo package</a>, <a href="http://www.freshports.org/devel/hs-cpphs/">FreeBSD port</a>, <a href="http://www.openbsd.org/cgi-bin/cvsweb/ports/devel/cpphs/">OpenBSD port</a>. <ul>-<li> Added a "--cpp" option for drop-in compatibility with standard cpp.- It causes cpphs to accept standard cpp flags and translate- them to cpphs equivalents. Compatibility options include: -o, -ansi,- -traditional, -stdc, -x, -include, -P, -C, -CC, -A. The file- behaviour is different too - if two filenames are given on the- commandline, then the second is treated as the output location.-<li> Fixed a corner-case bug in evaluating chained and overlapping #ifdefs.+<li> Fixed some more obscure corner cases, involving parameterised macro+ expansion within conditionals e.g. #if FOO(BAR,QUUX)+<li> Internal refactoring, affecting parts of the library API. </ul> <p>@@ -209,6 +211,34 @@ <p> <b>Older versions:</b> <p>+cpphs-1.4, release date 2007.04.17<br>+By HTTP:+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.4.tar.gz">.tar.gz</a>,+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.4.zip">.zip</a>.+<ul>+<li> Added a "--pragma" option to retain #pragma in the output.+<li> Fixed a number of obscure corner cases involving the interaction of+ multiple features e.g. foo##__LINE__.+<li> Added the "--nowarn" option.+</ul>++<p>+cpphs-1.3, release date 2006.10.09<br>+By HTTP:+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.3.tar.gz">.tar.gz</a>,+<a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.3.zip">.zip</a>,+<a href="http://www.cs.york.ac.uk/fp/cpphs-1.3-win32.zip">Windows binary</a>.+<ul>+<li> Added a "--cpp" option for drop-in compatibility with standard cpp.+ It causes cpphs to accept standard cpp flags and translate+ them to cpphs equivalents. Compatibility options include: -o, -ansi,+ -traditional, -stdc, -x, -include, -P, -C, -CC, -A. The file+ behaviour is different too - if two filenames are given on the+ commandline, then the second is treated as the output location.+<li> Fixed a corner-case bug in evaluating chained and overlapping #ifdefs.+</ul>++<p> cpphs-1.2, release date 2006.05.04<br> By HTTP: <a href="http://www.cs.york.ac.uk/fp/cpphs/cpphs-1.2.tar.gz">.tar.gz</a>,@@ -466,7 +496,7 @@ Malcolm.Wallace@cs.york.ac.uk</a> </ul> -<p><b>Copyright:</b> © 2004-2006 Malcolm Wallace,+<p><b>Copyright:</b> © 2004-2007 Malcolm Wallace, except for ParseLib (Copyright © 1995 Graham Hutton and Erik Meijer) <p><b>License:</b> The library modules in cpphs are distributed under
tests/expect10 view
@@ -7,8 +7,7 @@ #line 1 "./inclusion" hello world, this is an inclusion -#line 6 "multiline"-+#line 7 "multiline" 7 hello again 8 some more 9 aLongMacroDefinition(a,b)
tests/expect15 view
@@ -3,5 +3,4 @@ #line 1 "./inclusion" hello world, this is an inclusion -#line 2 "indirect"-+#line 3 "indirect"
+ tests/expect15a view
@@ -0,0 +1,6 @@+#line 1 "indirect-a"++#line 1 "./inclusion"+hello world, this is an inclusion++#line 3 "indirect-a"
tests/expect22 view
@@ -8,7 +8,6 @@ line 4 Error "horrible" at line 4 of file "./specials" line 5 -#line 3 "specialinclude"-+#line 4 "specialinclude" 4 5
tests/expect27 view
@@ -14,4 +14,4 @@ version4 = #6.2.2 -version5 = "GHC_PKG_VERSION"+version5 = "6.2.2"
+ tests/expect32 view
@@ -0,0 +1,2 @@+#line 1 "pragma"+#pragma ident "@(#)time.h 1.39 99/08/10 SMI"
+ tests/expect33 view
@@ -0,0 +1,1 @@+#pragma ident "@(#)time.h 1.39 99/08/10 SMI"
+ tests/expect34 view
@@ -0,0 +1,11 @@+#line 1 "igloo"++++1+++foo+++
+ tests/expect35 view
@@ -0,0 +1,12 @@+#line 1 "igloo2"++++baz+1+++foo+++
+ tests/expect36 view
@@ -0,0 +1,12 @@+#line 1 "igloo3"++++quux+FOOFOO+++++bar+
+ tests/expect36a view
@@ -0,0 +1,12 @@+#line 1 "igloo3a"++++quux+FOOFOO+++++bar+
+ tests/expect36b view
@@ -0,0 +1,13 @@+#line 1 "igloo3b"+++++quux+11+++foo+++
+ tests/expect37 view
@@ -0,0 +1,11 @@+#line 1 "igloo4"+++wibble+11+++foo+++
+ tests/expect37a view
@@ -0,0 +1,11 @@+#line 1 "igloo4a"+++wibble+11+++foo+++
+ tests/expect38 view
@@ -0,0 +1,8 @@+#line 1 "mauke"+++++++main = print 7 -- should print 7
+ tests/expect39 view
@@ -0,0 +1,5 @@+#line 1 "mauke2"++++4
tests/expect4 view
@@ -22,8 +22,7 @@ #line 1 "./inclusion" hello world, this is an inclusion -#line 21 "testfile"-+#line 22 "testfile"
+ tests/expect40 view
@@ -0,0 +1,8 @@+#line 1 "fasta"+++++++b7 = unsafeVisualize(foo)
+ tests/expect40a view
@@ -0,0 +1,7 @@+#line 1 "fasta2"++++++b6 = unsafeVisualize(foo)
+ tests/expect41 view
@@ -0,0 +1,6 @@+#line 1 "hashjoin"+++++2
+ tests/expect42 view
@@ -0,0 +1,5 @@+#line 1 "wrongline"++2+#line 20 "foo"+20
+ tests/expect43 view
@@ -0,0 +1,6 @@+#line 1 "param"+++++11 -- gcc gives BARBAR, cpphs gives 11
tests/expect5 view
@@ -23,7 +23,6 @@ - 25
tests/expect7 view
@@ -38,11 +38,9 @@ import Control.Monad ( liftM ) #line 1 "./MachDeps.h"-#line 39 "Storable.hs"--#line 1 "./config.h" #line 40 "Storable.hs"-+#line 1 "./config.h"+#line 41 "Storable.hs" import GHC.Storable
tests/expect9 view
@@ -7,8 +7,7 @@ #line 1 "./inclusion" hello world, this is an inclusion -#line 6 "multiline"-+#line 7 "multiline" 7 hello again 8 some more 9 some line here;
+ tests/fasta view
@@ -0,0 +1,7 @@+#define XCONCAT(a, b) a##b+#define CONCAT(a, b) XCONCAT(a, b)+#define PS(val) () <- trace (val) (return ())+#define VIS(ioaction) let CONCAT(b, __LINE__) = unsafeVisualize(ioaction)+#define V(ioaction) CONCAT(b, __LINE__) = unsafeVisualize(ioaction)++V(foo)
+ tests/fasta2 view
@@ -0,0 +1,6 @@+#define XCONCAT(a, b) a##b+#define CONCAT(a, b) XCONCAT(a, b)+#define PS(val) () <- trace (val) (return ())+#define VIS(ioaction) let CONCAT(b, __LINE__) = unsafeVisualize(ioaction)+#define V(ioaction) CONCAT(b, __LINE__) = unsafeVisualize(ioaction)+V(foo)
+ tests/hashjoin view
@@ -0,0 +1,5 @@+#define FOO 1+#define BAR FOO##FOO+#define FOOFOO 2++BAR
+ tests/igloo view
@@ -0,0 +1,10 @@+#define FOO 1+#define BAR FOO++BAR++#if BAR == 1+foo+#else+bar+#endif
+ tests/igloo2 view
@@ -0,0 +1,11 @@+#define FOO 1+#define BAZ(x) x++baz+BAZ(1)++#if BAZ(1) == 1+foo+#else+bar+#endif
+ tests/igloo3 view
@@ -0,0 +1,11 @@+#define FOO 1+#define QUUX FOO ## FOO++quux+QUUX++#if QUUX == 11+foo+#else+bar+#endif
+ tests/igloo3a view
@@ -0,0 +1,11 @@+#define FOO 1+#define QUUX FOO##FOO++quux+QUUX++#if QUUX == 11+foo+#else+bar+#endif
+ tests/igloo3b view
@@ -0,0 +1,12 @@+#define FOO 1+#define QUUX(a) a ## a+#define WIBBLE QUUX(FOO)++quux+WIBBLE++#if WIBBLE == 11+foo+#else+bar+#endif
+ tests/igloo4 view
@@ -0,0 +1,10 @@+#define WIBBLE 1 ## 1++wibble+WIBBLE++#if WIBBLE == 11+foo+#else+bar+#endif
+ tests/igloo4a view
@@ -0,0 +1,10 @@+#define WIBBLE 1##1++wibble+WIBBLE++#if WIBBLE == 11+foo+#else+bar+#endif
+ tests/indirect-a view
@@ -0,0 +1,2 @@+#define F(f) in##f+#include F(clusion)
+ tests/mauke view
@@ -0,0 +1,7 @@+#define X /\+* comment */ main++#define Y _\+_LINE__++X = print Y -- should print 7
+ tests/mauke2 view
@@ -0,0 +1,4 @@+#define foo _\+_LINE__++foo
+ tests/param view
@@ -0,0 +1,5 @@+#define FOO 1+#define BAR FOO+#define JOIN(f) f##f++JOIN(BAR) -- gcc gives BARBAR, cpphs gives 11
tests/runtests view
@@ -27,9 +27,10 @@ runtest "$CPPHS --strip ross" expect13 runtest "$CPPHS precedence" expect14 runtest "$CPPHS indirect" expect15+runtest "$CPPHS --hashes indirect-a" expect15a runtest "$CPPHS numbers" expect16-runtest "$CPPHS pragma" expect17-runtest "$CPPHS --noline pragma" expect18+runtest "$CPPHS pragma" expect17 # see also test 32+runtest "$CPPHS --noline pragma" expect18 # see also test 33 runtest "$CPPHS -D__NHC__=117 parens" expect19 runtest "$CPPHS -Dc -Dd -De -Df -Dg -Dh chains" expect20 runtest "$CPPHS --hashes specials" expect21@@ -43,4 +44,20 @@ runtest "$CPPHS Test.hsc" expect29 runtest "$CPPHS --unlit Arr.lhs" expect30 runtest "$CPPHS -D__NHC__=118 elif" expect31+runtest "$CPPHS --pragma pragma" expect32+runtest "$CPPHS --pragma --noline pragma" expect33+runtest "$CPPHS igloo" expect34+runtest "$CPPHS igloo2" expect35+runtest "$CPPHS --hashes igloo3" expect36+runtest "$CPPHS --hashes igloo3a" expect36a+runtest "$CPPHS --hashes igloo3b" expect36b+runtest "$CPPHS --hashes igloo4" expect37+runtest "$CPPHS --hashes igloo4a" expect37a+runtest "$CPPHS mauke" expect38+runtest "$CPPHS mauke2" expect39+runtest "$CPPHS --hashes fasta" expect40+runtest "$CPPHS --hashes fasta2" expect40a+runtest "$CPPHS --hashes hashjoin" expect41+runtest "$CPPHS wrongline" expect42+runtest "$CPPHS --hashes param" expect43 exit $FAIL
+ tests/tmp-cpp view
@@ -0,0 +1,48 @@+# 1 "igloo2"+# 1 "<built-in>"+# 1 "<command line>"+# 1 "igloo2"++++++++bar+1+++foo+++++baz+1+++foo+++++quux+1 ## 1+++++bar+++wibble+1 ## 1+++++bar+++
+ tests/tmp-cpphs view
@@ -0,0 +1,45 @@+#line 1 "igloo2"++++++++bar+1+++foo+++++baz+1+++++bar+++quux+1 ## 1+++++bar+++wibble+1 ## 1+++++bar+++
+ tests/wrongline view
@@ -0,0 +1,4 @@+#define whereami __LINE__+whereami+#line 20 "foo"+__LINE__
+ tests/wrongline2 view
@@ -0,0 +1,4 @@+#define whereami __LINE__+whereami +#line 20 "foo"+__LINE__