Class LabelList
java.lang.Object
simula.compiler.utilities.LabelList
A list of LabelDeclarations.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Vector
<LabelDeclaration> Set by MAKE_READY_FOR_CODING or accumLabelListprivate DeclarationScope
The owner of this label list.private Vector
<LabelDeclaration> The labels in this list.private Label
beginning of the default handler block.private static int
Utility to help make unique sequence numbers.private boolean
true: this LabelList is ready for coding.private int
The sequence number of this label list.private Vector
<SwitchCase> Set by MAKE_READY_FOR_CODINGprivate static boolean
Debug utility. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Accumulate the label list for the given block.int
Get number of accumulated labels.void
add
(LabelDeclaration lab) Add a label to the local label list.void
build_JUMPTABLE
(CodeBuilder.BlockCodeBuilder codeBuilder) ClassFile coding utility: Build the TableSwitch Instruction.void
clear()
Clears this list.int
Get number of local labels.Get all labels.Get DeclaredLabelsgetLastDeclaredLabel
(String ident) Get last declared local label with the given ident.getTableSwitchCases
(CodeBuilder codeBuilder) Get a List of SwitchCase suitable for the 'tableswitch' instruction.private String
ident()
Debug utility: Return identification String.void
labelBinding
(LabelDeclaration label, CodeBuilder codeBuilder) ClassFile coding utility: Build a labelBinding.private void
MAKE_READY_FOR_CODING
(CodeBuilder codeBuilder) ClassFile coding utility: Make this LabelList ready for coding.void
Debug utility: print the LabelListvoid
printTree
(int indent, BlockDeclaration owner) Debug utility: Print Syntax treestatic LabelList
Read and return a LabelList.void
Sets the label indexes suitable for the 'tableswitch' instruction.toString()
static void
writeLabelList
(LabelList labelList, AttributeOutputStream oupt) Write a LabelList to a AttributeOutputStream.
-
Field Details
-
TRACING
private static boolean TRACINGDebug utility. -
LABEL_SEQU
private static int LABEL_SEQUUtility to help make unique sequence numbers. -
sequ
private int sequThe sequence number of this label list. -
declaredIn
The owner of this label list. -
declaredLabels
The labels in this list. -
READY_FOR_CODING
private boolean READY_FOR_CODINGtrue: this LabelList is ready for coding. -
accumLabels
Set by MAKE_READY_FOR_CODING or accumLabelList -
defaultTarget
beginning of the default handler block. Set by MAKE_READY_FOR_CODING -
tableSwitchCases
Set by MAKE_READY_FOR_CODING
-
-
Constructor Details
-
LabelList
A list of LabelDeclarations.- Parameters:
declaredIn
- the DeclarationScope owning this list.
-
-
Method Details
-
clear
public void clear()Clears this list. -
ident
-
getDeclaredLabels
-
getAccumLabels
Get all labels. Accumulated through the prefix chain for classes and prefixed blocks.- Returns:
- a Vector of LabelDeclarations
-
accumLabelSize
public int accumLabelSize()Get number of accumulated labels. Accumulated through the prefix chain for classes and prefixed blocks.- Returns:
- number of accumulated labels.
-
declaredLabelSize
public int declaredLabelSize()Get number of local labels.- Returns:
- number of local labels.
-
getLastDeclaredLabel
Get last declared local label with the given ident.- Parameters:
ident
- label identifier- Returns:
- number of accumulated labels.
-
add
Add a label to the local label list.- Parameters:
lab
- the label to add.
-
accumLabelList
Accumulate the label list for the given block. accumulated through the prefix chain for classes and prefixed blocks.
This method is used when generating .java source.
- Parameters:
blk
- the given BlockDeclaration.
-
getTableSwitchCases
Get a List of SwitchCase suitable for the 'tableswitch' instruction.
This method is used when generating classFile using the codeBuilder.
- Parameters:
codeBuilder
- the codeBuilder- Returns:
- a List of SwitchCase
-
setLabelIdexes
public void setLabelIdexes()Sets the label indexes suitable for the 'tableswitch' instruction.
This method is used when generating classFile using the codeBuilder.
-
MAKE_READY_FOR_CODING
ClassFile coding utility: Make this LabelList ready for coding.- Parameters:
codeBuilder
- the codeBuilder to use
-
build_JUMPTABLE
ClassFile coding utility: Build the TableSwitch Instruction.- Parameters:
codeBuilder
- the codeBuilder to use
-
labelBinding
ClassFile coding utility: Build a labelBinding.- Parameters:
label
- the label to bindcodeBuilder
- the codeBuilder to use
-
printTree
Debug utility: Print Syntax tree- Parameters:
indent
- indentationowner
- the BlockDeclaration owning this LabelList
-
print
-
toString
-
writeLabelList
public static void writeLabelList(LabelList labelList, AttributeOutputStream oupt) throws IOException Write a LabelList to a AttributeOutputStream.- Parameters:
labelList
- the LabelList to write.oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readLabelList
Read and return a LabelList.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the LabelList object read from the stream.
- Throws:
IOException
- if something went wrong.
-