Class BlockFormatter<TInstruction>
- Namespace
- Echo.ControlFlow.Blocks
- Assembly
- Echo.ControlFlow.dll
Provides a mechanism for formatting a tree of blocks into an indented string representation.
public class BlockFormatter<TInstruction> : IBlockListener<TInstruction> where TInstruction : notnull
Type Parameters
TInstructionThe type of instructions stored in the block.
- Inheritance
-
BlockFormatter<TInstruction>
- Implements
-
IBlockListener<TInstruction>
- Inherited Members
Constructors
BlockFormatter(string)
Creates a new block formatter.
public BlockFormatter(string indentationString)
Parameters
indentationStringstringThe string to use when indenting a block.
Methods
EnterEpilogueBlock(HandlerBlock<TInstruction>)
Enters the epilogue region of a handler block.
public void EnterEpilogueBlock(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this epilogue is added to.
EnterExceptionHandlerBlock(ExceptionHandlerBlock<TInstruction>)
Enters an exception handler block.
public void EnterExceptionHandlerBlock(ExceptionHandlerBlock<TInstruction> block)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
EnterHandlerBlock(ExceptionHandlerBlock<TInstruction>, int)
Enters a handler region of an exception handler block.
public void EnterHandlerBlock(ExceptionHandlerBlock<TInstruction> block, int handlerIndex)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
handlerIndexintThe index of the handler that was entered.
EnterHandlerContents(HandlerBlock<TInstruction>)
Enters the main code of a handler block.
public void EnterHandlerContents(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this scope is added to.
EnterPrologueBlock(HandlerBlock<TInstruction>)
Enters the prologue region of a handler block.
public void EnterPrologueBlock(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this prologue is added to.
EnterProtectedBlock(ExceptionHandlerBlock<TInstruction>)
Enters the protected region of an exception handler block.
public void EnterProtectedBlock(ExceptionHandlerBlock<TInstruction> block)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
EnterScopeBlock(ScopeBlock<TInstruction>)
Enters a scope block.
public void EnterScopeBlock(ScopeBlock<TInstruction> block)
Parameters
blockScopeBlock<TInstruction>The block.
ExitEpilogueBlock(HandlerBlock<TInstruction>)
Exits the epilogue region of a handler block.
public void ExitEpilogueBlock(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this epilogue is added to.
ExitExceptionHandlerBlock(ExceptionHandlerBlock<TInstruction>)
Exits an exception handler block.
public void ExitExceptionHandlerBlock(ExceptionHandlerBlock<TInstruction> block)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
ExitHandlerBlock(ExceptionHandlerBlock<TInstruction>, int)
Exits a handler region of an exception handler block.
public void ExitHandlerBlock(ExceptionHandlerBlock<TInstruction> block, int handlerIndex)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
handlerIndexintThe index of the handler that was exit.
ExitHandlerContents(HandlerBlock<TInstruction>)
Exits the main code of a handler block.
public void ExitHandlerContents(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this scope is added to.
ExitPrologueBlock(HandlerBlock<TInstruction>)
Exits the prologue region of a handler block.
public void ExitPrologueBlock(HandlerBlock<TInstruction> block)
Parameters
blockHandlerBlock<TInstruction>The parent handler block this prologue is added to.
ExitProtectedBlock(ExceptionHandlerBlock<TInstruction>)
Exits the protected region of an exception handler block.
public void ExitProtectedBlock(ExceptionHandlerBlock<TInstruction> block)
Parameters
blockExceptionHandlerBlock<TInstruction>The block.
ExitScopeBlock(ScopeBlock<TInstruction>)
Exits a scope block.
public void ExitScopeBlock(ScopeBlock<TInstruction> block)
Parameters
blockScopeBlock<TInstruction>The block.
Format(IBlock<TInstruction>)
Formats a block into an indented string representation.
public static string Format(IBlock<TInstruction> block)
Parameters
blockIBlock<TInstruction>The block to format.
Returns
- string
The indented string.
GetOutput()
Obtains the raw string output.
public string GetOutput()
Returns
VisitBasicBlock(BasicBlock<TInstruction>)
Visits a basic block.
public void VisitBasicBlock(BasicBlock<TInstruction> block)
Parameters
blockBasicBlock<TInstruction>The block.