|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.multijava.mjc.JExpression
org.multijava.mjc.JLiteral
org.multijava.mjc.JNumberLiteral
org.multijava.mjc.JRealLiteral
This class represents real-valued literals (float, double)
| Field Summary | |
private String |
image
|
private CType |
type
|
private Number |
value
|
| Fields inherited from class org.multijava.mjc.JExpression |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JRealLiteral(TokenReference where,
Number value,
CType type)
Construct a node in the parsing tree |
|
JRealLiteral(TokenReference where,
String image)
Construct a node in the parsing tree |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor |
private void |
calculateType()
Sets the type of this from the image. |
JExpression |
convertType(CType dest,
CExpressionContextType context)
convertType changes the type of this expression to an other |
void |
genCode(CodeSequence code)
Generates a sequence of bytecodes |
CType |
getType()
Compute the type of this expression (called after parsing) |
Object |
getValue()
Get a Number that represents the value of this literal. |
boolean |
isRealLiteral()
Does this expression represent a real literal? |
void |
negate()
|
Number |
numberValue()
Get a Number that represents the value of this literal. |
private void |
setValue(Number newValue)
Sets the value of this to the given value. |
JExpression |
typecheck(CExpressionContextType context)
Typechecks the expression and mutates the context to record information gathered during typechecking. |
private Double |
valueFromImage()
Sets the value of this from the image. |
| Methods inherited from class org.multijava.mjc.JNumberLiteral |
isDefault, toString |
| Methods inherited from class org.multijava.mjc.JLiteral |
createLiteral, getLiteral, isConstant, isLiteral, isLValue |
| Methods inherited from class org.multijava.mjc.JExpression |
buildUniverseDynChecks, clone, dumpArray, fail, genBranch, genUniverseDynCheckCode, getApparentType, getBooleanLiteral, getFANonNulls, getFANulls, getNumberLiteral, getOrdinalLiteral, getRealLiteral, getStringLiteral, isAssignableTo, isBooleanLiteral, isDeclaredNonNull, isMaybeInitializable, isNonNull, isOrdinalLiteral, isStatementExpression, isStringLiteral, typecheck, unParenthesize |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private String image
private Number value
private CType type
| Constructor Detail |
public JRealLiteral(TokenReference where,
String image)
where - the line of this node in the source codeimage - the string representation of this literal
public JRealLiteral(TokenReference where,
Number value,
CType type)
| Method Detail |
public void negate()
JNumberLiteral
public CType getType()
public Number numberValue()
public Object getValue()
private void setValue(Number newValue)
private Double valueFromImage()
throws NumberFormatException
NumberFormatExceptionprivate void calculateType()
public boolean isRealLiteral()
isRealLiteral in class JExpression
public JExpression typecheck(CExpressionContextType context)
throws PositionedError
typecheck in class JLiteralcontext - the context in which this expression appears
JExpression.typecheck())
PositionedError - if the check fails
public JExpression convertType(CType dest,
CExpressionContextType context)
throws PositionedError
convertType in class JExpressiondest - the destination typecontext - the context in which this expression appears
PositionedErrorpublic void accept(MjcVisitor p)
p - the visitorpublic void genCode(CodeSequence code)
code - the code list
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||