changed indent method according to ghc standard
This commit is contained in:
26
CSVParser.hs
26
CSVParser.hs
@@ -1,31 +1,31 @@
|
||||
module CSVParser (
|
||||
parseCSV
|
||||
)where
|
||||
parseCSV
|
||||
)where
|
||||
|
||||
import Text.ParserCombinators.Parsec
|
||||
|
||||
csvFile :: GenParser Char st [[String]]
|
||||
csvFile = do
|
||||
result <- many line
|
||||
eof
|
||||
return result
|
||||
result <- many line
|
||||
eof
|
||||
return result
|
||||
|
||||
line :: GenParser Char st [String]
|
||||
line = do
|
||||
result <- cells
|
||||
_ <- eol
|
||||
return result
|
||||
result <- cells
|
||||
_ <- eol
|
||||
return result
|
||||
|
||||
cells :: GenParser Char st [String]
|
||||
cells = do
|
||||
first <- cellContent
|
||||
next <- remainingCells
|
||||
return (first : next)
|
||||
first <- cellContent
|
||||
next <- remainingCells
|
||||
return (first : next)
|
||||
|
||||
remainingCells :: GenParser Char st [String]
|
||||
remainingCells =
|
||||
(char ',' >> cells) -- Found comma? More cells coming
|
||||
<|> return [] -- No comma? Return [], no more cells
|
||||
(char ',' >> cells) -- Found comma? More cells coming
|
||||
<|> return [] -- No comma? Return [], no more cells
|
||||
|
||||
cellContent :: GenParser Char st String
|
||||
cellContent = many (noneOf ",\n")
|
||||
|
||||
Reference in New Issue
Block a user