{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  Language.C.Syntax.Ops
-- Copyright   :  (c) 2008 Benedikt Huber
-- License     :  BSD-style
-- Maintainer  : benedikt.huber@gmail.com
-- Stability   : experimental
-- Portability : ghc
--
-- Unary, binary and asssignment operators. Exported via AST.
-----------------------------------------------------------------------------
module Language.C.Syntax.Ops (
-- * Assignment operators
CAssignOp(..),
assignBinop,
-- * Binary operators
CBinaryOp(..),
isCmpOp,
isPtrOp,
isBitOp,
isLogicOp,
-- * Unary operators
CUnaryOp(..),
isEffectfulOp
)
where
import Data.Data (Data)
import Data.Typeable (Typeable)
import GHC.Generics (Generic)
import Control.DeepSeq (NFData)
-- | C assignment operators (K&R A7.17)
data CAssignOp = CAssignOp
               | CMulAssOp
               | CDivAssOp
               | CRmdAssOp              -- ^ remainder and assignment
               | CAddAssOp
               | CSubAssOp
               | CShlAssOp
               | CShrAssOp
               | CAndAssOp
               | CXorAssOp
               | COrAssOp
               deriving (CAssignOp -> CAssignOp -> Bool
(CAssignOp -> CAssignOp -> Bool)
-> (CAssignOp -> CAssignOp -> Bool) -> Eq CAssignOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CAssignOp -> CAssignOp -> Bool
== :: CAssignOp -> CAssignOp -> Bool
$c/= :: CAssignOp -> CAssignOp -> Bool
/= :: CAssignOp -> CAssignOp -> Bool
Eq,Eq CAssignOp
Eq CAssignOp =>
(CAssignOp -> CAssignOp -> Ordering)
-> (CAssignOp -> CAssignOp -> Bool)
-> (CAssignOp -> CAssignOp -> Bool)
-> (CAssignOp -> CAssignOp -> Bool)
-> (CAssignOp -> CAssignOp -> Bool)
-> (CAssignOp -> CAssignOp -> CAssignOp)
-> (CAssignOp -> CAssignOp -> CAssignOp)
-> Ord CAssignOp
CAssignOp -> CAssignOp -> Bool
CAssignOp -> CAssignOp -> Ordering
CAssignOp -> CAssignOp -> CAssignOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CAssignOp -> CAssignOp -> Ordering
compare :: CAssignOp -> CAssignOp -> Ordering
$c< :: CAssignOp -> CAssignOp -> Bool
< :: CAssignOp -> CAssignOp -> Bool
$c<= :: CAssignOp -> CAssignOp -> Bool
<= :: CAssignOp -> CAssignOp -> Bool
$c> :: CAssignOp -> CAssignOp -> Bool
> :: CAssignOp -> CAssignOp -> Bool
$c>= :: CAssignOp -> CAssignOp -> Bool
>= :: CAssignOp -> CAssignOp -> Bool
$cmax :: CAssignOp -> CAssignOp -> CAssignOp
max :: CAssignOp -> CAssignOp -> CAssignOp
$cmin :: CAssignOp -> CAssignOp -> CAssignOp
min :: CAssignOp -> CAssignOp -> CAssignOp
Ord,Int -> CAssignOp -> ShowS
[CAssignOp] -> ShowS
CAssignOp -> String
(Int -> CAssignOp -> ShowS)
-> (CAssignOp -> String)
-> ([CAssignOp] -> ShowS)
-> Show CAssignOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CAssignOp -> ShowS
showsPrec :: Int -> CAssignOp -> ShowS
$cshow :: CAssignOp -> String
show :: CAssignOp -> String
$cshowList :: [CAssignOp] -> ShowS
showList :: [CAssignOp] -> ShowS
Show,Typeable CAssignOp
Typeable CAssignOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> CAssignOp -> c CAssignOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CAssignOp)
-> (CAssignOp -> Constr)
-> (CAssignOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CAssignOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CAssignOp))
-> ((forall b. Data b => b -> b) -> CAssignOp -> CAssignOp)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CAssignOp -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CAssignOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> CAssignOp -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CAssignOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp)
-> Data CAssignOp
CAssignOp -> Constr
CAssignOp -> DataType
(forall b. Data b => b -> b) -> CAssignOp -> CAssignOp
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CAssignOp -> u
forall u. (forall d. Data d => d -> u) -> CAssignOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CAssignOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CAssignOp -> c CAssignOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CAssignOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CAssignOp)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CAssignOp -> c CAssignOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CAssignOp -> c CAssignOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CAssignOp
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CAssignOp
$ctoConstr :: CAssignOp -> Constr
toConstr :: CAssignOp -> Constr
$cdataTypeOf :: CAssignOp -> DataType
dataTypeOf :: CAssignOp -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CAssignOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CAssignOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CAssignOp)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CAssignOp)
$cgmapT :: (forall b. Data b => b -> b) -> CAssignOp -> CAssignOp
gmapT :: (forall b. Data b => b -> b) -> CAssignOp -> CAssignOp
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CAssignOp -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CAssignOp -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CAssignOp -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CAssignOp -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CAssignOp -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CAssignOp -> m CAssignOp
Data,Typeable,(forall x. CAssignOp -> Rep CAssignOp x)
-> (forall x. Rep CAssignOp x -> CAssignOp) -> Generic CAssignOp
forall x. Rep CAssignOp x -> CAssignOp
forall x. CAssignOp -> Rep CAssignOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CAssignOp -> Rep CAssignOp x
from :: forall x. CAssignOp -> Rep CAssignOp x
$cto :: forall x. Rep CAssignOp x -> CAssignOp
to :: forall x. Rep CAssignOp x -> CAssignOp
Generic)

instance NFData CAssignOp

assignBinop :: CAssignOp -> CBinaryOp
assignBinop :: CAssignOp -> CBinaryOp
assignBinop CAssignOp
CAssignOp = String -> CBinaryOp
forall a. HasCallStack => String -> a
error String
"direct assignment has no binary operator"
assignBinop CAssignOp
CMulAssOp = CBinaryOp
CMulOp
assignBinop CAssignOp
CDivAssOp = CBinaryOp
CDivOp
assignBinop CAssignOp
CRmdAssOp = CBinaryOp
CRmdOp
assignBinop CAssignOp
CAddAssOp = CBinaryOp
CAddOp
assignBinop CAssignOp
CSubAssOp = CBinaryOp
CSubOp
assignBinop CAssignOp
CShlAssOp = CBinaryOp
CShlOp
assignBinop CAssignOp
CShrAssOp = CBinaryOp
CShrOp
assignBinop CAssignOp
CAndAssOp = CBinaryOp
CAndOp
assignBinop CAssignOp
CXorAssOp = CBinaryOp
CXorOp
assignBinop CAssignOp
COrAssOp  = CBinaryOp
COrOp

-- | C binary operators (K&R A7.6-15)
--
data CBinaryOp = 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
               deriving (CBinaryOp -> CBinaryOp -> Bool
(CBinaryOp -> CBinaryOp -> Bool)
-> (CBinaryOp -> CBinaryOp -> Bool) -> Eq CBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CBinaryOp -> CBinaryOp -> Bool
== :: CBinaryOp -> CBinaryOp -> Bool
$c/= :: CBinaryOp -> CBinaryOp -> Bool
/= :: CBinaryOp -> CBinaryOp -> Bool
Eq,Eq CBinaryOp
Eq CBinaryOp =>
(CBinaryOp -> CBinaryOp -> Ordering)
-> (CBinaryOp -> CBinaryOp -> Bool)
-> (CBinaryOp -> CBinaryOp -> Bool)
-> (CBinaryOp -> CBinaryOp -> Bool)
-> (CBinaryOp -> CBinaryOp -> Bool)
-> (CBinaryOp -> CBinaryOp -> CBinaryOp)
-> (CBinaryOp -> CBinaryOp -> CBinaryOp)
-> Ord CBinaryOp
CBinaryOp -> CBinaryOp -> Bool
CBinaryOp -> CBinaryOp -> Ordering
CBinaryOp -> CBinaryOp -> CBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CBinaryOp -> CBinaryOp -> Ordering
compare :: CBinaryOp -> CBinaryOp -> Ordering
$c< :: CBinaryOp -> CBinaryOp -> Bool
< :: CBinaryOp -> CBinaryOp -> Bool
$c<= :: CBinaryOp -> CBinaryOp -> Bool
<= :: CBinaryOp -> CBinaryOp -> Bool
$c> :: CBinaryOp -> CBinaryOp -> Bool
> :: CBinaryOp -> CBinaryOp -> Bool
$c>= :: CBinaryOp -> CBinaryOp -> Bool
>= :: CBinaryOp -> CBinaryOp -> Bool
$cmax :: CBinaryOp -> CBinaryOp -> CBinaryOp
max :: CBinaryOp -> CBinaryOp -> CBinaryOp
$cmin :: CBinaryOp -> CBinaryOp -> CBinaryOp
min :: CBinaryOp -> CBinaryOp -> CBinaryOp
Ord,Int -> CBinaryOp -> ShowS
[CBinaryOp] -> ShowS
CBinaryOp -> String
(Int -> CBinaryOp -> ShowS)
-> (CBinaryOp -> String)
-> ([CBinaryOp] -> ShowS)
-> Show CBinaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CBinaryOp -> ShowS
showsPrec :: Int -> CBinaryOp -> ShowS
$cshow :: CBinaryOp -> String
show :: CBinaryOp -> String
$cshowList :: [CBinaryOp] -> ShowS
showList :: [CBinaryOp] -> ShowS
Show,Typeable CBinaryOp
Typeable CBinaryOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> CBinaryOp -> c CBinaryOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CBinaryOp)
-> (CBinaryOp -> Constr)
-> (CBinaryOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CBinaryOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CBinaryOp))
-> ((forall b. Data b => b -> b) -> CBinaryOp -> CBinaryOp)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> CBinaryOp -> [u])
-> (forall u.
    Int -> (forall d. Data d => d -> u) -> CBinaryOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp)
-> Data CBinaryOp
CBinaryOp -> Constr
CBinaryOp -> DataType
(forall b. Data b => b -> b) -> CBinaryOp -> CBinaryOp
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CBinaryOp -> u
forall u. (forall d. Data d => d -> u) -> CBinaryOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CBinaryOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CBinaryOp -> c CBinaryOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CBinaryOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CBinaryOp)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CBinaryOp -> c CBinaryOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CBinaryOp -> c CBinaryOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CBinaryOp
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CBinaryOp
$ctoConstr :: CBinaryOp -> Constr
toConstr :: CBinaryOp -> Constr
$cdataTypeOf :: CBinaryOp -> DataType
dataTypeOf :: CBinaryOp -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CBinaryOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CBinaryOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CBinaryOp)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CBinaryOp)
$cgmapT :: (forall b. Data b => b -> b) -> CBinaryOp -> CBinaryOp
gmapT :: (forall b. Data b => b -> b) -> CBinaryOp -> CBinaryOp
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CBinaryOp -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CBinaryOp -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CBinaryOp -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CBinaryOp -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CBinaryOp -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CBinaryOp -> m CBinaryOp
Data,Typeable,(forall x. CBinaryOp -> Rep CBinaryOp x)
-> (forall x. Rep CBinaryOp x -> CBinaryOp) -> Generic CBinaryOp
forall x. Rep CBinaryOp x -> CBinaryOp
forall x. CBinaryOp -> Rep CBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CBinaryOp -> Rep CBinaryOp x
from :: forall x. CBinaryOp -> Rep CBinaryOp x
$cto :: forall x. Rep CBinaryOp x -> CBinaryOp
to :: forall x. Rep CBinaryOp x -> CBinaryOp
Generic)

instance NFData CBinaryOp

isCmpOp :: CBinaryOp -> Bool
isCmpOp :: CBinaryOp -> Bool
isCmpOp CBinaryOp
op = CBinaryOp
op CBinaryOp -> [CBinaryOp] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ CBinaryOp
CLeqOp, CBinaryOp
CGeqOp, CBinaryOp
CLeOp, CBinaryOp
CGrOp, CBinaryOp
CEqOp, CBinaryOp
CNeqOp ]

isPtrOp :: CBinaryOp -> Bool
isPtrOp :: CBinaryOp -> Bool
isPtrOp CBinaryOp
op = CBinaryOp
op CBinaryOp -> [CBinaryOp] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ CBinaryOp
CAddOp, CBinaryOp
CSubOp ]

isBitOp :: CBinaryOp -> Bool
isBitOp :: CBinaryOp -> Bool
isBitOp CBinaryOp
op = CBinaryOp
op CBinaryOp -> [CBinaryOp] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ CBinaryOp
CShlOp, CBinaryOp
CShrOp, CBinaryOp
CAndOp, CBinaryOp
COrOp, CBinaryOp
CXorOp ]

isLogicOp :: CBinaryOp -> Bool
isLogicOp :: CBinaryOp -> Bool
isLogicOp CBinaryOp
op = CBinaryOp
op CBinaryOp -> [CBinaryOp] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ CBinaryOp
CLndOp, CBinaryOp
CLorOp ]

-- | C unary operator (K&R A7.3-4)
--
data CUnaryOp = 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
              deriving (CUnaryOp -> CUnaryOp -> Bool
(CUnaryOp -> CUnaryOp -> Bool)
-> (CUnaryOp -> CUnaryOp -> Bool) -> Eq CUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CUnaryOp -> CUnaryOp -> Bool
== :: CUnaryOp -> CUnaryOp -> Bool
$c/= :: CUnaryOp -> CUnaryOp -> Bool
/= :: CUnaryOp -> CUnaryOp -> Bool
Eq,Eq CUnaryOp
Eq CUnaryOp =>
(CUnaryOp -> CUnaryOp -> Ordering)
-> (CUnaryOp -> CUnaryOp -> Bool)
-> (CUnaryOp -> CUnaryOp -> Bool)
-> (CUnaryOp -> CUnaryOp -> Bool)
-> (CUnaryOp -> CUnaryOp -> Bool)
-> (CUnaryOp -> CUnaryOp -> CUnaryOp)
-> (CUnaryOp -> CUnaryOp -> CUnaryOp)
-> Ord CUnaryOp
CUnaryOp -> CUnaryOp -> Bool
CUnaryOp -> CUnaryOp -> Ordering
CUnaryOp -> CUnaryOp -> CUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: CUnaryOp -> CUnaryOp -> Ordering
compare :: CUnaryOp -> CUnaryOp -> Ordering
$c< :: CUnaryOp -> CUnaryOp -> Bool
< :: CUnaryOp -> CUnaryOp -> Bool
$c<= :: CUnaryOp -> CUnaryOp -> Bool
<= :: CUnaryOp -> CUnaryOp -> Bool
$c> :: CUnaryOp -> CUnaryOp -> Bool
> :: CUnaryOp -> CUnaryOp -> Bool
$c>= :: CUnaryOp -> CUnaryOp -> Bool
>= :: CUnaryOp -> CUnaryOp -> Bool
$cmax :: CUnaryOp -> CUnaryOp -> CUnaryOp
max :: CUnaryOp -> CUnaryOp -> CUnaryOp
$cmin :: CUnaryOp -> CUnaryOp -> CUnaryOp
min :: CUnaryOp -> CUnaryOp -> CUnaryOp
Ord,Int -> CUnaryOp -> ShowS
[CUnaryOp] -> ShowS
CUnaryOp -> String
(Int -> CUnaryOp -> ShowS)
-> (CUnaryOp -> String) -> ([CUnaryOp] -> ShowS) -> Show CUnaryOp
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CUnaryOp -> ShowS
showsPrec :: Int -> CUnaryOp -> ShowS
$cshow :: CUnaryOp -> String
show :: CUnaryOp -> String
$cshowList :: [CUnaryOp] -> ShowS
showList :: [CUnaryOp] -> ShowS
Show,Typeable CUnaryOp
Typeable CUnaryOp =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> CUnaryOp -> c CUnaryOp)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c CUnaryOp)
-> (CUnaryOp -> Constr)
-> (CUnaryOp -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c CUnaryOp))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CUnaryOp))
-> ((forall b. Data b => b -> b) -> CUnaryOp -> CUnaryOp)
-> (forall r r'.
    (r -> r' -> r)
    -> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r)
-> (forall r r'.
    (r' -> r -> r)
    -> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r)
-> (forall u. (forall d. Data d => d -> u) -> CUnaryOp -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> CUnaryOp -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp)
-> Data CUnaryOp
CUnaryOp -> Constr
CUnaryOp -> DataType
(forall b. Data b => b -> b) -> CUnaryOp -> CUnaryOp
forall a.
Typeable a =>
(forall (c :: * -> *).
 (forall d b. Data d => c (d -> b) -> d -> c b)
 -> (forall g. g -> c g) -> a -> c a)
-> (forall (c :: * -> *).
    (forall b r. Data b => c (b -> r) -> c r)
    -> (forall r. r -> c r) -> Constr -> c a)
-> (a -> Constr)
-> (a -> DataType)
-> (forall (t :: * -> *) (c :: * -> *).
    Typeable t =>
    (forall d. Data d => c (t d)) -> Maybe (c a))
-> (forall (t :: * -> * -> *) (c :: * -> *).
    Typeable t =>
    (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a))
-> ((forall b. Data b => b -> b) -> a -> a)
-> (forall r r'.
    (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall r r'.
    (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r)
-> (forall u. (forall d. Data d => d -> u) -> a -> [u])
-> (forall u. Int -> (forall d. Data d => d -> u) -> a -> u)
-> (forall (m :: * -> *).
    Monad m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> (forall (m :: * -> *).
    MonadPlus m =>
    (forall d. Data d => d -> m d) -> a -> m a)
-> Data a
forall u. Int -> (forall d. Data d => d -> u) -> CUnaryOp -> u
forall u. (forall d. Data d => d -> u) -> CUnaryOp -> [u]
forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CUnaryOp
forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CUnaryOp -> c CUnaryOp
forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CUnaryOp)
forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CUnaryOp)
$cgfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CUnaryOp -> c CUnaryOp
gfoldl :: forall (c :: * -> *).
(forall d b. Data d => c (d -> b) -> d -> c b)
-> (forall g. g -> c g) -> CUnaryOp -> c CUnaryOp
$cgunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CUnaryOp
gunfold :: forall (c :: * -> *).
(forall b r. Data b => c (b -> r) -> c r)
-> (forall r. r -> c r) -> Constr -> c CUnaryOp
$ctoConstr :: CUnaryOp -> Constr
toConstr :: CUnaryOp -> Constr
$cdataTypeOf :: CUnaryOp -> DataType
dataTypeOf :: CUnaryOp -> DataType
$cdataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CUnaryOp)
dataCast1 :: forall (t :: * -> *) (c :: * -> *).
Typeable t =>
(forall d. Data d => c (t d)) -> Maybe (c CUnaryOp)
$cdataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CUnaryOp)
dataCast2 :: forall (t :: * -> * -> *) (c :: * -> *).
Typeable t =>
(forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c CUnaryOp)
$cgmapT :: (forall b. Data b => b -> b) -> CUnaryOp -> CUnaryOp
gmapT :: (forall b. Data b => b -> b) -> CUnaryOp -> CUnaryOp
$cgmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
gmapQl :: forall r r'.
(r -> r' -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
$cgmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
gmapQr :: forall r r'.
(r' -> r -> r)
-> r -> (forall d. Data d => d -> r') -> CUnaryOp -> r
$cgmapQ :: forall u. (forall d. Data d => d -> u) -> CUnaryOp -> [u]
gmapQ :: forall u. (forall d. Data d => d -> u) -> CUnaryOp -> [u]
$cgmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CUnaryOp -> u
gmapQi :: forall u. Int -> (forall d. Data d => d -> u) -> CUnaryOp -> u
$cgmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
gmapM :: forall (m :: * -> *).
Monad m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
$cgmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
gmapMp :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
$cgmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
gmapMo :: forall (m :: * -> *).
MonadPlus m =>
(forall d. Data d => d -> m d) -> CUnaryOp -> m CUnaryOp
Data,Typeable,(forall x. CUnaryOp -> Rep CUnaryOp x)
-> (forall x. Rep CUnaryOp x -> CUnaryOp) -> Generic CUnaryOp
forall x. Rep CUnaryOp x -> CUnaryOp
forall x. CUnaryOp -> Rep CUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. CUnaryOp -> Rep CUnaryOp x
from :: forall x. CUnaryOp -> Rep CUnaryOp x
$cto :: forall x. Rep CUnaryOp x -> CUnaryOp
to :: forall x. Rep CUnaryOp x -> CUnaryOp
Generic)

instance NFData CUnaryOp

isEffectfulOp :: CUnaryOp -> Bool
isEffectfulOp :: CUnaryOp -> Bool
isEffectfulOp CUnaryOp
op = CUnaryOp
op CUnaryOp -> [CUnaryOp] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [ CUnaryOp
CPreIncOp, CUnaryOp
CPreDecOp, CUnaryOp
CPostIncOp, CUnaryOp
CPostDecOp ]