Fix parsing of nested MATCH in console
Resolves:
@@ -132,7 +132,7 @@ public class OConsoleCommandStream implements OCommandStream {
case RIGHT_BRAKET:
result.append(c);
nestingLevel--;
- if (nestingLevel <= 0 && !isMatch(result)) {
+ if (nestingLevel <= 0 && isControlBlock(result)) {
return result.toString().trim();
}
break;
@@ -266,12 +266,18 @@ public class OConsoleCommandStream implements OCommandStream {
}
}
- private boolean isMatch(StringBuilder result) {
+ private boolean isControlBlock(StringBuilder result) {
String cmd = result.toString().trim();
if (cmd.length() < 6) {
return false;
}
- if (cmd.substring(0, 6).equalsIgnoreCase("match ")) {
+ if (cmd.substring(0, 6).equalsIgnoreCase("if ")) {
+ return true;
+ }
+ if (cmd.substring(0, 6).equalsIgnoreCase("foreach ")) {
+ return true;
+ }
+ if (cmd.substring(0, 6).equalsIgnoreCase("while ")) {
return true;
}
return false;
