Class DeclarationScope
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.DeclarationScope
- Direct Known Subclasses:
BlockDeclaration, ConnectionBlock, Thunk
Declaration Scope.
This class is prefix to BlockDeclaration and ConnectionBlock, and superclass of ClassDeclaration, ProcedureDeclaration and MaybeBlockDeclaration.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
Indicator used to prevent multiple ClassFile generation.The declaration list.boolean
Indicate if this scope has local classes.If not null; this Class/Procedure is Pre-Compiled from a .jar fileThe label list.int
The source block level.The source file name.Fields inherited from class Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
DeclarationScope
(String ident) Create a new DeclarationScope. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Redefined in ClassDeclarationabstract byte[]
Build Class Fileboolean
buildCTX
(int corr, CodeBuilder codeBuilder) ClassFile coding utility: Build current context chain.boolean
buildCTX
(CodeBuilder codeBuilder) ClassFile coding utility: Build current context chain.static boolean
buildCTX2
(int ctxDiff, CodeBuilder codeBuilder) ClassFile coding utility: Build context chain.void
Create Java ClassFile.protected byte[]
Build ClassFile.edCTX()
ClassFile coding utility: Edit current context chain.static String
edCTX
(int ctxDiff) ClassFile coding utility: Edit context chain.protected String
Utility to edit JavaClass'NameedScope()
Debug utility: edScopeEdit scope chain.findLabelMeaning
(String identifier) Find Label's MeaningfindMeaning
(String identifier) Find MeaningfindProcedure
(String identifier) Follow Static Chain Looking for a Procedure named 'identifier'Find visible attribute's Meaningprotected byte[]
Get ClassFile bytes from file.Return the ClassDescint
Utility: Get Runtime BlockLevel.private void
listGeneratedClassFile
(byte[] bytes) Debug utility: listGeneratedClassFile.protected void
loadOrAddClassFile
(byte[] bytes) Load or add a ClassFile depending on the Option.compilerModeprotected void
modifyIdentifier
(String newIdentifier) Modify the identifier of this class, procedure, ...int
Returns the prefix level.protected DeclarationList
prep
(DeclarationList declarationList) Prepare the declaration list for attribute output.protected void
printDeclarationList
(int indent) Debug utility: print DeclarationList.void
printStaticChain
(String title, int details) Debug utility: printStaticChainscopeID()
Returns a printable scope ID.Methods inherited from class Declaration
acceptDeclaration, buildDeclaration, buildDeclarationCode, buildInitAttribute, checkAlreadyDefined, getFieldIdentifier, getJavaIdentifier, isCompatibleClasses, verifyTree
Methods inherited from class SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doChecking, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, readObject, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode, writeObject
-
Field Details
-
sourceFileName
The source file name. -
sourceBlockLevel
public int sourceBlockLevelThe source block level. Set during Parsing. -
hasLocalClasses
public boolean hasLocalClassesIndicate if this scope has local classes. -
isPreCompiledFromFile
If not null; this Class/Procedure is Pre-Compiled from a .jar file -
declarationList
The declaration list. -
labelList
The label list. -
CLASSFILE_ALREADY_GENERATED
protected boolean CLASSFILE_ALREADY_GENERATEDIndicator used to prevent multiple ClassFile generation. This situation may occur during the class body concatenation process.
-
-
Constructor Details
-
DeclarationScope
Create a new DeclarationScope.- Parameters:
ident
- scope identifier
-
-
Method Details
-
modifyIdentifier
Modify the identifier of this class, procedure, ...- Parameters:
newIdentifier
- the new identifier
-
edJavaClassName
Utility to edit JavaClass'Name- Returns:
- the edited JavaClass'Name
-
getRTBlockLevel
public int getRTBlockLevel()Utility: Get Runtime BlockLevel.- Returns:
- true: the Runtime BlockLevel.
-
scopeID
-
prefixLevel
public int prefixLevel()Returns the prefix level.
Redefined in ClassDeclaration
- Returns:
- the prefix level
-
findVisibleAttributeMeaning
-
findMeaning
-
findLabelMeaning
-
findProcedure
Follow Static Chain Looking for a Procedure named 'identifier'- Parameters:
identifier
- the procedure identifier- Returns:
- the resulting ProcedureDeclaration
-
edCTX
ClassFile coding utility: Edit current context chain.- Returns:
- edited context chain
-
edCTX
ClassFile coding utility: Edit context chain.- Parameters:
ctxDiff
- block level difference.- Returns:
- edited context chain
-
buildCTX
ClassFile coding utility: Build current context chain.- Parameters:
codeBuilder
- the codeBuilder to use.- Returns:
- true: if resulting field need a cast.
-
buildCTX
ClassFile coding utility: Build current context chain.- Parameters:
corr
- correction .codeBuilder
- the codeBuilder to use.- Returns:
- true: if resulting field need a cast.
-
buildCTX2
ClassFile coding utility: Build context chain.- Parameters:
ctxDiff
- block level difference.codeBuilder
- the codeBuilder to use.- Returns:
- true: if resulting field need a cast.
-
edScopeChain
-
getClassDesc
-
printStaticChain
Debug utility: printStaticChain- Parameters:
title
- title Stringdetails
- level of details
-
printDeclarationList
protected void printDeclarationList(int indent) Debug utility: print DeclarationList.- Parameters:
indent
- the indentation.
-
edScope
-
buildClassFile
public abstract byte[] buildClassFile()Build Class File- Returns:
- Class File bytes
-
createJavaClassFile
Create Java ClassFile.- Throws:
IOException
- if something went wrong.
-
buildAndLoadOrAddClassFile
Redefined in ClassDeclaration- Throws:
IOException
- if something went wrong.
-
doBuildClassFile
protected byte[] doBuildClassFile()Build ClassFile.- Returns:
- ClassFile bytes.
-
getBytesFromFile
protected byte[] getBytesFromFile()Get ClassFile bytes from file.- Returns:
- ClassFile bytes from file.
-
loadOrAddClassFile
Load or add a ClassFile depending on the Option.compilerMode- Parameters:
bytes
- the ClassFile bytes- Throws:
IOException
- if something went wrong
-
listGeneratedClassFile
Debug utility: listGeneratedClassFile.- Parameters:
bytes
- the classFile bytes.- Throws:
IOException
- if something went wrong.
-
prep
Prepare the declaration list for attribute output.- Parameters:
declarationList
- the input declarationList.- Returns:
- a new prepped declarationList.
-