Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOExcept
for (String str : strings) {
toks.add(new Tok(isNumbered ? kN++ : -1, str, str, charI, columnI, isToken, null));
charI += str.length();
columnI = updateColumn(columnI, originalTokText);
columnI = updateColumn(columnI, str);
}
}
if (extraNewline != null) {
Expand Down Expand Up @@ -523,8 +523,7 @@ private static boolean continueTrailingComment(List<Tok> toks, String comment, S
return false;
}

// What comes before the trailing comment on its line is read in the text, since Tok.getColumn() counts an
// operator such as == once for each of its characters. Code there makes the comment a trailing one, and its
// What comes before the trailing comment on its line: code there makes the comment a trailing one, and its
// length is the comment's column.
var position = trailing.getPosition();
var lineStart = Math.max(text.lastIndexOf('\n', position), text.lastIndexOf('\r', position)) + 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Pairs of arguments and array elements laid out as a table keep their rows when an operator of more than one
# character, such as -> or ==, comes before the table on its line, as they do after any other code.
----------
class T {
Supplier<Map<String, Integer>> pairs() {
return () -> Map.of("one", 1,
"two", 2);
}

int[] grid(int mode) {
return mode == 0 ? new int[] {1, 2, 3,
4, 5, 6} : null;
}
}
----------
class T {
Supplier<Map<String, Integer>> pairs() {
return () -> Map.of(
"one", 1,
"two", 2);
}

int[] grid(int mode) {
return mode == 0
? new int[] {
1, 2, 3,
4, 5, 6
}
: null;
}
}
Loading