Class Declaration
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
- Direct Known Subclasses:
ArrayDeclaration
,DeclarationScope
,ExternalDeclaration
,InspectVariableDeclaration
,Parameter
,SimpleVariableDeclaration
,UndefinedDeclaration
,VirtualMatch
,VirtualSpecification
Declaration.
Simula Standard: Chapter 5. Declarations declaration = simple-variable-declaration | array-declaration | switch-declaration | procedure-declaration | class-declaration | external-declaration
This class is prefix to DeclarationScope, ExternalDeclaration, Parameter, SimpleVariableDeclaration, VirtualSpecification, VirtualMatch, ArrayDeclaration
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
FieldsModifier and TypeFieldDescriptionint
The declarationKind.The DeclarationScope in which this Declaration is defined.External Identifier set by doCheckingSimula Identifier from Source TextIndicates that this declaration is protected.The typeFields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static boolean
acceptDeclaration
(BlockDeclaration enclosure) Parse a declaration and add it to the given declaration list.void
buildDeclaration
(ClassBuilder classBuilder, BlockDeclaration encloser) Output Java ByteCode.void
buildDeclarationCode
(CodeBuilder codeBuilder) Output Java ByteCode.void
buildInitAttribute
(CodeBuilder codeBuilder) Output Java ByteCode.protected void
Check if a declaration with this identifier is already defined.ClassFile coding utility: get getFieldIdentifier.final String
Returns the Java identifier for this declaration.boolean
isCompatibleClasses
(Declaration other) Check if these classes are compatible.protected void
verifyTree
(Object head) Debug utility: verifyTree.Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doChecking, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, readObject, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode, writeObject
-
Field Details
-
type
The type -
isProtected
Indicates that this declaration is protected. -
identifier
Simula Identifier from Source Text -
externalIdent
External Identifier set by doChecking -
declaredIn
The DeclarationScope in which this Declaration is defined. -
declarationKind
public int declarationKindThe declarationKind.
-
-
Constructor Details
-
Declaration
Create a new Declaration.- Parameters:
identifier
- the given identifier
-
-
Method Details
-
getJavaIdentifier
Returns the Java identifier for this declaration.- Returns:
- the Java identifier for this declaration
-
checkAlreadyDefined
protected void checkAlreadyDefined()Check if a declaration with this identifier is already defined. -
acceptDeclaration
Parse a declaration and add it to the given declaration list.- Parameters:
enclosure
- the owning block.- Returns:
- true if a declaration was found, false otherwise
-
isCompatibleClasses
Check if these classes are compatible.- Parameters:
other
- the other ClassDeclaration- Returns:
- the resulting boolean value
-
buildDeclaration
Output Java ByteCode. Treat Declaration.- Parameters:
classBuilder
- the classBuilder to use.encloser
- the owning block.
-
getFieldIdentifier
ClassFile coding utility: get getFieldIdentifier.- Returns:
- the resulting String.
-
buildInitAttribute
Output Java ByteCode. Build init code for an Attribute.- Parameters:
codeBuilder
- the codeBuilder to use.
-
buildDeclarationCode
Output Java ByteCode. Build declaration code for an Attribute.- Parameters:
codeBuilder
- the codeBuilder to use.
-
verifyTree
-