Bram Moolenaar | 9fbdbb8 | 2022-09-27 17:30:34 +0100 | [diff] [blame] | 1 | " Vim syntax file |
| 2 | " Language: Chatito |
| 3 | " Maintainer: ObserverOfTime <chronobserver@disroot.org> |
| 4 | " Filenames: *.chatito |
| 5 | " Last Change: 2022 Sep 19 |
| 6 | |
| 7 | if exists('b:current_syntax') |
| 8 | finish |
| 9 | endif |
| 10 | |
| 11 | " Comment |
| 12 | syn keyword chatitoTodo contained TODO FIXME XXX |
| 13 | syn match chatitoComment /^#.*/ contains=chatitoTodo,@Spell |
| 14 | syn match chatitoComment +^//.*+ contains=chatitoTodo,@Spell |
| 15 | |
| 16 | " Import |
| 17 | syn match chatitoImport /^import \+.*$/ transparent contains=chatitoImportKeyword,chatitoImportFile |
| 18 | syn keyword chatitoImportKeyword import contained nextgroup=chatitoImportFile |
| 19 | syn match chatitoImportFile /.*$/ contained skipwhite |
| 20 | |
| 21 | " Intent |
| 22 | syn match chatitoIntent /^%\[[^\]?]\+\]\((.\+)\)\=$/ contains=chatitoArgs |
| 23 | |
| 24 | " Slot |
| 25 | syn match chatitoSlot /^@\[[^\]?#]\+\(#[^\]?#]\+\)\=\]\((.\+)\)\=$/ contains=chatitoArgs,chatitoVariation |
| 26 | syn match chatitoSlot /@\[[^\]?#]\+\(#[^\]?#]\+\)\=?\=\]/ contained contains=chatitoOpt,chatitoVariation |
| 27 | |
| 28 | " Alias |
| 29 | syn match chatitoAlias /^\~\[[^\]?]\+\]\=$/ |
| 30 | syn match chatitoAlias /\~\[[^\]?]\+?\=\]/ contained contains=chatitoOpt |
| 31 | |
| 32 | " Probability |
| 33 | syn match chatitoProbability /\*\[\d\+\(\.\d\+\)\=%\=\]/ contained |
| 34 | |
| 35 | " Optional |
| 36 | syn match chatitoOpt '?' contained |
| 37 | |
| 38 | " Arguments |
| 39 | syn match chatitoArgs /(.\+)/ contained |
| 40 | |
| 41 | " Variation |
| 42 | syn match chatitoVariation /#[^\]?#]\+/ contained |
| 43 | |
| 44 | " Value |
| 45 | syn match chatitoValue /^ \{4\}\zs.\+$/ contains=chatitoProbability,chatitoSlot,chatitoAlias,@Spell |
| 46 | |
| 47 | " Errors |
| 48 | syn match chatitoError /^\t/ |
| 49 | |
| 50 | hi def link chatitoAlias String |
| 51 | hi def link chatitoArgs Special |
| 52 | hi def link chatitoComment Comment |
| 53 | hi def link chatitoError Error |
| 54 | hi def link chatitoImportKeyword Include |
| 55 | hi def link chatitoIntent Statement |
| 56 | hi def link chatitoOpt SpecialChar |
| 57 | hi def link chatitoProbability Number |
| 58 | hi def link chatitoSlot Identifier |
| 59 | hi def link chatitoTodo Todo |
| 60 | hi def link chatitoVariation Special |
| 61 | |
| 62 | let b:current_syntax = 'chatito' |