aboutsummaryrefslogtreecommitdiff
path: root/src/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 34d90ba..cf58a2b 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -10,6 +10,7 @@ module Parser ( parseLispValue
10import Base (Expr (..), Function) 10import Base (Expr (..), Function)
11import Control.Applicative ((<$>)) 11import Control.Applicative ((<$>))
12import Text.ParserCombinators.Parsec 12import Text.ParserCombinators.Parsec
13import Text.Parsec.Char
13 14
14 15
15 16
@@ -69,16 +70,22 @@ parseId = do
69parseComment :: Parser () 70parseComment :: Parser ()
70parseComment = do 71parseComment = do
71 char ';' 72 char ';'
72 skipMany (noneOf ['\n']) 73 -- get internals of comment by getting it from here
73 -- skipMany $ char '\n' 74 manyTill anyChar (try (eol<|> eof))
74 return () 75 return ()
76 where eol = endOfLine >>return ()
75 77
76 78
77whiteSpace :: Parser () 79-- whiteSpace :: Parser ()
78whiteSpace = do 80-- whiteSpace = do
79 optionMaybe parseComment 81-- optionMaybe parseComment
80 skipMany1 ( oneOf [' ', '\n']) <?> "whitespace or newline" 82-- skipMany1 ( oneOf [' ', '\n']) <?> "whitespace or endOfLine"
81 return () 83-- return ()
84whiteSpace::Parser()
85whiteSpace = skipMany( parseComment <|> nl <|> spc )
86 where nl = endOfLine >>return ()
87 spc = space >> return ()
88
82 89
83optionalWhiteSpace :: Parser () 90optionalWhiteSpace :: Parser ()
84optionalWhiteSpace = do 91optionalWhiteSpace = do