cgrep 6.6.16 → 6.6.17
raw patch · 4 files changed
+34/−9 lines, 4 files
Files
- README.md +1/−1
- cgrep.cabal +27/−2
- src/CGrep/Output.hs +5/−5
- src/CGrep/Parser/Cpp/Token.hs +1/−1
README.md view
@@ -7,7 +7,7 @@ Usage ----- -Cgrep 6.6.15. Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.6.17. 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.16+Version: 6.6.17 Synopsis: Command line tool Homepage: http://awgn.github.io/cgrep/ License: GPL-2@@ -25,7 +25,32 @@ BangPatterns, FlexibleInstances, FlexibleContexts- Other-Modules: Debug Options CmdOptions Util Config Reader CGrep.Lang CGrep.Filter CGrep.Token CGrep.Types CGrep.CGrep CGrep.Output CGrep.Distance CGrep.Common CGrep.Context CGrep.Parser.WildCard CGrep.Parser.Generic.Token CGrep.Parser.Token CGrep.Parser.Cpp.Token CGrep.Strategy.Generic.Semantic CGrep.Strategy.Levenshtein CGrep.Strategy.BoyerMoore CGrep.Strategy.Cpp.Tokenizer CGrep.Strategy.Cpp.Semantic CGrep.Strategy.Regex+ Other-Modules: Debug + Options + CmdOptions + Util + Config + Reader + CGrep.Lang + CGrep.Filter + CGrep.Token + CGrep.Types + CGrep.CGrep + CGrep.Output + CGrep.Distance + CGrep.Common + CGrep.Context + CGrep.Parser.WildCard + CGrep.Parser.Generic.Token + CGrep.Parser.Token + CGrep.Parser.Cpp.Token + CGrep.Strategy.Generic.Semantic + CGrep.Strategy.Levenshtein + CGrep.Strategy.BoyerMoore + CGrep.Strategy.Cpp.Tokenizer + CGrep.Strategy.Cpp.Semantic + CGrep.Strategy.Regex+ Paths_cgrep Build-Depends: base < 5.0, cmdargs >=0.10, bytestring >=0.10,
src/CGrep/Output.hs view
@@ -72,11 +72,10 @@ getOffset2d :: [OffsetLine] -> Offset -> Offset2d-getOffset2d idx off = let prc = fst $ partition (< off) idx in- case prc of- [] -> (0, off)- _ -> (length prc, off - last prc - 1)-+getOffset2d idx off =+ let prc = filter (< off) idx+ (len_prc, last_prc) = foldl' (\(len,_) cur -> (len + 1, cur)) (0,off) prc+ in (len_prc, off - last_prc - 1) mkOutput :: (Monad m) => FilePath -> Text8 -> Text8 -> [Token] -> OptionT m [Output] mkOutput f text multi ts = do@@ -243,6 +242,7 @@ showLineCol :: Options -> Output -> String showLineCol Options{no_numbers = True } _ = "" showLineCol Options{no_numbers = False, no_column = True } (Output _ n _ _) = show n+showLineCol Options{no_numbers = False, no_column = False } (Output _ n _ []) = show n showLineCol Options{no_numbers = False, no_column = False } (Output _ n _ ts) = show n ++ ":" ++ show ((+1) . fst . head $ ts)
src/CGrep/Parser/Cpp/Token.hs view
@@ -360,7 +360,7 @@ operOrPunct = HS.fromList [ "{","}","[","]","#","(",")",";",":","?",".","+","-","*", "/","%","^","&","|","~","!","=","<",">","," , "##", "<:", ":>", "<%", "%>", "%:", "::", ".*", "+=", "-=",- "*=", "/=", "%=", "^=", "&=", "|=", "<<", ">>", ">=", "<=",+ "*=", "/=", "%=", "^=", "&=", "|=", ">=", "<=", "&&", "||", "==", "!=", "++", "--", "->", "//", "/*", "*/", "...", "<<=", ">>=", "->*", "%:%:" ]