Mercurial > vim
annotate runtime/syntax/tads.vim @ 19077:568cce19fd2b v8.2.0099
patch 8.2.0099: use of NULL pointer when out of memory
Commit: https://github.com/vim/vim/commit/8b7aa2f9b238df916c161cdacda032c25d72a0ae
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 7 21:05:49 2020 +0100
patch 8.2.0099: use of NULL pointer when out of memory
Problem: Use of NULL pointer when out of memory.
Solution: Check for NULL pointer. (Dominique Pelle, closes https://github.com/vim/vim/issues/5449)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 07 Jan 2020 21:15:06 +0100 |
parents | 46763b01cd9a |
children |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: TADS | |
3 " Maintainer: Amir Karger <karger@post.harvard.edu> | |
2034 | 4 " $Date: 2004/06/13 19:28:45 $ |
5 " $Revision: 1.1 $ | |
7 | 6 " Stolen from: Bram Moolenaar's C language file |
7 " Newest version at: http://www.hec.utah.edu/~karger/vim/syntax/tads.vim | |
8 " History info at the bottom of the file | |
9 | |
10 " TODO lots more keywords | |
11 " global, self, etc. are special *objects*, not functions. They should | |
12 " probably be a different color than the special functions | |
13 " Actually, should cvtstr etc. be functions?! (change tadsFunction) | |
14 " Make global etc. into Identifiers, since we don't have regular variables? | |
15 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
16 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
17 if exists("b:current_syntax") |
7 | 18 finish |
19 endif | |
20 | |
21 " A bunch of useful keywords | |
22 syn keyword tadsStatement goto break return continue pass | |
23 syn keyword tadsLabel case default | |
24 syn keyword tadsConditional if else switch | |
25 syn keyword tadsRepeat while for do | |
26 syn keyword tadsStorageClass local compoundWord formatstring specialWords | |
27 syn keyword tadsBoolean nil true | |
28 | |
29 " TADS keywords | |
30 syn keyword tadsKeyword replace modify | |
31 syn keyword tadsKeyword global self inherited | |
32 " builtin functions | |
33 syn keyword tadsKeyword cvtstr cvtnum caps lower upper substr | |
34 syn keyword tadsKeyword say length | |
35 syn keyword tadsKeyword setit setscore | |
36 syn keyword tadsKeyword datatype proptype | |
37 syn keyword tadsKeyword car cdr | |
38 syn keyword tadsKeyword defined isclass | |
39 syn keyword tadsKeyword find firstobj nextobj | |
40 syn keyword tadsKeyword getarg argcount | |
41 syn keyword tadsKeyword input yorn askfile | |
42 syn keyword tadsKeyword rand randomize | |
43 syn keyword tadsKeyword restart restore quit save undo | |
44 syn keyword tadsException abort exit exitobj | |
45 | |
46 syn keyword tadsTodo contained TODO FIXME XXX | |
47 | |
48 " String and Character constants | |
49 " Highlight special characters (those which have a backslash) differently | |
50 syn match tadsSpecial contained "\\." | |
51 syn region tadsDoubleString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=tadsSpecial,tadsEmbedded | |
52 syn region tadsSingleString start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=tadsSpecial | |
53 " Embedded expressions in strings | |
54 syn region tadsEmbedded contained start="<<" end=">>" contains=tadsKeyword | |
55 | |
56 " TADS doesn't have \xxx, right? | |
57 "syn match cSpecial contained "\\[0-7][0-7][0-7]\=\|\\." | |
58 "syn match cSpecialCharacter "'\\[0-7][0-7]'" | |
59 "syn match cSpecialCharacter "'\\[0-7][0-7][0-7]'" | |
60 | |
61 "catch errors caused by wrong parenthesis | |
62 "syn region cParen transparent start='(' end=')' contains=ALLBUT,cParenError,cIncluded,cSpecial,cTodo,cUserCont,cUserLabel | |
63 "syn match cParenError ")" | |
64 "syn match cInParen contained "[{}]" | |
65 syn region tadsBrace transparent start='{' end='}' contains=ALLBUT,tadsBraceError,tadsIncluded,tadsSpecial,tadsTodo | |
66 syn match tadsBraceError "}" | |
67 | |
68 "integer number (TADS has no floating point numbers) | |
69 syn case ignore | |
70 syn match tadsNumber "\<[0-9]\+\>" | |
71 "hex number | |
72 syn match tadsNumber "\<0x[0-9a-f]\+\>" | |
73 syn match tadsIdentifier "\<[a-z][a-z0-9_$]*\>" | |
74 syn case match | |
75 " flag an octal number with wrong digits | |
76 syn match tadsOctalError "\<0[0-7]*[89]" | |
77 | |
78 " Removed complicated c_comment_strings | |
79 syn region tadsComment start="/\*" end="\*/" contains=tadsTodo | |
80 syn match tadsComment "//.*" contains=tadsTodo | |
81 syntax match tadsCommentError "\*/" | |
82 | |
83 syn region tadsPreCondit start="^\s*#\s*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=tadsComment,tadsString,tadsNumber,tadsCommentError | |
84 syn region tadsIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ | |
85 syn match tadsIncluded contained "<[^>]*>" | |
86 syn match tadsInclude "^\s*#\s*include\>\s*["<]" contains=tadsIncluded | |
87 syn region tadsDefine start="^\s*#\s*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,tadsPreCondit,tadsIncluded,tadsInclude,tadsDefine,tadsInBrace,tadsIdentifier | |
88 | |
89 syn region tadsPreProc start="^\s*#\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,tadsPreCondit,tadsIncluded,tadsInclude,tadsDefine,tadsInParen,tadsIdentifier | |
90 | |
91 " Highlight User Labels | |
92 " TODO labels for gotos? | |
93 "syn region cMulti transparent start='?' end=':' contains=ALLBUT,cIncluded,cSpecial,cTodo,cUserCont,cUserLabel,cBitField | |
94 " Avoid matching foo::bar() in C++ by requiring that the next char is not ':' | |
95 "syn match cUserCont "^\s*\I\i*\s*:$" contains=cUserLabel | |
96 "syn match cUserCont ";\s*\I\i*\s*:$" contains=cUserLabel | |
97 "syn match cUserCont "^\s*\I\i*\s*:[^:]" contains=cUserLabel | |
98 "syn match cUserCont ";\s*\I\i*\s*:[^:]" contains=cUserLabel | |
99 | |
100 "syn match cUserLabel "\I\i*" contained | |
101 | |
102 " identifier: class-name [, class-name [...]] [property-list] ; | |
103 " Don't highlight comment in class def | |
104 syn match tadsClassDef "\<class\>[^/]*" contains=tadsObjectDef,tadsClass | |
105 syn match tadsClass contained "\<class\>" | |
106 syn match tadsObjectDef "\<[a-zA-Z][a-zA-Z0-9_$]*\s*:\s*[a-zA-Z0-9_$]\+\(\s*,\s*[a-zA-Z][a-zA-Z0-9_$]*\)*\(\s*;\)\=" | |
107 syn keyword tadsFunction contained function | |
108 syn match tadsFunctionDef "\<[a-zA-Z][a-zA-Z0-9_$]*\s*:\s*function[^{]*" contains=tadsFunction | |
109 "syn region tadsObject transparent start = '[a-zA-Z][\i$]\s*:\s*' end=";" contains=tadsBrace,tadsObjectDef | |
110 | |
111 " How far back do we go to find matching groups | |
112 if !exists("tads_minlines") | |
113 let tads_minlines = 15 | |
114 endif | |
115 exec "syn sync ccomment tadsComment minlines=" . tads_minlines | |
116 if !exists("tads_sync_dist") | |
117 let tads_sync_dist = 100 | |
118 endif | |
119 execute "syn sync maxlines=" . tads_sync_dist | |
120 | |
121 " Define the default highlighting. | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
122 " Only when an item doesn't have highlighting yet |
7 | 123 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
2034
diff
changeset
|
124 " The default methods for highlighting. Can be overridden later |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link tadsFunctionDef Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link tadsFunction Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link tadsClass Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link tadsClassDef Identifier |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link tadsObjectDef Identifier |
7 | 130 " no highlight for tadsEmbedded, so it prints as normal text w/in the string |
131 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
132 hi def link tadsOperator Operator |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
133 hi def link tadsStructure Structure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
134 hi def link tadsTodo Todo |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
135 hi def link tadsLabel Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
136 hi def link tadsConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
137 hi def link tadsRepeat Repeat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
138 hi def link tadsException Exception |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
139 hi def link tadsStatement Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
140 hi def link tadsStorageClass StorageClass |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
141 hi def link tadsKeyWord Keyword |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
142 hi def link tadsSpecial SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
143 hi def link tadsNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
144 hi def link tadsBoolean Boolean |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
145 hi def link tadsDoubleString tadsString |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
146 hi def link tadsSingleString tadsString |
7 | 147 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
148 hi def link tadsOctalError tadsError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
149 hi def link tadsCommentError tadsError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
150 hi def link tadsBraceError tadsError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
151 hi def link tadsInBrace tadsError |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
152 hi def link tadsError Error |
7 | 153 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
154 hi def link tadsInclude Include |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
155 hi def link tadsPreProc PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
156 hi def link tadsDefine Macro |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
157 hi def link tadsIncluded tadsString |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
158 hi def link tadsPreCondit PreCondit |
7 | 159 |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
160 hi def link tadsString String |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
161 hi def link tadsComment Comment |
7 | 162 |
163 | |
164 | |
165 let b:current_syntax = "tads" | |
166 | |
167 " Changes: | |
168 " 11/18/99 Added a bunch of TADS functions, tadsException | |
169 " 10/22/99 Misspelled Moolenaar (sorry!), c_minlines to tads_minlines | |
170 " | |
171 " vim: ts=8 |