cgrep 6.4.18 → 6.4.19
raw patch · 4 files changed
+16/−15 lines, 4 files
Files
- README.md +1/−1
- cgrep.cabal +1/−1
- src/CGrep/Strategy/Cpp/Semantic.hs +6/−6
- src/CGrep/Strategy/Generic/Semantic.hs +8/−7
README.md view
@@ -4,7 +4,7 @@ Usage ----- -Cgrep 6.4.18 Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.4.19 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.4.18+Version: 6.4.19 Synopsis: Command line tool Homepage: http://awgn.github.io/cgrep/ License: GPL-2
src/CGrep/Strategy/Cpp/Semantic.hs view
@@ -57,12 +57,12 @@ -- quick Search... - ps' = map (C.pack . (\l -> if null l then ""- else maximumBy (compare `on` length) l) . mapMaybe (\x -> case x of- TokenCard (Cpp.TokenChar xs _) -> Just $ unquotes $ trim xs- TokenCard (Cpp.TokenString xs _) -> Just $ unquotes $ trim xs- TokenCard t -> Just $ Cpp.toString t- _ -> Nothing)) patterns'+ ps' = map C.pack $ (mapMaybe (\x -> case x of+ TokenCard (Cpp.TokenChar xs _) -> Just (unquotes $ trim xs)+ TokenCard (Cpp.TokenString xs _) -> Just (unquotes $ trim xs)+ TokenCard t -> Just (Cpp.toString t)+ _ -> Nothing+ ) . concat) patterns' found = quickSearch opt ps' text'
src/CGrep/Strategy/Generic/Semantic.hs view
@@ -54,16 +54,18 @@ patterns = map (Generic.tokenizer . contextFilter (getLang opt filename) filt) ps -- [ [t1,t2,..], [t1,t2...] ] patterns' = map (map mkWildCardFromToken) patterns -- [ [w1,w2,..], [w1,w2,..] ]- patterns'' = map (combineMultiCard . map (:[])) patterns' -- [ [m1,m2,..], [m1,m2,..] ] == [ [ [w1], [w2],..], [[w1],[w2],..]]+ patterns'' = map (combineMultiCard . map (:[])) patterns' -- [ [m1,m2,..], [m1,m2,..] ] == [[[w1], [w2],..], [[w1],[w2],..]] -- quickSearch ... - ps' = map ( C.pack . (\l -> if null l then ""- else maximumBy (compare `on` length) l) . mapMaybe (\x -> case x of- TokenCard (Generic.TokenLiteral xs _) -> Just (unquotes $ trim xs)- TokenCard t -> Just (tkToString t)- _ -> Nothing)) patterns'+ ps' = map C.pack $ (mapMaybe (\x -> case x of+ TokenCard (Generic.TokenLiteral xs _) -> Just (unquotes $ trim xs)+ TokenCard t -> Just (tkToString t)+ _ -> Nothing+ ) . concat) patterns' + found = quickSearch opt ps' text'+ -- put banners... putStrLevel1 (debug opt) $ "strategy : running generic semantic search on " ++ filename ++ "..."@@ -71,7 +73,6 @@ putStrLevel2 (debug opt) $ "multicards: " ++ show patterns'' putStrLevel2 (debug opt) $ "identif : " ++ show ps' - let found = quickSearch opt ps' text' if maybe False not found then return $ mkOutput opt filename text text []