Mercurial > vim
view 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 |
line wrap: on
line source
" Vim syntax file " Language: Sass " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " Filenames: *.sass " Last Change: 2022 Mar 15 if exists("b:current_syntax") finish endif runtime! syntax/css.vim syn case ignore syn cluster sassCssProperties contains=cssFontProp,cssFontDescriptorProp,cssColorProp,cssTextProp,cssBoxProp,cssGeneratedContentProp,cssPagingProp,cssUIProp,cssRenderProp,cssAuralProp,cssTableProp syn cluster sassCssAttributes contains=css.*Attr,sassEndOfLineComment,scssComment,cssValue.*,cssColor,cssURL,sassDefault,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,cssRenderProp syn region sassDefinition matchgroup=cssBraces start="{" end="}" contains=TOP syn match sassProperty "\%([{};]\s*\|^\)\@<=\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:" contains=css.*Prop skipwhite nextgroup=sassCssAttribute contained containedin=sassDefinition syn match sassProperty "^\s*\zs\s\%(\%([[:alnum:]-]\|#{[^{}]*}\)\+\s*:\|:[[:alnum:]-]\+\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute syn match sassProperty "^\s*\zs\s\%(:\=[[:alnum:]-]\+\s*=\)"hs=s+1 contains=css.*Prop skipwhite nextgroup=sassCssAttribute syn match sassCssAttribute +\%("\%([^"]\|\\"\)*"\|'\%([^']\|\\'\)*'\|#{[^{}]*}\|[^{};]\)*+ contained contains=@sassCssAttributes,sassVariable,sassFunction,sassInterpolation syn match sassFlag "!\%(default\|global\|optional\)\>" contained syn match sassVariable "$[[:alnum:]_-]\+" syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=\%(||\)\==" nextgroup=sassCssAttribute skipwhite syn match sassVariableAssignment "\%([!$][[:alnum:]_-]\+\s*\)\@<=:" nextgroup=sassCssAttribute skipwhite syn match sassFunction "\<\%(rgb\|rgba\|red\|green\|blue\|mix\)\>(\@=" contained syn match sassFunction "\<\%(hsl\|hsla\|hue\|saturation\|lightness\|adjust-hue\|lighten\|darken\|saturate\|desaturate\|grayscale\|complement\)\>(\@=" contained syn match sassFunction "\<\%(alpha\|opacity\|rgba\|opacify\|fade-in\|transparentize\|fade-out\)\>(\@=" contained syn match sassFunction "\<\%(unquote\|quote\)\>(\@=" contained syn match sassFunction "\<\%(percentage\|round\|ceil\|floor\|abs\)\>(\@=" contained syn match sassFunction "\<\%(type-of\|unit\|unitless\|comparable\)\>(\@=" contained syn region sassInterpolation matchgroup=sassInterpolationDelimiter start="#{" end="}" contains=@sassCssAttributes,sassVariable,sassFunction containedin=cssStringQ,cssStringQQ,cssPseudoClass,sassProperty syn match sassMixinName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute syn match sassMixin "^=" nextgroup=sassMixinName skipwhite syn match sassMixin "\%([{};]\s*\|^\s*\)\@<=@mixin" nextgroup=sassMixinName skipwhite syn match sassMixing "^\s\+\zs+" nextgroup=sassMixinName syn match sassMixing "\%([{};]\s*\|^\s*\)\@<=@include" nextgroup=sassMixinName skipwhite syn match sassExtend "\%([{};]\s*\|^\s*\)\@<=@extend" syn match sassFunctionName "[[:alnum:]_-]\+" contained nextgroup=sassCssAttribute syn match sassFunctionDecl "\%([{};]\s*\|^\s*\)\@<=@function" nextgroup=sassFunctionName skipwhite syn match sassReturn "\%([{};]\s*\|^\s*\)\@<=@return" syn match sassEscape "^\s*\zs\\" syn match sassIdChar "#[[:alnum:]_-]\@=" nextgroup=sassId syn match sassId "[[:alnum:]_-]\+" contained syn match sassClassChar "\.[[:alnum:]_-]\@=" nextgroup=sassClass syn match sassPlaceholder "\%([{};]\s*\|^\s*\)\@<=%" nextgroup=sassClass syn match sassClass "[[:alnum:]_-]\+" contained syn match sassAmpersand "&" " TODO: Attribute namespaces " TODO: Arithmetic (including strings and concatenation) syn region sassMediaQuery matchgroup=sassMedia start="@media" end="[{};]\@=\|$" contains=sassMediaOperators syn region sassKeyframe matchgroup=cssAtKeyword start=/@\(-[a-z]\+-\)\=keyframes\>/ end=";\|$" contains=cssVendor,cssComment nextgroup=cssDefinition syn keyword sassMediaOperators and not only contained syn region sassCharset start="@charset" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType syn region sassInclude start="@import" end=";\|$" contains=scssComment,cssStringQ,cssStringQQ,cssURL,cssUnicodeEscape,cssMediaType syn region sassDebugLine end=";\|$" matchgroup=sassDebug start="@debug\>" contains=@sassCssAttributes,sassVariable,sassFunction syn region sassWarnLine end=";\|$" matchgroup=sassWarn start="@warn\>" contains=@sassCssAttributes,sassVariable,sassFunction syn region sassControlLine matchgroup=sassControl start="@\%(if\|else\%(\s\+if\)\=\|while\|for\|each\)\>" end="[{};]\@=\|$" contains=sassFor,@sassCssAttributes,sassVariable,sassFunction syn keyword sassFor from to through in contained syn keyword sassTodo FIXME NOTE TODO OPTIMIZE XXX contained syn region sassComment start="^\z(\s*\)//" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell syn region sassCssComment start="^\z(\s*\)/\*" end="^\%(\z1 \)\@!" contains=sassTodo,@Spell syn match sassEndOfLineComment "//.*" contains=sassComment,sassTodo,@Spell hi def link sassEndOfLineComment sassComment hi def link sassCssComment sassComment hi def link sassComment Comment hi def link sassFlag cssImportant hi def link sassVariable Identifier hi def link sassFunction Function hi def link sassMixing PreProc hi def link sassMixin PreProc hi def link sassPlaceholder sassClassChar hi def link sassExtend PreProc hi def link sassFunctionDecl PreProc hi def link sassReturn PreProc hi def link sassTodo Todo hi def link sassCharset PreProc hi def link sassMedia PreProc hi def link sassMediaOperators PreProc hi def link sassInclude Include hi def link sassDebug sassControl hi def link sassWarn sassControl hi def link sassControl PreProc hi def link sassFor PreProc hi def link sassEscape Special hi def link sassIdChar Special hi def link sassClassChar Special hi def link sassInterpolationDelimiter Delimiter hi def link sassAmpersand Character hi def link sassId Identifier hi def link sassClass Type let b:current_syntax = "sass" " vim:set sw=2: