diff options
author | Akshay <[email protected]> | 2024-07-23 20:26:43 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2024-07-23 20:26:43 +0100 |
commit | ddc6f72c5b1cf6916ef2705b226d0c53950b9386 (patch) | |
tree | 56b1d651dfe18a5e45b8cc6477ff8cb49991d98c /syntax |
init
Diffstat (limited to 'syntax')
-rw-r--r-- | syntax/kotlin.vim | 139 | ||||
-rw-r--r-- | syntax/proto.vim | 106 |
2 files changed, 245 insertions, 0 deletions
diff --git a/syntax/kotlin.vim b/syntax/kotlin.vim new file mode 100644 index 0000000..48fc6ce --- /dev/null +++ b/syntax/kotlin.vim | |||
@@ -0,0 +1,139 @@ | |||
1 | " Vim syntax file | ||
2 | " Language: Kotlin | ||
3 | " Maintainer: Alexander Udalov | ||
4 | " Latest Revision: 13 July 2020 | ||
5 | |||
6 | if exists('b:current_syntax') | ||
7 | finish | ||
8 | endif | ||
9 | |||
10 | syn keyword ktStatement break continue return | ||
11 | syn keyword ktConditional if else when | ||
12 | syn keyword ktRepeat do for while | ||
13 | syn keyword ktOperator in is by | ||
14 | syn keyword ktKeyword get set out super this where | ||
15 | syn keyword ktException try catch finally throw | ||
16 | |||
17 | syn keyword ktInclude import package | ||
18 | |||
19 | " The following is generated by generate-stdlib-class-names.main.kts | ||
20 | syn keyword ktType AbstractCollection AbstractCoroutineContextElement AbstractCoroutineContextKey AbstractDoubleTimeSource AbstractIterator AbstractList AbstractLongTimeSource | ||
21 | syn keyword ktType AbstractMap AbstractMutableCollection AbstractMutableList AbstractMutableMap AbstractMutableSet AbstractSet AccessDeniedException Accessor Annotation | ||
22 | syn keyword ktType AnnotationRetention AnnotationTarget Any Appendable ArithmeticException Array ArrayDeque ArrayList AssertionError Boolean BooleanArray BooleanIterator | ||
23 | syn keyword ktType BuilderInference Byte ByteArray ByteIterator CallsInPlace CancellationException Char CharArray CharCategory CharDirectionality CharIterator CharProgression | ||
24 | syn keyword ktType CharRange CharSequence CharacterCodingException Charsets ClassCastException Cloneable ClosedFloatingPointRange ClosedRange Collection Comparable Comparator | ||
25 | syn keyword ktType ConcurrentModificationException ConditionalEffect Continuation ContinuationInterceptor ContractBuilder CoroutineContext DeepRecursiveFunction DeepRecursiveScope | ||
26 | syn keyword ktType Delegates Deprecated DeprecatedSinceKotlin DeprecationLevel Destructured Double DoubleArray DoubleIterator DslMarker Duration DurationUnit Effect Element | ||
27 | syn keyword ktType EmptyCoroutineContext Entry Enum Error Exception Experimental ExperimentalContracts ExperimentalJsExport ExperimentalMultiplatform ExperimentalStdlibApi | ||
28 | syn keyword ktType ExperimentalTime ExperimentalTypeInference ExperimentalUnsignedTypes ExtensionFunctionType FileAlreadyExistsException FileSystemException FileTreeWalk | ||
29 | syn keyword ktType FileWalkDirection Float FloatArray FloatIterator Function Function0 Function1 Function10 Function11 Function12 Function13 Function14 Function15 Function16 | ||
30 | syn keyword ktType Function17 Function18 Function19 Function2 Function20 Function21 Function22 Function3 Function4 Function5 Function6 Function7 Function8 Function9 FunctionN | ||
31 | syn keyword ktType Getter Grouping HashMap HashSet IllegalArgumentException IllegalStateException IndexOutOfBoundsException IndexedValue Int IntArray IntIterator IntProgression | ||
32 | syn keyword ktType IntRange InvocationKind Iterable Iterator JsExport JsName JvmDefault JvmDefaultWithoutCompatibility JvmField JvmMultifileClass JvmName JvmOverloads JvmStatic | ||
33 | syn keyword ktType JvmSuppressWildcards JvmSynthetic JvmWildcard KAnnotatedElement KCallable KClass KClassifier KDeclarationContainer KFunction KMutableProperty KMutableProperty0 | ||
34 | syn keyword ktType KMutableProperty1 KMutableProperty2 KParameter KProperty KProperty0 KProperty1 KProperty2 KType KTypeParameter KTypeProjection KVariance KVisibility Key Kind | ||
35 | syn keyword ktType KotlinNullPointerException KotlinReflectionNotSupportedError KotlinVersion Lazy LazyThreadSafetyMode Level LinkedHashMap LinkedHashSet List ListIterator Long | ||
36 | syn keyword ktType LongArray LongIterator LongProgression LongRange Map MatchGroup MatchGroupCollection MatchNamedGroupCollection MatchResult Metadata Monotonic MustBeDocumented | ||
37 | syn keyword ktType MutableCollection MutableEntry MutableIterable MutableIterator MutableList MutableListIterator MutableMap MutableSet NoSuchElementException NoSuchFileException | ||
38 | syn keyword ktType NoWhenBranchMatchedException NotImplementedError Nothing NullPointerException Number NumberFormatException ObservableProperty OnErrorAction OptIn | ||
39 | syn keyword ktType OptionalExpectation OverloadResolutionByLambdaReturnType Pair ParameterName PropertyDelegateProvider PublishedApi PurelyImplements Random RandomAccess | ||
40 | syn keyword ktType ReadOnlyProperty ReadWriteProperty Regex RegexOption Repeatable ReplaceWith RequiresOptIn RestrictsSuspension Result Retention Returns ReturnsNotNull | ||
41 | syn keyword ktType RuntimeException Sequence SequenceScope Set Setter SharedImmutable Short ShortArray ShortIterator SimpleEffect SinceKotlin Strictfp String StringBuilder Suppress | ||
42 | syn keyword ktType Synchronized Target TestTimeSource ThreadLocal Throwable Throws TimeMark TimeSource TimedValue Transient Triple TypeCastException Typography UByte UByteArray | ||
43 | syn keyword ktType UByteIterator UInt UIntArray UIntIterator UIntProgression UIntRange ULong ULongArray ULongIterator ULongProgression ULongRange UShort UShortArray UShortIterator | ||
44 | syn keyword ktType UninitializedPropertyAccessException Unit UnsafeVariance UnsupportedOperationException UseExperimental Volatile | ||
45 | |||
46 | syn keyword ktModifier annotation companion enum inner internal private protected public abstract final open override sealed vararg dynamic expect actual | ||
47 | syn keyword ktStructure class object interface typealias fun val var constructor init | ||
48 | |||
49 | syn keyword ktReservedKeyword typeof | ||
50 | |||
51 | syn keyword ktBoolean true false | ||
52 | syn keyword ktConstant null | ||
53 | |||
54 | syn keyword ktModifier data tailrec lateinit reified external inline noinline crossinline const operator infix suspend | ||
55 | |||
56 | syn match ktOperator "\v\?:|::|\<\=? | \>\=?|[!=]\=\=?|<as>\??|[-!%&*+/|]" | ||
57 | |||
58 | syn keyword ktTodo TODO FIXME XXX contained | ||
59 | syn match ktShebang "\v^#!.*$" | ||
60 | syn match ktLineComment "\v//.*$" contains=ktTodo,@Spell | ||
61 | syn region ktComment matchgroup=ktCommentMatchGroup start="/\*" end="\*/" contains=ktComment,ktTodo,@Spell | ||
62 | |||
63 | syn region ktDocComment start="/\*\*" end="\*/" contains=ktDocTag,ktTodo,@Spell | ||
64 | syn match ktDocTag "\v\@(author|constructor|receiver|return|since|suppress)>" contained | ||
65 | syn match ktDocTag "\v\@(exception|param|property|throws|see|sample)>\s*\S+" contains=ktDocTagParam contained | ||
66 | syn match ktDocTagParam "\v(\s|\[)\S+" contained | ||
67 | syn match ktComment "/\*\*/" | ||
68 | |||
69 | syn match ktSpecialCharError "\v\\." contained | ||
70 | syn match ktSpecialChar "\v\\([tbnr'"$\\]|u\x{4})" contained | ||
71 | syn region ktString start='"' skip='\\"' end='"' contains=ktSimpleInterpolation,ktComplexInterpolation,ktSpecialChar,ktSpecialCharError | ||
72 | syn region ktString start='"""' end='""""*' contains=ktSimpleInterpolation,ktComplexInterpolation | ||
73 | syn match ktCharacter "\v'[^']*'" contains=ktSpecialChar,ktSpecialCharError | ||
74 | syn match ktCharacter "\v'\\''" contains=ktSpecialChar | ||
75 | syn match ktCharacter "\v'[^\\]'" | ||
76 | |||
77 | " TODO: highlight label in 'this@Foo' | ||
78 | syn match ktAnnotation "\v(\w)@<!\@[[:alnum:]_.]*(:[[:alnum:]_.]*)?" | ||
79 | syn match ktLabel "\v\w+\@" | ||
80 | |||
81 | syn match ktSimpleInterpolation "\v\$\h\w*" contained | ||
82 | syn region ktComplexInterpolation matchgroup=ktComplexInterpolationBrace start="\v\$\{" end="\v\}" contains=ALLBUT,ktSimpleInterpolation,ktTodo,ktSpecialCharError,ktSpecialChar,ktDocTag,ktDocTagParam | ||
83 | |||
84 | syn match ktNumber "\v<\d+[_[:digit:]]*(uL?|UL?|[LFf])?" | ||
85 | syn match ktNumber "\v<0[Xx]\x+[_[:xdigit:]]*(uL?|UL?|L)?" | ||
86 | syn match ktNumber "\v<0[Bb][01]+[_01]*(uL?|UL?|L)?" | ||
87 | syn match ktFloat "\v<\d*(\d[eE][-+]?\d+|\.\d+([eE][-+]?\d+)?)[Ff]?" | ||
88 | |||
89 | syn match ktEscapedName "\v`.*`" | ||
90 | |||
91 | syn match ktExclExcl "!!" | ||
92 | syn match ktArrow "->" | ||
93 | |||
94 | hi def link ktStatement Statement | ||
95 | hi def link ktConditional Conditional | ||
96 | hi def link ktRepeat Repeat | ||
97 | hi def link ktOperator Operator | ||
98 | hi def link ktKeyword Keyword | ||
99 | hi def link ktException Exception | ||
100 | hi def link ktReservedKeyword Error | ||
101 | |||
102 | hi def link ktInclude Include | ||
103 | |||
104 | hi def link ktType Type | ||
105 | hi def link ktModifier StorageClass | ||
106 | hi def link ktStructure Structure | ||
107 | hi def link ktTypedef Typedef | ||
108 | |||
109 | hi def link ktBoolean Boolean | ||
110 | hi def link ktConstant Constant | ||
111 | |||
112 | hi def link ktTodo Todo | ||
113 | hi def link ktShebang Comment | ||
114 | hi def link ktLineComment Comment | ||
115 | hi def link ktComment Comment | ||
116 | hi def link ktCommentMatchGroup Comment | ||
117 | hi def link ktDocComment Comment | ||
118 | hi def link ktDocTag Special | ||
119 | hi def link ktDocTagParam Identifier | ||
120 | |||
121 | hi def link ktSpecialChar SpecialChar | ||
122 | hi def link ktSpecialCharError Error | ||
123 | hi def link ktString String | ||
124 | hi def link ktCharacter Character | ||
125 | |||
126 | hi def link ktAnnotation Identifier | ||
127 | hi def link ktLabel Identifier | ||
128 | |||
129 | hi def link ktSimpleInterpolation Identifier | ||
130 | hi def link ktComplexInterpolationBrace Identifier | ||
131 | |||
132 | hi def link ktNumber Number | ||
133 | hi def link ktFloat Float | ||
134 | |||
135 | hi def link ktExclExcl Special | ||
136 | hi def link ktArrow Structure | ||
137 | |||
138 | let b:current_syntax = 'kotlin' | ||
139 | |||
diff --git a/syntax/proto.vim b/syntax/proto.vim new file mode 100644 index 0000000..8545631 --- /dev/null +++ b/syntax/proto.vim | |||
@@ -0,0 +1,106 @@ | |||
1 | " Protocol Buffers - Google's data interchange format | ||
2 | " Copyright 2008 Google Inc. All rights reserved. | ||
3 | " https://developers.google.com/protocol-buffers/ | ||
4 | " | ||
5 | " Redistribution and use in source and binary forms, with or without | ||
6 | " modification, are permitted provided that the following conditions are | ||
7 | " met: | ||
8 | " | ||
9 | " * Redistributions of source code must retain the above copyright | ||
10 | " notice, this list of conditions and the following disclaimer. | ||
11 | " * Redistributions in binary form must reproduce the above | ||
12 | " copyright notice, this list of conditions and the following disclaimer | ||
13 | " in the documentation and/or other materials provided with the | ||
14 | " distribution. | ||
15 | " * Neither the name of Google Inc. nor the names of its | ||
16 | " contributors may be used to endorse or promote products derived from | ||
17 | " this software without specific prior written permission. | ||
18 | " | ||
19 | " THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
20 | " "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
21 | " LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
22 | " A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
23 | " OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
24 | " SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
25 | " LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
26 | " DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
27 | " THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
28 | " (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
29 | " OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
30 | |||
31 | " This is the Vim syntax file for Google Protocol Buffers. | ||
32 | " | ||
33 | " Usage: | ||
34 | " | ||
35 | " 1. cp proto.vim ~/.vim/syntax/ | ||
36 | " 2. Add the following to ~/.vimrc: | ||
37 | " | ||
38 | " augroup filetype | ||
39 | " au! BufRead,BufNewFile *.proto setfiletype proto | ||
40 | " augroup end | ||
41 | " | ||
42 | " Or just create a new file called ~/.vim/ftdetect/proto.vim with the | ||
43 | " previous lines on it. | ||
44 | |||
45 | if version < 600 | ||
46 | syntax clear | ||
47 | elseif exists("b:current_syntax") | ||
48 | finish | ||
49 | endif | ||
50 | |||
51 | syn case match | ||
52 | |||
53 | syn keyword pbTodo contained TODO FIXME XXX | ||
54 | syn cluster pbCommentGrp contains=pbTodo | ||
55 | |||
56 | syn keyword pbSyntax syntax import option | ||
57 | syn keyword pbStructure package message group oneof | ||
58 | syn keyword pbRepeat optional required repeated | ||
59 | syn keyword pbDefault default | ||
60 | syn keyword pbExtend extend extensions to max reserved | ||
61 | syn keyword pbRPC service rpc returns | ||
62 | |||
63 | syn keyword pbType int32 int64 uint32 uint64 sint32 sint64 | ||
64 | syn keyword pbType fixed32 fixed64 sfixed32 sfixed64 | ||
65 | syn keyword pbType float double bool string bytes | ||
66 | syn keyword pbTypedef enum | ||
67 | syn keyword pbBool true false | ||
68 | |||
69 | syn match pbInt /-\?\<\d\+\>/ | ||
70 | syn match pbInt /\<0[xX]\x+\>/ | ||
71 | syn match pbFloat /\<-\?\d*\(\.\d*\)\?/ | ||
72 | syn region pbComment start="\/\*" end="\*\/" contains=@pbCommentGrp | ||
73 | syn region pbComment start="//" skip="\\$" end="$" keepend contains=@pbCommentGrp | ||
74 | syn region pbString start=/"/ skip=/\\./ end=/"/ | ||
75 | syn region pbString start=/'/ skip=/\\./ end=/'/ | ||
76 | |||
77 | if version >= 508 || !exists("did_proto_syn_inits") | ||
78 | if version < 508 | ||
79 | let did_proto_syn_inits = 1 | ||
80 | command -nargs=+ HiLink hi link <args> | ||
81 | else | ||
82 | command -nargs=+ HiLink hi def link <args> | ||
83 | endif | ||
84 | |||
85 | HiLink pbTodo Todo | ||
86 | |||
87 | HiLink pbSyntax Include | ||
88 | HiLink pbStructure Structure | ||
89 | HiLink pbRepeat Repeat | ||
90 | HiLink pbDefault Keyword | ||
91 | HiLink pbExtend Keyword | ||
92 | HiLink pbRPC Keyword | ||
93 | HiLink pbType Type | ||
94 | HiLink pbTypedef Typedef | ||
95 | HiLink pbBool Boolean | ||
96 | |||
97 | HiLink pbInt Number | ||
98 | HiLink pbFloat Float | ||
99 | HiLink pbComment Comment | ||
100 | HiLink pbString String | ||
101 | |||
102 | delcommand HiLink | ||
103 | endif | ||
104 | |||
105 | let b:current_syntax = "proto" | ||
106 | |||