Take care of comments
This commit is contained in:
parent
0e67fdc21c
commit
048ee552d8
@ -5,18 +5,20 @@ import Prelude hiding (takeWhile)
|
|||||||
import Control.Applicative (Alternative, (<|>), empty, many)
|
import Control.Applicative (Alternative, (<|>), empty, many)
|
||||||
import Data.Char
|
import Data.Char
|
||||||
|
|
||||||
import Data.Attoparsec.Text.Lazy
|
import Data.Attoparsec.Text
|
||||||
( Parser
|
( Parser
|
||||||
, (<?>)
|
, (<?>)
|
||||||
, anyChar
|
, anyChar
|
||||||
, decimal
|
, decimal
|
||||||
, double
|
, double
|
||||||
|
, endOfLine
|
||||||
, isEndOfLine
|
, isEndOfLine
|
||||||
, many1
|
, many1
|
||||||
, manyTill
|
, manyTill
|
||||||
, satisfy
|
, satisfy
|
||||||
, sepBy
|
, sepBy
|
||||||
, sepBy1
|
, sepBy1
|
||||||
|
, skipMany
|
||||||
, skipSpace
|
, skipSpace
|
||||||
, skipWhile
|
, skipWhile
|
||||||
, signed
|
, signed
|
||||||
@ -289,10 +291,16 @@ space' :: Parser Char
|
|||||||
space' = satisfy isSpace'
|
space' = satisfy isSpace'
|
||||||
|
|
||||||
s :: Parser ()
|
s :: Parser ()
|
||||||
s = skipWhile isSpace'
|
s = comments <|> skipWhile isSpace'
|
||||||
|
|
||||||
s1 :: Parser ()
|
s1 :: Parser ()
|
||||||
s1 = space' *> s
|
s1 = comments <|> space' *> s
|
||||||
|
|
||||||
isSpace' :: Char -> Bool
|
isSpace' :: Char -> Bool
|
||||||
isSpace' c = isSpace c || ',' == c || isEndOfLine c
|
isSpace' c = isSpace c || ',' == c || isEndOfLine c
|
||||||
|
|
||||||
|
comments :: Parser ()
|
||||||
|
comments = skipMany comment
|
||||||
|
|
||||||
|
comment :: Parser ()
|
||||||
|
comment = () <$ "#" <* manyTill anyChar endOfLine
|
||||||
|
Loading…
Reference in New Issue
Block a user