Class LabelDeclaration
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.SimpleVariableDeclaration
simula.compiler.syntaxClass.declaration.LabelDeclaration
Label Declaration.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
The label index.boolean
Indicates that codeBuilder.labelBinding is called.Special case: Labels in a CompoundStatement or ConnectionBlock are moved to nearest enclosing Block which is not a CompoundStatement or ConnectionBlock.Fields inherited from class simula.compiler.syntaxClass.declaration.SimpleVariableDeclaration
constant, constantElement
Fields inherited from class simula.compiler.syntaxClass.declaration.Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildDeclaration
(ClassBuilder classBuilder, BlockDeclaration encloser) Output Java ByteCode.void
buildInitAttribute
(CodeBuilder codeBuilder) Output Java ByteCode.void
buildLabelQuant
(CodeBuilder codeBuilder) Build Label Quantityprivate void
buildVirtualMatchMethodBody
(int prefixLevel, CodeBuilder codeBuilder) ClassFile coding utility: Build Virtual Match Method Body.void
declareLocalLabel
(BlockDeclaration encloser) Declare a local Label.void
doBind
(CodeBuilder codeBuilder) Build binding for this Label.void
Perform semantic checking.ClassFile coding utility: get getFieldIdentifier.ClassFile coding utility: get FieldRefEntry of this SimpleVariable.private int
Returns the prefix level.private boolean
isLatestVirtualLabel
(DeclarationScope encloser) Check if this label is the last label in the owner's label list.static LabelDeclaration
Read and return an object.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.declaration.SimpleVariableDeclaration
doDeclarationCoding, expectSimpleVariable, isConstant, printTree, toJavaCode
Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
acceptDeclaration, buildDeclarationCode, checkAlreadyDefined, getJavaIdentifier, isCompatibleClasses, verifyTree
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED, setLineNumber
-
Field Details
-
index
public int indexThe label index. Set by BlockDeclaration.doAccumLabels. -
movedTo
Special case: Labels in a CompoundStatement or ConnectionBlock are moved to nearest enclosing Block which is not a CompoundStatement or ConnectionBlock. -
isBinded
public boolean isBindedIndicates that codeBuilder.labelBinding is called.
-
-
Constructor Details
-
LabelDeclaration
Create a new Label Declaration.- Parameters:
identifier
- label identifier
-
-
Method Details
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.
This must be redefined in every subclass.
- Overrides:
doChecking
in classSimpleVariableDeclaration
-
declareLocalLabel
Declare a local Label.- Parameters:
encloser
- the BlockDeclaration to update.
-
buildDeclaration
Description copied from class:Declaration
Output Java ByteCode. Treat Declaration.- Overrides:
buildDeclaration
in classSimpleVariableDeclaration
- Parameters:
classBuilder
- the classBuilder to use.encloser
- the owning block.
-
isLatestVirtualLabel
Check if this label is the last label in the owner's label list.- Parameters:
encloser
- the owner.- Returns:
- true: if this label is the last label in the owner's label list.
-
getPrefixLevel
private int getPrefixLevel()Returns the prefix level.- Returns:
- the prefix level.
-
buildVirtualMatchMethodBody
ClassFile coding utility: Build Virtual Match Method Body.- Parameters:
prefixLevel
- the prefix level.codeBuilder
- the codeBuilder to use.
-
getFieldRefEntry
Description copied from class:SimpleVariableDeclaration
ClassFile coding utility: get FieldRefEntry of this SimpleVariable.- Overrides:
getFieldRefEntry
in classSimpleVariableDeclaration
- Parameters:
pool
- the ConstantPoolBuilder to use.- Returns:
- the FieldRefEntry of this SimpleVariable.
-
getFieldIdentifier
Description copied from class:Declaration
ClassFile coding utility: get getFieldIdentifier.- Overrides:
getFieldIdentifier
in classSimpleVariableDeclaration
- Returns:
- the resulting String.
-
buildInitAttribute
Description copied from class:Declaration
Output Java ByteCode. Build init code for an Attribute.- Overrides:
buildInitAttribute
in classSimpleVariableDeclaration
- Parameters:
codeBuilder
- the codeBuilder to use.
-
doBind
Build binding for this Label.- Parameters:
codeBuilder
- the codeBuilder to use.
-
buildLabelQuant
Build Label Quantity- Parameters:
codeBuilder
- the codeBuilder to use
-
toString
- Overrides:
toString
in classSimpleVariableDeclaration
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classSimpleVariableDeclaration
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return an object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the object read from the stream.
- Throws:
IOException
- if something went wrong.
-