Class PrefixedBlockDeclaration
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.DeclarationScope
simula.compiler.syntaxClass.declaration.BlockDeclaration
simula.compiler.syntaxClass.declaration.ClassDeclaration
simula.compiler.syntaxClass.declaration.PrefixedBlockDeclaration
Prefixed Block Declaration.
Simula Standard: 4.10.1 Prefixed blocks prefixed-block = block-prefix main-block block-prefix = class-identifier [ actual-parameter-part ] main-block = block | compound-statement actual-parameter-part = "(" actual-parameter { , actual-parameter } ")" actual-parameter = expression | array-identifier-1 | switch-identifier | procedure-identifier-1 compound-statement = BEGIN statement { ; statement } END
Link to GitHub: Source File.
- Author:
- SIMULA Standards Group, Øystein Myhre Andersen
-
Nested Class Summary
Nested classes/interfaces inherited from class ClassDeclaration
ClassDeclaration.ClassParameterIterator
-
Field Summary
FieldsFields inherited from class ClassDeclaration
detachUsed, hiddenList, parameterList, prefix, prefixClass, protectedList, statements1, virtualMatchList, virtualSpecList
Fields inherited from class BlockDeclaration
currentBlock, isContextFree, isMainModule, labelcodeList, labelContext, labelContextStack, lastLineNumber, nLocalVariables, prevBlock, statements
Fields inherited from class DeclarationScope
CLASSFILE_ALREADY_GENERATED, declarationList, hasLocalClasses, isPreCompiledFromFile, labelList, sourceBlockLevel, sourceFileName
Fields inherited from class Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private Constructor used by Attribute File I/O.private
PrefixedBlockDeclaration
(boolean isMainModule) PrefixedBlock. -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildByteCode
(CodeBuilder codeBuilder) Build Java ClassFile ByteCode.byte[]
Build Class Filevoid
Perform semantic checking.private void
Coding Utility: Code the constructor.void
Output Java code.static PrefixedBlockDeclaration
expectPrefixedBlock
(VariableExpression blockPrefix, boolean isMainModule) Parse Utility: Expect PrefixedBlockDeclarationvoid
print
(int indent) Utility print method.void
Utility print syntax tree method.static PrefixedBlockDeclaration
Read and return an object.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class ClassDeclaration
build_STM_BODY, buildAndLoadOrAddClassFile, buildConstructor, buildDeclaration, buildInitAttribute, codeClassStatements, codeStatements, edCompleteParameterList, edConstructorSignature, edFormalParameterList, expectClassDeclaration, findLocalAttribute, findLocalProcedure, findRemoteAttributeMeaning, findVisibleAttributeMeaning, getPrefixClass, hasRealPrefix, isDetachUsed, isSubClassOf, parameterIterator, prefixLevel, searchHiddenList, searchProtectedList, searchVirtualSpecList, superClassDesc
Methods inherited from class BlockDeclaration
addLeadingLabel, allocateLocalVariable, build_TRY_CATCH, buildIsMethodDetachUsed, buildIsQPSystemBlock, buildMethod_STM, buildMethodMain, codeMethodMain, codeSTMBody, currentClassDesc, expectFormalParameterPart, getConstructorMethodTypeDesc, hasAccumLabel, hasDeclaredLabel, isBlockWithLocalClasses, isQPSystemBlock, nearestEnclosingBlock, printStatementList
Methods inherited from class DeclarationScope
buildCTX, buildCTX, buildCTX2, createJavaClassFile, doBuildClassFile, edCTX, edCTX, edJavaClassName, edScope, edScopeChain, findLabelMeaning, findMeaning, findProcedure, getBytesFromFile, getClassDesc, getRTBlockLevel, loadOrAddClassFile, modifyIdentifier, prep, printDeclarationList, printStaticChain, scopeID
Methods inherited from class Declaration
acceptDeclaration, buildDeclarationCode, checkAlreadyDefined, getFieldIdentifier, getJavaIdentifier, isCompatibleClasses, verifyTree
Methods inherited from class SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode
-
Field Details
-
blockPrefix
/// The block prefix.
-
-
Constructor Details
-
PrefixedBlockDeclaration
private PrefixedBlockDeclaration(boolean isMainModule) PrefixedBlock.- Parameters:
isMainModule
- true: this is the main module.
-
PrefixedBlockDeclaration
private PrefixedBlockDeclaration()Private Constructor used by Attribute File I/O.
-
-
Method Details
-
expectPrefixedBlock
public static PrefixedBlockDeclaration expectPrefixedBlock(VariableExpression blockPrefix, boolean isMainModule) Parse Utility: Expect PrefixedBlockDeclaration- Parameters:
blockPrefix
- the block prefixisMainModule
- true if main module- Returns:
- the resulting PrefixedBlockDeclaration
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.
This must be redefined in every subclass.
- Overrides:
doChecking
in classClassDeclaration
-
doJavaCoding
public void doJavaCoding()Description copied from class:SyntaxClass
Output Java code.- Overrides:
doJavaCoding
in classClassDeclaration
-
doCodeConstructor
private void doCodeConstructor()Coding Utility: Code the constructor. -
buildByteCode
Description copied from class:SyntaxClass
Build Java ClassFile ByteCode.- Overrides:
buildByteCode
in classSyntaxClass
- Parameters:
codeBuilder
- the codeBuilder to use.
-
buildClassFile
public byte[] buildClassFile()Description copied from class:DeclarationScope
Build Class File- Overrides:
buildClassFile
in classClassDeclaration
- Returns:
- Class File bytes
-
print
public void print(int indent) Description copied from class:SyntaxClass
Utility print method.- Overrides:
print
in classClassDeclaration
- Parameters:
indent
- number of spaces leading the line
-
printTree
Description copied from class:SyntaxClass
Utility print syntax tree method.- Overrides:
printTree
in classClassDeclaration
- Parameters:
indent
- number of spaces leading the lineshead
- the head of the tree.
-
toString
- Overrides:
toString
in classClassDeclaration
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classClassDeclaration
- 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.
-