annotate runtime/syntax/mojo.vim @ 33480:f8dd278ab05f v9.0.1991

patch 9.0.1991: no cmdline completion for setting the font Commit: https://github.com/vim/vim/commit/290b887e8cc2c0d3dfc7f315b2052472c7c589cc Author: Yee Cheng Chin <ychin.git@gmail.com> Date: Thu Oct 5 20:54:21 2023 +0200 patch 9.0.1991: no cmdline completion for setting the font Problem: no cmdline completion for setting the font Solution: enable it on Win32 and GTK builds Add guifont cmdline completion (for Windows and GTK) For Windows, auto-complete will only suggest monospace fonts as that's the only types allowed. Will also suggest font options after the colon, including suggesting the current font size for convenience, and misc charset and quality options like `cANSI` and `qCLEARTYPE`. For GTK, auto-complete will suggest only monospace fonts for `guifont` but will include all fonts for `guifontwide`. The completion code doesn't currently suggest the current font size, as the GTK guifont format does not have a clear delimiter (':' for other platforms). closes: #13264 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
author Christian Brabandt <cb@256bit.org>
date Thu, 05 Oct 2023 21:00:07 +0200
parents 44fa2b82a642
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33235
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Vim syntax file
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 " Language: Mojo
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 " Maintainer: Mahmoud Abduljawad <me@mahmoudajawad.com>
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 " Last Change: 2023 Sep 09
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 " Credits: Mahmoud Abduljawad <me@mahmoudajawad.com>
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 " Neil Schemenauer <nas@python.ca>
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 " Dmitry Vasiliev
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 " This is based on Vim Python highlighting
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " - introduced highlighting of doctests
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 " - updated keywords, built-ins, and exceptions
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 " - corrected regular expressions for
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 " * functions
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 " * decorators
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 " * strings
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 " * escapes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " * numbers
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 " * space error
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 " - corrected synchronization
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 " - more highlighting is ON by default, except
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 " - space error highlighting is OFF by default
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 " Optional highlighting can be controlled using these variables.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 " let mojo_no_builtin_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 " let mojo_no_doctest_code_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 " let mojo_no_doctest_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " let mojo_no_exception_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 " let mojo_no_number_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " let mojo_space_error_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 " All the options above can be switched on together.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 " let mojo_highlight_all = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 " The use of Python 2 compatible syntax highlighting can be enforced.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 " The straddling code (Python 2 and 3 compatible), up to Python 3.5,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " will be also supported.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 " let mojo_use_python2_syntax = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 " This option will exclude all modern Python 3.6 or higher features.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 " quit when a syntax file was already loaded.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 if exists("b:current_syntax")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 finish
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 " We need nocompatible mode in order to continue lines with backslashes.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 " Original setting will be restored.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 let s:cpo_save = &cpo
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 set cpo&vim
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 if exists("mojo_no_doctest_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 let mojo_no_doctest_code_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 if exists("mojo_highlight_all")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
63 if exists("mojo_no_builtin_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 unlet mojo_no_builtin_highlight
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 if exists("mojo_no_doctest_code_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 unlet mojo_no_doctest_code_highlight
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 if exists("mojo_no_doctest_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 unlet mojo_no_doctest_highlight
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 if exists("mojo_no_exception_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 unlet mojo_no_exception_highlight
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 if exists("mojo_no_number_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 unlet mojo_no_number_highlight
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
78 let mojo_space_error_highlight = 1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
79 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 " These keywords are based on Python syntax highlight, and adds to it struct,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82 " fn, alias, var, let
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 syn keyword mojoStatement False None True
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 syn keyword mojoStatement as assert break continue del global
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 syn keyword mojoStatement lambda nonlocal pass return with yield
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87 syn keyword mojoStatement class def nextgroup=mojoFunction skipwhite
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
88 syn keyword mojoStatement struct fn nextgroup=mojoFunction skipwhite
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
89 syn keyword mojoStatement alias var let
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 syn keyword mojoConditional elif else if
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 syn keyword mojoRepeat for while
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 syn keyword mojoOperator and in is not or
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93 syn keyword mojoException except finally raise try
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 syn keyword mojoInclude from import
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 syn keyword mojoAsync async await
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 " Soft keywords
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 " These keywords do not mean anything unless used in the right context.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 " See https://docs.python.org/3/reference/lexical_analysis.html#soft-keywords
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 " for more on this.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 syn match mojoConditional "^\s*\zscase\%(\s\+.*:.*$\)\@="
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102 syn match mojoConditional "^\s*\zsmatch\%(\s\+.*:\s*\%(#.*\)\=$\)\@="
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
103
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104 " Decorators
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 " A dot must be allowed because of @MyClass.myfunc decorators.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 syn match mojoDecorator "@" display contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107 syn match mojoDecoratorName "@\s*\h\%(\w\|\.\)*" display contains=pythonDecorator
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 " Python 3.5 introduced the use of the same symbol for matrix multiplication:
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 " https://www.python.org/dev/peps/pep-0465/. We now have to exclude the
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111 " symbol from highlighting when used in that context.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 " Single line multiplication.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 syn match mojoMatrixMultiply
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
114 \ "\%(\w\|[])]\)\s*@"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 \ transparent
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117 " Multiplication continued on the next line after backslash.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 syn match mojoMatrixMultiply
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
119 \ "[^\\]\\\s*\n\%(\s*\.\.\.\s\)\=\s\+@"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
120 \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 \ transparent
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 " Multiplication in a parenthesized expression over multiple lines with @ at
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 " the start of each continued line; very similar to decorators and complex.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 syn match mojoMatrixMultiply
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 \ "^\s*\%(\%(>>>\|\.\.\.\)\s\+\)\=\zs\%(\h\|\%(\h\|[[(]\).\{-}\%(\w\|[])]\)\)\s*\n\%(\s*\.\.\.\s\)\=\s\+@\%(.\{-}\n\%(\s*\.\.\.\s\)\=\s\+@\)*"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 \ contains=ALLBUT,mojoDecoratorName,mojoDecorator,mojoFunction,mojoDoctestValue
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 \ transparent
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 syn match mojoFunction "\h\w*" display contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 syn match mojoComment "#.*$" contains=mojoTodo,@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 syn keyword mojoTodo FIXME NOTE NOTES TODO XXX contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 " Triple-quoted strings can contain doctests.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 syn region mojoString matchgroup=mojoQuotes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 \ contains=mojoEscape,@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 syn region mojoString matchgroup=mojoTripleQuotes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 \ contains=mojoEscape,mojoSpaceError,mojoDoctest,@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 syn region mojoRawString matchgroup=mojoQuotes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 \ contains=@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 syn region mojoRawString matchgroup=pythonTripleQuotes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145 \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 \ contains=pythonSpaceError,mojoDoctest,@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
148 syn match mojoEscape +\\[abfnrtv'"\\]+ contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 syn match mojoEscape "\\\o\{1,3}" contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 syn match mojoEscape "\\x\x\{2}" contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 syn match mojoEscape "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 " Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 syn match mojoEscape "\\N{\a\+\%(\s\a\+\)*}" contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 syn match mojoEscape "\\$"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 " It is very important to understand all details before changing the
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 " regular expressions below or their order.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 " The word boundaries are *not* the floating-point number boundaries
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 " because of a possible leading or trailing decimal point.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160 " The expressions below ensure that all valid number literals are
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 " highlighted, and invalid number literals are not. For example,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 " - a decimal point in '4.' at the end of a line is highlighted,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164 " - a second dot in 1.0.0 is not highlighted,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 " - 08 is not highlighted,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 " - 08e0 or 08j are highlighted,
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 " and so on, as specified in the 'Python Language Reference'.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 " https://docs.python.org/reference/lexical_analysis.html#numeric-literals
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170 if !exists("mojo_no_number_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 " numbers (including complex)
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 syn match mojoNumber "\<0[oO]\%(_\=\o\)\+\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173 syn match mojoNumber "\<0[xX]\%(_\=\x\)\+\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 syn match mojoNumber "\<0[bB]\%(_\=[01]\)\+\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 syn match mojoNumber "\<\%([1-9]\%(_\=\d\)*\|0\+\%(_\=0\)*\)\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 syn match mojoNumber "\<\d\%(_\=\d\)*[jJ]\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 syn match mojoNumber "\<\d\%(_\=\d\)*[eE][+-]\=\d\%(_\=\d\)*[jJ]\=\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 syn match mojoNumber
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179 \ "\<\d\%(_\=\d\)*\.\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\%(\W\|$\)\@="
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 syn match mojoNumber
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 \ "\%(^\|\W\)\zs\%(\d\%(_\=\d\)*\)\=\.\d\%(_\=\d\)*\%([eE][+-]\=\d\%(_\=\d\)*\)\=[jJ]\=\>"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 " The built-ins are added in the same order of appearance in Mojo stdlib docs
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185 " https://docs.modular.com/mojo/lib.html
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 if !exists("mojo_no_builtin_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 " Built-in functions
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 syn keyword mojoBuiltin slice constrained debug_assert put_new_line print
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 syn keyword mojoBuiltin print_no_newline len range rebind element_type
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 syn keyword mojoBuiltin ord chr atol isdigit index address string
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 " Built-in types
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 syn keyword mojoType Byte ListLiteral CoroutineContext Coroutine DType
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 syn keyword mojoType dtype type invalid bool int8 si8 unit8 ui8 int16
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 syn keyword mojoType si16 unit16 ui16 int32 si32 uint32 ui32 int64
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 syn keyword mojoType si64 uint64 ui64 bfloat16 bf16 float16 f16 float32
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 syn keyword mojoType f32 float64 f64 Error FloatLiteral Int Attr SIMD
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 syn keyword mojoType Int8 UInt8 Int16 UInt16 Int32 UInt32 Int64 UInt64
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 syn keyword mojoType Float16 Float32 Float64 element_type _65x13_type
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 syn keyword mojoType String StringLiteral StringRef Tuple AnyType
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 syn keyword mojoType NoneType None Lifetime
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 " avoid highlighting attributes as builtins
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 syn match mojoAttribute /\.\h\w*/hs=s+1
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204 \ contains=ALLBUT,mojoBuiltin,mojoFunction,mojoAsync
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 \ transparent
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 " From the 'Python Library Reference' class hierarchy at the bottom.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209 " http://docs.python.org/library/exceptions.html
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 if !exists("mojo_no_exception_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 " builtin base exceptions (used mostly as base classes for other exceptions)
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 syn keyword mojoExceptions BaseException Exception
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213 syn keyword mojoExceptions ArithmeticError BufferError LookupError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 " builtin exceptions (actually raised)
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 syn keyword mojoExceptions AssertionError AttributeError EOFError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 syn keyword mojoExceptions FloatingPointError GeneratorExit ImportError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 syn keyword mojoExceptions IndentationError IndexError KeyError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 syn keyword mojoExceptions KeyboardInterrupt MemoryError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 syn keyword mojoExceptions ModuleNotFoundError NameError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 syn keyword mojoExceptions NotImplementedError OSError OverflowError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 syn keyword mojoExceptions RecursionError ReferenceError RuntimeError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 syn keyword mojoExceptions StopAsyncIteration StopIteration SyntaxError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 syn keyword mojoExceptions SystemError SystemExit TabError TypeError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 syn keyword mojoExceptions UnboundLocalError UnicodeDecodeError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 syn keyword mojoExceptions UnicodeEncodeError UnicodeError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226 syn keyword mojoExceptions UnicodeTranslateError ValueError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 syn keyword mojoExceptions ZeroDivisionError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 " builtin exception aliases for OSError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 syn keyword mojoExceptions EnvironmentError IOError WindowsError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 " builtin OS exceptions in Python 3
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 syn keyword mojoExceptions BlockingIOError BrokenPipeError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 syn keyword mojoExceptions ChildProcessError ConnectionAbortedError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 syn keyword mojoExceptions ConnectionError ConnectionRefusedError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 syn keyword mojoExceptions ConnectionResetError FileExistsError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 syn keyword mojoExceptions FileNotFoundError InterruptedError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 syn keyword mojoExceptions IsADirectoryError NotADirectoryError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 syn keyword mojoExceptions PermissionError ProcessLookupError TimeoutError
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 " builtin warnings
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 syn keyword mojoExceptions BytesWarning DeprecationWarning FutureWarning
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 syn keyword mojoExceptions ImportWarning PendingDeprecationWarning
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 syn keyword mojoExceptions ResourceWarning RuntimeWarning
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 syn keyword mojoExceptions SyntaxWarning UnicodeWarning
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243 syn keyword mojoExceptions UserWarning Warning
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 if exists("mojo_space_error_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 " trailing whitespace
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 syn match mojoSpaceError display excludenl "\s\+$"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 " mixed tabs and spaces
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 syn match mojoSpaceError display " \+\t"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 syn match mojoSpaceError display "\t\+ "
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 " Do not spell doctests inside strings.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 " Notice that the end of a string, either ''', or """, will end the contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256 " doctest too. Thus, we do *not* need to have it as an end pattern.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 if !exists("mojo_no_doctest_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 if !exists("mojo_no_doctest_code_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 syn region mojoDoctest
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 \ start="^\s*>>>\s" end="^\s*$"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261 \ contained contains=ALLBUT,mojoDoctest,mojoFunction,@Spell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 syn region mojoDoctestValue
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 \ contained
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265 else
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 syn region mojoDoctest
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267 \ start="^\s*>>>" end="^\s*$"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 \ contained contains=@NoSpell
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 " Sync at the beginning of class, function, or method definition.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 syn sync match mojoSync grouphere NONE "^\%(def\|class\)\s\+\h\w*\s*[(:]"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275 " The default highlight links. Can be overridden later.
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 hi def link mojoStatement Statement
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 hi def link mojoConditional Conditional
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278 hi def link mojoRepeat Repeat
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 hi def link mojoOperator Operator
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 hi def link mojoException Exception
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281 hi def link mojoInclude Include
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 hi def link mojoAsync Statement
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 hi def link mojoDecorator Define
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284 hi def link mojoDecoratorName Function
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 hi def link mojoFunction Function
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 hi def link mojoComment Comment
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 hi def link mojoTodo Todo
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 hi def link mojoString String
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 hi def link mojoRawString String
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 hi def link mojoQuotes String
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 hi def link mojoTripleQuotes mojoQuotes
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 hi def link mojoEscape Special
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 if !exists("mojo_no_number_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294 hi def link mojoNumber Number
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 if !exists("mojo_no_builtin_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 hi def link mojoBuiltin Function
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298 hi def link mojoType Type
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300 if !exists("mojo_no_exception_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 hi def link mojoExceptions Structure
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303 if exists("mojo_space_error_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 hi def link mojoSpaceError Error
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 if !exists("mojo_no_doctest_highlight")
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 hi def link mojoDoctest Special
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 hi def link mojoDoctestValue Define
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309 endif
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 let b:current_syntax = "mojo"
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313 let &cpo = s:cpo_save
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 unlet s:cpo_save
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315
44fa2b82a642 patch 9.0.1891: No runtime support for Mojo
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 " vim:set sw=2 sts=2 ts=8 noet: