Mercurial > vim
view runtime/syntax/testdir/dumps/java_switch_99.dump @ 34445:5609b011fd70
runtime(java): Recognise _when_ clauses in _switch_ blocks
Commit: https://github.com/vim/vim/commit/9ecf02cd5f5feabe096f66cd5f503a822c78793f
Author: Aliaksei Budavei <0x000c70@gmail.com>
Date: Wed Feb 28 21:30:22 2024 +0100
runtime(java): Recognise _when_ clauses in _switch_ blocks
Also:
- distinguish _yield_ when used as a contextual keyword from
when used qualified as a method or a method reference (as
can be seen in testdir/input/java_switch.java, variables
and method declarations named _yield_ will be recognised
as the namesake keyword--consider picking other names for
variables, and defining g:java_highlight_functions to have
method names painted; since _yield_ statements can have
trailing parens, they must be recognised as statements,
for only qualified _yield_ method calls are supported);
- recognise grouped _default_ _case_ labels;
- describe primitive types for _case_ labels (JLS, ?14.11,
?3.10.1);
- recognise some non-ASCII identifiers (see javaLambdaDef,
javaUserLabel) (further improvement for better recognition
of identifiers will be arranged in a separate PR).
Because the arrow '->' is used in two kinds of expressions,
lambda (abstractions) and _switch_, necessary changes were
made for the recognition of either (and further improvement
touching lambda expressions will be separately arranged).
Because 'default' is used for instance method declarations
in interfaces and in _switch_ labels, necessary changes were
made for the recognition of either (and further improvement
touching method declarations will be separately arranged).
Finally, it deemed appropriate to put 'yield' in the syntax
group of javaOperator rather than javaStatement, for its
member 'var' is also another contextual keyword (e.g., this
is valid syntax: "var var = var(test.var);").
References:
https://openjdk.org/jeps/361 (Switch Expressions)
https://openjdk.org/jeps/440 (Record Patterns)
https://openjdk.org/jeps/441 (Pattern Matching for switch)
Also, add a Java specific filetype plugin for the syntax
test, so that no soft-wrapping of long indented lines occur.
Otherwise the syntax scripts would miss a few lines during
scrolling and verification of the screen dumps.
closes: #14105
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 28 Feb 2024 21:45:09 +0100 |
parents | |
children |
line wrap: on
line source
| +0&#ffffff0@11|c+0#af5f00255&|a|s|e| +0#0000000&|(@1|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|)+0#0000000&| @3|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |1+0#e000002&|;+0#0000000&| @29 @12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@8|-|>| |(|s+0#00e0003&|h|o|r|t|)+0#0000000&| |-|1+0#e000002&|;+0#0000000&| @32 @8|}|)|;| @63 @75 @8|i+0#00e0003&|n|t| +0#0000000&|i| |=| |2+0#e000002&|;+0#0000000&| @56 @75 @8|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @54 @8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|b|0|_@1|0@1|_@2|0@2|:+0#0000000&| |{| |e|c|h|o|(|0+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 @8|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|x|0@2|_@2|0@1|_@1|1|:+0#0000000&| |{| |e|c|h|o|(|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @27 @8|d+0#af5f00255&|e|f|a|u|l|t|:+0#0000000&| @7|{| |e|c|h|o|(|-|1+0#e000002&|)+0#0000000&|;| |b+0#af5f00255&|r|e|a|k|;+0#0000000&| |}| @30 @8|}|;| @64 @75 @8|e|c|h|o|(|s+0#af5f00255&|w|i|t|c|h| +0#0000000&|(|i|)| |{| @49 @12|c+0#af5f00255&|a|s|e| +0#0000000&|0+0#e000002&|_|0|_|0|_|0|_|0| +0#0000000&@1|-|>| |0+0#e000002&|;+0#0000000&| @41 @12|c+0#af5f00255&|a|s|e| +0#0000000&|1+0#e000002&| +0#0000000&@5|-|>| |1+0#e000002&|;+0#0000000&| @45 @12|d+0#af5f00255&|e|f|a|u|l|t| +0#0000000&@4|-|>| |-|1+0#e000002&|;+0#0000000&| @44 @8|}|)|;| @63 @4|}| @69 >}| @73 @57|1|2@1|,|1| @8|B|o|t|