java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.DeclarationScope
simula.compiler.syntaxClass.declaration.BlockDeclaration
- Direct Known Subclasses:
ClassDeclaration
,MaybeBlockDeclaration
,ProcedureDeclaration
public abstract sealed class BlockDeclaration
extends DeclarationScope
permits ClassDeclaration, ProcedureDeclaration, MaybeBlockDeclaration
Block Declaration.
This class is prefix to ClassDeclaration, ProcedureDeclaration and MaybeBlockDeclaration.
It contains a number of useful fields and methods common to its subclasses.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Nested Class Summary
Nested classes/interfaces inherited from class simula.compiler.syntaxClass.declaration.Declaration
Declaration.Kind
-
Field Summary
Modifier and TypeFieldDescriptionboolean
If true; all member methods are independent of contextprotected boolean
If true; this is the outermost Subblock or Prefixed Block.boolean
If true; this Class/Procedure is Pre-CompiledThe leading labels.int
Last source line numberThe statements belonging to this block.Fields inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
ctBlockLevel, currentRTBlockLevel, declarationList, hasLocalClasses, labelList, rtBlockLevel, sourceBlockLevel
Fields inherited from class simula.compiler.syntaxClass.declaration.Declaration
declarationKind, declaredIn, externalIdent, identifier, isProtected, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
ModifierConstructorDescriptionprotected
BlockDeclaration
(String identifier) Create a new BlockDeclaration with the given identifier.private
BlockDeclaration
(String identifier, Declaration.Kind declarationKind) Create a new BlockDeclaration. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addLeadingLabel
(String labelcode) Coding utility: AD'HOC Leading Labelprotected void
Coding utility: Code statementsprotected void
Coding utility: Code STM bodyprotected void
doCheckLabelList
(ClassDeclaration prefixClass) Checking utility: doCheckLabelList.protected static void
expectFormalParameterPart
(Vector<Parameter> pList) Parse Utility: Expect formal-parameter-part and build the parameter list.protected boolean
hasLabel()
Returns true if this block has one ore more labels.protected boolean
Returns true if this block has local class(es).protected boolean
Returns true if this block is a QPS System block.protected void
printStatementList
(int indent) toString()
Methods inherited from class simula.compiler.syntaxClass.declaration.DeclarationScope
edCTX, edCTX, edJavaClassName, edScopeChain, findLabelMeaning, findMeaning, findProcedure, findVisibleAttributeMeaning, printDeclarationList, scopeID
Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
getJavaIdentifier, isCompatibleClasses, modifyIdentifier, parseDeclaration
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doChecking, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, SET_SEMANTICS_CHECKED, toJavaCode
-
Field Details
-
isMainModule
protected boolean isMainModuleIf true; this is the outermost Subblock or Prefixed Block. -
statements
The statements belonging to this block. -
lastLineNumber
public int lastLineNumberLast source line number -
isContextFree
public boolean isContextFreeIf true; all member methods are independent of context -
isPreCompiled
public boolean isPreCompiledIf true; this Class/Procedure is Pre-Compiled -
labelcodeList
The leading labels.
-
-
Constructor Details
-
BlockDeclaration
Create a new BlockDeclaration with the given identifier.Used by parseMaybeBlock, i.e. CompoundStatement, SubBlock or PrefixedBlock.
- Parameters:
identifier
- the given identifier
-
BlockDeclaration
Create a new BlockDeclaration.This constructor is only used by ClassDeclaration. ProcedureDeclaration and MaybeBlockDeclaration.
- Parameters:
identifier
- the block identifierdeclarationKind
- the declaration kind
-
-
Method Details
-
expectFormalParameterPart
Parse Utility: Expect formal-parameter-part and build the parameter list.Syntax: formal-parameter-part = "(" identifier { , identifier } ")"
Precondition: BEGPAR is already read.- Parameters:
pList
- the parameter list
-
doCheckLabelList
Checking utility: doCheckLabelList.- Parameters:
prefixClass
- possible prefix or null
-
isBlockWithLocalClasses
protected boolean isBlockWithLocalClasses()Returns true if this block has local class(es).- Returns:
- true if this block has local class(es)
-
isQPSystemBlock
protected boolean isQPSystemBlock()Returns true if this block is a QPS System block.QPS System is any block with local class(es)
- Returns:
- true if this block is a QPS System block
-
addLeadingLabel
Coding utility: AD'HOC Leading Label- Parameters:
labelcode
- argument
-
hasLabel
protected boolean hasLabel()Returns true if this block has one ore more labels.- Returns:
- true if this block has one ore more labels.
-
codeSTMBody
protected void codeSTMBody()Coding utility: Code STM body -
codeStatements
protected void codeStatements()Coding utility: Code statements -
printStatementList
protected void printStatementList(int indent) -
toString
-