swarm-0.7.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellNone
LanguageHaskell2010

Swarm.Language.Syntax.Comments

Description

Types for working with comments in Swarm programming language.

Synopsis

Documentation

data CommentType Source #

Line vs block comments.

Constructors

LineComment 
BlockComment 

Instances

Instances details
FromJSON CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

ToJSON CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Data CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CommentType -> c CommentType #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CommentType #

toConstr :: CommentType -> Constr #

dataTypeOf :: CommentType -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CommentType) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CommentType) #

gmapT :: (forall b. Data b => b -> b) -> CommentType -> CommentType #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CommentType -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CommentType -> r #

gmapQ :: (forall d. Data d => d -> u) -> CommentType -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CommentType -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CommentType -> m CommentType #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CommentType -> m CommentType #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CommentType -> m CommentType #

Bounded CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Enum CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Generic CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Associated Types

type Rep CommentType 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentType = D1 ('MetaData "CommentType" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LineComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockComment" 'PrefixI 'False) (U1 :: Type -> Type))
Read CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Show CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Eq CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Ord CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Hashable CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentType Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentType = D1 ('MetaData "CommentType" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LineComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "BlockComment" 'PrefixI 'False) (U1 :: Type -> Type))

data CommentSituation Source #

Was a comment all by itself on a line, or did it occur after some other tokens on a line?

Instances

Instances details
FromJSON CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

ToJSON CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Data CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> CommentSituation -> c CommentSituation #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c CommentSituation #

toConstr :: CommentSituation -> Constr #

dataTypeOf :: CommentSituation -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c CommentSituation) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CommentSituation) #

gmapT :: (forall b. Data b => b -> b) -> CommentSituation -> CommentSituation #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> CommentSituation -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> CommentSituation -> r #

gmapQ :: (forall d. Data d => d -> u) -> CommentSituation -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> CommentSituation -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> CommentSituation -> m CommentSituation #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> CommentSituation -> m CommentSituation #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> CommentSituation -> m CommentSituation #

Bounded CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Enum CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Generic CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Associated Types

type Rep CommentSituation 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentSituation = D1 ('MetaData "CommentSituation" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "StandaloneComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SuffixComment" 'PrefixI 'False) (U1 :: Type -> Type))
Read CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Show CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Eq CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Ord CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Hashable CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentSituation Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep CommentSituation = D1 ('MetaData "CommentSituation" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "StandaloneComment" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SuffixComment" 'PrefixI 'False) (U1 :: Type -> Type))

isStandalone :: Comment -> Bool Source #

Test whether a comment is a standalone comment or not.

data Comment Source #

A comment is retained as some text plus metadata (source location, comment type, + comment situation). While parsing we record all comments out-of-band, for later re-insertion into the AST.

Instances

Instances details
FromJSON Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

ToJSON Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Data Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

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 :: forall r r'. (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 #

Generic Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Associated Types

type Rep Comment 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep Comment = D1 ('MetaData "Comment" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Comment" 'PrefixI 'True) ((S1 ('MetaSel ('Just "commentSrcLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "commentType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommentType)) :*: (S1 ('MetaSel ('Just "commentSituation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommentSituation) :*: S1 ('MetaSel ('Just "commentText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))

Methods

from :: Comment -> Rep Comment x #

to :: Rep Comment x -> Comment #

Show Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Eq Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

(==) :: Comment -> Comment -> Bool #

(/=) :: Comment -> Comment -> Bool #

Hashable Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

hashWithSalt :: Int -> Comment -> Int #

hash :: Comment -> Int #

PrettyPrec Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

prettyPrec :: Int -> Comment -> Doc ann

type Rep Comment Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep Comment = D1 ('MetaData "Comment" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Comment" 'PrefixI 'True) ((S1 ('MetaSel ('Just "commentSrcLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "commentType") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommentType)) :*: (S1 ('MetaSel ('Just "commentSituation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CommentSituation) :*: S1 ('MetaSel ('Just "commentText") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))))

data Comments Source #

Comments which can be attached to a particular AST node. Some comments come textually before the node and some come after.

Instances

Instances details
FromJSON Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

ToJSON Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Data Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Comments -> c Comments #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Comments #

toConstr :: Comments -> Constr #

dataTypeOf :: Comments -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Comments) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Comments) #

gmapT :: (forall b. Data b => b -> b) -> Comments -> Comments #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Comments -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Comments -> r #

gmapQ :: (forall d. Data d => d -> u) -> Comments -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Comments -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Comments -> m Comments #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Comments -> m Comments #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Comments -> m Comments #

Monoid Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Semigroup Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Generic Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Associated Types

type Rep Comments 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep Comments = D1 ('MetaData "Comments" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Comments" 'PrefixI 'True) (S1 ('MetaSel ('Just "_beforeComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq Comment)) :*: S1 ('MetaSel ('Just "_afterComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq Comment))))

Methods

from :: Comments -> Rep Comments x #

to :: Rep Comments x -> Comments #

Show Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Eq Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Hashable Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

hashWithSalt :: Int -> Comments -> Int #

hash :: Comments -> Int #

AsEmpty Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

Methods

_Empty :: Prism' Comments () #

type Rep Comments Source # 
Instance details

Defined in Swarm.Language.Syntax.Comments

type Rep Comments = D1 ('MetaData "Comments" "Swarm.Language.Syntax.Comments" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "Comments" 'PrefixI 'True) (S1 ('MetaSel ('Just "_beforeComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq Comment)) :*: S1 ('MetaSel ('Just "_afterComments") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Seq Comment))))