Minor glitch fixes.

This commit is contained in:
Robert Greene 2003-12-21 01:11:58 +00:00
parent b7bb0e194a
commit f707dacea1

View File

@ -264,10 +264,13 @@ public class ApplesoftCompiler implements ApplesoftTokens {
try { try {
method.invoke(this, new Object[0]); method.invoke(this, new Object[0]);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
System.err.println("Unable to locate " + method.getName());
e.printStackTrace(); e.printStackTrace();
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
System.err.println("Unable to locate " + method.getName());
e.printStackTrace(); e.printStackTrace();
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
System.err.println("Unable to locate " + method.getName());
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
@ -371,7 +374,11 @@ public class ApplesoftCompiler implements ApplesoftTokens {
protected Variable evaluateExpression() throws CompileException { protected Variable evaluateExpression() throws CompileException {
// FIXME: no type checking available // FIXME: no type checking available
// FIXME: needs to evaluate all valid expressions // FIXME: needs to evaluate all valid expressions
ApplesoftToken token = nextToken(); ApplesoftToken token = peekToken();
if (token.isEndOfCommand()) {
return null;
}
token = nextToken();
if (token.isString()) { if (token.isString()) {
String value = token.getStringValue(); String value = token.getStringValue();
Variable variable = null; Variable variable = null;
@ -509,7 +516,9 @@ public class ApplesoftCompiler implements ApplesoftTokens {
ApplesoftToken token = null; ApplesoftToken token = null;
do { do {
Variable variable = evaluateExpression(); Variable variable = evaluateExpression();
if (variable.isConstantFloat() || variable.isTypeFloat()) { if (variable == null) {
addAssembly(null, "JSR", "PRCR");
} else if (variable.isConstantFloat() || variable.isTypeFloat()) {
addLoadFac(variable); addLoadFac(variable);
addAssembly(null, "JSR", "PRNTFAC"); addAssembly(null, "JSR", "PRNTFAC");
} else if (variable.isConstantInteger() || variable.isTypeInteger()) { } else if (variable.isConstantInteger() || variable.isTypeInteger()) {