mirror of
https://github.com/koalaman/shellcheck
synced 2025-08-20 05:13:49 -07:00
Change definition of Replacement, add ToJSON instance for it
This commit is contained in:
parent
4a87d2a3de
commit
5ed89d2241
4 changed files with 48 additions and 16 deletions
|
@ -142,11 +142,12 @@ fixedString comment line =
|
|||
apply_replacement rs line 0
|
||||
where
|
||||
apply_replacement [] s _ = s
|
||||
apply_replacement ((R startp endp r):xs) s offset =
|
||||
let start = posColumn startp
|
||||
end = posColumn endp
|
||||
z = do_replace start end s r
|
||||
len_r = (fromIntegral . length) r in
|
||||
apply_replacement (rep:xs) s offset =
|
||||
let replacementString = repString rep
|
||||
start = (posColumn . repStartPos) rep
|
||||
end = (posColumn . repEndPos) rep
|
||||
z = do_replace start end s replacementString
|
||||
len_r = (fromIntegral . length) replacementString in
|
||||
apply_replacement xs z (offset + (end - start) + len_r)
|
||||
|
||||
-- start and end comes from pos, which is 1 based
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue