chaiscript.vim (2887B)
1 " Vim syntax file 2 " Language: ChaiScript 3 " Maintainer: Jason Turner <lefticus 'at' gmail com> 4 5 " Quit when a (custom) syntax file was already loaded 6 if exists("b:current_syntax") 7 finish 8 end 9 10 syn case match 11 12 " syncing method 13 syn sync fromstart 14 15 " Strings 16 syn region chaiscriptString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=chaiscriptSpecial,chaiscriptEval,@Spell 17 18 " Escape characters 19 syn match chaiscriptSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}" 20 21 " String evals 22 syn region chaiscriptEval contained start="${" end="}" 23 24 " integer number 25 syn match chaiscriptNumber "\<\d\+\>" 26 27 " floating point number, with dot, optional exponent 28 syn match chaiscriptFloat "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>" 29 30 " floating point number, starting with a dot, optional exponent 31 syn match chaiscriptFloat "\.\d\+\%(e[-+]\=\d\+\)\=\>" 32 33 " floating point number, without dot, with exponent 34 syn match chaiscriptFloat "\<\d\+e[-+]\=\d\+\>" 35 36 " Hex strings 37 syn match chaiscriptNumber "\<0x\x\+\>" 38 39 " Binary strings 40 syn match chaiscriptNumber "\<0b[01]\+\>" 41 42 " Various language features 43 syn keyword chaiscriptCond if else 44 syn keyword chaiscriptRepeat while for do 45 syn keyword chaiscriptStatement break continue return 46 syn keyword chaiscriptExceptions try catch throw 47 48 "Keyword 49 syn keyword chaiscriptKeyword def true false attr 50 51 "Built in types 52 syn keyword chaiscriptType fun var 53 54 "Built in funcs, keep it simple 55 syn keyword chaiscriptFunc eval throw 56 57 "Let's treat all backtick operator function lookups as built in too 58 syn region chaiscriptFunc matchgroup=chaiscriptFunc start="`" end="`" 59 60 " Account for the "[1..10]" syntax, treating it as an operator 61 " Intentionally leaving out all of the normal, well known operators 62 syn match chaiscriptOperator "\.\." 63 64 " Guard separator as an operator 65 syn match chaiscriptOperator ":" 66 67 " Comments 68 syn match chaiscriptComment "//.*$" contains=@Spell 69 syn region chaiscriptComment matchgroup=chaiscriptComment start="/\*" end="\*/" contains=@Spell 70 71 72 73 hi def link chaiscriptExceptions Exception 74 hi def link chaiscriptKeyword Keyword 75 hi def link chaiscriptStatement Statement 76 hi def link chaiscriptRepeat Repeat 77 hi def link chaiscriptString String 78 hi def link chaiscriptNumber Number 79 hi def link chaiscriptFloat Float 80 hi def link chaiscriptOperator Operator 81 hi def link chaiscriptConstant Constant 82 hi def link chaiscriptCond Conditional 83 hi def link chaiscriptFunction Function 84 hi def link chaiscriptComment Comment 85 hi def link chaiscriptTodo Todo 86 hi def link chaiscriptError Error 87 hi def link chaiscriptSpecial SpecialChar 88 hi def link chaiscriptFunc Identifier 89 hi def link chaiscriptType Type 90 hi def link chaiscriptEval Special 91 92 let b:current_syntax = "chaiscript" 93 94 " vim: nowrap sw=2 sts=2 ts=8 noet