ControlStruct

public abstract class ControlStruct

Abstract class for IfThenElse, Let, Loop, Switch,.. Controls.

Fields

aboveControlStruct

protected ControlStruct aboveControlStruct

controlStructBlock

protected Block controlStructBlock

naturalFlow

protected TapList<FGArrow> naturalFlow

naturalNext

protected Block naturalNext

structuredTree

protected Tree structuredTree

treesReverse

protected TapList<Tree> treesReverse

Methods

addControlStruct

protected abstract void addControlStruct(ControlStruct struct, FGArrow arrow)

Insert the given “struct” into this ControlStruct, at the correct place determined by “arrow”.

checkLabels

protected Tree checkLabels(Tree structTree, TapList<FGArrow> naturalArrows, TapList<FGArrow> naturalCycleArrows, TapList<FGArrow> ignoredArrows)

dump

public void dump(int indent)

Prints in detail the contents of this ControlStruct, onto TapEnv.curOutputStream().

Parameters
  • indent – the amount of indentation to be used for this printing.

generateTree

protected abstract void generateTree(boolean delayGoto, TapList<TapTriplet<Tree, Tree, Integer>> toFutureIncludes, TapList<Tree> fileUserHelpStrings)

(Recursive) final regeneration of the structured Tree.

generateTreeChained

protected static TapList<Tree> generateTreeChained(TapList<ControlStruct> chainedStructs, boolean delayGoto, String lastLabel, TapList<TapTriplet<Tree, Tree, Integer>> toFutureIncludes, TapList<Tree> fileUserHelpStrings)

getBlock

protected ControlStruct getBlock(Block block)

insertInstructionTree

protected void insertInstructionTree(Tree instructionTree, boolean atTheEnd)

insertLetStructure

protected abstract void insertLetStructure()

(Recursive) Inserts Let structures into the tree of ControlStruct’s to reflect nested local SymbolTable’s.

insertLetStructureChained

protected static TapList<ControlStruct> insertLetStructureChained(TapList<ControlStruct> chainedStructs, SymbolTable refSymbolTable)

preGenerateBody

protected Tree preGenerateBody(TapList<Instruction> instructions, TapList<FGArrow> naturalArrows, TapList<TapTriplet<Tree, Tree, Integer>> toFutureIncludes, TapList<Tree> fileUserHelpStrings, boolean skipSubUnits)

Utility called during preGenerateTree(). Prepares the list of instructions of the current Block, taking care of removing empty and phantom instructions, but keeping the comments at the best possible place.

Returns

the last instruction Tree.

preGenerateTree

protected abstract TapList<FGArrow> preGenerateTree(TapList<FGArrow> naturalArrows, TapList<TapTriplet<Tree, Tree, Integer>> toFutureIncludes, TapList<Tree> fileUserHelpStrings, TapList<ControlStruct> enclosingStructs, boolean skipSubUnits)

(Recursive) preparation before tree regeneration. Labels the arrows that need explicit jumps, prepares the skeleton of the future Tree.

Returns

a TapList of FGArrow

preGenerateTreeChained

protected static TapList<FGArrow> preGenerateTreeChained(TapList<ControlStruct> chainedStructs, TapList<TapTriplet<Tree, Tree, Integer>> toFutureIncludes, TapList<Tree> fileUserHelpStrings, TapList<FGArrow> naturalArrows, TapList<ControlStruct> enclosingStructs, boolean skipSubUnits)

propagateNaturalFlow

protected abstract TapList<FGArrow> propagateNaturalFlow()

(Recursive) precomputation of the “naturalFlow: info: the TapList of FGArrow that would naturally flow out of this ControlStruct, i.e. without any additional explicit jump.

propagateNaturalFlowChained

protected static TapList<FGArrow> propagateNaturalFlowChained(TapList<ControlStruct> chainedStructs)

propagateNaturalNext

protected abstract void propagateNaturalNext(Block naturalNext)

(Recursive) precomputation of the “naturalNext” info: the next Block reached by natural flow from each ControlStruct.

propagateNaturalNextChained

protected static void propagateNaturalNextChained(TapList<ControlStruct> chainedStructs, Block lastNaturalNext)

putDirectivesBackAsComments

protected void putDirectivesBackAsComments(TapList<Directive> directives)

reorderBody

protected abstract void reorderBody()

(Recursive) Orders the lists of control structures inside, following the order of the block ranks…

reorderBodyChained

protected static TapList<ControlStruct> reorderBodyChained(TapList<ControlStruct> chainedStructs)

toString

public String toString()

turnCarryIntoJump

protected Tree turnCarryIntoJump(FGArrow arrow)