Copyright | (c) roki 2019 |
---|---|
License | MIT |
Maintainer | falgon53@yahoo.co.jp |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Data types and type synonyms used during AST construction
Synopsis
- data ConstructionData i = ConstructionData {}
- type Warnings i = Seq (Text, TokenLC i)
- addLVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i)
- addGVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i)
- addGVarWith :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> GVarInitWith i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i)
- addLiteral :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i)
- addTag :: Num i => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i)
- addTypedef :: (Eq i, Num i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i)
- addFunction :: Num i => Bool -> StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i)
- addEnumerator :: Num i => StorageClass i -> TokenLC i -> i -> ConstructionData i -> Either (ASTError i) (ConstructionData i)
- lookupLVar :: Text -> ConstructionData i -> Maybe (LVar i)
- lookupGVar :: Text -> ConstructionData i -> Maybe (GVar i)
- lookupVar :: Text -> ConstructionData i -> LookupVarResult i
- lookupTag :: Text -> ConstructionData i -> Maybe (Tag i)
- lookupTypedef :: Text -> ConstructionData i -> Maybe (Typedef i)
- lookupFunction :: Text -> ConstructionData i -> Maybe (Function i)
- lookupEnumerator :: Text -> ConstructionData i -> Maybe (Enumerator i)
- succNest :: ConstructionData i -> ConstructionData i
- fallBack :: ConstructionData i -> ConstructionData i -> ConstructionData i
- initConstructionData :: ConstructionData i
- resetLocal :: ConstructionData i -> ConstructionData i
- pushWarn :: Text -> TokenLC i -> ConstructionData i -> ConstructionData i
- incomplete :: StorageClass i -> ConstructionData i -> Maybe (StorageClass i)
Main type
data ConstructionData i Source #
ConstructionData
is a set of "things" used during the construction of the AST.
Contains error messages and scope information.
ConstructionData | The constructor of ConstructionData |
Instances
Show i => Show (ConstructionData i) Source # | |
Defined in Htcc.Parser.ConstructionData.Core showsPrec :: Int -> ConstructionData i -> ShowS # show :: ConstructionData i -> String # showList :: [ConstructionData i] -> ShowS # |
Adding funcitons
addLVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i) Source #
Shortcut to function addLVar
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
second (\x -> y { scope = x }) <$> Htcc.Parser.AST.Scope.addLVar ty tkn (scope x)
addGVar :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i) Source #
Shortcut to function addGVar
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
second (\x -> y { scope = x }) <$> Htcc.Parser.AST.Scope.addGVar ty tkn (scope x)
addGVarWith :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> GVarInitWith i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i) Source #
Shortcut to function addGVarWith
for variable x
of tye ConstructionData
.
addLiteral :: (Integral i, Bits i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ATree i, ConstructionData i) Source #
Shortcut to function addLiteral
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
second (\x -> y { scope = x }) <$> Htcc.Parser.AST.Scope.addLiteral ty tkn (scope x)
addTag :: Num i => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i) Source #
Shortcut to function addTag
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
(\y -> x { scope = y }) <$> Htcc.Parser.AST.Scope.addTag ty tkn (scope x)
addTypedef :: (Eq i, Num i) => StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i) Source #
Shortcut to function addTypedef
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
(\y -> x { scope = y }) <$> Htcc.Parser.AST.Scope.addTypedef ty tkn (scope x)
addFunction :: Num i => Bool -> StorageClass i -> TokenLC i -> ConstructionData i -> Either (ASTError i) (ConstructionData i) Source #
Shortcut to function addFunction
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
(\y -> x { scope = y }) <$> Htcc.Parser.AST.Scope.addFunction ty tkn (scope x)
addEnumerator :: Num i => StorageClass i -> TokenLC i -> i -> ConstructionData i -> Either (ASTError i) (ConstructionData i) Source #
Shortcut to function addEnumerator
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
(\y -> x { scope = y }) <$> Htcc.Parser.AST.Scope.addEnumerator ty tkn (scope x)
Searching function
lookupLVar :: Text -> ConstructionData i -> Maybe (LVar i) Source #
Shortcut to function lookupLVar
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupLVar s $ scope x
lookupGVar :: Text -> ConstructionData i -> Maybe (GVar i) Source #
Shortcut to function lookupGVar
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupGVar s $ scope x
lookupVar :: Text -> ConstructionData i -> LookupVarResult i Source #
Shortcut to function lookupVar
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupVar s $ scope x
lookupTag :: Text -> ConstructionData i -> Maybe (Tag i) Source #
Shortcut to function lookupTag
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupTag s $ scope x
lookupTypedef :: Text -> ConstructionData i -> Maybe (Typedef i) Source #
Shortcut to function lookupTypedef
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupTypedef s $ scope x
lookupFunction :: Text -> ConstructionData i -> Maybe (Function i) Source #
Shortcut to function lookupFunction
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupFunction s $ scope x
lookupEnumerator :: Text -> ConstructionData i -> Maybe (Enumerator i) Source #
Shortcut to function lookupEnumerator
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
Htcc.Parser.AST.Scope.lookupEnumerator s $ scope x
Other utilities
succNest :: ConstructionData i -> ConstructionData i Source #
Shortcut to function succNest
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
x { scope = Htcc.Parser.AST.Scope.succNest (scope x) }
fallBack :: ConstructionData i -> ConstructionData i -> ConstructionData i Source #
Shortcut to function fallBack
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
post { scope = Htcc.Parser.AST.Scope.fallBack (scope pre) (scope post) }
initConstructionData :: ConstructionData i Source #
Shortcut to the initial state of ConstructionData
.
resetLocal :: ConstructionData i -> ConstructionData i Source #
Shortcut to function resetLocal
for variable x
of type ConstructionData
.
This function is equivalent to
>>>
x { scope = Htcc.Parser.AST.Scope.resetLocal (scope x) }
pushWarn :: Text -> TokenLC i -> ConstructionData i -> ConstructionData i Source #
Function to add warning text.
incomplete :: StorageClass i -> ConstructionData i -> Maybe (StorageClass i) Source #
Returns Nothing
if incomplete, otherwise StorageClass
.