tt.vim 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049
  1. " VIM Syntax file for tintin++ scripts
  2. " TODO
  3. " Add proper support for #chat
  4. " Add proper support for #map
  5. " Finish support for #buffer get
  6. " Make Better use of Clusters
  7. " Porper #script support, I feel none is better than the fragile support from
  8. " before
  9. " Test vs various code styles
  10. " Add bad syntax highlights to ttError
  11. if version < 600
  12. syntax clear
  13. elseif exists("b:current_syntax")
  14. finish
  15. endif
  16. " Sets the '#' character as a valid keyword character
  17. setlocal iskeyword+=#
  18. " tintin++ keywords are case insensitive
  19. syntax case ignore
  20. " tintin++ Commands {{{
  21. " Kill: #kill #killall {{{
  22. syntax keyword ttCmd #kill
  23. \ nextgroup=ttListNameKill
  24. \ skipwhite skipempty
  25. syntax keyword ttCmd #killall
  26. \ nextgroup=ttListName
  27. \ skipwhite skipempty
  28. " }}}
  29. " Debugging: #ignore #debug #message {{{
  30. syntax keyword ttCmdDebug #ignore #debug #message
  31. \ nextgroup=ttListName,ttListNameBlock
  32. \ skipwhite skipempty
  33. " }}}
  34. " Useless For Scripting: #grep #help #greeting #info {{{
  35. syntax keyword ttCmdUseless #grep #help #greeting #info
  36. " }}}
  37. " Misc tintin commands: #cr #bell #send #split #system #config #pathdir {{{
  38. syntax keyword ttCmd #cr #bell
  39. syntax keyword ttCmd #send
  40. \ nextgroup=ttValueBlock
  41. \ skipwhite skipempty
  42. syntax keyword ttCmd #split
  43. \ nextgroup=ttSplitValueBlock
  44. \ skipwhite skipempty
  45. syntax keyword ttCmd #system
  46. \ nextgroup=ttShellCmd
  47. \ skipwhite skipempty
  48. syntax keyword ttCmd #config
  49. \ nextgroup=ttConfigBlock
  50. \ skipwhite skipempty
  51. syntax keyword ttCmd #pathdir
  52. " }}}
  53. " End/Suspend: #end #suspend #zap {{{
  54. syntax keyword ttCmd #end #suspend
  55. syntax keyword ttCmd #zap
  56. \ nextgroup=ttSessionName,ttSessionNameBlock
  57. \ skipwhite skipempty
  58. " }}}
  59. " Session Related: #all #gts #snoop #session #run {{{
  60. syntax keyword ttCmd #all #gts
  61. syntax match ttCmd "\c#{gts}"
  62. syntax keyword ttCmd #snoop
  63. \ nextgroup=ttSessionName,ttSessionNameBlock
  64. \ skipwhite skipempty
  65. syntax keyword ttCmd #ses[sion]
  66. \ nextgroup=ttSesSessionNameBlock,ttSesSessionName
  67. \ skipwhite skipempty
  68. syntax keyword ttCmd #run
  69. \ nextgroup=ttRunSessionNameBlock,ttRunSessionName
  70. \ skipwhite skipempty
  71. " }}}
  72. " Looping Commands #while #loop #forall #foreach #parse #break #continue {{{
  73. syntax keyword ttCmdLoop #break #continue
  74. syntax keyword ttCmdLoop #while
  75. \ nextgroup=ttExpressionBlock
  76. \ skipwhite skipempty
  77. syntax keyword ttCmdLoop #forall
  78. \ nextgroup=ttForAllBlock
  79. \ skipwhite skipempty
  80. syntax keyword ttCmdLoop #foreach
  81. \ nextgroup=ttForEachBlock
  82. \ skipwhite skipempty
  83. syntax keyword ttCmdLoop #loop
  84. \ nextgroup=ttLoopLowerBlock
  85. \ skipwhite skipempty
  86. syntax keyword ttCmdLoop #parse
  87. \ nextgroup=ttParseValueBlock
  88. \ skipwhite skipempty
  89. " }}}
  90. " Triggers On Game Output #act #high #sub #event {{{
  91. syntax keyword ttCmdTrigger #act[ion] #gag
  92. \ nextgroup=ttPatternBlock
  93. \ skipwhite skipempty
  94. syntax keyword ttCmdTrigger #high[light]
  95. \ nextgroup=ttPatternBlockHigh
  96. \ skipwhite skipempty
  97. syntax keyword ttCmdTrigger #sub[stitute] #prompt
  98. \ nextgroup=ttPatternBlockSub
  99. \ skipwhite skipempty
  100. syntax keyword ttCmdTrigger #event
  101. \ nextgroup=ttEventBlock
  102. \ skipwhite skipempty
  103. " }}}
  104. " Input Related: #alias #tab #macro #history #cursor #buffer {{{
  105. syntax keyword ttCmdInput #alias
  106. \ nextgroup=ttPatternBlock
  107. \ skipwhite skipempty
  108. syntax keyword ttCmdInput #tab
  109. \ nextgroup=ttValueBlock
  110. \ skipwhite skipempty
  111. syntax keyword ttCmdInput #macro
  112. \ nextgroup=ttKeyBlock
  113. \ skipwhite skipempty
  114. syntax keyword ttCmdInput #hist[ory]
  115. \ nextgroup=ttHistSub
  116. \ skipwhite skipempty
  117. syntax keyword ttCmdInput #cursor
  118. \ nextgroup=ttCursorBlock
  119. \ skipwhite skipempty
  120. syntax keyword ttCmdInput #buffer
  121. \ nextgroup=ttBufferSub
  122. \ skipwhite skipempty
  123. " }}}
  124. " Switch/Case: #switch #case #default {{{
  125. syntax keyword ttCmdSwitch #switch #case
  126. \ nextgroup=ttExpressionBlock
  127. \ skipwhite skipempty
  128. syntax keyword ttCmdSwitch #default
  129. "}}}
  130. " If/ElseIf/Else Branching: #if #elseif #else {{{
  131. syntax keyword ttCmdBranch #if #elseif
  132. \ nextgroup=ttExpressionBlock
  133. \ skipwhite skipempty
  134. syntax keyword ttCmdBranch #else
  135. " }}}
  136. " File Related: #read #write #scan #textin {{{
  137. syntax keyword ttCmd #read #write #scan #textin
  138. \ nextgroup=ttFileNameBlock,ttFileName
  139. \ skipwhite skipempty
  140. " }}}
  141. " Variable Assignment: #var #format #math #regex #repalce #list {{{
  142. syntax keyword ttCmdVar #var[iable]
  143. \ nextgroup=ttVarVarBlock,ttVarVar
  144. \ skipwhite skipempty
  145. syntax keyword ttCmdVar #loc[al]
  146. \ nextgroup=ttVarVarBlock,ttVarVar
  147. \ skipwhite skipempty
  148. syntax keyword ttCmdVar #format
  149. \ nextgroup=ttFormatVarBlock,ttFormatVar
  150. \ skipwhite skipempty
  151. syntax keyword ttCmdVar #math
  152. \ nextgroup=ttMathVarBlock,ttMathVar
  153. \ skipwhite skipempty
  154. syntax keyword ttCmdVar #regex
  155. \ nextgroup=ttRegexVarBlock,ttRegexVar
  156. \ skipwhite skipempty
  157. syntax keyword ttCmdVar #replace
  158. \ nextgroup=ttReplaceVarBlock,ttReplaceVar
  159. \ skipwhite skipempty
  160. syntax keyword ttCmdVar #list
  161. \ nextgroup=ttListVarBlock,ttListVar
  162. \ skipwhite skipempty
  163. " }}}
  164. " Functions: #function #return {{{
  165. syntax keyword ttCmd #func[tion]
  166. \ nextgroup=ttFunctionNameBlock
  167. \ skipwhite skipempty
  168. syntax keyword ttCmd #return
  169. \ nextgroup=ttValueBlock
  170. \ skipwhite skipempty
  171. " }}}
  172. " Time Realted: #tick #delay {{{
  173. syntax keyword ttCmdTime #tick[er] #delay
  174. \ nextgroup=ttTimeNameBlock
  175. \ skipwhite skipempty
  176. " }}}
  177. " Class: #class {{{
  178. syntax keyword ttCmd #class
  179. \ nextgroup=ttClassNameBlock,ttClassName
  180. \ skipwhite skipempty
  181. " }}}
  182. " Local Echos: #echo #showme {{{
  183. syntax keyword ttCmd #showme
  184. \ nextgroup=ttValueBlock
  185. \ skipwhite skipempty
  186. syntax keyword ttCmd #echo
  187. \ nextgroup=ttEchoBlock
  188. \ skipwhite skipempty
  189. " }}}
  190. " Path: #path {{{
  191. syntax keyword ttCmd #path
  192. \ nextgroup=ttPathSub
  193. \ skipwhite skipempty
  194. " }}}
  195. " Log: #log {{{
  196. syntax keyword ttCmd #log
  197. \ nextgroup=ttLogSub
  198. \ skipwhite skipempty
  199. " }}}
  200. " Line: #line {{{
  201. syntax keyword ttCmd #line
  202. \ nextgroup=ttLineSub
  203. \ skipwhite skipempty
  204. " }}}
  205. " UnCommands: #un* {{{
  206. syntax keyword ttCmdUn #unvar[iable] #untick[er] #undelay #unact[ion] #unevent #unfunc[tion]
  207. \ #unhigh[light] #unmacro #unprompt #unsub[sisitue] #untab #ungag #unalias
  208. \ nextgroup=ttUnBlock,ttUn
  209. \ skipwhite
  210. " }}}
  211. " Repeat Command: #{number} {{{
  212. syntax match ttCmdRep "#\d\+"
  213. syntax match ttCmdRep "#{\d\+}"
  214. " }}}
  215. " #script is handled in a special way {{{
  216. syntax keyword ttCmdScript #script
  217. " }}}
  218. " Map: #map {{{
  219. syntax keyword ttCmd #map
  220. \ nextgroup=ttMapSub
  221. \ skipwhite skipempty
  222. " }}}
  223. syntax keyword ttCmd #chat
  224. " }}}
  225. syntax case match
  226. " Cluster ttCmd* into ttCmds {{{
  227. syntax cluster ttCmds contains=
  228. \ ttCmd,
  229. \ ttCmdBranch,
  230. \ ttCmdDebug,
  231. \ ttCmdInput,
  232. \ ttCmdLoop,
  233. \ ttCmdRep,
  234. \ ttCmdSwitch,
  235. \ ttCmdTime,
  236. \ ttCmdTrigger,
  237. \ ttCmdUseless,
  238. \ ttCmdVar,
  239. \ ttCmdUn,
  240. \ ttCmdScript,
  241. " }}}
  242. " Blocks {{{
  243. " General Blocks:
  244. " Pattern Match Blocks {{{
  245. syntax region ttPatternBlock
  246. \ matchgroup=ttBracesMatch start=/{/ end=/}/
  247. \ contained
  248. syntax region ttPatternBlockHigh
  249. \ matchgroup=ttBracesMatch start=/{/ end=/}/
  250. \ contained skipwhite skipempty
  251. \ nextgroup=ttHighColorBlock
  252. syntax region ttPatternBlockSub
  253. \ matchgroup=ttBracesMatch start=/{/ end=/}/
  254. \ contained skipwhite skipempty
  255. \ nextgroup=ttFormatBlock
  256. " }}}
  257. " Format Block {{{
  258. syntax region ttFormatBlock
  259. \ matchgroup=ttBracesFormat start=/{/ end=/}/
  260. \ contained
  261. syntax region ttReplaceFormatBlock
  262. \ matchgroup=ttBracesFormat start=/{/ end=/}/
  263. \ contained
  264. " }}}
  265. " Value Blocks {{{
  266. syntax region ttValueBlock
  267. \ matchgroup=ttBracesValue start=/{/ end=/}/
  268. \ contained
  269. \ contains=ttValueBlock
  270. syntax region ttSplitValueBlock
  271. \ matchgroup=ttBracesValue start=/{/ end=/}/
  272. \ contained skipwhite skipempty
  273. \ nextgroup=ttValueBlock
  274. syntax region ttParseValueBlock
  275. \ matchgroup=ttBracesValue start=/{/ end=/}/
  276. \ contained skipwhite skipempty
  277. \ nextgroup=ttLoopVarBlock
  278. " }}}
  279. " Expression Block {{{
  280. syntax region ttExpressionBlock
  281. \ matchgroup=ttBracesExpression start=/{/ end=/}/
  282. \ contained
  283. " }}}
  284. " File Name Block {{{
  285. syntax region ttFileNameBlock
  286. \ matchgroup=ttBraces start=/{/ end=/}/
  287. \ contained
  288. syntax region ttFileName
  289. \ start=/\w/ skip=/\\\s/ end=/\( \|$\)/
  290. \ contained
  291. \ contains=ttCmdSep
  292. " }}}
  293. " Key Block {{{
  294. syntax region ttKeyBlock
  295. \ matchgroup=ttBraces start=/{/ end=/}/
  296. \ contained
  297. " }}}
  298. " Shell Command Block {{{
  299. syntax region ttShellCmd
  300. \ matchgroup=ttBraces start=/{/ end=/}/
  301. \ contained
  302. \ contains=ttShellCmd
  303. " }}}
  304. " Blocks For Specefic Commands:
  305. " ListName Blocks {{{
  306. syntax match ttListName "\c\%[{]\(act\%[ions]\|alias\%[es]\|class\%[es]\|config\%[urations]\|delay\%[s]\|event\%[s]\|func\%[tions]\|gag\[%s]\|high\%[lights]\|hist\%[ories]\|macro\%[s]\|path\%[s]\|pathdirs\|prompt\%[s]\|sub\%[stitutions]\|tab\%[s]\|tabcycle\|ticker\%[s]\|var\%[iables]\)\%[}]"
  307. \ contained
  308. \ contains=ttSubBrace
  309. syntax match ttListNameKill "\c\%[{]\(act\%[ions]\|alias\%[es]\|class\%[es]\|config\%[urations]\|delay\%[s]\|event\%[s]\|func\%[tions]\|gag\[%s]\|high\%[lights]\|hist\%[ories]\|macro\%[s]\|path\%[s]\|pathdirs\|prompt\%[s]\|sub\%[stitutions]\|tab\%[s]\|tabcycle\|ticker\%[s]\|var\%[iables]\)\%[}]"
  310. \ contains=ttSubBrace
  311. \ contained
  312. \ skipwhite skipempty
  313. \ nextgroup=ttPatternBlock
  314. " }}}
  315. " ForAll/ForEach LoopLower/LoopUpper {{{
  316. syntax region ttForAllBlock
  317. \ matchgroup=ttBraces start=/{/ end=/}/
  318. \ contained
  319. \ contains=ttValueBlock
  320. syntax region ttForEachBlock
  321. \ matchgroup=ttBraces start=/{/ end=/}/
  322. \ contained
  323. \ contains=ttValueBlock
  324. \ skipwhite skipempty
  325. \ nextgroup=ttLoopVarBlock
  326. syntax region ttLoopVarBlock
  327. \ matchgroup=ttBraces start=/{/ end=/}/
  328. \ contained
  329. syntax region ttLoopLowerBlock
  330. \ matchgroup=ttBraces start=/{/ end=/}/
  331. \ contained
  332. \ skipwhite skipempty
  333. \ nextgroup=ttLoopUpperBlock
  334. syntax region ttLoopUpperBlock
  335. \ matchgroup=ttBraces start=/{/ end=/}/
  336. \ contained
  337. \ skipwhite skipempty
  338. \ nextgroup=ttLoopVarBlock
  339. " }}}
  340. " Highlight Color Block {{{
  341. syntax region ttHighColorBlock
  342. \ matchgroup=ttBraces start=/{/ end=/}/
  343. \ contained
  344. " }}}
  345. " Functions Name Block {{{
  346. syntax region ttFunctionNameBlock
  347. \ matchgroup=ttBraces start=/{/ end=/}/
  348. \ contained
  349. " }}}
  350. " Variable Name Block {{{
  351. syntax match ttVarVar "[^ ;]\+"
  352. \ contained
  353. \ contains=ttVarIndex
  354. \ skipwhite
  355. \ nextgroup=ttValueBlock
  356. syntax region ttVarVarBlock
  357. \ matchgroup=ttBraces start=/{/ end=/}/
  358. \ contained
  359. \ contains=ttVarIndex
  360. \ skipwhite
  361. \ nextgroup=ttValueBlock
  362. syntax match ttFormatVar "[^ ;]\+"
  363. \ contained
  364. \ contains=ttVarIndex
  365. \ skipwhite
  366. \ nextgroup=ttFormatBlock
  367. syntax region ttFormatVarBlock
  368. \ matchgroup=ttBraces start=/{/ end=/}/
  369. \ contained
  370. \ contains=ttVarIndex
  371. \ skipwhite skipempty
  372. \ nextgroup=ttFormatBlock
  373. syntax match ttMathVar "[^ ;]\+"
  374. \ contained
  375. \ contains=ttVarIndex
  376. \ skipwhite
  377. \ nextgroup=ttExpressionBlock
  378. syntax region ttMathVarBlock
  379. \ matchgroup=ttBraces start=/{/ end=/}/
  380. \ contained
  381. \ contains=ttVarIndex
  382. \ skipwhite skipempty
  383. \ nextgroup=ttExpressionBlock
  384. syntax match ttMRegexVar "[^ ;]\+"
  385. \ contained
  386. \ contains=ttVarIndex
  387. \ skipwhite
  388. \ nextgroup=ttFormatBlock
  389. syntax region ttRegexVarBlock
  390. \ matchgroup=ttBraces start=/{/ end=/}/
  391. \ contained
  392. \ contains=ttVarIndex
  393. \ skipwhite skipempty
  394. \ nextgroup=ttPatternBlock
  395. syntax match ttReplaceVar "[^ ;]\+"
  396. \ contained
  397. \ contains=ttVarIndex
  398. \ skipwhite
  399. \ nextgroup=ttReplaceFormatBlock
  400. syntax region ttReplaceVarBlock
  401. \ matchgroup=ttBraces start=/{/ end=/}/
  402. \ contained
  403. \ contains=ttVarIndex
  404. \ skipwhite skipempty
  405. \ nextgroup=ttReplaceFormatBlock
  406. syntax match ttListVar "[^ ;]\+"
  407. \ contained
  408. \ contains=ttVarIndex
  409. \ skipwhite
  410. \ nextgroup=ttListSub
  411. syntax region ttListVarBlock
  412. \ matchgroup=ttBraces start=/{/ end=/}/
  413. \ contained
  414. \ contains=ttVarIndex
  415. \ skipwhite skipempty
  416. \ nextgroup=ttListSub
  417. syntax match ttPathVar "[^ ;]\+"
  418. \ contained
  419. \ contains=ttVarIndex
  420. \ skipwhite
  421. \ nextgroup=ttListSub
  422. syntax region ttPathVarBlock
  423. \ matchgroup=ttBraces start=/{/ end=/}/
  424. \ contained
  425. \ contains=ttVarIndex
  426. \ skipwhite skipempty
  427. \ nextgroup=ttListSub
  428. " }}}
  429. " Ticker/Delay Name {{{
  430. syntax region ttTimeNameBlock
  431. \ matchgroup=ttBraces start=/{/ end=/}/
  432. \ contained
  433. " }}}
  434. " Class Blocks {{{
  435. syntax match ttClassName "[^ ;]\+"
  436. \ contained
  437. \ skipwhite
  438. \ nextgroup=ttClassSub
  439. syntax region ttClassNameBlock
  440. \ matchgroup=ttBraces start=/{/ end=/}/
  441. \ contained
  442. \ skipwhite
  443. \ nextgroup=ttClassSub
  444. syntax match ttClassSub "\c\%[{]\(open\|close\|kill\)\%[}]"
  445. \ contained
  446. \ contains=ttSubBrace
  447. syntax match ttClassSub "\c\%[{]\(read\|write\)\%[}]"
  448. \ contained
  449. \ contains=ttSubBrace
  450. \ skipwhite
  451. \ nextgroup=ttFileNameBlock,ttFileName
  452. " }}}
  453. " List Block {{{
  454. syntax match ttListSub "\c\%[{]\(add\|cl\%[ear]\|create\|del\%[ete]\|ins\%[ert]\|get\|set\|size\|sort\)\%[}]"
  455. \ contained
  456. \ contains=ttSubBrace
  457. " }}}
  458. " Map Block {{{
  459. syntax match ttMapSub "\c\%[{]\(at\|create\|destroy\|info\|jump\|find\|flag\|get\|goto\|leave\|legend\|list\|map\|name\|resize\|return\|run\|undo\|vnum\)\%[}]"
  460. \ contained
  461. \ contains=ttSubBrace
  462. syntax match ttMapSub "\c\%[{]\(read\|write\)\%[}]"
  463. \ contained
  464. \ contains=ttSubBrace
  465. \ skipwhite skipempty
  466. \ nextgroup=ttFileNameBlock,ttFileName
  467. syntax match ttMapSub "\c\%[{]color\%[}]"
  468. \ contained
  469. \ contains=ttSubBrace
  470. \ skipwhite skipempty
  471. \ nextgroup=ttMapSubSubColor
  472. syntax match ttMapSub "\c\%[{]flag\%[}]"
  473. \ contained
  474. \ contains=ttSubBrace
  475. \ skipwhite skipempty
  476. \ nextgroup=ttMapSubSubFlag
  477. syntax match ttMapSub "\c\%[{]\(delete\|dig\|exit\%[flag]\|explore\|insert\|link\|move\|travel\|uninsert\|unlink\)\%[}]"
  478. \ contained
  479. \ contains=ttSubBrace
  480. \ skipwhite skipempty
  481. \ nextgroup=ttMapSubSubDirection
  482. syntax match ttMapSub "\c\%[{]roomflag\%[}]"
  483. \ contained
  484. \ contains=ttSubBrace
  485. \ skipwhite skipempty
  486. \ nextgroup=ttMapSubSubRoomFlag
  487. syntax match ttMapSub "\c\%[{]set\%[}]"
  488. \ contained
  489. \ contains=ttSubBrace
  490. \ skipwhite skipempty
  491. \ nextgroup=ttMapSubSubSet
  492. syntax match ttMapSubSubColor "\c\%[{]\(exit\|here\|path\|room\)\%[}]"
  493. \ contained
  494. \ contains=ttSubBrace
  495. syntax match ttMapSubSubFlag "\c\%[{]\(asciigraphics\|asciivnums\|mudfont\|nofollow\|static\|symbolgraphics\|vtmap\|vtgraphics\)\%[}]"
  496. \ contained
  497. \ contains=ttSubBrace
  498. syntax match ttMapSubSubDirection "\c\%[{]\(ne\|nw\|se\|sw\|n\|s\|e\|w\|w\|u\|d\)\%[}]"
  499. \ contained
  500. \ contains=ttSubBrace
  501. syntax match ttMapSubSubRoomFlag "\c\%[{]\(avoid\|hide\|leave\|void\|static\)\%[}]"
  502. \ contained
  503. \ contains=ttSubBrace
  504. syntax match ttMapSubSubSet "\c\%[{]room\(area\|color\|data\|desc\|flags\|name\|note\|symbol\|terrain\|weight\)\%[}]"
  505. \ contained
  506. \ contains=ttSubBrace
  507. " }}}
  508. " Path Block {{{
  509. syntax match ttPathSub "\c\%[{]\(end\|del\|new\|run\|show\|walk\|zip\|unzip\)\%[}]"
  510. \ contained
  511. \ contains=ttSubBrace
  512. syntax match ttPathSub "\c\%[{]\(load\|save\)\%[}]"
  513. \ contained
  514. \ contains=ttSubBrace
  515. \ skipwhite
  516. \ nextgroup=ttPathVarBlock,ttPathVar
  517. syntax match ttPathSub "\c\%[{]\(ins\%[ert]\)\%[}]"
  518. \ contained
  519. \ contains=ttSubBrace
  520. \ skipwhite
  521. \ nextgroup=ttValueBlock
  522. " }}}
  523. " Log Block {{{
  524. syntax match ttLogSub "\c\%[{]\(a\%[ppend]\|ov\%[erwrite]\|of\%[f]\)\%[}]"
  525. \ contained
  526. \ contains=ttSubBrace
  527. \ skipwhite
  528. \ nextgroup=ttFileNameBlock,ttFileName
  529. " }}}
  530. " Buffer Block {{{
  531. syntax match ttBufferSub "\c\%[{]\(clear\|down\|end\|find\|home\|info\|lock\|up\)\%[}]"
  532. \ contained
  533. \ contains=ttSubBrace
  534. syntax match ttBufferSub "\c\%[{]write\%[}]"
  535. \ contained
  536. \ contains=ttSubBrace
  537. \ skipwhite
  538. \ nextgroup=ttFileNameBlock,ttFileName
  539. syntax match ttBufferSub "\c\%[{]get\%[}]"
  540. \ contained
  541. \ contains=ttSubBrace
  542. \ skipwhite
  543. " }}}
  544. " Event Name {{{
  545. syntax region ttEventBlock
  546. \ matchgroup=ttBraces start=/{/ end=/}/
  547. \ contained
  548. " }}}
  549. " Cursor Option {{{
  550. syntax region ttCursorBlock
  551. \ matchgroup=ttBraces start=/{/ end=/}/
  552. \ contained
  553. \ skipwhite skipempty
  554. \ nextgroup=ttKeyBlock
  555. " }}}
  556. "Session/Run Name Blocks {{{
  557. syntax match ttSessionName "[^ ;]\+"
  558. \ contained
  559. syntax region ttSessionNameBlock
  560. \ matchgroup=ttBraces start=/{/ end=/}/
  561. \ contained
  562. syntax match ttSesSessionName "[^ ;]\+"
  563. \ contained
  564. \ skipwhite
  565. \ nextgroup=ttSessionURIBlock,ttSessionURI
  566. syntax region ttSesSessionNameBlock
  567. \ matchgroup=ttBraces start=/{/ end=/}/
  568. \ contained
  569. \ skipwhite
  570. \ nextgroup=ttSessionURIBlock,ttSessionURI
  571. syntax match ttRunSessionName "[^ ;]\+"
  572. \ contained
  573. \ skipwhite
  574. \ nextgroup=ttShellCmd
  575. syntax region ttRunSessionNameBlock
  576. \ matchgroup=ttBraces start=/{/ end=/}/
  577. \ contained
  578. \ skipwhite
  579. \ nextgroup=ttShellCmd
  580. syntax match ttSessionURI "[^ ;]\+"
  581. \ contained
  582. \ skipwhite
  583. \ nextgroup=ttSessionPortBlock,ttSessionPort
  584. syntax region ttSessionURIBlock
  585. \ matchgroup=ttBraces start=/{/ end=/}/
  586. \ contained
  587. \ skipwhite
  588. \ nextgroup=ttSessionPortBlock,ttSessionPort
  589. syntax match ttSessionPort "[^ ;]\+"
  590. \ contained
  591. syntax region ttSessionPortBlock
  592. \ matchgroup=ttBraces start=/{/ end=/}/
  593. \ contained
  594. " }}}
  595. " History Block {{{
  596. syntax match ttHistSub "\c\%[{]\(delete\|list\)\%[}]"
  597. \ contained
  598. \ contains=ttSubBrace
  599. syntax match ttHistSub "\c\%[{]insert\%[}]"
  600. \ contained
  601. \ contains=ttSubBrace
  602. \ skipwhite
  603. \ nextgroup=ttValueBlock
  604. syntax match ttHistSub "\c\%[{]\(write\|read\)\%[}]"
  605. \ contained
  606. \ contains=ttSubBrace
  607. \ skipwhite
  608. \ nextgroup=ttFileNameBlock,ttFileName
  609. " }}}
  610. " Echo Block {{{
  611. syntax region ttEchoBlock
  612. \ matchgroup=ttBraces start=/{/ end=/}/
  613. \ contained
  614. \ contains=ttFormatBlock,ttEchoNumberBlock
  615. syntax match ttEchoNumberBlock "{\d\+}"
  616. \ contained
  617. \ contains=ttCodeBlock
  618. " }}}
  619. " RegEx Matching Block {{{
  620. syntax region ttRegExBlock
  621. \ matchgroup=ttRegExBraces start=/{/ end=/}/
  622. \ contained
  623. \ contains=ttRegExBlock
  624. \ containedin=ttPatternBlock,ttPatternBlockSub,ttPatternBlockHigh
  625. " }}}
  626. " String Block {{{
  627. syntax region ttString
  628. \ matchgroup=ttBraces start=/"/ skip=/\\"/ end=/"/
  629. \ contained
  630. \ contains=ttRegExBlock
  631. \ containedin=ttExpressionBlock
  632. " }}}
  633. " Config Block {{{
  634. syntax region ttConfigBlock
  635. \ matchgroup=ttBraces start=/{/ end=/}/
  636. \ contained
  637. " }}}
  638. " Line Block {{{
  639. syntax match ttLineSub "\c\%[{]\(gag\)\%[}]"
  640. \ contained
  641. \ contains=ttSubBrace
  642. syntax match ttLineSub "\c\%[{]\(strip\|ignore\|verbose\)\%[}]"
  643. \ contained
  644. \ contains=ttSubBrace
  645. syntax match ttLineSub "\c\%[{]\(sub\%[titute]\)\%[}]"
  646. \ contained
  647. \ contains=ttSubBrace
  648. \ skipwhite
  649. \ nextgroup=ttLineSubSub
  650. syntax match ttLineSub "\c\%[{]\(log\%[verbatim]\)\%[}]"
  651. \ contained
  652. \ contains=ttSubBrace
  653. \ skipwhite
  654. \ nextgroup=ttFileNameBlock,ttFileName
  655. syntax match ttLineSubSub "\c\%[{]\(var\%[iables]\|functions\|colors\|escapes\|secure\|eol\|lnf\)\%[}]"
  656. \ contained
  657. \ contains=ttSubBrace
  658. " }}}
  659. " Un* Block {{{
  660. syntax region ttUnBlock
  661. \ matchgroup=ttBraces start=/{/ end=/}/
  662. \ contained
  663. syntax match ttUn "[^;{} ]\+"
  664. \ contained
  665. " }}}
  666. " Generic Block:
  667. " Falls Back To Generic Code Block {{{
  668. syntax region ttCodeBlock
  669. \ matchgroup=ttBraces start=/{/ end=/}/
  670. \ contains=ttCodeBlock,ttCmdSep,@ttCmds,ttNopComment
  671. " }}}
  672. " Error Block: {{{
  673. syntax region ttErrorBlock
  674. \ start=/\S\+/ end=/$\|;/
  675. \ keepend
  676. \ contains=ttCmdSep
  677. \ contained
  678. " }}}
  679. " }}}
  680. " Syntax Elements {{{
  681. " Numbers {{{
  682. syntax match ttInt "\d\+"
  683. \ containedin=ttCodeBlock,ttValueBlock,ttTimeNameBlock,ttExpressionBlock,ttVarIndex,ttLoopLowerBlock,ttLoopUpperBlock,ttFuncBlock,ttSessionPort,ttSessionPortBlock
  684. syntax match ttFloat "\d\+.\d\+"
  685. \ containedin=ttCodeBlock,ttValueBlock,ttTimeNameBlock,ttExpressionBlock,ttVarIndex,ttLoopLowerBlock,ttLoopUpperBlock,ttFuncBlock,ttSessionPort,ttSessionPortBlock
  686. " }}}
  687. " Lazy Match Patterns {{{
  688. syntax match ttMatchLazy "%[iIwWdDsS?.+*]"
  689. \ contained
  690. \ containedin=ttPatternBlock,ttPatternBlockHigh,ttPatternBlockSub,ttUn,ttUnBlock,ttReplaceFormatBlock,ttString
  691. " }}}
  692. " Match Special Regex Chars {{{
  693. syntax match ttMatchSpecial "\^\|\~\|\$"
  694. \ contained
  695. \ containedin=ttPatternBlock,ttPatternBlockHigh,ttPatternBlockSub,ttReplaceFormatBlock
  696. " }}}
  697. " Format specifiers {{{
  698. syntax match ttFormat "%\%[.+-][0-9]\{-}[acdghlmnprstuwACLRTU]"
  699. \ contained
  700. \ containedin=ttFormatBlock,ttEchoBlock
  701. " }}}
  702. " RexEx {{{
  703. syntax match ttRegEx "\(\.\|+\|?\|*\|\\.\)"
  704. \ contained
  705. \ containedin=ttRegExBlock
  706. syntax match ttRegExBraces "\()\|(\|\]\|\[\||\)"
  707. \ contained
  708. \ containedin=ttRegExBlock
  709. " }}}
  710. " Math and Bitwise Operators {{{
  711. syntax match ttOperators "\(<<\|>>\|==\|!=\|^^\|||\|&&\|[-+*%&/^|<>!=]\)"
  712. \ contained
  713. \ containedin=ttExpressionBlock
  714. syntax match ttOperatorsParen "[)(]"
  715. \ contained
  716. \ containedin=ttExpressionBlock
  717. " }}}
  718. " Color codes {{{
  719. syntax match ttColor "<\d\d\d>"
  720. \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock
  721. syntax match ttColor "<[a-fA-F][a-fA-F][a-fA-F]>"
  722. \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock
  723. syntax match ttColor "<[gG]\d\{2}>"
  724. \ containedin=ttFormatBlock,ttValueBlock,ttEchoBlock
  725. " }}}
  726. " Dynamic Variables {{{
  727. syntax match ttArgRef "%\d\{1,2}"
  728. \ containedin=ALLBUT,ttComment,ttNopComment
  729. syntax match ttRegExRef "&\d\{1,2}"
  730. \ containedin=ALLBUT,ttComment,ttNopComment
  731. " }}}
  732. " Character Escapes {{{
  733. syntax match ttEsc "\\[0abcenrt\\]"
  734. \ containedin=ALLBUT,ttComment,ttNopComment
  735. syntax match ttEsc "\\x\x\{2}"
  736. \ containedin=ALLBUT,ttComment,ttNopComment
  737. syntax match ttEsc "\\\d\d\d"
  738. \ containedin=ALLBUT,ttComment,ttNopComment
  739. " }}}
  740. " ANSI Escape/Control Codes {{{
  741. syntax match ttAnsiEsc /\\e\[[0-9;\\]\{-}m/
  742. \ containedin=ALLBUT,ttComment,ttNopComment
  743. " }}}
  744. " tintin Variables {{{
  745. syntax match ttVar "\$\%[{][a-zA-Z_]\+"
  746. \ nextgroup=ttVarIndex
  747. \ containedin=ALLBUT,ttComment,ttNopComment
  748. syntax match ttVar "&\%[{][a-zA-Z_]\+"
  749. \ nextgroup=ttVarIndex
  750. \ containedin=ALLBUT,ttComment,ttNopComment
  751. " }}}
  752. " Variable Blocks {{{
  753. syntax region ttVarBlock
  754. \ matchgroup=ttVarBraces start=/${/ end=/}/
  755. \ contains=ttVarIndex
  756. \ containedin=ALLBUT,ttComment,ttNopComment
  757. syntax region ttVarBlock
  758. \ matchgroup=ttVarBraces start=/&{/ end=/}/
  759. \ contains=ttVarIndex
  760. \ containedin=ALLBUT,ttComment,ttNopComment
  761. " }}}
  762. " Variable Index {{{
  763. syntax region ttVarIndex
  764. \ matchgroup=ttVarIndexBracket start=/\[/ end=/\]/
  765. \ contained
  766. \ containedin=ttVarBlock
  767. \ transparent
  768. \ nextgroup=ttVarIndex
  769. " }}}
  770. " @function calls and the obligatory braces around the arguments {{{
  771. syntax region ttFuncBlock
  772. \ matchgroup=ttBracesFunction start=/{/ skip=/$/ end=/}/
  773. \ contains=ttCodeBlock
  774. \ contained
  775. syntax match ttFunction "@[A-Za-z_0-9]\+"
  776. \ containedin=ALLBUT,ttComment,ttNopComment
  777. \ nextgroup=ttFuncBlock
  778. " }}}
  779. " Optional SubCommand Braces {{{
  780. syntax match ttSubBrace "{\|}"
  781. \ contained
  782. " }}}
  783. " Command Terminator {{{
  784. syntax match ttCmdSep /;/
  785. \ containedin=ttCodeBlock,ttFuncBlock,ttForAllBlock,ttForEachBlock
  786. " }}}
  787. " }}}
  788. " Comments {{{
  789. " #nop comments
  790. syntax region ttNopComment
  791. \ matchgroup=ttNop start="#nop" end=/\;\|$/
  792. " C-style multi-line comments
  793. syntax region ttComment start="/\*" end="\*/"
  794. syntax region ttCommentError start="/\*" end="\*/"
  795. \ contained
  796. \ containedin=ttCodeBlock
  797. " Special notes in Comments
  798. syntax keyword ttTodo TODO FIXME XXX BUG DEBUG
  799. \ contained
  800. \ containedin=ttComment,ttNopComment
  801. " }}}
  802. " Internal Highlink Linking {{{
  803. " Link ttCmd* to ttCmd Group {{{
  804. hi link ttCmdBranch ttCmd
  805. hi link ttCmdDebug ttCmd
  806. hi link ttCmdInput ttCmd
  807. hi link ttCmdLoop ttCmd
  808. hi link ttCmdRep ttCmd
  809. hi link ttCmdSwitch ttCmd
  810. hi link ttCmdTime ttCmd
  811. hi link ttCmdTrigger ttCmd
  812. hi link ttCmdUseless ttCmd
  813. hi link ttCmdVar ttCmd
  814. hi link ttCmdUn ttCmd
  815. hi link ttCmdScript ttCmd
  816. "}}}
  817. " Link Syntax Elements {{{
  818. hi link ttMatchLazy ttMacro
  819. hi link ttMatchSpecial ttMacro
  820. hi link ttFormat ttMacro
  821. hi link ttRegEx ttMacro
  822. hi link ttRegExBraces ttBraces
  823. hi link ttColor ttMacro
  824. hi link ttEsc ttMacro
  825. hi link ttAnsiEsc ttMacro
  826. hi link ttArgRef ttReference
  827. hi link ttRegExRef ttReference
  828. " }}}
  829. " tintin Lists and Sub commands are keywords {{{
  830. hi link ttListNameKill ttKeyword
  831. hi link ttListName ttKeyword
  832. hi link ttConfigBlock ttKeyword
  833. hi link ttListSub ttKeyword
  834. hi link ttPathSub ttKeyword
  835. hi link ttLogSub ttKeyword
  836. hi link ttClassSub ttKeyword
  837. hi link ttHistSub ttKeyword
  838. hi link ttEventBlock ttKeyword
  839. hi link ttCursorBlock ttKeyword
  840. hi link ttBufferSub ttKeyword
  841. hi link ttLineSub ttKeyword
  842. hi link ttLineSubSub ttKeyword
  843. hi link ttMapSub ttKeyword
  844. hi link ttMapSubSubSet ttKeyword
  845. hi link ttMapSubSubColor ttKeyword
  846. hi link ttMapSubSubFlag ttKeyword
  847. hi link ttMapSubSubRoomFlag ttKeyword
  848. hi link ttMapSubSubDirection ttKeyword
  849. " }}}
  850. hi link ttSessionURIBlock ttSessionURI
  851. hi link ttSessionURI ttString
  852. " Link all Braces together {{{
  853. hi link ttBracesMatch ttBraces
  854. hi link ttBracesFormat ttBraces
  855. hi link ttBracesValue ttBraces
  856. hi link ttBracesExpression ttBraces
  857. hi link ttVarIndexBracket ttBraces
  858. hi link ttRegExBraces ttBraces
  859. hi link ttOperatorsParen ttBraces
  860. hi link ttSubBrace ttBraces
  861. " }}}
  862. hi link ttBracesFunction ttFunction
  863. " Link Various Variable Names to ttVarName {{{
  864. hi link ttLoopVarBlock ttVarName
  865. hi link ttMathVarBlock ttVarName
  866. hi link ttFormatVarBlock ttVarName
  867. hi link ttRegexVarBlock ttVarName
  868. hi link ttReplaceVarBlock ttVarName
  869. hi link ttVarVarBlock ttVarName
  870. hi link ttListVarBlock ttVarName
  871. hi link ttPathVarBlock ttVarName
  872. hi link ttVarVar ttVarName
  873. hi link ttMathVar ttVarName
  874. hi link ttFormatVar ttVarName
  875. hi link ttRegexVar ttVarName
  876. hi link ttReplaceVar ttVarName
  877. hi link ttListVar ttVarName
  878. hi link ttPathVar ttVarName
  879. hi link ttScriptVarNameVar ttVarName
  880. " }}}
  881. " Link all pattern blocks together {{{
  882. hi link ttPatternBlockHigh ttPatternBlock
  883. hi link ttPatternBlockSub ttPatternBlock
  884. " }}}
  885. " Link all names to ttIdentifier {{{
  886. hi link ttClassName ttIdentifier
  887. hi link ttClassNameBlock ttIdentifier
  888. hi link ttTimeNameBlock ttIdentifier
  889. hi link ttSessionName ttIdentifier
  890. hi link ttSessionNameBlock ttIdentifier
  891. hi link ttSesSessionName ttIdentifier
  892. hi link ttSesSessionNameBlock ttIdentifier
  893. hi link ttRunSessionName ttIdentifier
  894. hi link ttRunSessionNameBlock ttIdentifier
  895. hi link ttUnBlock ttIdentifier
  896. hi link ttUn ttIdentifier
  897. " }}}
  898. " Link various number types to ttNumber {{{
  899. hi link ttInt ttNumber
  900. hi link ttFloat ttNumber
  901. " }}}
  902. hi link ttFunctionNameBlock ttFunction
  903. hi link ttFileNameBlock ttFileName
  904. hi link ttScriptShell ttShellCmd
  905. hi link ttVarBlock ttVar
  906. hi link ttVarBraces ttVar
  907. hi link ttNopComment ttComment
  908. hi link ttNop ttCmd
  909. hi link ttCommentError ttError
  910. hi link ttErrorBlock ttError
  911. " }}}
  912. " Link tt Highlighting Groups to Default Groups {{{
  913. hi default link ttVar Special
  914. hi default link ttCmd Statement
  915. hi default link ttBraces Delimiter
  916. hi default link ttCmdSep Delimiter
  917. hi default link ttFileName Character
  918. hi default link ttReference Special
  919. hi default link ttMacro Macro
  920. hi default link ttKeyword Keyword
  921. hi default link ttFunction Function
  922. hi default link ttShellCmd Character
  923. hi default link ttVarName Identifier
  924. hi default link ttIdentifier Identifier
  925. hi default link ttNumber Number
  926. hi default link ttString String
  927. hi default link ttOperators Operator
  928. hi default link ttCodeBlock Structure
  929. hi default link ttTodo Todo
  930. hi default link ttComment Comment
  931. hi default link ttError Error
  932. " }}}
  933. let b:current_syntax = "tt"