kopia lustrzana https://github.com/maccasoft/z80-tools
49 wiersze
759 B
Java
49 wiersze
759 B
Java
package nl.grauw.glass.expressions;
|
|
|
|
public class ContextLiteral extends Literal {
|
|
|
|
private final Context context;
|
|
|
|
public ContextLiteral(Context context) {
|
|
this.context = context;
|
|
}
|
|
|
|
@Override
|
|
public ContextLiteral copy(Context context) {
|
|
return new ContextLiteral(context);
|
|
}
|
|
|
|
@Override
|
|
public boolean isContext() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public Context getContext() {
|
|
return context;
|
|
}
|
|
|
|
@Override
|
|
public boolean isInteger() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public int getInteger() {
|
|
return context.getAddress();
|
|
}
|
|
|
|
public String toString() {
|
|
try {
|
|
return getHexValue();
|
|
} catch (EvaluationException e) {
|
|
return "<" + e.getMessage() + ">";
|
|
}
|
|
}
|
|
|
|
public String toDebugString() {
|
|
return toString();
|
|
}
|
|
|
|
}
|