never executed always true always false
1 module Parse.Comments where
2
3 import Parse.Whitespace
4 import Parse.IParser
5 import AST.V0_16
6
7
8
9 commented :: IParser a -> IParser (C2 l1 l2 a)
10 commented inner =
11 (\c1 a c2 -> C (c1, c2) a) <$> whitespace <*> inner <*> whitespace
12
13
14 postCommented :: IParser a -> IParser (C1 l a)
15 postCommented a =
16 flip C <$> a <*> whitespace
17
18
19 preCommented :: IParser a -> IParser (C1 l a)
20 preCommented a =
21 C <$> whitespace <*> a
22
23
24 withEol :: IParser a -> IParser (C0Eol a)
25 withEol a =
26 do
27 (result, multiline) <- trackNewline a
28 case multiline of
29 SplitAll -> return $ C Nothing result
30 JoinAll -> flip C result <$> restOfLine