Module Simula

Class 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
  • Field Details

    • isMainModule

      protected boolean isMainModule
      If true; this is the outermost Subblock or Prefixed Block.
    • statements

      protected final Vector<Statement> statements
      The statements belonging to this block.
    • lastLineNumber

      public int lastLineNumber
      Last source line number
    • isContextFree

      public boolean isContextFree
      If true; all member methods are independent of context
    • isPreCompiled

      public boolean isPreCompiled
      If true; this Class/Procedure is Pre-Compiled
    • labelcodeList

      protected Vector<String> labelcodeList
      The leading labels.
  • Constructor Details

    • BlockDeclaration

      protected BlockDeclaration(String identifier)
      Create a new BlockDeclaration with the given identifier.

      Used by parseMaybeBlock, i.e. CompoundStatement, SubBlock or PrefixedBlock.

      Parameters:
      identifier - the given identifier
    • BlockDeclaration

      private BlockDeclaration(String identifier, Declaration.Kind declarationKind)
      Create a new BlockDeclaration.

      This constructor is only used by ClassDeclaration. ProcedureDeclaration and MaybeBlockDeclaration.

      Parameters:
      identifier - the block identifier
      declarationKind - the declaration kind
  • Method Details

    • expectFormalParameterPart

      protected static void expectFormalParameterPart(Vector<Parameter> pList)
      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

      protected void doCheckLabelList(ClassDeclaration prefixClass)
      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

      public void addLeadingLabel(String labelcode)
      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

      public String toString()
      Overrides:
      toString in class Object