Mercurial > vim
annotate runtime/syntax/basic.vim @ 27084:6fc63c6a7ee7 v8.2.4071
patch 8.2.4071: Vim9: no detection of return in try/endtry
Commit: https://github.com/vim/vim/commit/53c296112edd8471eb63afbca03f96bad164c813
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jan 12 16:18:18 2022 +0000
patch 8.2.4071: Vim9: no detection of return in try/endtry
Problem: Vim9: no detection of return in try/endtry. (Dominique Pell?)
Solution: Check if any of the blocks inside try/endtry did not end in
return.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 12 Jan 2022 17:30:07 +0100 |
parents | 34b4eb3a8458 |
children | 5825405e4e2c |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
23737 | 2 " Language: BASIC |
3 " Maintainer: Doug Kearns <dougkearns@gmail.com> | |
4 " Previous Maintainer: Allan Kelly <allan@fruitloaf.co.uk> | |
5 " Contributors: Thilo Six | |
6 " Last Change: 2015 Jan 10 | |
7 | 7 |
8 " First version based on Micro$soft QBASIC circa 1989, as documented in | |
9 " 'Learn BASIC Now' by Halvorson&Rygmyr. Microsoft Press 1989. | |
10 " This syntax file not a complete implementation yet. Send suggestions to the | |
11 " maintainer. | |
12 | |
23737 | 13 " Prelude {{{1 |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3237
diff
changeset
|
14 if exists("b:current_syntax") |
7 | 15 finish |
16 endif | |
17 | |
3237 | 18 let s:cpo_save = &cpo |
19 set cpo&vim | |
20 | |
23737 | 21 " Keywords {{{1 |
7 | 22 syn keyword basicStatement BEEP beep Beep BLOAD bload Bload BSAVE bsave Bsave |
23 syn keyword basicStatement CALL call Call ABSOLUTE absolute Absolute | |
24 syn keyword basicStatement CHAIN chain Chain CHDIR chdir Chdir | |
25 syn keyword basicStatement CIRCLE circle Circle CLEAR clear Clear | |
26 syn keyword basicStatement CLOSE close Close CLS cls Cls COLOR color Color | |
27 syn keyword basicStatement COM com Com COMMON common Common | |
28 syn keyword basicStatement CONST const Const DATA data Data | |
29 syn keyword basicStatement DECLARE declare Declare DEF def Def | |
30 syn keyword basicStatement DEFDBL defdbl Defdbl DEFINT defint Defint | |
31 syn keyword basicStatement DEFLNG deflng Deflng DEFSNG defsng Defsng | |
32 syn keyword basicStatement DEFSTR defstr Defstr DIM dim Dim | |
33 syn keyword basicStatement DO do Do LOOP loop Loop | |
34 syn keyword basicStatement DRAW draw Draw END end End | |
35 syn keyword basicStatement ENVIRON environ Environ ERASE erase Erase | |
36 syn keyword basicStatement ERROR error Error EXIT exit Exit | |
37 syn keyword basicStatement FIELD field Field FILES files Files | |
38 syn keyword basicStatement FOR for For NEXT next Next | |
39 syn keyword basicStatement FUNCTION function Function GET get Get | |
40 syn keyword basicStatement GOSUB gosub Gosub GOTO goto Goto | |
41 syn keyword basicStatement IF if If THEN then Then ELSE else Else | |
42 syn keyword basicStatement INPUT input Input INPUT# input# Input# | |
43 syn keyword basicStatement IOCTL ioctl Ioctl KEY key Key | |
44 syn keyword basicStatement KILL kill Kill LET let Let | |
45 syn keyword basicStatement LINE line Line LOCATE locate Locate | |
46 syn keyword basicStatement LOCK lock Lock UNLOCK unlock Unlock | |
47 syn keyword basicStatement LPRINT lprint Lprint USING using Using | |
48 syn keyword basicStatement LSET lset Lset MKDIR mkdir Mkdir | |
49 syn keyword basicStatement NAME name Name ON on On | |
50 syn keyword basicStatement ERROR error Error OPEN open Open | |
51 syn keyword basicStatement OPTION option Option BASE base Base | |
52 syn keyword basicStatement OUT out Out PAINT paint Paint | |
53 syn keyword basicStatement PALETTE palette Palette PCOPY pcopy Pcopy | |
54 syn keyword basicStatement PEN pen Pen PLAY play Play | |
55 syn keyword basicStatement PMAP pmap Pmap POKE poke Poke | |
56 syn keyword basicStatement PRESET preset Preset PRINT print Print | |
57 syn keyword basicStatement PRINT# print# Print# USING using Using | |
58 syn keyword basicStatement PSET pset Pset PUT put Put | |
59 syn keyword basicStatement RANDOMIZE randomize Randomize READ read Read | |
60 syn keyword basicStatement REDIM redim Redim RESET reset Reset | |
61 syn keyword basicStatement RESTORE restore Restore RESUME resume Resume | |
62 syn keyword basicStatement RETURN return Return RMDIR rmdir Rmdir | |
63 syn keyword basicStatement RSET rset Rset RUN run Run | |
64 syn keyword basicStatement SEEK seek Seek SELECT select Select | |
65 syn keyword basicStatement CASE case Case SHARED shared Shared | |
66 syn keyword basicStatement SHELL shell Shell SLEEP sleep Sleep | |
67 syn keyword basicStatement SOUND sound Sound STATIC static Static | |
68 syn keyword basicStatement STOP stop Stop STRIG strig Strig | |
69 syn keyword basicStatement SUB sub Sub SWAP swap Swap | |
70 syn keyword basicStatement SYSTEM system System TIMER timer Timer | |
71 syn keyword basicStatement TROFF troff Troff TRON tron Tron | |
72 syn keyword basicStatement TYPE type Type UNLOCK unlock Unlock | |
73 syn keyword basicStatement VIEW view View WAIT wait Wait | |
74 syn keyword basicStatement WHILE while While WEND wend Wend | |
75 syn keyword basicStatement WIDTH width Width WINDOW window Window | |
76 syn keyword basicStatement WRITE write Write DATE$ date$ Date$ | |
77 syn keyword basicStatement MID$ mid$ Mid$ TIME$ time$ Time$ | |
78 | |
79 syn keyword basicFunction ABS abs Abs ASC asc Asc | |
80 syn keyword basicFunction ATN atn Atn CDBL cdbl Cdbl | |
81 syn keyword basicFunction CINT cint Cint CLNG clng Clng | |
82 syn keyword basicFunction COS cos Cos CSNG csng Csng | |
83 syn keyword basicFunction CSRLIN csrlin Csrlin CVD cvd Cvd | |
84 syn keyword basicFunction CVDMBF cvdmbf Cvdmbf CVI cvi Cvi | |
85 syn keyword basicFunction CVL cvl Cvl CVS cvs Cvs | |
86 syn keyword basicFunction CVSMBF cvsmbf Cvsmbf EOF eof Eof | |
87 syn keyword basicFunction ERDEV erdev Erdev ERL erl Erl | |
88 syn keyword basicFunction ERR err Err EXP exp Exp | |
89 syn keyword basicFunction FILEATTR fileattr Fileattr FIX fix Fix | |
90 syn keyword basicFunction FRE fre Fre FREEFILE freefile Freefile | |
91 syn keyword basicFunction INP inp Inp INSTR instr Instr | |
92 syn keyword basicFunction INT int Int LBOUND lbound Lbound | |
93 syn keyword basicFunction LEN len Len LOC loc Loc | |
94 syn keyword basicFunction LOF lof Lof LOG log Log | |
95 syn keyword basicFunction LPOS lpos Lpos PEEK peek Peek | |
96 syn keyword basicFunction PEN pen Pen POINT point Point | |
97 syn keyword basicFunction POS pos Pos RND rnd Rnd | |
98 syn keyword basicFunction SADD sadd Sadd SCREEN screen Screen | |
99 syn keyword basicFunction SEEK seek Seek SETMEM setmem Setmem | |
100 syn keyword basicFunction SGN sgn Sgn SIN sin Sin | |
101 syn keyword basicFunction SPC spc Spc SQR sqr Sqr | |
102 syn keyword basicFunction STICK stick Stick STRIG strig Strig | |
103 syn keyword basicFunction TAB tab Tab TAN tan Tan | |
104 syn keyword basicFunction UBOUND ubound Ubound VAL val Val | |
105 syn keyword basicFunction VALPTR valptr Valptr VALSEG valseg Valseg | |
106 syn keyword basicFunction VARPTR varptr Varptr VARSEG varseg Varseg | |
107 syn keyword basicFunction CHR$ Chr$ chr$ COMMAND$ command$ Command$ | |
108 syn keyword basicFunction DATE$ date$ Date$ ENVIRON$ environ$ Environ$ | |
109 syn keyword basicFunction ERDEV$ erdev$ Erdev$ HEX$ hex$ Hex$ | |
110 syn keyword basicFunction INKEY$ inkey$ Inkey$ INPUT$ input$ Input$ | |
111 syn keyword basicFunction IOCTL$ ioctl$ Ioctl$ LCASES$ lcases$ Lcases$ | |
112 syn keyword basicFunction LAFT$ laft$ Laft$ LTRIM$ ltrim$ Ltrim$ | |
113 syn keyword basicFunction MID$ mid$ Mid$ MKDMBF$ mkdmbf$ Mkdmbf$ | |
114 syn keyword basicFunction MKD$ mkd$ Mkd$ MKI$ mki$ Mki$ | |
115 syn keyword basicFunction MKL$ mkl$ Mkl$ MKSMBF$ mksmbf$ Mksmbf$ | |
116 syn keyword basicFunction MKS$ mks$ Mks$ OCT$ oct$ Oct$ | |
117 syn keyword basicFunction RIGHT$ right$ Right$ RTRIM$ rtrim$ Rtrim$ | |
118 syn keyword basicFunction SPACE$ space$ Space$ STR$ str$ Str$ | |
119 syn keyword basicFunction STRING$ string$ String$ TIME$ time$ Time$ | |
120 syn keyword basicFunction UCASE$ ucase$ Ucase$ VARPTR$ varptr$ Varptr$ | |
121 | |
23737 | 122 " Numbers {{{1 |
123 " Integer number, or floating point number without a dot. | |
7 | 124 syn match basicNumber "\<\d\+\>" |
23737 | 125 " Floating point number, with dot |
7 | 126 syn match basicNumber "\<\d\+\.\d*\>" |
23737 | 127 " Floating point number, starting with a dot |
7 | 128 syn match basicNumber "\.\d\+\>" |
129 | |
23737 | 130 " String and Character constants {{{1 |
131 syn match basicSpecial "\\\d\d\d\|\\." contained | |
132 syn region basicString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=basicSpecial | |
7 | 133 |
23737 | 134 " Line numbers {{{1 |
7 | 135 syn region basicLineNumber start="^\d" end="\s" |
23737 | 136 |
137 " Data-type suffixes {{{1 | |
138 syn match basicTypeSpecifier "[a-zA-Z0-9][$%&!#]"ms=s+1 | |
7 | 139 " Used with OPEN statement |
140 syn match basicFilenumber "#\d\+" | |
23737 | 141 |
142 " Mathematical operators {{{1 | |
7 | 143 " syn match basicMathsOperator "[<>+\*^/\\=-]" |
23737 | 144 syn match basicMathsOperator "-\|=\|[:<>+\*^/\\]\|AND\|OR" |
7 | 145 |
23737 | 146 " Comments {{{1 |
147 syn keyword basicTodo TODO FIXME XXX NOTE contained | |
148 syn region basicComment start="^\s*\zsREM\>" start="\%(:\s*\)\@<=REM\>" end="$" contains=basicTodo | |
149 syn region basicComment start="'" end="$" contains=basicTodo | |
7 | 150 |
23737 | 151 "syn sync ccomment basicComment |
152 | |
153 " Default Highlighting {{{1 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
154 hi def link basicLabel Label |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
155 hi def link basicConditional Conditional |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
156 hi def link basicRepeat Repeat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
157 hi def link basicLineNumber Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
158 hi def link basicNumber Number |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
159 hi def link basicError Error |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
160 hi def link basicStatement Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
161 hi def link basicString String |
23737 | 162 hi def link basicComment Comment |
163 hi def link basicSpecial Special | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
164 hi def link basicTodo Todo |
23737 | 165 hi def link basicFunction Identifier |
166 hi def link basicTypeSpecifier Type | |
167 hi def link basicFilenumber basicTypeSpecifier | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3237
diff
changeset
|
168 "hi basicMathsOperator term=bold cterm=bold gui=bold |
7 | 169 |
23737 | 170 " Postscript {{{1 |
7 | 171 let b:current_syntax = "basic" |
172 | |
3237 | 173 let &cpo = s:cpo_save |
174 unlet s:cpo_save | |
23737 | 175 |
176 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: |