Class ConnectionBlock
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.DeclarationScope
simula.compiler.syntaxClass.declaration.ConnectionBlock
Connection Block.
A Connection Block is a Statement within a Connection Statement. It acts as a block, whether it takes the form of a block or not. It further acts as if enclosed by a second fictitious block, called a "connection block". During the execution of a connection block the object X is said to be "connected".
See Simula Standard 4.8 Connection statement.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe when class declaration.The connected ident.The inspected variable.The Connection Statement.private Declaration
When clause class Declaration.private String
When clause class identifier.Fields inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
CLASSFILE_ALREADY_GENERATED, declarationList, hasLocalClasses, isPreCompiledFromFile, labelList, sourceBlockLevel, sourceFileName
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
ConstructorsConstructorDescriptionConnectionBlock
(String identifier) Default constructor used by Attribute File I/OConnectionBlock
(VariableExpression inspectedVariable, String whenClassIdentifier) Create a new ConnectionBlock. -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildByteCode
(CodeBuilder codeBuilder) Build Java ClassFile ByteCode.byte[]
Build Class Filevoid
Perform semantic checking.void
Output Java code.void
end()
Connection block end.findMeaning
(String identifier) Find MeaningFind visible attribute's MeaningReturn the ClassDescint
Utility: Get Runtime BlockLevel.Get inspected variable.void
print
(int indent) Utility print method.void
Utility print syntax tree method.static ConnectionBlock
Read and return a ConnectionBlock object.void
setClassDeclaration
(ClassDeclaration classDeclaration) Set the Connected ClassDeclaration.void
setStatement
(Statement statement) Set the Connection Statement.Generate Java code for this Syntax Class.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
buildAndLoadOrAddClassFile, buildCTX, buildCTX, buildCTX2, createJavaClassFile, doBuildClassFile, edCTX, edCTX, edJavaClassName, edScope, edScopeChain, findLabelMeaning, findProcedure, getBytesFromFile, loadOrAddClassFile, modifyIdentifier, prefixLevel, prep, printDeclarationList, printStaticChain, scopeID
Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
acceptDeclaration, buildDeclaration, buildDeclarationCode, buildInitAttribute, checkAlreadyDefined, getFieldIdentifier, getJavaIdentifier, isCompatibleClasses, verifyTree
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, SET_SEMANTICS_CHECKED, setLineNumber
-
Field Details
-
statement
The Connection Statement. -
whenClassIdentifier
When clause class identifier. -
whenClassDeclaration
When clause class Declaration. Set during checking. -
inspectedVariable
The inspected variable. -
connID
The connected ident. E.g: the ident in the Java statement: if(_inspect_7 instanceof RTS_Infile connID) -
classDeclaration
The when class declaration. Set during checking.
-
-
Constructor Details
-
ConnectionBlock
Create a new ConnectionBlock.- Parameters:
inspectedVariable
- the inspected variablewhenClassIdentifier
- the when class identifier
-
ConnectionBlock
Default constructor used by Attribute File I/O- Parameters:
identifier
- the block identifier.
-
-
Method Details
-
getTypedInspectedVariable
-
end
public void end()Connection block end. -
setClassDeclaration
Set the Connected ClassDeclaration.- Parameters:
classDeclaration
- the Connected ClassDeclaration.
-
setStatement
Set the Connection Statement.- Parameters:
statement
- the Connection Statement
-
findMeaning
Description copied from class:DeclarationScope
Find Meaning- Overrides:
findMeaning
in classDeclarationScope
- Parameters:
identifier
- declared identifier- Returns:
- the resulting Meaning
-
findVisibleAttributeMeaning
Description copied from class:DeclarationScope
Find visible attribute's Meaning- Overrides:
findVisibleAttributeMeaning
in classDeclarationScope
- Parameters:
ident
- attribute identifier- Returns:
- the resulting Meaning
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.
This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
getRTBlockLevel
public int getRTBlockLevel()Description copied from class:DeclarationScope
Utility: Get Runtime BlockLevel.- Overrides:
getRTBlockLevel
in classDeclarationScope
- Returns:
- true: the Runtime BlockLevel.
-
doJavaCoding
public void doJavaCoding()Description copied from class:SyntaxClass
Output Java code.- Overrides:
doJavaCoding
in classSyntaxClass
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
getClassDesc
Description copied from class:DeclarationScope
Return the ClassDesc- Overrides:
getClassDesc
in classDeclarationScope
- Returns:
- the ClassDesc
-
buildByteCode
Description copied from class:SyntaxClass
Build Java ClassFile ByteCode.- Overrides:
buildByteCode
in classSyntaxClass
- Parameters:
codeBuilder
- the codeBuilder to use.
-
print
public void print(int indent) Description copied from class:SyntaxClass
Utility print method.- Overrides:
print
in classSyntaxClass
- Parameters:
indent
- number of spaces leading the line
-
printTree
Description copied from class:SyntaxClass
Utility print syntax tree method.- Overrides:
printTree
in classSyntaxClass
- Parameters:
indent
- number of spaces leading the lineshead
- the head of the tree.
-
toString
-
buildClassFile
public byte[] buildClassFile()Description copied from class:DeclarationScope
Build Class File- Specified by:
buildClassFile
in classDeclarationScope
- Returns:
- Class File bytes
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classSyntaxClass
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return a ConnectionBlock object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the object read from the stream.
- Throws:
IOException
- if something went wrong.
-