| language-c-0.3.1.1: Analysis and generation of C code | Source code | Contents | Index

Language.C.Data.Ident

Portability | ghc
Stability | experimental
Maintainer | benedikt.huber@gmail.com

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

data Ident = Ident String !Int NodeInfo

data SUERef

= AnonymousRef Name
| NamedRef Ident

isAnonymousRef :: SUERef -> Bool
mkIdent :: Position -> String -> Name -> Ident
builtinIdent :: String -> Ident
internalIdent :: String -> Ident
internalIdentAt :: Position -> String -> Ident
isInternalIdent :: Ident -> Bool
identToString :: Ident -> String
dumpIdent :: Ident -> String

Documentation

data Ident | Source

C identifiers
Constructors

Ident String !Int NodeInfo |

Instances

Eq Ident
Data Ident
Ord Ident
Show Ident
Typeable Ident
Pos Ident
CNode Ident
Pretty Ident

data SUERef | Source

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

AnonymousRef Name |
NamedRef Ident |

Instances

Eq SUERef
Data SUERef
Ord SUERef
Show SUERef
Typeable SUERef
Pretty SUERef

isAnonymousRef :: SUERef -> Bool | Source

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

mkIdent :: Position -> String -> Name -> Ident | Source

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 | Source

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

internalIdent :: String -> Ident | Source

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

internalIdentAt :: Position -> String -> Ident | Source

return an internal identifier with position info

isInternalIdent :: Ident -> Bool | Source

return `True` if the given identifier is internal

identToString :: Ident -> String | Source

string of an identifier

dumpIdent :: Ident -> String | Source

dump the identifier string and its positions for debugging purposes
Produced by Haddock version 2.4.2