packages feed

lentil 1.0.8.0 → 1.0.9.0

raw patch · 14 files changed

+152/−33 lines, 14 files

Files

changes.txt view
@@ -1,3 +1,11 @@+1.0.9.0+-------++- Released Tue 04 Apr 2017 08:53:46 CEST+- Added support for rst/sphinx directives (patch by Ben Franksen)+- Added support for .scala files (request by Utku Demir)+- Added developer mode (on: -Werror -Wall)+ 1.0.8.0 ------- 
contributors.txt view
@@ -2,6 +2,7 @@  Michał Antkiewi Francesco Ariis+Ben Franksen Artyom Kazak Anton Felix Lorenzen Rodney Lorrimar
doc/usr/page.rst view
@@ -183,9 +183,11 @@ - Erlang source files (``.erl``, ``.hrl``, ``.escript``) including YECC   (``.yrl``) and LEEX (``.xrl``) - OCaml source files (``.ml``, ``.mli``)+- Scala source files (``.scala``) - Rust source files (``.rs``, ``.rlib``) - Standard ML source files (``.sml``) - OpenGL Shading Language source files (``.glsl``)+- Restructured Text (Sphinx) ``.. ::todo`` directives (``.rst``) - plain text files (``.txt``)  If you want a file type ``.xyz`` to be recognised as one in the list above,
issues.txt view
@@ -27,11 +27,11 @@     32  add .lentilignore (or even .lentilconf) Michał Antkiewicz         [feature:intermediate] [request]     34 -    https://blog.steve.org.uk/If_line_noise_is_a_program__all_fuzzers_are_developers.html-    in lentil? [debug] [u:2]- -lentil.cabal-    17  o data-files [easy] [fix] [2017]+   https://blog.steve.org.uk/If_line_noise_is_a_program__all_fuzzers_are_developers.html+   in lentil? [debug] [u:2]+    35  add diff syntax (Sean Russel) [feature] [2017] [design]+    36  allow input from stdin (Sean Russel -- see diff syntax) [feature]+        [2017] [design]   src/Lentil/Args.hs     26  disambiguation optparse-applicative [feature:intermediate]@@ -52,10 +52,17 @@     96  sicuramente c'è un modo più elegante e breve. Ah! quando mettono le         tuples section! [refactor] [duct]  +src/Lentil/Parse/Source.hs+   173  modText is extremely ducttape [duct]+   189  probabilmente getPosition non dovrebbe essere usato che solo per+        gli errori [duct]+  src/Lentil/Parse/Syntaxes.hs     25  qptain_nemo fake multiline comments in C (i.e. // and \ at the         bottom of the line, continued into next line, are valid C comments         but not recognised by lentil [u:1] [request]+    99  rst parser doesn't respect whitespace or paragraphs. How to+        implement this without breaking other parsers? [bug] [design]   test/Lentil/FileSpec.hs     38  excluding files fails on MS Windows! Check why! [u:3] [bug]
lentil.cabal view
@@ -1,5 +1,5 @@ name:                lentil-version:             1.0.8.0+version:             1.0.9.0 synopsis:            frugal issue tracker description:         minumum effort, cohesive issue tracker based on                      ubiquitous @TODO@s and @FIXME@s conventions.@@ -30,6 +30,7 @@                      test/test-files/lang-comm/ocaml.ml,                      test/test-files/lang-comm/rust.rs,                      test/test-files/lang-comm/standard-ml.sml,+                     test/test-files/lang-comm/rst.rst,                      test/test-files/lang-comm/text.txt,                      test/test-files/specific/contiguous.c,                      test/test-files/specific/cont-custom.c,@@ -48,6 +49,10 @@                      issues.txt, contributors.txt cabal-version:       >=1.24 +flag developer+  description: developer mode - warnings let compilation fail+  manual: True+  default: False  executable lentil   main-is:             Main.hs@@ -66,10 +71,17 @@                        Lentil.Parse.Run, Lentil.Helpers   hs-source-dirs:      src   default-language:    Haskell2010+  if flag(developer)+      GHC-Options: -Wall -Werror+  else+      GHC-Options: -Wall  test-suite test   default-language:    Haskell2010-  ghc-options:         -Wall+  if flag(developer)+     ghc-options:      -Wall -Werror+  else+     ghc-options:      -Wall   HS-Source-Dirs:      test, src   main-is:             Tests.hs   build-depends:       base==4.*,
src/Lentil/File.hs view
@@ -78,8 +78,6 @@           extCheck = (fmap getAny . mconcat)                      (map (fmap Any . (extension ==?)) (extensionList as)) -- -- recursion predicate: excludes dot ('.') or _ folders recPred :: RecursionPredicate recPred = (not . isDotFolder) <$> fileName
src/Lentil/Parse/Issue.hs view
@@ -56,7 +56,6 @@ -- a blank line of text (even at eof) blankline :: ParIssue () blankline = char '\n' *> (() <$ char '\n' <|> eof)--- blankline = () <$ string "\n\n"   ----------
src/Lentil/Parse/Source.hs view
@@ -30,12 +30,15 @@ -- from source to comment strings type ParSource a = Parsec String () a -data ParSyntax = ParSyntax { psLineComms   :: [String],+data ParSyntax = -- 'standard' language (with single line and/or multiline+                 -- markers, etc.+                 StdSyntax { psLineComms   :: [String],                              psBlockComms  :: [(String, String)],                              psStringStyle :: EscapeStyle,                              psStringLits  :: [Char],                              psCharStyle   :: CharStyle,                              psCharLits    :: [Char] }+               | RstSyntax -- reStructuredText/sphinx parsing                  deriving (Show)  data EscapeStyle = ClangLike | SQLLike@@ -142,19 +145,68 @@                                      (psCharLits ps))  +-----------------------+-- RST+SPHINX SYNTAX --+-----------------------++rstDocumentPart :: ParSource (Maybe CommentString)+rstDocumentPart = choice . map try $ [Just <$> rstTodo, Nothing <$ rstOther]++-- `.. todo::` directive+rstTodo :: ParSource CommentString+rstTodo = MultiLine <$> getRow <*>+            (rstTodoIncipit *> fmap modText todoBody)+          <?> "rst todo directive"+  where+        startPara :: ParSource ()+        startPara = newline *> (() <$ satisfy (not . C.isSpace) <|> eof)++        todoBody :: ParSource String+        todoBody = manyTill1 anyChar (lookAhead . try $ startPara <|> eof)++        -- modText does 2 things+        --   1. injects a dummy todo keyword, having discarded `.. todo::`+        --   2. replaces '\n' with "\n ", so that issue is not broken+        --      by newline+        modText :: String -> String+        modText cs = "TODO " ++ addSpace cs+            -- todo modText is extremely ducttape [duct]++        addSpace :: String -> String+        addSpace [] = []+        addSpace ('\n':cs) = '\n' : ' ' : addSpace cs+        addSpace (c:cs) = c : addSpace cs++-- everything else+rstOther :: ParSource String+rstOther = manyTill1 anyChar (endp <|> eof)+           <?> "rst other text"+    where+          endp = lookAhead . try $ rstTodoIncipit++rstTodoIncipit :: ParSource ()+rstTodoIncipit = fmap sourceColumn getPosition >>= \c ->+                 -- todo probabilmente getPosition non dovrebbe essere usato+                 --      che solo per gli errori [duct]+                 if c == 1+                   then () <$ string ".. todo::"+                   else parserFail "rst todo incipit: not at begin-of-line"++ ------------ -- SOURCE -- ------------  -- given a set of lineparsers / blockparsers sourcePart :: ParSyntax -> ParSource (Maybe CommentString)-sourcePart ps@(ParSyntax lc bc es sl cs cl) =+sourcePart RstSyntax                        = rstDocumentPart+sourcePart ps@(StdSyntax lc bc es sl cs cl) =             choice [plc, pbc, psl, pcl, ppr]             <?> "source file part"     where           ct = choice . map try -          plc = Just <$> (ct . map lineComment  $ lc)  -- line comlm+          plc = Just <$> (ct . map lineComment  $ lc)  -- line comm           pbc = Just <$> (ct . map blockComment $ bc)  -- block comm           psl = Nothing <$ (choice . map (try . litString es) $ sl)                                                            -- str lit
src/Lentil/Parse/Syntaxes.hs view
@@ -45,6 +45,7 @@               ([".elm"],                Just haskell), -- Elm               ([".c", ".h"],            Just c),               ([".cpp", ".hpp"],        Just c), -- C+++              ([".scala"],              Just c), -- Scala               ([".java"],               Just c), -- Java               ([".glsl"],               Just c), -- GL Shader               ([".xrl"],                Just c), -- FLEX@@ -63,36 +64,41 @@               ([".ml", ".mli"],         Just ocaml),               ([".rs", ".rlib"],        Just rust),               ([".sml"],                Just sml),+              ([".rst"],                Just rst), -- reStructuredText               ([".txt"],                Just text) ]  haskell, c, javascript, pascal, python, ruby, perl, nix,-    xml, erlang, ocaml, rust, sml, text :: ParSource [CommentString]-haskell    = source $ ParSyntax ["--"] [("{-", "-}")]+    xml, erlang, ocaml, rust, sml, rst, text :: ParSource [CommentString]+haskell    = source $ StdSyntax ["--"] [("{-", "-}")]                                 ClangLike ['"'] CommonChr ['\'']-c          = source $ ParSyntax ["//"] [("/*", "*/")]+c          = source $ StdSyntax ["//"] [("/*", "*/")]                                 ClangLike ['"'] CommonChr ['\'']-javascript = source $ ParSyntax ["//"] [("/*", "*/")]+javascript = source $ StdSyntax ["//"] [("/*", "*/")]                                 ClangLike ['"', '\''] CommonChr []-pascal     = source $ ParSyntax ["//"] [("{",  "}" ), ("(*", "*)")]+pascal     = source $ StdSyntax ["//"] [("{",  "}" ), ("(*", "*)")]                                 SQLLike ['\''] CommonChr []-python     = source $ ParSyntax ["#"] [("\"\"\"", "\"\"\"")]+python     = source $ StdSyntax ["#"] [("\"\"\"", "\"\"\"")]                                 ClangLike ['"', '\''] CommonChr []-ruby       = source $ ParSyntax ["#"] [("=begin", "=end")]+ruby       = source $ StdSyntax ["#"] [("=begin", "=end")]                                 ClangLike ['"', '\''] CommonChr []-perl       = source $ ParSyntax ["#"] []+perl       = source $ StdSyntax ["#"] []                                 ClangLike ['"', '\''] CommonChr []-nix        = source $ ParSyntax ["#"] [("/*", "*/")]+nix        = source $ StdSyntax ["#"] [("/*", "*/")]                                 ClangLike ['"'] CommonChr ['\'']-xml        = source $ ParSyntax [] [("<!--", "-->")]+xml        = source $ StdSyntax [] [("<!--", "-->")]                                 ClangLike ['"', '\''] CommonChr []-erlang     = source $ ParSyntax ["%"] []+erlang     = source $ StdSyntax ["%"] []                                 ClangLike ['"'] ErlangChr ['$']-ocaml      = source $ ParSyntax [] [("(*", "*)")]+ocaml      = source $ StdSyntax [] [("(*", "*)")]                                 ClangLike ['"', '\''] CommonChr []-rust       = source $ ParSyntax ["//!", "///", "//"] []+rust       = source $ StdSyntax ["//!", "///", "//"] []                                 ClangLike ['"', '\''] CommonChr []-sml        = source $ ParSyntax [] [("(*", "*)")]+sml        = source $ StdSyntax [] [("(*", "*)")]                                 ClangLike ['"'] CommonChr []+rst        = source RstSyntax+             -- todo [bug] [design] rst parser doesn't respect whitespace or+             --      paragraphs. How to implement this without breaking other+             --      parsers? text       = (:[]) . MultiLine 1 <$> many anyChar  
src/Main.hs view
@@ -7,7 +7,6 @@  import Options.Applicative -import qualified Data.Maybe as M import Data.Monoid -- 7.8 import qualified System.IO as I @@ -25,11 +24,12 @@                                                  short 'h',                                                  help "Show this help text" ] +version :: Parser (a -> a) version = infoOption versionCopy ( long "version" <>                                    short 'v'      <>                                    help "show version and copyright info" )     where-          versionCopy = "\nlentil - frugal issue tracker, version 1.0.8.0\n\+          versionCopy = "\nlentil - frugal issue tracker, version 1.0.9.0\n\                         \(C) 2015-2017 Francesco Ariis - http://www.ariis.it\n\                         \released under the GNU General Public License v3\n" 
stack.yaml view
@@ -1,3 +1,3 @@-resolver: nightly-2016-12-29+resolver: lts-8.3 packages: - '.'
test/Lentil/Parse/RunSpec.hs view
@@ -104,4 +104,9 @@     it "parses a Standard ML source" $         fileParser [] [] "test/test-files/lang-comm/standard-ml.sml"             `shouldReturn` spt "test/test-files/lang-comm/standard-ml.sml"+    it "parses an rst+sphinx document" $+        fileParser [] [] "test/test-files/lang-comm/rst.rst"+            `shouldReturn` [Issue "test/test-files/lang-comm/rst.rst" 3+                           (Just "some text, more text another paragraph, \+                                 \still belongs to todo") [Tag "hh2"]] 
test/Lentil/Parse/SourceSpec.hs view
@@ -1,7 +1,7 @@ module Lentil.Parse.SourceSpec where  import Test.Hspec-import Text.Parsec (runParser)+import Text.Parsec (runParser, many, anyChar)  import Lentil.Types import Lentil.Parse.Source@@ -62,7 +62,7 @@     it "parses an erlang-style char" $       sp (litChar ErlangChr '$') "$%" `shouldBe` Just '%' -  let hss = ParSyntax ["--"] [("{-", "-}")]+  let hss = StdSyntax ["--"] [("{-", "-}")]                       ClangLike ['"'] CommonChr ['\'']   describe "program" $ do     it "parses program instructions till eof" $@@ -78,7 +78,28 @@     it "stops at ' which is not a literal char" $       sp (program hss) "prova' " `shouldBe`  Just "prova' " -  let rbs = ParSyntax ["#"] [] ClangLike ['"', '\''] CommonChr []+  describe "rstTodo" $ do+    it "parses a reStructuredText+sphinx todo directive" $+      sp rstTodo ".. todo:: prova\n\n  foo" `shouldBe`+                 Just (ml 1 "TODO  prova\n \n   foo")+    it "fails if directive is not at the beginning of line" $+      sp rstTodo " .. todo:: prova\n\n  foo" `shouldBe` Nothing++  describe "rstOther" $ do+    it "parses a reStructuredText+sphinx other-than-todo directive part" $+      sp rstOther "gianni \n.. todo:: prova\n\n  foo" `shouldBe`+                 Just "gianni \n"++  describe "rstDocmuentPart" $ do+    it "parses a reStructuredText+sphinx document part: todo" $+      sp rstDocumentPart ".. todo:: prova\n\n  foo" `shouldBe`+                 Just (Just $ ml 1 "TODO  prova\n \n   foo")+    it "parses a reStructuredText+sphinx document part: non-todo" $+      sp (rstDocumentPart *> many anyChar)+         "gianni \n.. todo:: prova\n\n  foo" `shouldBe`+          Just ".. todo:: prova\n\n  foo"++  let rbs = StdSyntax ["#"] [] ClangLike ['"', '\''] CommonChr []   describe "source" $ do     it "parses one piece of source (line-comment)" $       sp (source hss) "-- hey\n my " `shouldBe` Just [sl 1 " hey"]
+ test/test-files/lang-comm/rst.rst view
@@ -0,0 +1,8 @@+The girl in purple shirts where urged not to disturb sir Cuthbert.++.. todo:: [hh2] some text,+  more text++  another paragraph, still belongs to todo++This format was provided by Ben Franksen.