summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-03-21 20:26:58 -0400
committerJoe Crayne <joe@jerkface.net>2019-03-21 20:26:58 -0400
commitcde705a95f6456a8c91428fd4a2c5be18666bbee (patch)
tree4648005ab7dd6246ee7f030318bea5e8e6bee3e8
parent9e1579d5074f895cce9ac4a32ea5b94c70e4b269 (diff)
Fixed line-count when line comments are used.
-rw-r--r--GrepNested.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/GrepNested.hs b/GrepNested.hs
index c62262f..df52581 100644
--- a/GrepNested.hs
+++ b/GrepNested.hs
@@ -65,10 +65,12 @@ grepNested p !lin !col s = case cmtToken p s of
65 in mkComment lin col xs : grepNested p (lin + lcnt) col' cs' 65 in mkComment lin col xs : grepNested p (lin + lcnt) col' cs'
66 (StartLine,tlen,cs) 66 (StartLine,tlen,cs)
67 -> let findEOL !tot xs = case cmtToken p xs of 67 -> let findEOL !tot xs = case cmtToken p xs of
68 (EOL,tlen,_) -> tot 68 (EOL,tlen,_) -> (tot , tlen )
69 (tok,tlen,ys) -> findEOL (tot + tlen) ys 69 (tok,tlen,ys) -> findEOL (tot + tlen) ys
70 (comment,_) = cmtSplitAt p (findEOL 0 cs) cs 70 (clen,dlen) = findEOL 0 cs
71 in mkComment lin col comment : grepNested p (lin + 1) 1 cs 71 (comment,ds) = cmtSplitAt p clen cs
72 (_,es) = cmtSplitAt p dlen ds
73 in mkComment lin col comment : grepNested p (lin + 1) 1 es
72 (EOL,tlen,cs) -> grepNested p (lin+1) 1 cs 74 (EOL,tlen,cs) -> grepNested p (lin+1) 1 cs
73 (NullInput,tlen,_) -> [] 75 (NullInput,tlen,_) -> []
74 (IgnoredChar clen,_,cs) -> grepNested p lin (col+clen) cs 76 (IgnoredChar clen,_,cs) -> grepNested p lin (col+clen) cs