annotate runtime/syntax/hare.vim @ 31653:ec76f9d2319e v9.0.1159

patch 9.0.1159: extends argument for class not implemented yet Commit: https://github.com/vim/vim/commit/8367716a6e9589d61a771e6c329da05c9b55e61a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 8 19:54:10 2023 +0000 patch 9.0.1159: extends argument for class not implemented yet Problem: Extends argument for class not implemented yet. Solution: Basic implementation of "extends".
author Bram Moolenaar <Bram@vim.org>
date Sun, 08 Jan 2023 21:00:05 +0100
parents 1e91e26ceebf
children ea0402ba92f6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " PRELUDE {{{1
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 " Vim syntax file
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 " Language: Hare
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 " Maintainer: Amelia Clarke <me@rsaihe.dev>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 " Last Change: 2022-09-21
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 if exists("b:current_syntax")
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 finish
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 endif
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 let b:current_syntax = "hare"
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 " SYNTAX {{{1
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 syn case match
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 " KEYWORDS {{{2
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 syn keyword hareConditional if else match switch
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 syn keyword hareKeyword break continue return yield
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 syn keyword hareKeyword defer
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 syn keyword hareKeyword fn
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 syn keyword hareKeyword let
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 syn keyword hareLabel case
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 syn keyword hareOperator as is
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 syn keyword hareRepeat for
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 syn keyword hareStorageClass const def export nullable static
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 syn keyword hareStructure enum struct union
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 syn keyword hareTypedef type
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 " C ABI.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 syn keyword hareKeyword vastart vaarg vaend
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 " BUILTINS {{{2
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 syn keyword hareBuiltin abort
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 syn keyword hareBuiltin alloc free
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 syn keyword hareBuiltin append delete insert
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 syn keyword hareBuiltin assert
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 syn keyword hareBuiltin len offset
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 " TYPES {{{2
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 syn keyword hareType bool
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 syn keyword hareType char str
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 syn keyword hareType f32 f64
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 syn keyword hareType u8 u16 u32 u64 i8 i16 i32 i64
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 syn keyword hareType uint int
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 syn keyword hareType rune
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 syn keyword hareType uintptr
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 syn keyword hareType void
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 " C ABI.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 syn keyword hareType valist
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 " LITERALS {{{2
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 syn keyword hareBoolean true false
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 syn keyword hareNull null
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 " Number literals.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 syn match hareNumber "\v(\.@1<!|\.\.)\zs<\d+([Ee][+-]?\d+)?(z|[iu](8|16|32|64)?)?>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 syn match hareNumber "\v(\.@1<!|\.\.)\zs<0b[01]+(z|[iu](8|16|32|64)?)?>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 syn match hareNumber "\v(\.@1<!|\.\.)\zs<0o\o+(z|[iu](8|16|32|64)?)?>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 syn match hareNumber "\v(\.@1<!|\.\.)\zs<0x\x+(z|[iu](8|16|32|64)?)?>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 " Floating-point number literals.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 syn match hareFloat "\v<\d+\.\d+([Ee][+-]?\d+)?(f32|f64)?>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 syn match hareFloat "\v<\d+([Ee][+-]?\d+)?(f32|f64)>" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 " String and rune literals.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 syn match hareEscape "\\[\\'"0abfnrtv]" contained display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 syn match hareEscape "\v\\(x\x{2}|u\x{4}|U\x{8})" contained display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 syn match hareFormat "\v\{\d*(\%\d*|(:[ 0+-]?\d*(\.\d+)?[Xbox]?))?}" contained display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 syn match hareFormat "\({{\|}}\)" contained display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 syn region hareRune start="'" end="'\|$" skip="\\'" contains=hareEscape display extend
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 syn region hareString start=+"+ end=+"\|$+ skip=+\\"+ contains=hareEscape,hareFormat display extend
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 syn region hareString start="`" end="`\|$" contains=hareFormat display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 " MISCELLANEOUS {{{2
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 syn keyword hareTodo FIXME TODO XXX contained
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 " Attributes.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 syn match hareAttribute "@[a-z]*"
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " Blocks.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 syn region hareBlock start="{" end="}" fold transparent
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 " Comments.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 syn region hareComment start="//" end="$" contains=hareCommentDoc,hareTodo,@Spell display keepend
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 syn region hareCommentDoc start="\[\[" end="]]\|\ze\_s" contained display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 " The size keyword can be either a builtin or a type.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 syn match hareBuiltin "\v<size>\ze(\_s*//.*\_$)*\_s*\(" contains=hareComment
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 syn match hareType "\v<size>((\_s*//.*\_$)*\_s*\()@!" contains=hareComment
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 " Trailing whitespace.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 syn match hareSpaceError "\v\s+$" display excludenl
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 syn match hareSpaceError "\v\zs +\ze\t" display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 " Use statement.
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 syn region hareUse start="\v^\s*\zsuse>" end=";" contains=hareComment display
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 syn match hareErrorAssertion "\v(^([^/]|//@!)*\)\_s*)@<=!\=@!"
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 syn match hareQuestionMark "?"
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 " DEFAULT HIGHLIGHTING {{{1
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 hi def link hareAttribute Keyword
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 hi def link hareBoolean Boolean
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 hi def link hareBuiltin Function
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 hi def link hareComment Comment
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 hi def link hareCommentDoc SpecialComment
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 hi def link hareConditional Conditional
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 hi def link hareEscape SpecialChar
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 hi def link hareFloat Float
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 hi def link hareFormat SpecialChar
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 hi def link hareKeyword Keyword
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 hi def link hareLabel Label
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 hi def link hareNull Constant
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 hi def link hareNumber Number
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 hi def link hareOperator Operator
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 hi def link hareQuestionMark Special
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117 hi def link hareRepeat Repeat
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 hi def link hareRune Character
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 hi def link hareStorageClass StorageClass
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 hi def link hareString String
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 hi def link hareStructure Structure
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 hi def link hareTodo Todo
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 hi def link hareType Type
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 hi def link hareTypedef Typedef
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 hi def link hareUse PreProc
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 hi def link hareSpaceError Error
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 autocmd InsertEnter * hi link hareSpaceError NONE
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 autocmd InsertLeave * hi link hareSpaceError Error
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 hi def hareErrorAssertion ctermfg=red cterm=bold guifg=red gui=bold
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 " vim: tabstop=8 shiftwidth=2 expandtab