summaryrefslogtreecommitdiff
path: root/src/LambdaCube/Compiler/Lexer.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LambdaCube/Compiler/Lexer.hs')
-rw-r--r--src/LambdaCube/Compiler/Lexer.hs30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/LambdaCube/Compiler/Lexer.hs b/src/LambdaCube/Compiler/Lexer.hs
index 2b2407dd..6a269f6b 100644
--- a/src/LambdaCube/Compiler/Lexer.hs
+++ b/src/LambdaCube/Compiler/Lexer.hs
@@ -533,29 +533,19 @@ symbol name
533whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace') 533whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace')
534whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "") 534whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "")
535 535
536simpleSpace = 536simpleSpace
537 skipMany1 (satisfy isSpace) 537 = skipMany1 (satisfy isSpace)
538 538
539oneLineComment = 539oneLineComment
540 do{ try (string "--" >> many (char '-') >> notFollowedBy opLetter) 540 = try (string "--" >> many (char '-') >> notFollowedBy opLetter)
541 ; skipMany (satisfy (/= '\n')) 541 >> skipMany (satisfy (/= '\n'))
542 ; return ()
543 }
544
545commentStart = "{-"
546commentEnd = "-}"
547 542
548multiLineComment = 543multiLineComment = try (string "{-") *> inCommentMulti
549 do { try (string commentStart)
550 ; inCommentMulti
551 }
552 544
553inCommentMulti 545inCommentMulti
554 = do{ try (string commentEnd) ; return () } 546 = try (() <$ string "-}")
555 <|> do{ multiLineComment ; inCommentMulti } 547 <|> multiLineComment *> inCommentMulti
556 <|> do{ skipMany1 (noneOf startEnd) ; inCommentMulti } 548 <|> skipMany1 (noneOf "{}-") *> inCommentMulti
557 <|> do{ oneOf startEnd ; inCommentMulti } 549 <|> oneOf "{}-" *> inCommentMulti
558 <?> "end of comment" 550 <?> "end of comment"
559 where
560 startEnd = commentEnd ++ commentStart
561 551