Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Telix (Modem Comm Program) SALT Script |
| 3 | " Maintainer: Sean M. McKee <mckee@misslink.net> |
| 4 | " Last Change: 2001 May 09 |
| 5 | " Version Info: @(#)tsalt.vim 1.5 97/12/16 08:11:15 |
| 6 | |
| 7 | " For version 5.x: Clear all syntax items |
| 8 | " For version 6.x: Quit when a syntax file was already loaded |
| 9 | if version < 600 |
| 10 | syntax clear |
| 11 | elseif exists("b:current_syntax") |
| 12 | finish |
| 13 | endif |
| 14 | |
| 15 | " turn case matching off |
| 16 | syn case ignore |
| 17 | |
| 18 | "FUNCTIONS |
| 19 | " Character Handling Functions |
| 20 | syn keyword tsaltFunction IsAscii IsAlNum IsAlpha IsCntrl IsDigit |
| 21 | syn keyword tsaltFunction IsLower IsUpper ToLower ToUpper |
| 22 | |
| 23 | " Connect Device Operations |
| 24 | syn keyword tsaltFunction Carrier cInp_Cnt cGetC cGetCT cPutC cPutN |
| 25 | syn keyword tsaltFunction cPutS cPutS_TR FlushBuf Get_Baud |
| 26 | syn keyword tsaltFunction Get_DataB Get_Port Get_StopB Hangup |
| 27 | syn keyword tsaltFunction KillConnectDevice MakeConnectDevice |
| 28 | syn keyword tsaltFunction Send_Brk Set_ConnectDevice Set_Port |
| 29 | |
| 30 | " File Input/Output Operations |
| 31 | syn keyword tsaltFunction fClearErr fClose fDelete fError fEOF fFlush |
| 32 | syn keyword tsaltFunction fGetC fGetS FileAttr FileFind FileSize |
| 33 | syn keyword tsaltFunction FileTime fnStrip fOpen fPutC fPutS fRead |
| 34 | syn keyword tsaltFunction fRename fSeek fTell fWrite |
| 35 | |
| 36 | " File Transfers and Logs |
| 37 | syn keyword tsaltFunction Capture Capture_Stat Printer Receive Send |
| 38 | syn keyword tsaltFunction Set_DefProt UsageLog Usage_Stat UStamp |
| 39 | |
| 40 | " Input String Matching |
| 41 | syn keyword tsaltFunction Track Track_AddChr Track_Free Track_Hit |
| 42 | syn keyword tsaltFunction WaitFor |
| 43 | |
| 44 | " Keyboard Operations |
| 45 | syn keyword tsaltFunction InKey InKeyW KeyGet KeyLoad KeySave KeySet |
| 46 | |
| 47 | " Miscellaneous Functions |
| 48 | syn keyword tsaltFunction ChatMode Dos Dial DosFunction ExitTelix |
| 49 | syn keyword tsaltFunction GetEnv GetFon HelpScreen LoadFon NewDir |
| 50 | syn keyword tsaltFunction Randon Redial RedirectDOS Run |
| 51 | syn keyword tsaltFunction Set_Terminal Show_Directory TelixVersion |
| 52 | syn keyword tsaltFunction Terminal TransTab Update_Term |
| 53 | |
| 54 | " Script Management |
| 55 | syn keyword tsaltFunction ArgCount Call CallD CompileScript GetRunPath |
| 56 | syn keyword tsaltFunction Is_Loaded Load_Scr ScriptVersion |
| 57 | syn keyword tsaltFunction TelixForWindows Unload_Scr |
| 58 | |
| 59 | " Sound Functions |
| 60 | syn keyword tsaltFunction Alarm PlayWave Tone |
| 61 | |
| 62 | " String Handling |
| 63 | syn keyword tsaltFunction CopyChrs CopyStr DelChrs GetS GetSXY |
| 64 | syn keyword tsaltFunction InputBox InsChrs ItoS SetChr StoI StrCat |
| 65 | syn keyword tsaltFunction StrChr StrCompI StrLen StrLower StrMaxLen |
| 66 | syn keyword tsaltFunction StrPos StrPosI StrUpper SubChr SubChrs |
| 67 | syn keyword tsaltFunction SubStr |
| 68 | |
| 69 | " Time, Date, and Timer Operations |
| 70 | syn keyword tsaltFunction CurTime Date Delay Delay_Scr Get_OnlineTime |
| 71 | syn keyword tsaltFunction tDay tHour tMin tMonth tSec tYear Time |
| 72 | syn keyword tsaltFunction Time_Up Timer_Free Time_Restart |
| 73 | syn keyword tsaltFunction Time_Start Time_Total |
| 74 | |
| 75 | " Video Operations |
| 76 | syn keyword tsaltFunction Box CNewLine Cursor_OnOff Clear_Scr |
| 77 | syn keyword tsaltFunction GetTermHeight GetTermWidth GetX GetY |
| 78 | syn keyword tsaltFunction GotoXY MsgBox NewLine PrintC PrintC_Trm |
| 79 | syn keyword tsaltFunction PrintN PrintN_Trm PrintS PrintS_Trm |
| 80 | syn keyword tsaltFunction PrintSC PRintSC_Trm |
| 81 | syn keyword tsaltFunction PStrA PStrAXY Scroll Status_Wind vGetChr |
| 82 | syn keyword tsaltFunction vGetChrs vGetChrsA vPutChr vPutChrs |
| 83 | syn keyword tsaltFunction vPutChrsA vRstrArea vSaveArea |
| 84 | |
| 85 | " Dynamic Data Exchange (DDE) Operations |
| 86 | syn keyword tsaltFunction DDEExecute DDEInitate DDEPoke DDERequest |
| 87 | syn keyword tsaltFunction DDETerminate DDETerminateAll |
| 88 | "END FUNCTIONS |
| 89 | |
| 90 | "PREDEFINED VARAIABLES |
| 91 | syn keyword tsaltSysVar _add_lf _alarm_on _answerback_str _asc_rcrtrans |
| 92 | syn keyword tsaltSysVar _asc_remabort _asc_rlftrans _asc_scpacing |
| 93 | syn keyword tsaltSysVar _asc_scrtrans _asc_secho _asc_slpacing |
| 94 | syn keyword tsaltSysVar _asc_spacechr _asc_striph _back_color |
| 95 | syn keyword tsaltSysVar _capture_fname _connect_str _dest_bs |
| 96 | syn keyword tsaltSysVar _dial_pause _dial_time _dial_post |
| 97 | syn keyword tsaltSysVar _dial_pref1 _dial_pref2 _dial_pref3 |
| 98 | syn keyword tsaltSysVar _dial_pref4 _dir_prog _down_dir |
| 99 | syn keyword tsaltSysVar _entry_bbstype _entry_comment _entry_enum |
| 100 | syn keyword tsaltSysVar _entry_name _entry_num _entry_logonname |
| 101 | syn keyword tsaltSysVar _entry_pass _fore_color _image_file |
| 102 | syn keyword tsaltSysVar _local_echo _mdm_hang_str _mdm_init_str |
| 103 | syn keyword tsaltSysVar _no_connect1 _no_connect2 _no_connect3 |
| 104 | syn keyword tsaltSysVar _no_connect4 _no_connect5 _redial_stop |
| 105 | syn keyword tsaltSysVar _scr_chk_key _script_dir _sound_on |
| 106 | syn keyword tsaltSysVar _strip_high _swap_bs _telix_dir _up_dir |
| 107 | syn keyword tsaltSysVar _usage_fname _zmodauto _zmod_rcrash |
| 108 | syn keyword tsaltSysVar _zmod_scrash |
| 109 | "END PREDEFINED VARAIABLES |
| 110 | |
| 111 | "TYPE |
| 112 | syn keyword tsaltType str int |
| 113 | "END TYPE |
| 114 | |
| 115 | "KEYWORDS |
| 116 | syn keyword tsaltStatement goto break return continue |
| 117 | syn keyword tsaltConditional if then else |
| 118 | syn keyword tsaltRepeat while for do |
| 119 | "END KEYWORDS |
| 120 | |
| 121 | syn keyword tsaltTodo contained TODO |
| 122 | |
| 123 | " the rest is pretty close to C ----------------------------------------- |
| 124 | |
| 125 | " String and Character constants |
| 126 | " Highlight special characters (those which have a backslash) differently |
| 127 | syn match tsaltSpecial contained "\^\d\d\d\|\^." |
| 128 | syn region tsaltString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=tsaltSpecial |
| 129 | syn match tsaltCharacter "'[^\\]'" |
| 130 | syn match tsaltSpecialCharacter "'\\.'" |
| 131 | |
| 132 | "catch errors caused by wrong parenthesis |
| 133 | syn region tsaltParen transparent start='(' end=')' contains=ALLBUT,tsaltParenError,tsaltIncluded,tsaltSpecial,tsaltTodo |
| 134 | syn match tsaltParenError ")" |
| 135 | syn match tsaltInParen contained "[{}]" |
| 136 | |
| 137 | hi link tsaltParenError tsaltError |
| 138 | hi link tsaltInParen tsaltError |
| 139 | |
| 140 | "integer number, or floating point number without a dot and with "f". |
| 141 | syn match tsaltNumber "\<\d\+\(u\=l\=\|lu\|f\)\>" |
| 142 | "floating point number, with dot, optional exponent |
| 143 | syn match tsaltFloat "\<\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\=\>" |
| 144 | "floating point number, starting with a dot, optional exponent |
| 145 | syn match tsaltFloat "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>" |
| 146 | "floating point number, without dot, with exponent |
| 147 | syn match tsaltFloat "\<\d\+e[-+]\=\d\+[fl]\=\>" |
| 148 | "hex number |
| 149 | syn match tsaltNumber "0x[0-9a-f]\+\(u\=l\=\|lu\)\>" |
| 150 | "syn match cIdentifier "\<[a-z_][a-z0-9_]*\>" |
| 151 | |
| 152 | syn region tsaltComment start="/\*" end="\*/" contains=cTodo |
| 153 | syn match tsaltComment "//.*" contains=cTodo |
| 154 | syn match tsaltCommentError "\*/" |
| 155 | |
| 156 | syn region tsaltPreCondit start="^[ \t]*#[ \t]*\(if\>\|ifdef\>\|ifndef\>\|elif\>\|else\>\|endif\>\)" skip="\\$" end="$" contains=tsaltComment,tsaltString,tsaltCharacter,tsaltNumber,tsaltCommentError |
| 157 | syn region tsaltIncluded contained start=+"+ skip=+\\\\\|\\"+ end=+"+ |
| 158 | syn match tsaltIncluded contained "<[^>]*>" |
| 159 | syn match tsaltInclude "^[ \t]*#[ \t]*include\>[ \t]*["<]" contains=tsaltIncluded |
| 160 | "syn match TelixSalyLineSkip "\\$" |
| 161 | syn region tsaltDefine start="^[ \t]*#[ \t]*\(define\>\|undef\>\)" skip="\\$" end="$" contains=ALLBUT,tsaltPreCondit,tsaltIncluded,tsaltInclude,tsaltDefine,tsaltInParen |
| 162 | syn region tsaltPreProc start="^[ \t]*#[ \t]*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" contains=ALLBUT,tsaltPreCondit,tsaltIncluded,tsaltInclude,tsaltDefine,tsaltInParen |
| 163 | |
| 164 | " Highlight User Labels |
| 165 | syn region tsaltMulti transparent start='?' end=':' contains=ALLBUT,tsaltIncluded,tsaltSpecial,tsaltTodo |
| 166 | |
| 167 | syn sync ccomment tsaltComment |
| 168 | |
| 169 | |
| 170 | " Define the default highlighting. |
| 171 | " For version 5.7 and earlier: only when not done already |
| 172 | " For version 5.8 and later: only when an item doesn't have highlighting yet |
| 173 | if version >= 508 || !exists("did_tsalt_syntax_inits") |
| 174 | if version < 508 |
| 175 | let did_tsalt_syntax_inits = 1 |
| 176 | command -nargs=+ HiLink hi link <args> |
| 177 | else |
| 178 | command -nargs=+ HiLink hi def link <args> |
| 179 | endif |
| 180 | |
| 181 | HiLink tsaltFunction Statement |
| 182 | HiLink tsaltSysVar Type |
| 183 | "HiLink tsaltLibFunc UserDefFunc |
| 184 | "HiLink tsaltConstants Type |
| 185 | "HiLink tsaltFuncArg Type |
| 186 | "HiLink tsaltOperator Operator |
| 187 | "HiLink tsaltLabel Label |
| 188 | "HiLink tsaltUserLabel Label |
| 189 | HiLink tsaltConditional Conditional |
| 190 | HiLink tsaltRepeat Repeat |
| 191 | HiLink tsaltCharacter SpecialChar |
| 192 | HiLink tsaltSpecialCharacter SpecialChar |
| 193 | HiLink tsaltNumber Number |
| 194 | HiLink tsaltFloat Float |
| 195 | HiLink tsaltCommentError tsaltError |
| 196 | HiLink tsaltInclude Include |
| 197 | HiLink tsaltPreProc PreProc |
| 198 | HiLink tsaltDefine Macro |
| 199 | HiLink tsaltIncluded tsaltString |
| 200 | HiLink tsaltError Error |
| 201 | HiLink tsaltStatement Statement |
| 202 | HiLink tsaltPreCondit PreCondit |
| 203 | HiLink tsaltType Type |
| 204 | HiLink tsaltString String |
| 205 | HiLink tsaltComment Comment |
| 206 | HiLink tsaltSpecial Special |
| 207 | HiLink tsaltTodo Todo |
| 208 | |
| 209 | delcommand HiLink |
| 210 | endif |
| 211 | |
| 212 | let b:current_syntax = "tsalt" |
| 213 | |
| 214 | " vim: ts=8 |