Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ast.Parser.State
Synopsis
- type TypeState = [(String, Type)]
- type VarState = [(String, Type)]
- data PreProcessorState = PreProcessorState {}
- type DeferState = [[Expr]]
- data ParserState = ParserState {}
- parserState :: ParserState
- insertType :: String -> Type -> ParserState -> ParserState
- lookupType :: String -> ParserState -> Maybe Type
- insertVar :: String -> Type -> ParserState -> ParserState
- lookupVar :: String -> ParserState -> Maybe Type
- insertImport :: String -> ParserState -> ParserState
- lookupImport :: String -> ParserState -> Bool
- setImportDepth :: Int -> ParserState -> ParserState
- getImportDepth :: ParserState -> Int
- pushDefered :: Expr -> ParserState -> ParserState
- pushScope :: ParserState -> ParserState
- popScope :: ParserState -> ([Expr], ParserState)
Documentation
type VarState = [(String, Type)] Source #
Represents the state of variable definitions in the parser.
data PreProcessorState Source #
Tracks preprocessor-specific information, such as visited imports and import depth.
Constructors
PreProcessorState | |
Fields
|
Instances
Show PreProcessorState Source # | |
Defined in Ast.Parser.State Methods showsPrec :: Int -> PreProcessorState -> ShowS # show :: PreProcessorState -> String # showList :: [PreProcessorState] -> ShowS # | |
Eq PreProcessorState Source # | |
Defined in Ast.Parser.State Methods (==) :: PreProcessorState -> PreProcessorState -> Bool # (/=) :: PreProcessorState -> PreProcessorState -> Bool # |
type DeferState = [[Expr]] Source #
Represents the stack of deferred expressions, grouped by scope.
data ParserState Source #
The complete state of the parser, including types, variables, preprocessor state, and deferred expressions.
Constructors
ParserState | |
Fields |
Instances
Show ParserState Source # | |
Defined in Ast.Parser.State Methods showsPrec :: Int -> ParserState -> ShowS # show :: ParserState -> String # showList :: [ParserState] -> ShowS # | |
Eq ParserState Source # | |
Defined in Ast.Parser.State |
parserState :: ParserState Source #
The initial state of the parser.
insertType :: String -> Type -> ParserState -> ParserState Source #
Inserts a custom type into the environment. If the type already exists, it overwrites it.
lookupType :: String -> ParserState -> Maybe Type Source #
Looks up a custom type in the environment by its name.
insertVar :: String -> Type -> ParserState -> ParserState Source #
Inserts a variable into the environment. If the variable already exists, it overwrites it.
lookupVar :: String -> ParserState -> Maybe Type Source #
Looks up a variable in the environment by its name.
Returns Nothing
if the variable is not found.
insertImport :: String -> ParserState -> ParserState Source #
Marks an import as visited by adding it to the set of visited imports.
lookupImport :: String -> ParserState -> Bool Source #
Checks if a file has already been imported.
Returns True
if the file is in the set of visited imports.
setImportDepth :: Int -> ParserState -> ParserState Source #
Sets the depth of nested imports in the preprocessor state.
getImportDepth :: ParserState -> Int Source #
Gets the current depth of nested imports from the preprocessor state.
pushDefered :: Expr -> ParserState -> ParserState Source #
Pushes a deferred expression onto the current defer stack.
pushScope :: ParserState -> ParserState Source #
Pushes a new empty array onto the defer state to represent entering a new scope.
popScope :: ParserState -> ([Expr], ParserState) Source #
Pops the top scope expressions stack. Returns the popped stack and the updated ParserState.