Open rvjansen opened 2 years ago
Comment by Kermit Kiser [ 10/Jul/14 ] This seems like a "philosophy" question: Is the engine interpreting a statement or a program when a line is passed? Since jrunscript is a simple verification tool to see what is available and working or so it seems to me, I recommend doing nothing about this except perhaps documenting that each line in that environment is a separate program with it's own context. Multiple statements can be placed on a single line if needed.
Comment by rvjansen [ 16/Feb/15 ] I would like this to work the same way other REPLS do this. - see Ruby's IR
Comment by Kermit Kiser [ 27/Apr/15 ] jrunscript passes each line separately to the jsr223 interface. I tested this and it cannot be altered even with option "-f -". jrunscript is a program in the Java sdk provided by Oracle and cannot be changed by the NetRexx team. By design NetRexx only translates and interprets complete programs not individual lines of code. Rather than making a mess out of the NetRexx JSR223 interface I suggest replacing the jrunscript program with the following NetRexx program which should act more like desired I think:
/* This program reads NetRexx statements from the command line and passes them to the NetRexx interpreter via the jsr223 interface. Enter a null line to execute the statements previously entered or to exit if no statements were entered since the last execute. */
import javax.script.
import org.netrexx.
br =BufferedReader(InputStreamReader(System.in))
nrEngine = ScriptEngineManager().getEngineByName("NetRexx")
loop foreverbr.mark(1024)
input=br.readLine()
if input="" then return br.reset()
sb=StringBuilder(1024)
loop forevernew=br.readLine()
if new="" then do
nrEngine.put("result",null)
say nrEngine.eval(sb.toString())
leave
end
else sb.append(Rexx(new"\n").toString())
end
end
```