Class ForWhileElement
java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.statement.ForListElement
simula.compiler.syntaxClass.statement.ForWhileElement
Utility class: For-list While element.
-
Field Summary
FieldsFields inherited from class simula.compiler.syntaxClass.statement.ForListElement
expr1, forStatement
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
CHECKED, lineNumber, OBJECT_SEQU
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Default constructor used by Attribute File I/OForWhileElement
(ForStatement forStatement, Expression expr1, Expression expr2) Create a new WhileElement. -
Method Summary
Modifier and TypeMethodDescriptionvoid
buildByteCode
(CodeBuilder codeBuilder, VariableExpression controlVariable) Build byte code.void
Perform semantic checking.void
Perform simplified JavaCoding.void
doSingleElementByteCoding
(CodeBuilder codeBuilder) Build SingleElement ByteCodingEdit Java source code for this ForListElement.Checks if this ForListElement can be optimized.static ForWhileElement
Read and return a ForWhileElement object.toString()
void
Write a SyntaxClass object to a AttributeOutputStream.Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, buildByteCode, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, printTree, SET_SEMANTICS_CHECKED, setLineNumber, toJavaCode
-
Field Details
-
expr2
Expression expr2The second expression.
-
-
Constructor Details
-
ForWhileElement
Create a new WhileElement.- Parameters:
forStatement
- the ForStatementexpr1
- first expressionexpr2
- second expression
-
ForWhileElement
private ForWhileElement()Default constructor used by Attribute File I/O
-
-
Method Details
-
doChecking
public void doChecking()Description copied from class:ForListElement
Perform semantic checking.- Overrides:
doChecking
in classForListElement
-
edCode
Description copied from class:ForListElement
Edit Java source code for this ForListElement.- Overrides:
edCode
in classForListElement
- Parameters:
classIdent
- Java class identifierxType
- control variable's type- Returns:
- the resulting Java source code for this ForListElement
-
isOptimisable
Description copied from class:ForListElement
Checks if this ForListElement can be optimized.- Overrides:
isOptimisable
in classForListElement
- Returns:
- this ForListElement if it can be optimized
-
doSimplifiedJavaCoding
public void doSimplifiedJavaCoding()Description copied from class:ForListElement
Perform simplified JavaCoding.- Overrides:
doSimplifiedJavaCoding
in classForListElement
-
doSingleElementByteCoding
Description copied from class:ForListElement
Build SingleElement ByteCoding- Overrides:
doSingleElementByteCoding
in classForListElement
- Parameters:
codeBuilder
- the codeBuilder to use.
-
buildByteCode
Description copied from class:ForListElement
Build byte code.- Overrides:
buildByteCode
in classForListElement
- Parameters:
codeBuilder
- the codeBuilder to use.controlVariable
- the ForStatement's controlVariable.
-
toString
- Overrides:
toString
in classForListElement
-
writeObject
Description copied from class:SyntaxClass
Write a SyntaxClass object to a AttributeOutputStream.- Overrides:
writeObject
in classForListElement
- Parameters:
oupt
- the AttributeOutputStream to write to.- Throws:
IOException
- if something went wrong.
-
readObject
Read and return a ForWhileElement object.- Parameters:
inpt
- the AttributeInputStream to read from- Returns:
- the ForWhileElement object read from the stream.
- Throws:
IOException
- if something went wrong.
-