diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-09 16:02:10 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2017-10-09 16:02:10 -0300 |
| commit | f028ea6dc555fc5192a96b00b8e96e90dbf6de55 (patch) | |
| tree | 4b2a28ecbeb30095b50e6e9e8ac8b98fa8ddc79e /dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java | |
| parent | be4675f9512060aa85b1e0a4f223208b51b55812 (diff) | |
TODO tagging
Diffstat (limited to 'dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java b/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java index 8ace8ad..649c6fa 100644 --- a/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java +++ b/dice-lang/src/bjc/dicelang/scl/StreamControlConsole.java @@ -8,21 +8,43 @@ import java.util.Scanner; import java.util.function.Supplier; +/** + * Implement a SCL REPL + * + * @author Ben Culkin + */ public class StreamControlConsole { + /* + * @TODO 10/08/17 :SCLArgs + * Do something useful with the CLI args. + * + */ + /** + * Main method + * + * @param args + * Unused CLI args. + */ public static void main(String[] args) { - /* Initialize vars. */ - /* We're not using the DiceLangEngine in the streams yet. */ - StreamEngine sengine = new StreamEngine(null); + /* + * Initialize vars. + * + * We can get away with passing the null, because StreamEngine + * doesn't reference any parts of DiceLangEngine. + */ + StreamEngine sengine = new StreamEngine(null); StreamControlEngine sclengine = new StreamControlEngine(sengine); - Scanner scn = new Scanner(System.in); + Scanner scn = new Scanner(System.in); /* Get input from the user. */ System.out.print("Enter a SCL command string (blank to exit): "); + /* Process it. */ while (scn.hasNextLine()) { - String ln = scn.nextLine(); + String ln = scn.nextLine().trim(); - if (ln.trim().equals("")) { + if (ln.equals("")) { + /* Ignore empty lines. */ break; } @@ -32,16 +54,16 @@ public class StreamControlConsole { /* Run the stream engine on the tokens. */ boolean succ = sengine.doStreams(tokens, res); - if (!succ) { + System.out.printf("ERROR: Stream engine failed for line '%s'\n", ln); continue; } /* Run the command through SCL. */ tokens = res.toArray(new String[res.getSize()]); succ = sclengine.runProgram(tokens); - if (!succ) { + System.out.printf("ERROR: SCL engine failed for line '%s'\n", ln); continue; } |
