diff options
Diffstat (limited to 'src/LambdaCube/Compiler/Lexer.hs')
-rw-r--r-- | src/LambdaCube/Compiler/Lexer.hs | 30 |
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 | |||
533 | whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace') | 533 | whiteSpace = ignoreAbsoluteIndentation (localTokenMode (const Pa.Any) whiteSpace') |
534 | whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "") | 534 | whiteSpace' = skipMany (simpleSpace <|> oneLineComment <|> multiLineComment <?> "") |
535 | 535 | ||
536 | simpleSpace = | 536 | simpleSpace |
537 | skipMany1 (satisfy isSpace) | 537 | = skipMany1 (satisfy isSpace) |
538 | 538 | ||
539 | oneLineComment = | 539 | oneLineComment |
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 | |||
545 | commentStart = "{-" | ||
546 | commentEnd = "-}" | ||
547 | 542 | ||
548 | multiLineComment = | 543 | multiLineComment = try (string "{-") *> inCommentMulti |
549 | do { try (string commentStart) | ||
550 | ; inCommentMulti | ||
551 | } | ||
552 | 544 | ||
553 | inCommentMulti | 545 | inCommentMulti |
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 | ||