提交 e3a45374 authored 作者: Thomas Mueller's avatar Thomas Mueller

Shell: line comments didn't work correctly.

上级 1e7406b5
...@@ -161,15 +161,15 @@ public class Shell { ...@@ -161,15 +161,15 @@ public class Shell {
if (line == null) { if (line == null) {
break; break;
} }
line = line.trim(); String trimmed = line.trim();
if (line.length() == 0) { if (trimmed.length() == 0) {
continue; continue;
} }
boolean end = line.endsWith(";"); boolean end = trimmed.endsWith(";");
if (end) { if (end) {
line = line.substring(0, line.length() - 1).trim(); line = line.substring(0, line.lastIndexOf(';'));
} }
String upper = line.toUpperCase(); String upper = trimmed.toUpperCase();
if ("EXIT".equals(upper) || "QUIT".equals(upper)) { if ("EXIT".equals(upper) || "QUIT".equals(upper)) {
break; break;
} else if ("HELP".equals(upper) || "?".equals(upper)) { } else if ("HELP".equals(upper) || "?".equals(upper)) {
...@@ -242,7 +242,7 @@ public class Shell { ...@@ -242,7 +242,7 @@ public class Shell {
if (statement == null) { if (statement == null) {
statement = line; statement = line;
} else { } else {
statement += " " + line; statement += "\n" + line;
} }
if (end) { if (end) {
execute(statement); execute(statement);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论