private String collectInput(Context cx) throws IOException { String source = ""; // Collect lines of source to compile. while (true) { String newline; newline = in.readLine(); if (newline == null) { // hit EOF source = null; break; } source = source + newline + "\n"; if (cx.stringIsCompilableUnit(source)) { break; } } return source; }
@Override public boolean isCompilable(String source) { return Context.getCurrentContext().stringIsCompilableUnit(source); } }
public String read(final Console console) throws IOException { final Context ctx = Context.getCurrentContext(); final StringBuilder buffer = new StringBuilder(); String line = null; if ((line = console.readLine(PROMPT)) != null) { // apply continued lines to last value if (line.startsWith(".") && has(LAST_VALUE_NAME, this)) { buffer.append(LAST_VALUE_NAME); } // read lines a complete statement is found or eof buffer.append(line); while (!ctx.stringIsCompilableUnit(buffer.toString()) && (line = console.readLine(PROMPT_CONTINUE)) != null) { buffer.append(NEWLINE).append(line); } return buffer.toString(); } return null; }
public String read(final Console console) throws IOException { final Context ctx = Context.getCurrentContext(); final StringBuilder buffer = new StringBuilder(); String line = null; if ((line = console.readLine(PROMPT)) != null) { // apply continued lines to last value if (line.startsWith(".") && has(LAST_VALUE_NAME, this)) { buffer.append(LAST_VALUE_NAME); } // read lines a complete statement is found or eof buffer.append(line); while (!ctx.stringIsCompilableUnit(buffer.toString()) && (line = console.readLine(PROMPT_CONTINUE)) != null) { buffer.append(NEWLINE).append(line); } return buffer.toString(); } return null; }
if (cx.stringIsCompilableUnit(source)) { break;
booleanResult = cx.stringIsCompilableUnit(text); break;
booleanResult = cx.stringIsCompilableUnit(text); break;
if (cx.stringIsCompilableUnit(source)) break; prompt = prompts[1];
if (cx.stringIsCompilableUnit(source)) break; prompt = prompts[1];