|
|
|
@ -115,6 +115,13 @@ public class Main {
@@ -115,6 +115,13 @@ public class Main {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Serene's nRepl is super simple. It waits for a newline char and then evaluates the |
|
|
|
|
* given input. It sends back the result of the evaluation in `<status-char><value>` format. |
|
|
|
|
* `status-char` is either `0` or `1`. **Zero** means the evaluation was successful and the `value` |
|
|
|
|
* is the result of evaluation while **one** means there was an error during the evaluation and |
|
|
|
|
* the `value` is the traceback for the exception. |
|
|
|
|
*/ |
|
|
|
|
public static void nrepl() throws IOException { |
|
|
|
|
RootScope rootScope = new RootScope(); |
|
|
|
|
ServerSocket socket = new ServerSocket(Main.port);; |
|
|
|
@ -124,6 +131,8 @@ public class Main {
@@ -124,6 +131,8 @@ public class Main {
|
|
|
|
|
System.out.println( |
|
|
|
|
String.format("nRepl has been started on tcp://%s:%s", Main.host, Main.port)); |
|
|
|
|
|
|
|
|
|
// NOTE: The nRepl server is too simple. It supports one connection at a time
|
|
|
|
|
// and will terminate when the client disconnects.
|
|
|
|
|
try { |
|
|
|
|
Socket clientSocket = socket.accept(); |
|
|
|
|
|
|
|
|
|