Module Simula

Class ObjectGenerator


public final class ObjectGenerator extends Expression
ObjectGenerator i.e. new Object expression.
 
 Simula Standard: 3.8 Object expressions
 
 object-generator = NEW class-identifier [ ( actual-parameter-part ) ]
 
    actual-parameter-part
         =  "("  actual-parameter  {  ,  actual-parameter  }  ")"

       actual-parameter
           =  expression
           |  array-identifier-1
           |  switch-identifier
           |  procedure-identifier-1
 
 
Link to GitHub: Source File.
Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • classIdentifier

      private final String classIdentifier
      The class-identifier
    • meaning

      private Meaning meaning
      The semantic meaning
    • params

      private final Vector<Expression> params
      The actual parameters before checking
    • checkedParams

      private final Vector<Expression> checkedParams
      The actual parameters after checking
  • Constructor Details

    • ObjectGenerator

      private ObjectGenerator(String ident, Vector<Expression> params)
      Create a new ObjectGenerator
      Parameters:
      ident - class-identifier
      params - the actual parameters
  • Method Details

    • expectNew

      static Expression expectNew()
      Parse an object generator
       object-generator = NEW class-identifier [ ( actual-parameter-part ) ]
       
          actual-parameter-part
               =  "("  actual-parameter  {  ,  actual-parameter  }  ")"
       
      Returns:
      the newly created ObjectGenerator.
    • doChecking

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

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • maybeStatement

      public boolean maybeStatement()
      Description copied from class: Expression
      Returns true if this expression may be used as a statement.
      Specified by:
      maybeStatement in class Expression
      Returns:
      true if this expression may be used as a statement
    • toJavaCode

      public String toJavaCode()
      Description copied from class: SyntaxClass
      Generate Java code for this Syntax Class.
      Overrides:
      toJavaCode in class SyntaxClass
      Returns:
      Java code
    • toString

      public String toString()
      Overrides:
      toString in class Expression