Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: tf |
| 3 | " Maintainer: Lutz Eymers <ixtab@polzin.com> |
| 4 | " URL: http://www.isp.de/data/tf.vim |
| 5 | " Email: send syntax_vim.tgz |
| 6 | " Last Change: 2001 May 10 |
| 7 | " |
| 8 | " Options lite_minlines = x to sync at least x lines backwards |
| 9 | |
| 10 | " Remove any old syntax stuff hanging around |
| 11 | |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 12 | " quit when a syntax file was already loaded |
| 13 | if exists("b:current_syntax") |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 14 | finish |
| 15 | endif |
| 16 | |
| 17 | syn case match |
| 18 | |
| 19 | if !exists("main_syntax") |
| 20 | let main_syntax = 'tf' |
| 21 | endif |
| 22 | |
| 23 | " Special global variables |
| 24 | syn keyword tfVar HOME LANG MAIL SHELL TERM TFHELP TFLIBDIR TFLIBRARY TZ contained |
| 25 | syn keyword tfVar background backslash contained |
| 26 | syn keyword tfVar bamf bg_output borg clearfull cleardone clock connect contained |
| 27 | syn keyword tfVar emulation end_color gag gethostbyname gpri hook hilite contained |
| 28 | syn keyword tfVar hiliteattr histsize hpri insert isize istrip kecho contained |
| 29 | syn keyword tfVar kprefix login lp lpquote maildelay matching max_iter contained |
Viktor Szépe | 3fc7a7e | 2023-08-23 21:20:00 +0200 | [diff] [blame] | 30 | syn keyword tfVar max_recur mecho more mprefix oldslash prompt_sec contained |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 31 | syn keyword tfVar prompt_usec proxy_host proxy_port ptime qecho qprefix contained |
| 32 | syn keyword tfVar quite quitdone redef refreshtime scroll shpause snarf sockmload contained |
| 33 | syn keyword tfVar start_color tabsize telopt sub time_format visual contained |
| 34 | syn keyword tfVar watch_dog watchname wordpunct wrap wraplog wrapsize contained |
| 35 | syn keyword tfVar wrapspace contained |
| 36 | |
| 37 | " Worldvar |
| 38 | syn keyword tfWorld world_name world_character world_password world_host contained |
| 39 | syn keyword tfWorld world_port world_mfile world_type contained |
| 40 | |
| 41 | " Number |
| 42 | syn match tfNumber "-\=\<\d\+\>" |
| 43 | |
| 44 | " Float |
| 45 | syn match tfFloat "\(-\=\<\d+\|-\=\)\.\d\+\>" |
| 46 | |
| 47 | " Operator |
| 48 | syn match tfOperator "[-+=?:&|!]" |
| 49 | syn match tfOperator "/[^*~@]"he=e-1 |
| 50 | syn match tfOperator ":=" |
| 51 | syn match tfOperator "[^/%]\*"hs=s+1 |
| 52 | syn match tfOperator "$\+[([{]"he=e-1,me=e-1 |
| 53 | syn match tfOperator "\^\[\+"he=s+1 contains=tfSpecialCharEsc |
| 54 | |
| 55 | " Relational |
| 56 | syn match tfRelation "&&" |
| 57 | syn match tfRelation "||" |
| 58 | syn match tfRelation "[<>/!=]=" |
| 59 | syn match tfRelation "[<>]" |
| 60 | syn match tfRelation "[!=]\~" |
| 61 | syn match tfRelation "[=!]/" |
| 62 | |
| 63 | |
| 64 | " Readonly Var |
| 65 | syn match tfReadonly "[#*]" contained |
| 66 | syn match tfReadonly "\<-\=L\=\d\{-}\>" contained |
| 67 | syn match tfReadonly "\<P\(\d\+\|R\|L\)\>" contained |
| 68 | syn match tfReadonly "\<R\>" contained |
| 69 | |
| 70 | " Identifier |
| 71 | syn match tfIdentifier "%\+[a-zA-Z_#*-0-9]\w*" contains=tfVar,tfReadonly |
| 72 | syn match tfIdentifier "%\+[{]"he=e-1,me=e-1 |
| 73 | syn match tfIdentifier "\$\+{[a-zA-Z_#*-0-9]\w*}" contains=tfWorld |
| 74 | |
| 75 | " Function names |
| 76 | syn keyword tfFunctions ascii char columns echo filename ftime fwrite getopts |
| 77 | syn keyword tfFunctions getpid idle kbdel kbgoto kbhead kblen kbmatch kbpoint |
| 78 | syn keyword tfFunctions kbtail kbwordleft kbwordright keycode lines mod |
| 79 | syn keyword tfFunctions moresize pad rand read regmatch send strcat strchr |
| 80 | syn keyword tfFunctions strcmp strlen strncmp strrchr strrep strstr substr |
| 81 | syn keyword tfFunctions systype time tolower toupper |
| 82 | |
| 83 | syn keyword tfStatement addworld bamf beep bind break cat changes connect contained |
| 84 | syn keyword tfStatement dc def dokey echo edit escape eval export expr fg for contained |
| 85 | syn keyword tfStatement gag getfile grab help hilite histsize hook if input contained |
| 86 | syn keyword tfStatement kill lcd let list listsockets listworlds load contained |
| 87 | syn keyword tfStatement localecho log nohilite not partial paste ps purge contained |
| 88 | syn keyword tfStatement purgeworld putfile quit quote recall recordline save contained |
| 89 | syn keyword tfStatement saveworld send sh shift sub substitute contained |
| 90 | syn keyword tfStatement suspend telnet test time toggle trig trigger unbind contained |
| 91 | syn keyword tfStatement undef undefn undeft unhook untrig unworld contained |
| 92 | syn keyword tfStatement version watchdog watchname while world contained |
| 93 | |
| 94 | " Hooks |
| 95 | syn keyword tfHook ACTIVITY BACKGROUND BAMF CONFAIL CONFLICT CONNECT DISCONNECT |
| 96 | syn keyword tfHook KILL LOAD LOADFAIL LOG LOGIN MAIL MORE PENDING PENDING |
| 97 | syn keyword tfHook PROCESS PROMPT PROXY REDEF RESIZE RESUME SEND SHADOW SHELL |
| 98 | syn keyword tfHook SIGHUP SIGTERM SIGUSR1 SIGUSR2 WORLD |
| 99 | |
| 100 | " Conditional |
| 101 | syn keyword tfConditional if endif then else elseif contained |
| 102 | |
| 103 | " Repeat |
| 104 | syn keyword tfRepeat while do done repeat for contained |
| 105 | |
| 106 | " Statement |
| 107 | syn keyword tfStatement break quit contained |
| 108 | |
| 109 | " Include |
| 110 | syn keyword tfInclude require load save loaded contained |
| 111 | |
| 112 | " Define |
| 113 | syn keyword tfDefine bind unbind def undef undefn undefn purge hook unhook trig untrig contained |
| 114 | syn keyword tfDefine set unset setenv contained |
| 115 | |
| 116 | " Todo |
| 117 | syn keyword tfTodo TODO Todo todo contained |
| 118 | |
| 119 | " SpecialChar |
| 120 | syn match tfSpecialChar "\\[abcfnrtyv\\]" contained |
| 121 | syn match tfSpecialChar "\\\d\{3}" contained contains=tfOctalError |
| 122 | syn match tfSpecialChar "\\x[0-9a-fA-F]\{2}" contained |
| 123 | syn match tfSpecialCharEsc "\[\+" contained |
| 124 | |
| 125 | syn match tfOctalError "[89]" contained |
| 126 | |
| 127 | " Comment |
| 128 | syn region tfComment start="^;" end="$" contains=tfTodo |
| 129 | |
| 130 | " String |
| 131 | syn region tfString oneline matchgroup=None start=+'+ skip=+\\\\\|\\'+ end=+'+ contains=tfIdentifier,tfSpecialChar,tfEscape |
| 132 | syn region tfString matchgroup=None start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=tfIdentifier,tfSpecialChar,tfEscape |
| 133 | |
| 134 | syn match tfParentError "[)}\]]" |
| 135 | |
| 136 | " Parents |
| 137 | syn region tfParent matchgroup=Delimiter start="(" end=")" contains=ALLBUT,tfReadonly |
| 138 | syn region tfParent matchgroup=Delimiter start="\[" end="\]" contains=ALL |
| 139 | syn region tfParent matchgroup=Delimiter start="{" end="}" contains=ALL |
| 140 | |
| 141 | syn match tfEndCommand "%%\{-};" |
| 142 | syn match tfJoinLines "\\$" |
| 143 | |
| 144 | " Types |
| 145 | |
| 146 | syn match tfType "/[a-zA-Z_~@][a-zA-Z0-9_]*" contains=tfConditional,tfRepeat,tfStatement,tfInclude,tfDefine,tfStatement |
| 147 | |
| 148 | " Catch /quote .. ' |
| 149 | syn match tfQuotes "/quote .\{-}'" contains=ALLBUT,tfString |
| 150 | " Catch $(/escape ) |
| 151 | syn match tfEscape "(/escape .*)" |
| 152 | |
| 153 | " sync |
| 154 | if exists("tf_minlines") |
| 155 | exec "syn sync minlines=" . tf_minlines |
| 156 | else |
| 157 | syn sync minlines=100 |
| 158 | endif |
| 159 | |
| 160 | " Define the default highlighting. |
Bram Moolenaar | 89bcfda | 2016-08-30 23:26:57 +0200 | [diff] [blame] | 161 | " Only when an item doesn't have highlighting yet |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 162 | |
Bram Moolenaar | f37506f | 2016-08-31 22:22:10 +0200 | [diff] [blame] | 163 | hi def link tfComment Comment |
| 164 | hi def link tfString String |
| 165 | hi def link tfNumber Number |
| 166 | hi def link tfFloat Float |
| 167 | hi def link tfIdentifier Identifier |
| 168 | hi def link tfVar Identifier |
| 169 | hi def link tfWorld Identifier |
| 170 | hi def link tfReadonly Identifier |
| 171 | hi def link tfHook Identifier |
| 172 | hi def link tfFunctions Function |
| 173 | hi def link tfRepeat Repeat |
| 174 | hi def link tfConditional Conditional |
| 175 | hi def link tfLabel Label |
| 176 | hi def link tfStatement Statement |
| 177 | hi def link tfType Type |
| 178 | hi def link tfInclude Include |
| 179 | hi def link tfDefine Define |
| 180 | hi def link tfSpecialChar SpecialChar |
| 181 | hi def link tfSpecialCharEsc SpecialChar |
| 182 | hi def link tfParentError Error |
| 183 | hi def link tfTodo Todo |
| 184 | hi def link tfEndCommand Delimiter |
| 185 | hi def link tfJoinLines Delimiter |
| 186 | hi def link tfOperator Operator |
| 187 | hi def link tfRelation Operator |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 188 | |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 189 | |
| 190 | let b:current_syntax = "tf" |
| 191 | |
| 192 | if main_syntax == 'tf' |
| 193 | unlet main_syntax |
| 194 | endif |
| 195 | |
| 196 | " vim: ts=8 |