kanga.translate
Class MResult
java.lang.Object
kanga.translate.MResult
public class MResult
- extends java.lang.Object
This class wraps the result of a visit on expression type nodes in
a Kanga AST. It encapsulates the union structure of a Kanga expression:
a register/storage value, an immediate value, or a label value.
- Author:
- Santoso Wijaya
Constructor Summary |
MResult(java.lang.String reg)
Creates a default expression result, with type MResult.Type.REG . |
MResult(java.lang.String val,
MResult.Type type)
Creates an expression result with the given value and type. |
Method Summary |
java.lang.String |
getValue()
Returns the underlying string value of this expression result. |
boolean |
isImmediate()
|
boolean |
isLabel()
|
boolean |
isReg()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MResult
public MResult(java.lang.String reg)
- Creates a default expression result, with type
MResult.Type.REG
.
- Parameters:
reg
- the value
MResult
public MResult(java.lang.String val,
MResult.Type type)
- Creates an expression result with the given value and type.
- Parameters:
val
- the valuetype
- the type
isReg
public boolean isReg()
isImmediate
public boolean isImmediate()
isLabel
public boolean isLabel()
getValue
public java.lang.String getValue()
- Returns the underlying string value of this expression result.
- Returns:
- the string value of this expression result