Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions for working with comment stream.
Synopsis
- newtype CommentStream = CommentStream [RealLocated Comment]
- newtype Comment = Comment (NonEmpty String)
- mkCommentStream :: [Located String] -> PState -> (CommentStream, [Pragma], [Located String])
- isShebang :: String -> Bool
- isPrevHaddock :: Comment -> Bool
- isMultilineComment :: Comment -> Bool
- showCommentStream :: CommentStream -> String
Documentation
newtype CommentStream Source #
A stream of RealLocated
Comment
s in ascending order with respect to
beginning of corresponding spans.
Instances
A wrapper for a single comment. The NonEmpty
list inside contains
lines of multiline comment {- … -}
or just single item/line otherwise.
Instances
Eq Comment Source # | |
Data Comment Source # | |
Defined in Ormolu.Parser.CommentStream gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Comment -> c Comment # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Comment # toConstr :: Comment -> Constr # dataTypeOf :: Comment -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Comment) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Comment) # gmapT :: (forall b. Data b => b -> b) -> Comment -> Comment # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Comment -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Comment -> r # gmapQ :: (forall d. Data d => d -> u) -> Comment -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Comment -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Comment -> m Comment # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Comment -> m Comment # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Comment -> m Comment # | |
Show Comment Source # | |
:: [Located String] | Extra comments to include |
-> PState | Parser state to use for comment extraction |
-> (CommentStream, [Pragma], [Located String]) | Comment stream, a set of extracted pragmas, and extracted shebangs |
Create CommentStream
from PState
. The pragmas and shebangs are
removed from the CommentStream
. Shebangs are only extracted from the
comments that come from the first argument.
isPrevHaddock :: Comment -> Bool Source #
Test whether a Comment
looks like a Haddock following a definition,
i.e. something starting with -- ^
.
isMultilineComment :: Comment -> Bool Source #
Is this comment multiline-style?
showCommentStream :: CommentStream -> String Source #
Pretty-print a CommentStream
.