language-c-0.10.1: Analysis and generation of C code

Copyright | (c) 2008 Benedikt Huber
License | BSD-style
Maintainer | benedikt.huber@gmail.com
Stability | experimental
Portability | ghc
Safe Haskell | None
Language | Haskell2010

Language.C.Syntax.Ops

Contents

- Assignment operators
- Binary operators
- Unary operators

Description

Unary, binary and asssignment operators. Exported via AST.

Synopsis

- data CAssignOp
  - = CAssignOp
  - | CMulAssOp
  - | CDivAssOp
  - | CRmdAssOp
  - | CAddAssOp
  - | CSubAssOp
  - | CShlAssOp
  - | CShrAssOp
  - | CAndAssOp
  - | CXorAssOp
  - | COrAssOp
- assignBinop :: CAssignOp -> CBinaryOp
- data CBinaryOp
  - = CMulOp
  - | CDivOp
  - | CRmdOp
  - | CAddOp
  - | CSubOp
  - | CShlOp
  - | CShrOp
  - | CLeOp
  - | CGrOp
  - | CLeqOp
  - | CGeqOp
  - | CEqOp
  - | CNeqOp
  - | CAndOp
  - | CXorOp
  - | COrOp
  - | CLndOp
  - | CLorOp
- isCmpOp :: CBinaryOp -> Bool
- isPtrOp :: CBinaryOp -> Bool
- isBitOp :: CBinaryOp -> Bool
- isLogicOp :: CBinaryOp -> Bool
- data CUnaryOp
  - = CPreIncOp
  - | CPreDecOp
  - | CPostIncOp
  - | CPostDecOp
  - | CAdrOp
  - | CIndOp
  - | CPlusOp
  - | CMinOp
  - | CCompOp
  - | CNegOp
- isEffectfulOp :: CUnaryOp -> Bool

# Assignment operators

data CAssignOp Source #

C assignment operators (K&R A7.17)

Constructors

CAssignOp |
CMulAssOp |
CDivAssOp |
CRmdAssOp | remainder and assignment
CAddAssOp |
CSubAssOp |
CShlAssOp |
CShrAssOp |
CAndAssOp |
CXorAssOp |
COrAssOp |

#### Instances

Instances details

NFData CAssignOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods rnf :: CAssignOp -> () Source #
Data CAssignOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Methods

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

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

toConstr :: CAssignOp -> Constr Source #

dataTypeOf :: CAssignOp -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic CAssignOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Associated Types

type Rep CAssignOp |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CAssignOp = D1 ('MetaData "CAssignOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (((C1 ('MetaCons "CAssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CMulAssOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CDivAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CRmdAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAddAssOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "CSubAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CShlAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CShrAssOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "CAndAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CXorAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "COrAssOp" 'PrefixI 'False) (U1 :: Type -> Type)))))

Methods

from :: CAssignOp -> Rep CAssignOp x Source #

to :: Rep CAssignOp x -> CAssignOp Source #

Show CAssignOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods showsPrec :: Int -> CAssignOp -> ShowS Source # show :: CAssignOp -> String Source # showList :: [CAssignOp] -> ShowS Source #
Eq CAssignOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods (==) :: CAssignOp -> CAssignOp -> Bool Source # (/=) :: CAssignOp -> CAssignOp -> Bool Source #
Ord CAssignOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Methods

compare :: CAssignOp -> CAssignOp -> Ordering Source #

(<) :: CAssignOp -> CAssignOp -> Bool Source #

(<=) :: CAssignOp -> CAssignOp -> Bool Source #

(>) :: CAssignOp -> CAssignOp -> Bool Source #

(>=) :: CAssignOp -> CAssignOp -> Bool Source #

max :: CAssignOp -> CAssignOp -> CAssignOp Source #

min :: CAssignOp -> CAssignOp -> CAssignOp Source #

Pretty CAssignOp Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CAssignOp -> Doc Source # prettyPrec :: Int -> CAssignOp -> Doc Source #
type Rep CAssignOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CAssignOp = D1 ('MetaData "CAssignOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (((C1 ('MetaCons "CAssignOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CMulAssOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CDivAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CRmdAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAddAssOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "CSubAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CShlAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CShrAssOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "CAndAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CXorAssOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "COrAssOp" 'PrefixI 'False) (U1 :: Type -> Type)))))

assignBinop :: CAssignOp -> CBinaryOp Source #

# Binary operators

data CBinaryOp Source #

C binary operators (K&R A7.6-15)

Constructors

CMulOp |
CDivOp |
CRmdOp | remainder of division
CAddOp |
CSubOp |
CShlOp | shift left
CShrOp | shift right
CLeOp | less
CGrOp | greater
CLeqOp | less or equal
CGeqOp | greater or equal
CEqOp | equal
CNeqOp | not equal
CAndOp | bitwise and
CXorOp | exclusive bitwise or
COrOp | inclusive bitwise or
CLndOp | logical and
CLorOp | logical or

#### Instances

Instances details

NFData CBinaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods rnf :: CBinaryOp -> () Source #
Data CBinaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Methods

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

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

toConstr :: CBinaryOp -> Constr Source #

dataTypeOf :: CBinaryOp -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic CBinaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Associated Types

type Rep CBinaryOp |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CBinaryOp = D1 ('MetaData "CBinaryOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) ((((C1 ('MetaCons "CMulOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CDivOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CRmdOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAddOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CSubOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CShlOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CShrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CLeOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CGrOp" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "CLeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CGeqOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CEqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CNeqOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CAndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CXorOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "COrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CLndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CLorOp" 'PrefixI 'False) (U1 :: Type -> Type))))))

Methods

from :: CBinaryOp -> Rep CBinaryOp x Source #

to :: Rep CBinaryOp x -> CBinaryOp Source #

Show CBinaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods showsPrec :: Int -> CBinaryOp -> ShowS Source # show :: CBinaryOp -> String Source # showList :: [CBinaryOp] -> ShowS Source #
Eq CBinaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods (==) :: CBinaryOp -> CBinaryOp -> Bool Source # (/=) :: CBinaryOp -> CBinaryOp -> Bool Source #
Ord CBinaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Methods

compare :: CBinaryOp -> CBinaryOp -> Ordering Source #

(<) :: CBinaryOp -> CBinaryOp -> Bool Source #

(<=) :: CBinaryOp -> CBinaryOp -> Bool Source #

(>) :: CBinaryOp -> CBinaryOp -> Bool Source #

(>=) :: CBinaryOp -> CBinaryOp -> Bool Source #

max :: CBinaryOp -> CBinaryOp -> CBinaryOp Source #

min :: CBinaryOp -> CBinaryOp -> CBinaryOp Source #

Pretty CBinaryOp Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CBinaryOp -> Doc Source # prettyPrec :: Int -> CBinaryOp -> Doc Source #
type Rep CBinaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CBinaryOp = D1 ('MetaData "CBinaryOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) ((((C1 ('MetaCons "CMulOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CDivOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CRmdOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAddOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CSubOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CShlOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CShrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CLeOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CGrOp" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "CLeqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CGeqOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CEqOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CNeqOp" 'PrefixI 'False) (U1 :: Type -> Type))) :+: ((C1 ('MetaCons "CAndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CXorOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "COrOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CLndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CLorOp" 'PrefixI 'False) (U1 :: Type -> Type))))))

isCmpOp :: CBinaryOp -> Bool Source #

isPtrOp :: CBinaryOp -> Bool Source #

isBitOp :: CBinaryOp -> Bool Source #

isLogicOp :: CBinaryOp -> Bool Source #

# Unary operators

data CUnaryOp Source #

C unary operator (K&R A7.3-4)

Constructors

CPreIncOp | prefix increment operator
CPreDecOp | prefix decrement operator
CPostIncOp | postfix increment operator
CPostDecOp | postfix decrement operator
CAdrOp | address operator
CIndOp | indirection operator
CPlusOp | prefix plus
CMinOp | prefix minus
CCompOp | one's complement
CNegOp | logical negation

#### Instances

Instances details

NFData CUnaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods rnf :: CUnaryOp -> () Source #
Data CUnaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Methods

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

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

toConstr :: CUnaryOp -> Constr Source #

dataTypeOf :: CUnaryOp -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Generic CUnaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

Associated Types

type Rep CUnaryOp |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CUnaryOp = D1 ('MetaData "CUnaryOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (((C1 ('MetaCons "CPreIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CPreDecOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CPostIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CPostDecOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAdrOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "CIndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CPlusOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CMinOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CCompOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CNegOp" 'PrefixI 'False) (U1 :: Type -> Type)))))

Methods

from :: CUnaryOp -> Rep CUnaryOp x Source #

to :: Rep CUnaryOp x -> CUnaryOp Source #

Show CUnaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods showsPrec :: Int -> CUnaryOp -> ShowS Source # show :: CUnaryOp -> String Source # showList :: [CUnaryOp] -> ShowS Source #
Eq CUnaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods (==) :: CUnaryOp -> CUnaryOp -> Bool Source # (/=) :: CUnaryOp -> CUnaryOp -> Bool Source #
Ord CUnaryOp Source # |
Instance details Defined in Language.C.Syntax.Ops Methods compare :: CUnaryOp -> CUnaryOp -> Ordering Source # (<) :: CUnaryOp -> CUnaryOp -> Bool Source # (<=) :: CUnaryOp -> CUnaryOp -> Bool Source # (>) :: CUnaryOp -> CUnaryOp -> Bool Source # (>=) :: CUnaryOp -> CUnaryOp -> Bool Source # max :: CUnaryOp -> CUnaryOp -> CUnaryOp Source # min :: CUnaryOp -> CUnaryOp -> CUnaryOp Source #
Pretty CUnaryOp Source # |
Instance details Defined in Language.C.Pretty Methods pretty :: CUnaryOp -> Doc Source # prettyPrec :: Int -> CUnaryOp -> Doc Source #
type Rep CUnaryOp Source # |

Instance details

Defined in Language.C.Syntax.Ops

type Rep CUnaryOp = D1 ('MetaData "CUnaryOp" "Language.C.Syntax.Ops" "language-c-0.10.1-IbTB6TwjqRkHrdbw3CJkeG" 'False) (((C1 ('MetaCons "CPreIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CPreDecOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CPostIncOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CPostDecOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CAdrOp" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "CIndOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CPlusOp" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "CMinOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "CCompOp" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "CNegOp" 'PrefixI 'False) (U1 :: Type -> Type)))))

isEffectfulOp :: CUnaryOp -> Bool Source #