summaryrefslogtreecommitdiff
path: root/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java
diff options
context:
space:
mode:
Diffstat (limited to 'dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java')
-rw-r--r--dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java b/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java
index 71dacaa..4dc9b82 100644
--- a/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java
+++ b/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java
@@ -10,34 +10,32 @@ import java.util.function.Supplier;
public class StreamControlConsole {
public static void main(String[] args) {
- /*
- * We're not using the DiceLangEngine in the streams yet.
- */
+ /* Initialize vars. */
+ /* We're not using the DiceLangEngine in the streams yet. */
StreamEngine sengine = new StreamEngine(null);
-
StreamControlEngine sclengine = new StreamControlEngine(sengine);
-
Scanner scn = new Scanner(System.in);
+ /* Get input from the user. */
System.out.print("Enter a SCL command string (blank to exit): ");
-
while(scn.hasNextLine()) {
String ln = scn.nextLine();
-
if(ln.trim().equals("")) break;
+ /* Break the token into strings. */
IList<String> res = new FunctionalList<>();
+ String[] tokens = ln.split(" ");
- String[] tokens = ln.split(" ");
-
+ /* Run the stream engine on the tokens. */
boolean succ = sengine.doStreams(tokens, res);
if(!succ) continue;
+ /* Run the command through SCL. */
tokens = res.toArray(new String[res.getSize()]);
-
- succ = sclengine.runProgram(tokens);
+ succ = sclengine.runProgram(tokens);
if(!succ) continue;
+ /* Prompt again. */
System.out.print("Command string executed succesfully.\n\n");
System.out.print("Enter a SCL command string (blank to exit): ");
}