3 " Maintainer: Jason Turner <lefticus 'at' gmail com>
5 " Quit when a (custom) syntax file was already loaded
6 if exists("b:current_syntax")
16 syn region chaiscriptString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=chaiscriptSpecial,chaiscriptEval,@Spell
19 syn match chaiscriptSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}"
22 syn region chaiscriptEval contained start="${" end="}"
25 syn match chaiscriptNumber "\<\d\+\>"
27 " floating point number, with dot, optional exponent
28 syn match chaiscriptFloat "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>"
30 " floating point number, starting with a dot, optional exponent
31 syn match chaiscriptFloat "\.\d\+\%(e[-+]\=\d\+\)\=\>"
33 " floating point number, without dot, with exponent
34 syn match chaiscriptFloat "\<\d\+e[-+]\=\d\+\>"
37 syn match chaiscriptNumber "\<0x\x\+\>"
40 syn match chaiscriptNumber "\<0b[01]\+\>"
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
49 syn keyword chaiscriptKeyword def true false attr
52 syn keyword chaiscriptType fun var
54 "Built in funcs, keep it simple
55 syn keyword chaiscriptFunc eval throw
57 "Let's treat all backtick operator function lookups as built in too
58 syn region chaiscriptFunc matchgroup=chaiscriptFunc start="`" end="`"
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 "\.\."
64 " Guard seperator as an operator
65 syn match chaiscriptOperator ":"
68 syn match chaiscriptComment "//.*$" contains=@Spell
69 syn region chaiscriptComment matchgroup=chaiscriptComment start="/\*" end="\*/" contains=@Spell
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
92 let b:current_syntax = "chaiscript"
94 " vim: nowrap sw=2 sts=2 ts=8 noet