java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.declaration.Declaration
simula.compiler.syntaxClass.declaration.Parameter
- All Implemented Interfaces:
Externalizable
,Serializable
Parameter Declaration.
A parameter models class and procedure parameters.
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Procedure parameter Kind.static enum
Procedure parameter transfer Mode. -
Field Summary
Modifier and TypeFieldDescriptionParameter Kind.Parameter transfer Mode.int
Parameter's number of dimension in case of array kind.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
ConstructorDescriptionDefault constructor used by Externalization.Create a new Parameter.Parameter
(String identifier, Type type, Parameter.Kind kind) Create a new Parameter.Parameter
(String identifier, Type type, Parameter.Kind kind, int nDim) Create a new Parameter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform semantic checking.(package private) static String
editParameterList
(Vector<Parameter> parameterList) Printing Utility: edit parameter list.boolean
(package private) void
Add this parameter to the given parameter list.private boolean
Check if the parameter has a legal transmission mode.void
printTree
(int indent) Utility print syntax tree method.void
readExternal
(ObjectInput inpt) (package private) void
setExternalIdentifier
(int prefixLevel) Utility: Set new external identifier based on the given prefix level.(package private) void
setMode
(Parameter.Mode mode) Utility: Set new parameter mode.(package private) void
setTypeAndKind
(Type type, Parameter.Kind kind) Utility: Set new type and kind.Generate Java code for this Syntax Class.(package private) String
Coding utility: edit Java code version of this parameter's type.toString()
void
writeExternal
(ObjectOutput oupt) Methods inherited from class simula.compiler.syntaxClass.declaration.Declaration
getJavaIdentifier, isCompatibleClasses, modifyIdentifier, parseDeclaration
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED
-
Field Details
-
mode
Parameter transfer Mode. -
kind
Parameter Kind. -
nDim
public int nDimParameter's number of dimension in case of array kind. Set during doChecking
-
-
Constructor Details
-
Parameter
Parameter(String identifier) Create a new Parameter.- Parameters:
identifier
- parameter identifier
-
Parameter
Parameter(String identifier, Type type, Parameter.Kind kind) Create a new Parameter.- Parameters:
identifier
- parameter identifiertype
- parameter typekind
- parameter kind
-
Parameter
Create a new Parameter.- Parameters:
identifier
- parameter identifiertype
- parameter typekind
- parameter kindnDim
- parameter's number of dimension in case of array kind.
-
Parameter
public Parameter()Default constructor used by Externalization.
-
-
Method Details
-
into
Add this parameter to the given parameter list.- Parameters:
parameterList
- the given parameter list
-
equals
-
setMode
Utility: Set new parameter mode.- Parameters:
mode
- the new mode
-
setTypeAndKind
Utility: Set new type and kind.- Parameters:
type
- the new typekind
- the new kind
-
setExternalIdentifier
void setExternalIdentifier(int prefixLevel) Utility: Set new external identifier based on the given prefix level.- Parameters:
prefixLevel
- the given prefix level
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
legalTransmitionMode
private boolean legalTransmitionMode()Check if the parameter has a legal transmission mode.The available transmission modes for the different kinds of parameters to procedures.
-------------------------------------------------------------- | | Transmission modes | | Parameter | - - - - - - - - - - - - - - - - - - -| | | by value | by reference | by name | |--------------------------------------------------------------| | value type | D | I | O | | object ref. type | I | D | O | | text | O | D | O | | value type array | O | D | O | | reference type array| I | D | O | | procedure | I | D | O | | type procedure | I | D | O | | label | I | D | O | | switch | I | D | O | -------------------------------------------------------------- D: default mode O: optional mode I: illegal
- Returns:
- true if the parameter has a legal transmission mode
-
toJavaType
String toJavaType()Coding utility: edit Java code version of this parameter's type.- Returns:
- the resulting Java code
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
editParameterList
Printing Utility: edit parameter list.- Parameters:
parameterList
- the given parameter list- Returns:
- the resulting string
-
printTree
public void printTree(int indent) Description copied from class:SyntaxClass
Utility print syntax tree method.- Overrides:
printTree
in classSyntaxClass
- Parameters:
indent
- number of spaces leading the lines
-
toString
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-