public final CommandControl isValid(BlocLines lines) { if (isCommandForbidden()) { return CommandControl.NOT_OK; } final Matcher2 m1 = starting.matcher(StringUtils.trim(lines.getFirst499())); if (m1.matches() == false) { return CommandControl.NOT_OK; } if (lines.size() == 1) { return CommandControl.OK_PARTIAL; } int level = 1; for (CharSequence cs : lines.subExtract(1, 0)) { final String s = StringUtils.trim(cs); if (isLineConsistent(s, level) == false) { return CommandControl.NOT_OK; } if (s.endsWith("{")) { level++; } if (s.endsWith("}")) { level--; } if (level < 0) { return CommandControl.NOT_OK; } } if (level != 0) { return CommandControl.OK_PARTIAL; } actionIfCommandValid(); return CommandControl.OK; }