Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Added extra url for explanations

* The program now doesn't just crash on an haskell-src-exts error but reports
  it.
  • Loading branch information...
commit 9baca12b22589870998d10bc88a499fcf8576fa7 1 parent 7e7b818
@spockz authored
View
6 src/Base/CLI.hs
@@ -22,9 +22,11 @@ data ProgramOptions = ProgramOptions
usage :: String
usage = unlines
- [ programName ++" "++ programVersion ++" - A lhs2TeX Syntax Coloring pre-processor"
+ [ programName ++" "++ programVersion ++" - A lhs2TeX Syntax Colouring preprocessor"
, "Consult the README file for extra information or visit:\n"
- , " https://github.com/spockz/lhs2texhl"
+ , " https://github.com/spockz/lhs2texhl"
+ , " and "
+ , " http://alessandrovermeulen.me/projects/lhs2texhl\n"
, "Copyright 2010, Alessandro Vermeulen <me@alessandrovermeulen.me>" ]
newCommands :: String
View
6 src/Literate/Haskell.hs
@@ -28,11 +28,11 @@ parseFile fp = parseFileWithMode (defaultParseMode { fixities = Just baseFi
)
fp
-runHaskell :: FilePath -> IO SimpleInfo
+runHaskell :: FilePath -> IO (Either String SimpleInfo)
runHaskell fp = do mod <- parseFile fp
case mod of
- (ParseOk m) -> return $ getSimpleInfo m
- (ParseFailed loc err) -> error $
+ (ParseOk m) -> (return . Right) (getSimpleInfo m)
+ (ParseFailed loc err) -> (return . Left) $
"Parsing failed at `"
++ show loc
++ " " ++ err
View
6 src/LiterateHighlighter.hs
@@ -44,13 +44,15 @@ main = do args <- cmdArgsRun standard
printFormatting args
where printFormat keyword (seek, rep) = "%format " ++ seek ++ " = \" {\\lhsCH" ++ keyword ++ "{" ++ rep ++ "}}\""
- writeOutput output si mapping =
+ writeOutput output mapping si =
mapM_ (\(keyword, f) -> mapM_ (hPutStrLn output . printFormat keyword)
(filter lhs2TeXSafe (f si))
)
mapping
printFormatting args = do hOutput <- openUTF8File (output args)
- let writer = flip $ writeOutput hOutput
+ let writer m (Right si) = writeOutput hOutput m si
+ writer _ (Left err) = hPutStrLn stderr $ "There was an error, a file has been skipped:" ++ err
+
files <- fmap (nub . concat)
(mapM discoverFiles (input args))
Please sign in to comment.
Something went wrong with that request. Please try again.