Couple of error messages have been fixed
This commit is contained in:
parent
bf21c741ec
commit
30ad70d94f
|
@ -23,7 +23,7 @@ public abstract class BaseScope {
|
||||||
return this.parent.lookupSymbol(symbolName);
|
return this.parent.lookupSymbol(symbolName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RuntimeException(String.format("Variable '%s' is not defined in this scope.",
|
throw new RuntimeException(String.format("Symbol '%s' is not defined in this scope.",
|
||||||
symbolName));
|
symbolName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
package serene.simple;
|
package serene.simple;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.Console;
|
import java.io.Console;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
public static void main(String[] args) throws IOException {
|
|
||||||
|
private static void isJava8() throws RuntimeException {
|
||||||
|
if (System.getProperty("java.vm.specification.version").equals("1.8"))
|
||||||
|
throw new RuntimeException("Minimume required version of JDK is 1.8");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws IOException, RuntimeException {
|
||||||
|
Main.isJava8();
|
||||||
|
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
startRepl();
|
startRepl();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||||
import serene.simple.builtin.PrintlnFn;
|
import serene.simple.builtin.PrintlnFn;
|
||||||
import serene.simple.builtin.QuitFn;
|
import serene.simple.builtin.QuitFn;
|
||||||
import serene.simple.builtin.PlusFn;
|
import serene.simple.builtin.PlusFn;
|
||||||
|
import serene.simple.builtin.NewFn;
|
||||||
|
|
||||||
public class RootScope extends BaseScope {
|
public class RootScope extends BaseScope {
|
||||||
private final BaseScope parent;
|
private final BaseScope parent;
|
||||||
|
@ -15,6 +15,7 @@ public class RootScope extends BaseScope {
|
||||||
put("System", System.class);
|
put("System", System.class);
|
||||||
put("Boolean", Boolean.class);
|
put("Boolean", Boolean.class);
|
||||||
put("String", String.class);
|
put("String", String.class);
|
||||||
|
put("new", new NewFn());
|
||||||
}};
|
}};
|
||||||
// "+", PlusFn,
|
// "+", PlusFn,
|
||||||
// "-", MinusFn,
|
// "-", MinusFn,
|
||||||
|
@ -36,7 +37,7 @@ public class RootScope extends BaseScope {
|
||||||
return this.symbolsMapping.get(symbolName);
|
return this.symbolsMapping.get(symbolName);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new RuntimeException(String.format("Variable '%s' is not defined in this scope.",
|
throw new RuntimeException(String.format("Symbol '%s' is not defined in this scope.",
|
||||||
symbolName));
|
symbolName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue