Module Simula

Class VirtualSpecification

All Implemented Interfaces:
Externalizable, Serializable

public final class VirtualSpecification extends Declaration implements Externalizable
Virtual Quantities.
 Simula Standard: 5.5.3 Virtual quantities
 
    virtual-part  =  VIRTUAL  :  virtual-spec  ;  {  virtual-spec  ;  }
    
    virtual-spec  =  virtual-specifier  identifier-list
                  |  PROCEDURE  procedure-identifier  procedure-specification
                  
      procedure-specification =  IS  procedure-declaration
        
        virtual-specifier = LABEL | SWITCH |  [ type ] PROCEDURE
   
        identifier-list  =  identifier  { , identifier }

 
Link to GitHub: Source File.
Author:
SIMULA Standards Group, Øystein Myhre Andersen
See Also:
  • Field Details

    • kind

      Virtual kind.
    • procedureSpec

      public ProcedureSpecification procedureSpec
      The procedure specification if present.
    • hasDefaultMatch

      boolean hasDefaultMatch
      Indicates if this virtual has a default match.

      Set during doChecking

  • Constructor Details

    • VirtualSpecification

      VirtualSpecification(String identifier, Type type, VirtualSpecification.Kind kind, ProcedureSpecification procedureSpec)
      VirtualSpecification.
      Parameters:
      identifier - virtual identifier
      type - the virtual's type
      kind - the vitual Kind
      procedureSpec - the ProcedureSpecification
    • VirtualSpecification

      public VirtualSpecification()
      Default constructor used by Externalization.
  • Method Details

    • expectVirtualPart

      static void expectVirtualPart(ClassDeclaration cls)
      Parse a virtual-part and put it into the given class.
       Syntax:
       
            virtual-part = VIRTUAL: virtual-spec ; { virtual-spec ; }
               virtual-spec
                   = virtual-specifier identifier-list
                   | PROCEDURE procedure-identifier  procedure-specification
                   
                      virtual-Specifier = [ type ] PROCEDURE | LABEL | SWITCH
                      
                      identifier-list = identifier { , identifier }
                      
                      procedure-specification = IS procedure-declaration
      
       
      Precondition: VIRTUAL is already read.
      Parameters:
      cls - the ClassDeclaration
    • expectIdentifierList

      private static void expectIdentifierList(ClassDeclaration cls, Type type, VirtualSpecification.Kind kind)
      Parse a virtual identifier list.
       Syntax:
       
              identifier-list = identifier { , identifier
       
      Parameters:
      cls - the ClassDeclaration
      type - the specifiers type
      kind - the specifiers kind
    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass
      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • getVirtualIdentifier

      public String getVirtualIdentifier()
      Returns the virtual identifier used i Java code.
      Returns:
      the virtual identifier used i Java code
    • getVirtualSpecification

      public static VirtualSpecification getVirtualSpecification(Declaration decl)
      Get virtual specification.
      Parameters:
      decl - the declaration to search for
      Returns:
      a VirtualSpecification or null
    • doJavaCoding

      public void doJavaCoding()
      Description copied from class: SyntaxClass
      Output Java code.
      Overrides:
      doJavaCoding in class SyntaxClass
    • printTree

      public void printTree(int indent)
      Description copied from class: SyntaxClass
      Utility print syntax tree method.
      Overrides:
      printTree in class SyntaxClass
      Parameters:
      indent - number of spaces leading the lines
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • writeExternal

      public void writeExternal(ObjectOutput oupt) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput inpt) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException