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

Swarm.Language.Syntax.Loc

Description

Types for working with locations of something in source code.

Synopsis

Documentation

data SrcLoc Source #

The location of something in the textual source code (recorded as an interval measured in terms of indices into the input stream).

Constructors

NoLoc 
SrcLoc Int Int

Half-open interval from start (inclusive) to end (exclusive)

Instances

Instances details
FromJSON SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

ToJSON SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Data SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

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

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

toConstr :: SrcLoc -> Constr #

dataTypeOf :: SrcLoc -> DataType #

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

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

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

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

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

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

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

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

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

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

Monoid SrcLoc Source #

mempty is a special value which means we have no location information.

Instance details

Defined in Swarm.Language.Syntax.Loc

Semigroup SrcLoc Source #

x <> y is the smallest SrcLoc that subsumes both x and y.

Instance details

Defined in Swarm.Language.Syntax.Loc

Generic SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Associated Types

type Rep SrcLoc 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Swarm.Language.Syntax.Loc" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "NoLoc" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SrcLoc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

Methods

from :: SrcLoc -> Rep SrcLoc x #

to :: Rep SrcLoc x -> SrcLoc #

Show SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Eq SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

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

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

Ord SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Hashable SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

hashWithSalt :: Int -> SrcLoc -> Int #

hash :: SrcLoc -> Int #

type Rep SrcLoc Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep SrcLoc = D1 ('MetaData "SrcLoc" "Swarm.Language.Syntax.Loc" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "NoLoc" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "SrcLoc" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Int)))

data Located v Source #

A variable with associated source location, used for variable binding sites. (Variable occurrences are a bare TVar which gets wrapped in a Syntax node, so we don't need LocVar for those.)

Constructors

LV 

Fields

Instances

Instances details
Functor Located Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

fmap :: (a -> b) -> Located a -> Located b #

(<$) :: a -> Located b -> Located a #

FromJSON v => FromJSON (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

ToJSON v => ToJSON (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Data v => Data (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

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

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

toConstr :: Located v -> Constr #

dataTypeOf :: Located v -> DataType #

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

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

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

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

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

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

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

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

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

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

Generic (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Associated Types

type Rep (Located v) 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep (Located v) = D1 ('MetaData "Located" "Swarm.Language.Syntax.Loc" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LV" 'PrefixI 'True) (S1 ('MetaSel ('Just "lvSrcLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "lvVar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 v)))

Methods

from :: Located v -> Rep (Located v) x #

to :: Rep (Located v) x -> Located v #

Show v => Show (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

showsPrec :: Int -> Located v -> ShowS #

show :: Located v -> String #

showList :: [Located v] -> ShowS #

Eq v => Eq (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

(==) :: Located v -> Located v -> Bool #

(/=) :: Located v -> Located v -> Bool #

Ord v => Ord (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

compare :: Located v -> Located v -> Ordering #

(<) :: Located v -> Located v -> Bool #

(<=) :: Located v -> Located v -> Bool #

(>) :: Located v -> Located v -> Bool #

(>=) :: Located v -> Located v -> Bool #

max :: Located v -> Located v -> Located v #

min :: Located v -> Located v -> Located v #

Hashable v => Hashable (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

Methods

hashWithSalt :: Int -> Located v -> Int #

hash :: Located v -> Int #

type Rep (Located v) Source # 
Instance details

Defined in Swarm.Language.Syntax.Loc

type Rep (Located v) = D1 ('MetaData "Located" "Swarm.Language.Syntax.Loc" "swarm-0.7.0.0-IuFfgHrMoE7JrptOBRVOwx-swarm-lang" 'False) (C1 ('MetaCons "LV" 'PrefixI 'True) (S1 ('MetaSel ('Just "lvSrcLoc") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 SrcLoc) :*: S1 ('MetaSel ('Just "lvVar") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 v)))

srcLocStartsBefore :: SrcLoc -> SrcLoc -> Bool Source #

Check whether one SrcLoc starts before another one, i.e. compare their starting indices to see if the first is <= the second.

srcLocEndsBefore :: SrcLoc -> SrcLoc -> Bool Source #

Check whether the first SrcLoc ends before the second, i.e. compare their ending indices to see if the first is <= the second.