| Copyright | (c) roki 2019 |
|---|---|
| License | MIT |
| Maintainer | falgon53@yahoo.co.jp |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Htcc.Parser.ConstructionData.Scope
Contents
Description
The Data type of variables and its utilities used in parsing
Synopsis
- data Scoped i = Scoped {
- curNestDepth :: !Natural
- vars :: Vars i
- structs :: Tags i
- typedefs :: Typedefs i
- functions :: Functions i
- enumerators :: Enumerators i
- data LookupVarResult i
- addLVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i)
- addGVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i)
- addGVarWith :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> GVarInitWith i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i)
- addLiteral :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i)
- addTag :: Num i => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i)
- addTypedef :: (Eq i, Num i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i)
- addFunction :: Num i => Bool -> StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i)
- addEnumerator :: Num i => StorageClass i -> TokenLC i -> i -> Scoped i -> Either (ASTError i) (Scoped i)
- succNest :: Scoped i -> Scoped i
- fallBack :: Scoped i -> Scoped i -> Scoped i
- lookupLVar :: Text -> Scoped i -> Maybe (LVar i)
- lookupGVar :: Text -> Scoped i -> Maybe (GVar i)
- lookupVar :: Text -> Scoped i -> LookupVarResult i
- lookupTag :: Text -> Scoped i -> Maybe (Tag i)
- lookupTypedef :: Text -> Scoped i -> Maybe (Typedef i)
- lookupFunction :: Text -> Scoped i -> Maybe (Function i)
- lookupEnumerator :: Text -> Scoped i -> Maybe (Enumerator i)
- initScope :: Scoped i
- resetLocal :: Scoped i -> Scoped i
The types
The data type of a struct tag
Constructors
| Scoped | The constructor of a struct tag |
Fields
| |
Instances
data LookupVarResult i Source #
A type that represents the result of a variable search
Constructors
| FoundGVar (GVar i) | A type constructor indicating that a global variable has been found |
| FoundLVar (LVar i) | A type constructor indicating that a local variable has been found |
| FoundEnum (Enumerator i) | A type constructor indicating that a enumerator has been found |
| NotFound | A type constructor indicating that it was not found |
Instances
| Eq i => Eq (LookupVarResult i) Source # | |
Defined in Htcc.Parser.ConstructionData.Scope Methods (==) :: LookupVarResult i -> LookupVarResult i -> Bool # (/=) :: LookupVarResult i -> LookupVarResult i -> Bool # | |
| Show i => Show (LookupVarResult i) Source # | |
Defined in Htcc.Parser.ConstructionData.Scope Methods showsPrec :: Int -> LookupVarResult i -> ShowS # show :: LookupVarResult i -> String # showList :: [LookupVarResult i] -> ShowS # | |
Operations for scope
addLVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i) Source #
addGVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i) Source #
addGVarWith :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> GVarInitWith i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i) Source #
addGVarWith has a scoped type argument and is the same function as addLiteral internally.
addLiteral :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (ATree i, Scoped i) Source #
addLiteral has a scoped type argument and is the same function as addLiteral internally.
addTag :: Num i => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i) Source #
addTypedef :: (Eq i, Num i) => StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i) Source #
addTypedef has a scoped type argument and is the same function as add internally.
addFunction :: Num i => Bool -> StorageClass i -> TokenLC i -> Scoped i -> Either (ASTError i) (Scoped i) Source #
addFunction has a scoped type argument and is the same function as add internally.
addEnumerator :: Num i => StorageClass i -> TokenLC i -> i -> Scoped i -> Either (ASTError i) (Scoped i) Source #
addEnumerator has a scoped type argument and is the same function as add internally.
lookupLVar :: Text -> Scoped i -> Maybe (LVar i) Source #
lookupLVar has a scoped type argument and is the same function as lookupLVar internally.
lookupGVar :: Text -> Scoped i -> Maybe (GVar i) Source #
lookupGVar has a scoped type argument and is the same function as lookupGVar internally.
lookupTypedef :: Text -> Scoped i -> Maybe (Typedef i) Source #
lookupTypedef has a scoped type argument and is the same function as lookupTypedef internally.
lookupFunction :: Text -> Scoped i -> Maybe (Function i) Source #
lookupFunction has a scoped type argument and is the same function as lookupFunction internally.
lookupEnumerator :: Text -> Scoped i -> Maybe (Enumerator i) Source #
lookupEnumerator has a scoped type argument and is the same function as lookupFunction internally.
resetLocal :: Scoped i -> Scoped i Source #
resetLocal has a scoped type argument and is the same function as resetLocal internally.