TextMateCommentPrefixes (@NotNull final ShellVariablesRegistry registry, @NotNull final TextMateScope scope) { String lineCommentPrefix = null; TextMateBlockCommentPair blockCommentPair = null; int index = 1; while (lineCommentPrefix == null || blockCommentPair == null) { String variableSuffix = index > 1 ? "_" + index : ""; TextMateShellVariable start = registry.getVariableValue(Constants.COMMENT_START_VARIABLE + variableSuffix, scope); TextMateShellVariable end = registry.getVariableValue(Constants.COMMENT_END_VARIABLE + variableSuffix, scope); index++; if (start == null) break; if ((end == null || !end.scopeName.equals(start.scopeName)) && lineCommentPrefix == null) { lineCommentPrefix = start.value; } if ((end != null && end.scopeName.equals(start.scopeName)) && blockCommentPair == null) { blockCommentPair = new TextMateBlockCommentPair(start.value, end.value); } } return new TextMateCommentPrefixes(lineCommentPrefix, blockCommentPair); }