3Description : Turn literate programs into normal programs.
6Maintainer : The Idris Community.
8module Idris.Unlit(unlit) where
14unlit :: FilePath -> String -> TC String
15unlit f s = do let s' = map ulLine (lines s)
17 return $ unlines (map snd s')
19data LineType = Prog | Blank | Comm
21ulLine :: String -> (LineType, String)
22ulLine ('>':' ':xs) = (Prog, ' ':' ':xs) -- Replace with spaces, otherwise text position numbers will be bogus.
23ulLine ('>':xs) = (Prog, ' ' :xs) -- The parser can deal with this, because /every/ (code) line is prefixed
25ulLine xs | all isSpace xs = (Blank, "")
26-- make sure it's not a doc comment
27 | otherwise = (Comm, '-':'-':' ':'>':xs)
29check :: FilePath -> Int -> [(LineType, String)] -> TC ()
30check f l (a:b:cs) = do chkAdj f l (fst a) (fst b)
32check f l [x] = return ()
33check f l [ ] = return ()
35-- Issue #1593 on the issue checker.
37-- https://github.com/idris-lang/Idris-dev/issues/1593
39chkAdj :: FilePath -> Int -> LineType -> LineType -> TC ()
40chkAdj f l Prog Comm = tfail $ At (FC f (l, 0) (l, 0)) ProgramLineComment --TODO: Span correctly
41chkAdj f l Comm Prog = tfail $ At (FC f (l, 0) (l, 0)) ProgramLineComment --TODO: Span correctly
42chkAdj f l _ _ = return ()
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list