]> git.ipfire.org Git - thirdparty/vim.git/commit
runtime(java): Recognise string templates (#14150)
authorAliaksei Budavei <32549825+zzzyxwvut@users.noreply.github.com>
Sat, 9 Mar 2024 17:03:11 +0000 (20:03 +0300)
committerGitHub <noreply@github.com>
Sat, 9 Mar 2024 17:03:11 +0000 (18:03 +0100)
commita2c65809dafe5c4f45f278fddf368c7c971d83e9
tree7c03e5ea7b1ed1c00d0144563c0a90228f0b508b
parent5d67aef3060d6d3aa14d273c39f23d8a90c4cef1
runtime(java): Recognise string templates (#14150)

As this is encouraged in the referenced JEPs, "to visually
distinguish a string template from a string literal, and
a text block template from a text block", the default
colours for java\%[Debug]StrTempl are made distinct from
java\%[Debug]String.

According to ยง3.2 Lexical Translations (JLS, c. 1996 or any
more recent version), line terminators, white space, and
comments are discarded before tokens are accepted. Since
a template expression comprises a template processor, a dot,
and a template, it may be visually appealing to break up
its head across a few lines whenever its tail already spans
multiple lines.  Curiously, no allowance for it is made in
the distributed tests for OpenJDK 21; the proposed regexp
patterns take in consideration a line terminator and white
space after a dot.

References:
https://openjdk.org/jeps/430 (Preview)
https://openjdk.org/jeps/459 (Second Preview)
https://openjdk.org/jeps/465

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/syntax/java.vim
runtime/syntax/testdir/dumps/java_string_00.dump
runtime/syntax/testdir/dumps/java_string_01.dump
runtime/syntax/testdir/dumps/java_string_02.dump
runtime/syntax/testdir/dumps/java_string_03.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_string_04.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_string_05.dump [new file with mode: 0644]
runtime/syntax/testdir/dumps/java_string_99.dump
runtime/syntax/testdir/input/java_string.java