cgrep 6.6.10 → 6.6.11
raw patch · 4 files changed
+18/−12 lines, 4 files
Files
- README.md +1/−1
- cgrep.cabal +1/−1
- src/CGrep/Strategy/Cpp/Semantic.hs +7/−1
- src/CGrep/Strategy/Generic/Semantic.hs +9/−9
README.md view
@@ -7,7 +7,7 @@ Usage ----- -Cgrep 6.6.10. Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.6.11. Usage: cgrep [OPTION] [PATTERN] files... cgrep [OPTIONS] [ITEM]
cgrep.cabal view
@@ -1,6 +1,6 @@ Name: cgrep Description: Cgrep: a context-aware grep for source codes-Version: 6.6.10+Version: 6.6.11 Synopsis: Command line tool Homepage: http://awgn.github.io/cgrep/ License: GPL-2
src/CGrep/Strategy/Cpp/Semantic.hs view
@@ -23,6 +23,7 @@ import Control.Monad.Trans.Reader import Control.Monad.IO.Class+import Control.Applicative (liftA2) import Data.List import Data.Function import Data.Maybe@@ -76,7 +77,12 @@ putStrLevel2 $ "multicards: " ++ show patterns''' putStrLevel2 $ "identif : " ++ show identif - runQuickSearch filename (quickSearch opt (map C.pack identif) text') $ do+ let text'' = contextFilter (getFileLang opt filename) filt text'+ idpack = map C.pack identif+ quick1 = quickSearch opt idpack text'+ quick2 = quickSearch opt idpack text''++ runQuickSearch filename (liftA2 (&&) quick1 quick2) $ do let [text''', _ , _] = scanr ($) text' [ expandMultiline opt , contextFilter (getFileLang opt filename) filt
src/CGrep/Strategy/Generic/Semantic.hs view
@@ -29,6 +29,7 @@ import CGrep.Parser.Token import CGrep.Parser.WildCard +import Control.Applicative (liftA2) import Control.Monad.Trans.Reader import Control.Monad.IO.Class @@ -52,7 +53,6 @@ -- transform text let text' = ignoreCase opt text- filt = (mkContextFilter opt) { getFilterComment = False } -- pre-process patterns@@ -63,7 +63,7 @@ -- quickSearch ... - ps' = mapMaybe (\x -> case x of+ identif = mapMaybe (\x -> case x of TokenCard (Generic.TokenLiteral xs _) -> Just (rmQuote $ trim xs) TokenCard (Generic.TokenAlpha "OR" _) -> Nothing TokenCard t -> Just (tkToString t)@@ -75,18 +75,18 @@ putStrLevel1 $ "strategy : running generic semantic search on " ++ filename ++ "..." putStrLevel2 $ "wildcards : " ++ show patterns' putStrLevel2 $ "multicards: " ++ show patterns''- putStrLevel2 $ "identif : " ++ show ps'--- runQuickSearch filename (quickSearch opt (map C.pack ps') text') $ do+ putStrLevel2 $ "identif : " ++ show identif - -- context filter+ let text'' = contextFilter (getFileLang opt filename) filt text'+ idpack = map C.pack identif+ quick1 = quickSearch opt idpack text'+ quick2 = quickSearch opt idpack text'' - let text'' = contextFilter (getFileLang opt filename) filt text'+ runQuickSearch filename (liftA2 (&&) quick1 quick2) $ do -- expand multi-line - text''' = expandMultiline opt text''+ let text''' = expandMultiline opt text'' -- parse source code, get the Generic.Token list...