icon.vim (8926B)
1 " Vim syntax file 2 " Language: Icon 3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 4 " Previous Maintainer: Wendell Turner <wendell@adsi-m4.com> (invalid last known address) 5 " Last Change: 2022 Jun 16 6 " Contributor: eschen@alumni.princeton.edu 2002.09.18 7 8 " Prelude {{{1 9 if exists("b:current_syntax") 10 finish 11 endif 12 13 syn iskeyword @,48-57,_,192-255,& 14 15 " Not Top {{{1 16 syn cluster iconNotTop contains=iconDocField,iconIncluded,iconStringSpecial,iconTodo,@Spell 17 18 " Whitespace errors {{{1 19 if exists("icon_space_errors") 20 if !exists("icon_no_trail_space_error") 21 syn match iconSpaceError "\s\+$" display excludenl 22 endif 23 if !exists("icon_no_tab_space_error") 24 syn match iconSpaceError " \+\t"me=e-1 display 25 endif 26 endif 27 28 " Reserved words {{{1 29 syn keyword iconReserved break by case create default do else every fail if 30 syn keyword iconReserved initial next not of repeat return suspend then to 31 syn keyword iconReserved until while 32 33 syn keyword iconStorageClass global static local record invocable 34 35 syn keyword iconLink link 36 37 " Procedure definitions {{{1 38 if exists("icon_no_procedure_fold") 39 syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop 40 else 41 syn region iconProcedure matchgroup=iconReserved start="\<procedure\>" end="\<end\>" contains=ALLBUT,@iconNotTop fold 42 endif 43 44 " Keywords {{{1 45 syn keyword iconKeyword &allocated &ascii &clock &collections &cset ¤t 46 syn keyword iconKeyword &date &dateline &digits &dump &e &error &errornumber 47 syn keyword iconKeyword &errortext &errorvalue &errout &fail &features &file 48 syn keyword iconKeyword &host &input &lcase &letters &level &line &main &null 49 syn keyword iconKeyword &output &phi &pi &pos &progname &random ®ions 50 syn keyword iconKeyword &source &storage &subject &time &trace &ucase &version 51 52 " Graphics keywords 53 syn keyword iconKeyword &col &control &interval &ldrag &lpress &lrelease 54 syn keyword iconKeyword &mdrag &meta &mpress &mrelease &rdrag &resize &row 55 syn keyword iconKeyword &rpress &rrelease &shift &window &x &y 56 57 " Functions {{{1 58 syn keyword iconFunction abs acos any args asin atan bal callout center char 59 syn keyword iconFunction chdir close collect copy cos cset delay delete detab 60 syn keyword iconFunction display dtor entab errorclear exit exp find flush 61 syn keyword iconFunction function get getch getche getenv iand icom image 62 syn keyword iconFunction insert integer ior ishift ixor kbhit key left list 63 syn keyword iconFunction loadfunc log many map match member move name numeric 64 syn keyword iconFunction open ord pop pos proc pull push put read reads real 65 syn keyword iconFunction remove rename repl reverse right rtod runerr save 66 syn keyword iconFunction seek self seq serial set sin sort sortf sqrt stop 67 syn keyword iconFunction string system tab table tan trim type upto variable 68 syn keyword iconFunction where write writes 69 70 " Graphics functions 71 syn keyword iconFunction Active Alert Bg CenterString Clip Clone Color 72 syn keyword iconFunction ColorDialog ColorValue CopyArea Couple DrawArc 73 syn keyword iconFunction DrawCircle DrawCurve DrawImage DrawLine DrawPoint 74 syn keyword iconFunction DrawPolygon DrawRectangle DrawSegment DrawString 75 syn keyword iconFunction Enqueue EraseArea Event Fg FillArc FillCircle 76 syn keyword iconFunction FillPolygon FillRectangle Font FreeColor GotoRC 77 syn keyword iconFunction GotoXY LeftString Lower NewColor Notice OpenDialog 78 syn keyword iconFunction PaletteChars PaletteColor PaletteGrays PaletteKey 79 syn keyword iconFunction Pattern Pending Pixel Raise ReadImage RightString 80 syn keyword iconFunction SaveDialog SelectDialog Shade TextDialog TextWidth 81 syn keyword iconFunction ToggleDialog Uncouple WAttrib WClose WDefault WDelay 82 syn keyword iconFunction WDone WFlush WOpen WQuit WRead WReads WriteImage 83 syn keyword iconFunction WSync WWrite WWrites 84 85 " String and character constants {{{1 86 syn match iconStringSpecial "\\x\x\{2}\|\\\o\{3\}\|\\[bdeflnrtv\"\'\\]\|\\^[a-zA-Z0-9]" contained 87 syn match iconStringSpecial "\\$" contained 88 syn match iconStringSpecial "_\ze\s*$" contained 89 90 syn region iconString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=iconStringSpecial 91 syn region iconCset start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=iconStringSpecial 92 93 " Bracket errors {{{1 94 95 if !exists("icon_no_bracket_errors") 96 " catch errors caused by wrong brackets (ACE 2002.09.18) 97 syn cluster iconBracketGroup contains=iconBracketError,iconIncluded 98 syn region iconBracket start='\[' end='\]' contains=ALLBUT,@iconBracketGroup,@iconNotTop transparent 99 syn match iconBracketError "]" 100 101 "catch errors caused by wrong braces (ACE 2002.09.18) 102 syn cluster iconBraceGroup contains=iconBraceError,iconIncluded 103 syn region iconBrace start='{' end='}' contains=ALLBUT,@iconBraceGroup,@iconNotTop transparent 104 syn match iconBraceError "}" 105 106 "catch errors caused by wrong parenthesis 107 syn cluster iconParenGroup contains=iconParenError,iconIncluded 108 syn region iconParen start='(' end=')' contains=ALLBUT,@iconParenGroup,@iconNotTop transparent 109 syn match iconParenError ")" 110 end 111 112 " Numbers {{{1 113 syn case ignore 114 115 " integer 116 syn match iconInteger "\<\d\+\>" 117 syn match iconInteger "\<\d\{1,2}[rR][a-zA-Z0-9]\+\>" 118 119 " real with trailing dot 120 syn match iconReal "\<\d\+\." 121 122 " real, with dot, optional exponent 123 syn match iconReal "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>" 124 125 " real, with leading dot, optional exponent 126 syn match iconReal "\.\d\+\%(e[-+]\=\d\+\)\=\>" 127 128 " real, without dot, with exponent 129 syn match iconReal "\<\d\+e[-+]\=\d\+\>" 130 131 syn cluster iconNumber contains=iconInteger,iconReal 132 133 syn case match 134 135 " Comments {{{1 136 syn keyword iconTodo TODO FIXME XXX BUG contained 137 syn match iconComment "#.*" contains=iconTodo,iconSpaceError,@Spell 138 syn match iconDocField "^#\s\+\zs\%(File\|Subject\|Authors\=\|Date\|Version\|Links\|Requires\|See also\):" contained 139 140 if exists("icon_no_comment_fold") 141 syn region iconDocumentation start="\%^#\{2,}\%(\n#\+\%(\s\+.*\)\=\)\+" end="^#\+\n\s*$" contains=iconDocField keepend 142 else 143 syn region iconMultilineComment start="^\s*#.*\n\%(^\s*#\)\@=" end="^\s*#.*\n\%(^\s*#\)\@!" contains=iconComment keepend fold transparent 144 syn region iconDocumentation start="\%^#\{2,}\%(\n#\)\+" end="^#\+\n\%([^#]\|$\)" contains=iconDocField keepend fold 145 endif 146 147 " Preprocessor {{{1 148 syn match iconPreInclude '^\s*\zs$\s*include\>\ze\s*"' nextgroup=iconIncluded skipwhite 149 syn match iconIncluded '"[^"]\+"' contained 150 151 syn region iconPreDefine start="^\s*\zs$\s*\%(define\|undef\)\>" end="$" oneline contains=ALLBUT,@iconPreGroup 152 syn region iconPreProc start="^\s*\zs$\s*\%(error\|line\)\>" end="$" oneline contains=ALLBUT,@iconPreGroup 153 syn region iconPreConditional start="^\s*\zs$\s*\%(if\|ifdef\|ifndef\|elif\|else\|endif\)\>" end="$" oneline contains=iconComment,iconString,iconCset,iconNumber,iconSpaceError 154 155 syn cluster iconPreGroup contains=iconPreCondit,iconPreInclude,iconIncluded,iconPreDefine 156 157 syn match iconPreSymbol "_V\d\+" 158 syn keyword iconPreSymbol _ACORN _AMIGA _ARM_FUNCTIONS _ASCII _CALLING 159 syn keyword iconPreSymbol _CO_EXPRESSIONS _COMPILED _DIRECT_EXECUTION 160 syn keyword iconPreSymbol _DOS_FUNCTIONS _EBCDIC _EVENT_MONITOR 161 syn keyword iconPreSymbol _EXECUTABLE_IMAGES _EXTERNAL_FUNCTIONS 162 syn keyword iconPreSymbol _EXTERNAL_VALUES _INTERPRETED _KEYBOARD_FUNCTIONS 163 syn keyword iconPreSymbol _LARGE_INTEGERS _MACINTOSH _MEMORY_MONITOR _MSDOS 164 syn keyword iconPreSymbol _MSDOS_386 _MULTIREGION _MULTITASKING _OS2 _PIPES 165 syn keyword iconPreSymbol _PORT _PRESENTATION_MGR _RECORD_IO _STRING_INVOKE 166 syn keyword iconPreSymbol _SYSTEM_FUNCTION _UNIX _VISUALIZATION _VMS 167 syn keyword iconPreSymbol _WINDOW_FUNCTIONS _X_WINDOW_SYSTEM 168 169 " Syncing {{{1 170 if !exists("icon_minlines") 171 let icon_minlines = 250 172 endif 173 exec "syn sync ccomment iconComment minlines=" . icon_minlines 174 175 " Default Highlighting {{{1 176 177 hi def link iconParenError iconError 178 hi def link iconBracketError iconError 179 hi def link iconBraceError iconError 180 hi def link iconSpaceError iconError 181 hi def link iconError Error 182 183 hi def link iconInteger Number 184 hi def link iconReal Float 185 hi def link iconString String 186 hi def link iconCset String 187 hi def link iconStringSpecial SpecialChar 188 189 hi def link iconPreProc PreProc 190 hi def link iconIncluded iconString 191 hi def link iconPreInclude Include 192 hi def link iconPreSymbol iconPreProc 193 hi def link iconPreDefine Define 194 hi def link iconPreConditional PreCondit 195 196 hi def link iconStatement Statement 197 hi def link iconStorageClass StorageClass 198 hi def link iconFunction Function 199 hi def link iconReserved Label 200 hi def link iconLink Include 201 hi def link iconKeyword Keyword 202 203 hi def link iconComment Comment 204 hi def link iconTodo Todo 205 hi def link iconDocField SpecialComment 206 hi def link iconDocumentation Comment 207 208 " Postscript {{{1 209 let b:current_syntax = "icon" 210 211 " vim: nowrap sw=2 sts=2 ts=8 noet fdm=marker: