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

Copyright(c) [1995..1999] Manuel M. T. Chakravarty
(c) 2008 Benedikt Huber
LicenseBSD-style
Maintainerbenedikt.huber@gmail.com
Stabilityexperimental
Portabilityghc
Safe HaskellNone
LanguageHaskell98

Language.C.Data.Ident

Description

This module provides the notion of identifiers in C, speed up using hashing. Identifiers are associated optionally associated with a NodeInfo, i.e. with a unique Name and a source location (Position). The ordering relation on identifiers is based on the hash and does not follow the lexical order.

Synopsis

Documentation

data Ident #

C identifiers

Constructors

Ident String !Int NodeInfo 
Instances
Eq Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

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

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

Data Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

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

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

toConstr :: Ident -> Constr #

dataTypeOf :: Ident -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

compare :: Ident -> Ident -> Ordering #

(<) :: Ident -> Ident -> Bool #

(<=) :: Ident -> Ident -> Bool #

(>) :: Ident -> Ident -> Bool #

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

max :: Ident -> Ident -> Ident #

min :: Ident -> Ident -> Ident #

Show Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

showsPrec :: Int -> Ident -> ShowS #

show :: Ident -> String #

showList :: [Ident] -> ShowS #

Generic Ident # 
Instance details

Defined in Language.C.Data.Ident

Associated Types

type Rep Ident :: Type -> Type #

Methods

from :: Ident -> Rep Ident x #

to :: Rep Ident x -> Ident #

NFData Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

rnf :: Ident -> () #

Pos Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

posOf :: Ident -> Position #

CNode Ident # 
Instance details

Defined in Language.C.Data.Ident

Methods

nodeInfo :: Ident -> NodeInfo #

Pretty Ident # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: Ident -> Doc #

prettyPrec :: Int -> Ident -> Doc #

type Rep Ident # 
Instance details

Defined in Language.C.Data.Ident

data SUERef #

References uniquely determining a struct, union or enum type. Those are either identified by an string identifier, or by a unique name (anonymous types).

Instances
Eq SUERef # 
Instance details

Defined in Language.C.Data.Ident

Methods

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

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

Data SUERef # 
Instance details

Defined in Language.C.Data.Ident

Methods

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

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

toConstr :: SUERef -> Constr #

dataTypeOf :: SUERef -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord SUERef # 
Instance details

Defined in Language.C.Data.Ident

Show SUERef # 
Instance details

Defined in Language.C.Data.Ident

Generic SUERef # 
Instance details

Defined in Language.C.Data.Ident

Associated Types

type Rep SUERef :: Type -> Type #

Methods

from :: SUERef -> Rep SUERef x #

to :: Rep SUERef x -> SUERef #

NFData SUERef # 
Instance details

Defined in Language.C.Data.Ident

Methods

rnf :: SUERef -> () #

Pretty SUERef # 
Instance details

Defined in Language.C.Analysis.Debug

Methods

pretty :: SUERef -> Doc #

prettyPrec :: Int -> SUERef -> Doc #

type Rep SUERef # 
Instance details

Defined in Language.C.Data.Ident

type Rep SUERef = D1 (MetaData "SUERef" "Language.C.Data.Ident" "language-c-0.8.2-KO6GGy0fbH5KZxtBHfA7kD" False) (C1 (MetaCons "AnonymousRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Name)) :+: C1 (MetaCons "NamedRef" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Ident)))

isAnonymousRef :: SUERef -> Bool #

Return true if the struct/union/enum reference is anonymous.

mkIdent :: Position -> String -> Name -> Ident #

build an identifier from a string.

  • only minimal error checking, e.g., the characters of the identifier are not checked for being alphanumerical only; the correct lexis of the identifier should be ensured by the caller, e.g., the scanner.
  • for reasons of simplicity the complete lexeme is hashed.

builtinIdent :: String -> Ident #

returns a builtin identifier (has builtin position and no unique name)

internalIdent :: String -> Ident #

returns an internal identifier (has internal position and no unique name)

internalIdentAt :: Position -> String -> Ident #

return an internal identifier with position info

isInternalIdent :: Ident -> Bool #

return True if the given identifier is internal

identToString :: Ident -> String #

string of an identifier

sueRefToString :: SUERef -> String #

string of a SUE ref (empty if anonymous)

dumpIdent :: Ident -> String #

dump the identifier string and its positions for debugging purposes