diff options
author | Joe Crayne <joe@jerkface.net> | 2019-03-21 20:26:58 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2019-03-21 20:26:58 -0400 |
commit | cde705a95f6456a8c91428fd4a2c5be18666bbee (patch) | |
tree | 4648005ab7dd6246ee7f030318bea5e8e6bee3e8 /GrepNested.hs | |
parent | 9e1579d5074f895cce9ac4a32ea5b94c70e4b269 (diff) |
Fixed line-count when line comments are used.
Diffstat (limited to 'GrepNested.hs')
-rw-r--r-- | GrepNested.hs | 8 |
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 |