java.lang.Object
simula.compiler.syntaxClass.SyntaxClass
simula.compiler.syntaxClass.expression.Expression
simula.compiler.syntaxClass.expression.UnaryOperation
Unary Operation.
Syntax: unary-operation = unary-operator Expression unary-operator = NOT | + | -Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Modifier and TypeFieldDescription(package private) Expression
The operand Expression.(package private) final KeyWord
The unary operator.Fields inherited from class simula.compiler.syntaxClass.expression.Expression
backLink, type
Fields inherited from class simula.compiler.syntaxClass.SyntaxClass
lineNumber
-
Constructor Summary
ModifierConstructorDescriptionprivate
UnaryOperation
(KeyWord oprator, Expression operand) Create a new UnaryOperation. -
Method Summary
Modifier and TypeMethodDescription(package private) static Expression
create
(KeyWord oprator, Expression operand) Create a new UnaryOperation.void
Perform semantic checking.evaluate()
Try to Compile-time Evaluate this expressionboolean
Returns true if this expression may be used as a statement.Generate Java code for this Syntax Class.toString()
Methods inherited from class simula.compiler.syntaxClass.expression.Expression
acceptExpression, checkCompatibility, expectExpression, get, getInt, getNumber, getQualification, getWriteableVariable, printTree, put
Methods inherited from class simula.compiler.syntaxClass.SyntaxClass
ASSERT_SEMANTICS_CHECKED, doDeclarationCoding, doJavaCoding, edIndent, edTreeIndent, IS_SEMANTICS_CHECKED, print, SET_SEMANTICS_CHECKED
-
Field Details
-
oprator
The unary operator. -
operand
Expression operandThe operand Expression.
-
-
Constructor Details
-
UnaryOperation
Create a new UnaryOperation.- Parameters:
oprator
- the unary operator.operand
- the operand Expression
-
-
Method Details
-
create
Create a new UnaryOperation.- Parameters:
oprator
- the unary operator.operand
- the operand Expression- Returns:
- the newly created UnaryOperation
-
evaluate
Description copied from class:Expression
Try to Compile-time Evaluate this expression- Overrides:
evaluate
in classExpression
- Returns:
- the resulting evaluated expression
-
doChecking
public void doChecking()Description copied from class:SyntaxClass
Perform semantic checking.This must be redefined in every subclass.
- Overrides:
doChecking
in classSyntaxClass
-
maybeStatement
public boolean maybeStatement()Description copied from class:Expression
Returns true if this expression may be used as a statement.- Specified by:
maybeStatement
in classExpression
- Returns:
- true if this expression may be used as a statement
-
toJavaCode
Description copied from class:SyntaxClass
Generate Java code for this Syntax Class.- Overrides:
toJavaCode
in classSyntaxClass
- Returns:
- Java code
-
toString
- Overrides:
toString
in classExpression
-