aboutsummaryrefslogtreecommitdiff
path: root/src/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Parser.hs')
-rw-r--r--src/Parser.hs28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/Parser.hs b/src/Parser.hs
index 67d302a..feb56d3 100644
--- a/src/Parser.hs
+++ b/src/Parser.hs
@@ -12,12 +12,6 @@ import Control.Applicative ((<$>))
12import Text.ParserCombinators.Parsec 12import Text.ParserCombinators.Parsec
13 13
14 14
15parseComment :: Parser ()
16parseComment = do
17 char ';'
18 innards <- many (noneOf ['\n'])
19 return ()
20
21 15
22-- backslash double quote escapes a quote inside strings 16-- backslash double quote escapes a quote inside strings
23quotedChar = noneOf ['\"'] <|> try (string "\\\"" >> return '"') 17quotedChar = noneOf ['\"'] <|> try (string "\\\"" >> return '"')
@@ -71,15 +65,25 @@ parseId = do
71 "#f" -> BoolLiteral False 65 "#f" -> BoolLiteral False
72 _ -> Id atom 66 _ -> Id atom
73 67
68-- atmosphere
69parseComment :: Parser ()
70parseComment = do
71 char ';'
72 skipMany (noneOf ['\n'])
73 -- skipMany $ char '\n'
74 return ()
75
76
74whiteSpace :: Parser () 77whiteSpace :: Parser ()
75whiteSpace = 78whiteSpace = do
76 skipMany1 ( oneOf [' ', '\n']) 79 optionMaybe parseComment
77 <|> parseComment 80 skipMany1 ( oneOf [' ', '\n']) <?> "whitespace or newline"
81 return ()
78 82
79optionalWhiteSpace :: Parser () 83optionalWhiteSpace :: Parser ()
80optionalWhiteSpace = 84optionalWhiteSpace = do
81 skipMany ( oneOf [' ', '\n']) 85 optionMaybe $ whiteSpace
82 <|> parseComment 86 return ()
83 87
84type Alias = String 88type Alias = String
85parseModifier :: String -> Alias -> Parser Expr 89parseModifier :: String -> Alias -> Parser Expr