Fixed bug in withRaw.

Didn't correctly handle case where nothing is parsed.
This commit is contained in:
John MacFarlane 2012-12-13 19:01:01 -08:00
parent 6e36375bdc
commit 2695434113

View file

@ -412,7 +412,7 @@ withRaw parser = do
let (l2,c2) = (sourceLine pos2, sourceColumn pos2)
let inplines = take ((l2 - l1) + 1) $ lines inp
let raw = case inplines of
[] -> error "raw: inplines is null" -- shouldn't happen
[] -> ""
[l] -> take (c2 - c1) l
ls -> unlines (init ls) ++ take (c2 - 1) (last ls)
return (result, raw)