packages feed

lentil 0.1.3.1 → 0.1.4.0

raw patch · 11 files changed

+93/−41 lines, 11 files

Files

changes.txt view
@@ -1,3 +1,9 @@+0.1.4.0+-------++- Released Wed 26 Aug 2015 19:42:05 CEST+- Added SQL-like string parsing (requested by qptain nemo)+ 0.1.3.1 ------- 
+ contributors.txt view
@@ -0,0 +1,7 @@+Francesco Ariis+Henning Thielemann+Larsen+Qptain Nemo+Peter Simons+Simon Michael+Tomislav
doc/usr/page.rst view
@@ -143,6 +143,7 @@ - ruby source files (``.rb``) - perl source files (``.pl``, ``.pm``, ``.t``) - shell script source files (``.sh``)+- nix source files (``.nix``) - plain text files (``.txt``)  Every other file-type will get ignored! Contact me if you need another
issues.txt view
@@ -1,3 +1,6 @@+bin/make-bins.hs+    20  auto search (global? cpp?) version number? [dist]+  doc/dev/issues.txt     10  have stuff linked to haskell-platform friendly e non template         haskell and stuff [feature:intermediate]@@ -31,23 +34,27 @@     88  uncomment and implement sorting [feature:intermediate]   src/Lentil/File.hs-    42  not using canonised paths because it is extremely slow on big+    41  not using canonised paths because it is extremely slow on big         repositories (like darcs). Explore different possibilities         (conduit, new Filepath, unix program). [u:2] [duct]-    62  combine funziona su windows? [feature:intermediate]+    61  combine funziona su windows? [feature:intermediate]   src/Lentil/Parse/Run.hs-    32  a function String -> [Issue]-    68  change '\n' trick [refactor] [duct]+    27  hGetContents: invalid argument (invalid byte sequence) [fixme]+        [u:3]+    33  a function String -> [Issue]+    69  change '\n' trick [refactor] [duct]   src/Lentil/Parse/Syntaxes.hs     21  add langparsers che sia estensibile e leggibile a compilazione         [u:2] [feature:intermediate]-    39  multiline signature? [lint]-    40  tag at the beginning too? [design]+    40  multiline signature? [lint]+    41  tag at the beginning too? [design]   src/Main.hs     35  add doc to use less -r when piping hIsTerminalDevice stdout [doc]+    41  leave sort out as now? [design]+    58  o ord? [fixme]   test/Lentil/ArgsSpec.hs     37  real parsing testing options [test]
lentil.cabal view
@@ -1,5 +1,5 @@ name:                lentil-version:             0.1.3.1+version:             0.1.4.0 synopsis:            frugal issue tracker description:         minumum effort, cohesive issue tracker based on                      ubiquitous @TODO@s and @FIXME@s conventions.@@ -32,7 +32,7 @@                      test/test-files/test-proj/fold-c/sub-fold/foo4.hs,                      test/test-files/test-proj/fold-c/sub-fold/foo5.hs extra-doc-files:     README, changes.txt, doc/usr/page.rst, doc/usr/test.zip,-                     issues.txt+                     issues.txt, contributors.txt cabal-version:       >=1.10  
src/Lentil/File.hs view
@@ -11,7 +11,6 @@ module Lentil.File where  import Lentil.Types-import Lentil.Helpers import Lentil.Parse.Run  import System.FilePath
src/Lentil/Parse/Source.hs view
@@ -29,13 +29,17 @@ -- from source to comment strings type ParSource a = Parsec String () a -data ParSyntax = ParSyntax { psLineComms  :: [String],-                             psBlockComms :: [(String, String)],-                             psStringLits :: [Char],-                             psCharLits   :: [Char] }+data ParSyntax = ParSyntax { psLineComms   :: [String],+                             psBlockComms  :: [(String, String)],+                             psStringStyle :: EscapeStyle,+                             psStringLits  :: [Char],+                             psCharLits    :: [Char] }                  deriving (Show) +data EscapeStyle = ClangLike | SQLLike+                 deriving (Show, Eq) + ----------------- -- ANCILLARIES -- -----------------@@ -69,23 +73,43 @@ getRow :: ParSource Row getRow = fmap sourceLine getPosition ---------------------- OTHER BLOCKS --------------------- +-------------+-- STRINGS --+-------------++litString :: EscapeStyle -> Char -> ParSource String+litString ClangLike ic = cString ic+litString SQLLike   ic = sqlString ic++-- string ancillaries --+ -- quoted strings, escaped by \, by mauke^-litString :: Char -> ParSource String-litString ic = q *> many ((char '\\' *> anyChar) <|> noneOf no) <* q-               <?> "codestring"+cString :: Char -> ParSource String+cString ic = q *> many ((char '\\' *> anyChar) <|> noneOf no) <* q+             <?> "codestring"     where q  = char ic           no = C.showLitChar ic "\\" +-- sqllike string (no escape with \, '' to escape ')+sqlString :: Char -> ParSource String+sqlString ic = char ic *> manyTill anyChar (char ic)+    -- we treat 'cdscsad  cdscdsa '' csdcs' as two strings+    -- because the content is meaningless to our program+++------------------+-- OTHER BLOCKS --+------------------++ -- quoted single character litChar :: Char -> ParSource Char litChar ic = q *> ((char '\\' *> anyChar) <|> anyChar) <* q              <?> "char string sign"     where q = char ic + -- a program is instructions to the computer. Ends when you meet -- a well formed element from above (linecomm, blockcom, stringlit, -- charLit)@@ -112,14 +136,15 @@  -- given a set of lineparsers / blockparsers sourcePart :: ParSyntax -> ParSource (Maybe CommentString)-sourcePart ps@(ParSyntax lc bc sl cl) = choice [plc, pbc, psl, pcl, ppr]+sourcePart ps@(ParSyntax lc bc es sl cl) = choice [plc, pbc, psl, pcl, ppr]             <?> "source file part"     where           ct = choice . map try            plc = Just <$> (ct . map lineComment  $ lc)  -- line comlm           pbc = Just <$> (ct . map blockComment $ bc)  -- block comm-          psl = Nothing <$ (choice . map try . map litString $ sl) -- str lit+          psl = Nothing <$ (choice . map try . map (litString es) $ sl)+                                                                   -- str lit           pcl = Nothing <$ (ct . map litChar $ cl)                 -- char lit           ppr = Nothing <$ program ps                              -- program 
src/Lentil/Parse/Syntaxes.hs view
@@ -40,18 +40,23 @@ -- todo multiline signature? [lint] -- todo tag at the beginning too? [design] haskell, c, javascript, pascal, python, ruby :: ParSource [CommentString]-perl :: ParSource [CommentString]+perl, nix :: ParSource [CommentString] text :: ParSource [CommentString]-haskell    = source $ ParSyntax ["--"] [("{-", "-}")] ['"']  ['\'']-c          = source $ ParSyntax ["//"] [("/*", "*/")] ['"']  ['\'']-javascript = source $ ParSyntax ["//"] [("/*", "*/")] ['"', '\''] []-pascal     = source $ ParSyntax ["//"] [("{",  "}" ),-                                        ("(*", "*)")] ['\''] []-python     = source $ ParSyntax ["#"]  [("\"\"\"",-                                         "\"\"\"")]   ['"', '\''] []-ruby       = source $ ParSyntax ["#"]  [("=begin",-                                         "=end")]     ['"', '\''] []-perl       = source $ ParSyntax ["#"]  []             ['"', '\''] []-nix        = source $ ParSyntax ["#"]  [("/*", "*/")] ['"']       ['\'']+haskell    = source $ ParSyntax ["--"] [("{-", "-}")]+                                ClangLike ['"'] ['\'']+c          = source $ ParSyntax ["//"] [("/*", "*/")]+                                ClangLike ['"'] ['\'']+javascript = source $ ParSyntax ["//"] [("/*", "*/")]+                                ClangLike ['"', '\''] []+pascal     = source $ ParSyntax ["//"] [("{",  "}" ), ("(*", "*)")]+                                SQLLike ['\''] []+python     = source $ ParSyntax ["#"] [("\"\"\"", "\"\"\"")]+                                ClangLike ['"', '\''] []+ruby       = source $ ParSyntax ["#"] [("=begin", "=end")]+                                ClangLike ['"', '\''] []+perl       = source $ ParSyntax ["#"] []+                                ClangLike ['"', '\''] []+nix        = source $ ParSyntax ["#"] [("/*", "*/")]+                                ClangLike ['"'] ['\''] text       = (:[]) . MultiLine 1 <$> many anyChar 
src/Main.hs view
@@ -28,9 +28,9 @@                                    short 'v'      <>                                    help "show version and copyright info" )     where-          versionCopy = "lentil - a frugal issue tracker, version 0.1.3.1\n\+          versionCopy = "lentil - frugal issue tracker, version 0.1.4.0\n\                         \(C) 2015 Francesco Ariis - http://www.ariis.it\n\-                        \released under the GNU General Public License 3\n"+                        \released under the GNU General Public License v3\n"  -- todo add doc to use less -r when piping hIsTerminalDevice stdout [doc] 
test/Lentil/Parse/SourceSpec.hs view
@@ -56,11 +56,13 @@    describe "litString" $ do     it "parses code string" $-      sp (litString '"') "\"palla\"" `shouldBe` Just "palla"+      sp (litString ClangLike '"') "\"palla\"" `shouldBe` Just "palla"     it "parses code string with escaped \" inside" $-      sp (litString '"') "\"pal\\\"la\"" `shouldBe` Just "pal\"la"+      sp (litString ClangLike '"') "\"pal\\\"la\"" `shouldBe` Just "pal\"la"     it "parses code string with comments symbols inside" $-      sp (litString '"') "\"pal#la\"" `shouldBe` Just "pal#la"+      sp (litString ClangLike '"') "\"pal#la\"" `shouldBe` Just "pal#la"+    it "parses escape character (Pascal, SQL)" $+      sp (litString SQLLike '\'') "\'\\\'" `shouldBe` Just "\\"    describe "litChar" $ do     it "parses a string literal character inside" $@@ -68,7 +70,7 @@     it "parses escaped characters too" $       sp (litChar '\'') "'\"'" `shouldBe` Just '\"' -  let hss = ParSyntax ["--"] [("{-", "-}")] ['"']  ['\'']+  let hss = ParSyntax ["--"] [("{-", "-}")] ClangLike ['"']  ['\'']   describe "program" $ do     it "parses program instructions till eof" $       sp (program hss) "prova " `shouldBe`  Just "prova "@@ -83,7 +85,7 @@     it "stops at ' which is not a literal char" $       sp (program hss) "prova' " `shouldBe`  Just "prova' " -  let rbs = ParSyntax ["#"] [] ['"', '\'']  []+  let rbs = ParSyntax ["#"] [] ClangLike ['"', '\'']  []   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/pascal.pas view
@@ -2,7 +2,7 @@ // comment // Todo: single2 -qqq := 'Afla' // string+qqq := 'Afla' '\' // string c := '"' // char  { TODO: block1 }