Mercurial > vim
annotate runtime/syntax/sass.vim @ 35039:fbdb6aeca2e2
runtime(java): Improve the recognition of the "style" method declarations
Commit: https://github.com/vim/vim/commit/a4c085a3e607bd01d34e1db600b6460fc35fb0a3
Author: Aliaksei Budavei <0x000c70@gmail.com>
Date: Wed Apr 24 21:04:25 2024 +0200
runtime(java): Improve the recognition of the "style" method declarations
- Request the new regexp engine (v7.3.970) for [:upper:] and
[:lower:].
- Recognise declarations of in-line annotated methods.
- Recognise declarations of _strictfp_ methods.
- Establish partial order for method modifiers as shown in
the MethodModifier production; namely, _public_ and
friends should be written the leftmost, possibly followed
by _abstract_ or _default_, or possibly followed by other
modifiers.
- Stop looking for parameterisable primitive types (void<?>,
int<Object>, etc., are malformed).
- Stop looking for arrays of _void_.
- Acknowledge the prevailing convention for method names to
begin with a small letter and for class/interface names to
begin with a capital letter; and, therefore, desist from
claiming declarations of enum constants and constructors
with javaFuncDef.
Rationale:
+ Constructor is distinct from method:
* its (overloaded) name is not arbitrary;
* its return type is implicit;
* its _throws_ clause depends on indirect vagaries of
instance (variable) initialisers;
* its invocation makes other constructors of its type
hierarchy invoked one by one, concluding with the
primordial constructor;
* its explicit invocation, via _this_ or _super_, can
only appear as the first statement in a constructor
(not anymore, see JEP 447); else, its _super_ call
cannot appear in constructors of _record_ or _enum_;
and neither invocation is allowed for the primordial
constructor;
* it is not a member of its class, like initialisers,
and is never inherited;
* it is never _abstract_ or _native_.
+ Constructor declarations tend to be few in number and
merit visual recognition from method declarations.
+ Enum constants define a fixed set of type instances
and more resemble class variable initialisers.
Note that the code duplicated for @javaFuncParams is written
keeping in mind for g:java_highlight_functions a pending 3rd
variant, which would require none of the :syn-cluster added
groups.
closes: #14620
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 24 Apr 2024 21:15:02 +0200 |
parents | dce918af0c00 |
children |
rev | line source |
---|---|
1668 | 1 " Vim syntax file |
2415 | 2 " Language: Sass |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
4 " Filenames: *.sass | |
28141 | 5 " Last Change: 2022 Mar 15 |
1668 | 6 |
7 if exists("b:current_syntax") | |
8 finish | |
9 endif | |
10 | |
11 runtime! syntax/css.vim | |
12 | |
13 syn case ignore | |
14 | |
15 syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
16 syn cluster sassCssAttributes contains=css.*Attr,sassEndOfLineComment,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp |
1668 | 17 |
2415 | 18 syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP |
19 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
20 syn match sassProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
21 syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute |
2415 | 22 syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2421
diff
changeset
|
23 syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction,sassInterpolation |
18818 | 24 syn match sassFlag "!\%(default\|global\|optional\)\>" contained |
2415 | 25 syn match sassVariable "$[[:alnum:]_-]\+" |
26 syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite | |
27 syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite | |
28 | |
29 syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained | |
30 syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained | |
31 syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained | |
32 syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained | |
33 syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained | |
34 syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained | |
35 | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
36 syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ,cssPseudoClass,sassProperty |
2415 | 37 |
38 syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
39 syn match sassMixin "^=" nextgroup=sassMixinName skipwhite |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2421
diff
changeset
|
40 syn match sassMixin "\%([{};]\s*\|^\s*\)\@<=@mixin" nextgroup=sassMixinName skipwhite |
2415 | 41 syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2421
diff
changeset
|
42 syn match sassMixing "\%([{};]\s*\|^\s*\)\@<=@include" nextgroup=sassMixinName skipwhite |
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2421
diff
changeset
|
43 syn match sassExtend "\%([{};]\s*\|^\s*\)\@<=@extend" |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
44 |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
45 syn match sassFunctionName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
46 syn match sassFunctionDecl "\%([{};]\s*\|^\s*\)\@<=@function" nextgroup=sassFunctionName skipwhite |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
47 syn match sassReturn "\%([{};]\s*\|^\s*\)\@<=@return" |
1668 | 48 |
49 syn match sassEscape "^\s*\zs\\" | |
50 syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId | |
51 syn match sassId "[[:alnum:]_-]\+" contained | |
52 syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass | |
18818 | 53 syn match sassPlaceholder "\%([{};]\s*\|^\s*\)\@<=%" nextgroup=sassClass |
1668 | 54 syn match sassClass "[[:alnum:]_-]\+" contained |
55 syn match sassAmpersand "&" | |
56 | |
57 " TODO: Attribute namespaces | |
58 " TODO: Arithmetic (including strings and concatenation) | |
59 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
60 syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators |
28141 | 61 syn region sassKeyframe matchgroup=cssAtKeyword start=/@\(-[a-z]\+-\)\=keyframes\>/ end=";\|$" contains=cssVendor,cssComment nextgroup=cssDefinition |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
62 syn keyword sassMediaOperators and not only contained |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
63 syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
64 syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType |
2415 | 65 syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction |
66 syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction | |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
67 syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\|each\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
68 syn keyword sassFor from to through in contained |
1668 | 69 |
70 syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained | |
2415 | 71 syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell |
72 syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
73 syn match sassEndOfLineComment "//.*" contains=sassComment,sassTodo,@Spell |
1668 | 74 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
75 hi def link sassEndOfLineComment sassComment |
1668 | 76 hi def link sassCssComment sassComment |
77 hi def link sassComment Comment | |
18818 | 78 hi def link sassFlag cssImportant |
2415 | 79 hi def link sassVariable Identifier |
80 hi def link sassFunction Function | |
1668 | 81 hi def link sassMixing PreProc |
82 hi def link sassMixin PreProc | |
18818 | 83 hi def link sassPlaceholder sassClassChar |
2415 | 84 hi def link sassExtend PreProc |
4681
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
85 hi def link sassFunctionDecl PreProc |
2eb30f341e8d
Updated runtime files and translations.
Bram Moolenaar <bram@vim.org>
parents:
2526
diff
changeset
|
86 hi def link sassReturn PreProc |
1668 | 87 hi def link sassTodo Todo |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
88 hi def link sassCharset PreProc |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
89 hi def link sassMedia PreProc |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
4681
diff
changeset
|
90 hi def link sassMediaOperators PreProc |
1668 | 91 hi def link sassInclude Include |
2415 | 92 hi def link sassDebug sassControl |
93 hi def link sassWarn sassControl | |
2202 | 94 hi def link sassControl PreProc |
95 hi def link sassFor PreProc | |
1668 | 96 hi def link sassEscape Special |
97 hi def link sassIdChar Special | |
98 hi def link sassClassChar Special | |
2415 | 99 hi def link sassInterpolationDelimiter Delimiter |
1668 | 100 hi def link sassAmpersand Character |
101 hi def link sassId Identifier | |
102 hi def link sassClass Type | |
103 | |
104 let b:current_syntax = "sass" | |
105 | |
106 " vim:set sw=2: |