
javarepl.console.rest.RestConsoleExpressionReader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javarepl Show documentation
Show all versions of javarepl Show documentation
Java REPL is a simple Read-Eval-Print-Loop for Java language.
package javarepl.console.rest;
import com.googlecode.totallylazy.Option;
import com.googlecode.totallylazy.Sequence;
import com.googlecode.totallylazy.Sequences;
import static com.googlecode.totallylazy.Option.none;
import static com.googlecode.totallylazy.Option.some;
import static javarepl.ExpressionReader.expressionIsTerminated;
public class RestConsoleExpressionReader {
private Sequence lines = Sequences.empty();
public Option readExpression(String line) {
lines = lines.append(line);
if (expressionIsTerminated(lines)) {
Option result = some(lines.toString("\n"));
lines = Sequences.empty();
return result;
} else {
return none();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy