@@ -1958,11 +1958,6 @@ r3_commands:
19581958 if (indent.indexOf("\n") == -1) {
19591959 struct.putNewline(node.from, theLineSeparator);
19601960 logger.fine(struct.getClass(), "r3_commands: add line break at " + node.from + ".");
1961- } else {
1962- // remove existing indentation; enforce conformity in these cases
1963- var newIndent = getLeadingNewLines(node.from);
1964- struct.putNewline(node.from, newIndent);
1965- logger.fine(struct.getClass(), "r3_commands: remove indentation at " + node.from + ".");
19661961 }
19671962 }
19681963}
@@ -2811,6 +2806,7 @@ r2_common:
28112806 | [node) 'RETURN' & [node^) subprg_spec
28122807 | [node-1) 'RETURN' & [node^) stmt
28132808 | [node) plsql_declarations & ([node^) with_clause | [node^) with_clause___0)
2809+ | [node) colmapped_query_name___0
28142810;
28152811
28162812r2_flowcontrol_condition:
@@ -2947,6 +2943,7 @@ r2_decrement_left_margin:
29472943 | [node^) XML_attributes_clause
29482944 | [node^^) analytic_function
29492945 | [node^) external_parameter_list
2946+ | [node^) colmapped_query_name___0
29502947 )
29512948 | [node) 'XMLTABLE' & [node^) xmltable
29522949 | [node) 'JSON_TABLE' & [node^) json_table
@@ -4121,6 +4118,20 @@ a18_indent_comment:
41214118 return tokens[pos].begin - tokens[nlpos].end;
41224119 }
41234120
4121+ var isFirstWhen = function(pos) {
4122+ var i = pos;
4123+ while (i > 0) {
4124+ i--;
4125+ var content = target.src.get(i).content.toLowerCase();
4126+ if (content == "when") {
4127+ return false;
4128+ } else if (content == "case") {
4129+ return true;
4130+ }
4131+ }
4132+ return false;
4133+ }
4134+
41244135 var getIndentBefore = function(pos) {
41254136 var indent = getIndent(pos);
41264137 var content = target.src.get(pos).content.toLowerCase();
@@ -4129,7 +4140,9 @@ a18_indent_comment:
41294140 if (target.src.get(pos+1).content.toLowerCase() == "case") {
41304141 indent += getSpaces(indentSpaces);
41314142 }
4132- } else if (content == "elsif" || content == "else" || content == "when") {
4143+ } else if (content == "elsif" || content == "else") {
4144+ indent += getSpaces(indentSpaces);
4145+ } else if (content == "when" && !isFirstWhen(pos)) {
41334146 indent += getSpaces(indentSpaces);
41344147 }
41354148 return indent;
0 commit comments