mirror of
https://github.com/anoma/juvix.git
synced 2024-11-30 14:13:27 +03:00
parent
0462d623f2
commit
2b0668b55a
@ -91,10 +91,21 @@ space' special =
|
||||
special
|
||||
(notFollowedBy (P.chunk Str.pragmasStart))
|
||||
(_commentText, _commentInterval) <- interval $ do
|
||||
void (P.chunk "{-")
|
||||
pack <$> P.manyTill anySingle (P.chunk "-}")
|
||||
void start
|
||||
go 1 ""
|
||||
hspace_
|
||||
return Comment {..}
|
||||
where
|
||||
start :: m Text = P.chunk "{-"
|
||||
ending :: m Text = P.chunk "-}"
|
||||
go :: Int -> Text -> m Text
|
||||
go n acc = do
|
||||
(txt, startOrEnd) <- P.manyTill_ anySingle (Left <$> start <|> Right <$> ending)
|
||||
case startOrEnd of
|
||||
Left st -> go (n + 1) (acc <> pack txt <> st)
|
||||
Right en
|
||||
| n > 1 -> go (n - 1) (acc <> pack txt <> en)
|
||||
| otherwise -> return (acc <> pack txt)
|
||||
|
||||
integer' :: ParsecS r (Integer, Interval) -> ParsecS r (Integer, Interval)
|
||||
integer' dec = do
|
||||
|
@ -5,7 +5,7 @@ module test003;
|
||||
|
||||
Multiline comment
|
||||
|
||||
{- nested comments don't work -- }
|
||||
{- nested comments work -}
|
||||
|
||||
-}
|
||||
|
||||
|
@ -4,6 +4,6 @@
|
||||
|
||||
Multiline comment
|
||||
|
||||
{- nested comments don't work -- }
|
||||
{- nested comments work -}
|
||||
|
||||
-}
|
||||
|
@ -3,5 +3,25 @@ module Parsing;
|
||||
let' : Type;
|
||||
let' := Type;
|
||||
|
||||
{- block comment -}
|
||||
-- line comment
|
||||
-- line comment 2
|
||||
|
||||
{- block comment 2
|
||||
|
||||
block comment 2
|
||||
-}
|
||||
|
||||
{- Nesting
|
||||
|
||||
{- Nesting
|
||||
|
||||
{- Nesting
|
||||
|
||||
-}
|
||||
|
||||
-}
|
||||
-}
|
||||
|
||||
TypeMine : Type;
|
||||
TypeMine := Type;
|
||||
|
Loading…
Reference in New Issue
Block a user