Clean up the vim syntax a bit, add escape characters and incorporate changes from bram
This commit is contained in:
parent
f070575205
commit
e77ec4b16a
@ -2,74 +2,93 @@
|
|||||||
" Language: ChaiScript
|
" Language: ChaiScript
|
||||||
" Maintainer: Jason Turner <lefticus 'at' gmail com>
|
" Maintainer: Jason Turner <lefticus 'at' gmail com>
|
||||||
|
|
||||||
|
" Quit when a (custom) syntax file was already loaded
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
end
|
||||||
|
|
||||||
syn case match
|
syn case match
|
||||||
|
|
||||||
" syncing method
|
" syncing method
|
||||||
syn sync fromstart
|
syn sync fromstart
|
||||||
|
|
||||||
" Strings
|
" Strings
|
||||||
syn region chaiscriptString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=chaiscriptSpecial,@Spell
|
syn region chaiscriptString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=chaiscriptSpecial,chaiscriptEval,@Spell
|
||||||
|
|
||||||
|
" Escape characters
|
||||||
|
syn match chaiscriptSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}"
|
||||||
|
|
||||||
|
" String evals
|
||||||
|
syn region chaiscriptEval contained start="${" end="}"
|
||||||
|
|
||||||
" integer number
|
" integer number
|
||||||
syn match chaiscriptNumber "\<\d\+\>"
|
syn match chaiscriptNumber "\<\d\+\>"
|
||||||
|
|
||||||
" floating point number, with dot, optional exponent
|
" floating point number, with dot, optional exponent
|
||||||
syn match chaiscriptFloat "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>"
|
syn match chaiscriptFloat "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>"
|
||||||
|
|
||||||
" floating point number, starting with a dot, optional exponent
|
" floating point number, starting with a dot, optional exponent
|
||||||
syn match chaiscriptFloat "\.\d\+\%(e[-+]\=\d\+\)\=\>"
|
syn match chaiscriptFloat "\.\d\+\%(e[-+]\=\d\+\)\=\>"
|
||||||
|
|
||||||
" floating point number, without dot, with exponent
|
" floating point number, without dot, with exponent
|
||||||
syn match chaiscriptFloat "\<\d\+e[-+]\=\d\+\>"
|
syn match chaiscriptFloat "\<\d\+e[-+]\=\d\+\>"
|
||||||
|
|
||||||
syn match chaiscriptNumber "\<0x\x\+\>"
|
" Hex strings
|
||||||
|
syn match chaiscriptNumber "\<0x\x\+\>"
|
||||||
|
|
||||||
syn keyword chaiscriptCond if else
|
" Binary strings
|
||||||
|
syn match chaiscriptNumber "\<0b[01]\+\>"
|
||||||
|
|
||||||
syn keyword chaiscriptRepeat while for do
|
" Various language features
|
||||||
syn keyword chaiscriptStatement break continue return
|
syn keyword chaiscriptCond if else
|
||||||
|
syn keyword chaiscriptRepeat while for do
|
||||||
syn keyword chaiscriptExceptions try catch throw
|
syn keyword chaiscriptStatement break continue return
|
||||||
|
syn keyword chaiscriptExceptions try catch throw
|
||||||
|
|
||||||
"Keyword
|
"Keyword
|
||||||
syn keyword chaiscriptKeyword def true false attr
|
syn keyword chaiscriptKeyword def true false attr
|
||||||
|
|
||||||
syn keyword chaiscriptType fun var
|
"Built in types
|
||||||
|
syn keyword chaiscriptType fun var
|
||||||
|
|
||||||
"Built in funcs
|
"Built in funcs, keep it simple
|
||||||
syn keyword chaiscriptFunc eval throw
|
syn keyword chaiscriptFunc eval throw
|
||||||
|
|
||||||
"Let's treat all backtick operator function lookups as built in too
|
"Let's treat all backtick operator function lookups as built in too
|
||||||
syn region chaiscriptFunc matchgroup=chaiscriptFunc start="`" end="`"
|
syn region chaiscriptFunc matchgroup=chaiscriptFunc start="`" end="`"
|
||||||
|
|
||||||
syn match chaiscriptOperator "\.\."
|
" Account for the "[1..10]" syntax, treating it as an operator
|
||||||
|
" Intentionally leaving out all of the normal, well known operators
|
||||||
|
syn match chaiscriptOperator "\.\."
|
||||||
|
|
||||||
|
" Guard seperator as an operator
|
||||||
|
syn match chaiscriptOperator ":"
|
||||||
|
|
||||||
" Comments
|
" Comments
|
||||||
syn match chaiscriptComment "//.*$" contains=@Spell
|
syn match chaiscriptComment "//.*$" contains=@Spell
|
||||||
syn region chaiscriptComment matchgroup=chaiscriptComment start="/\*" end="\*/" contains=@Spell
|
syn region chaiscriptComment matchgroup=chaiscriptComment start="/\*" end="\*/" contains=@Spell
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
command -nargs=+ HiLink hi def link <args>
|
hi def link chaiscriptExceptions Exception
|
||||||
|
hi def link chaiscriptKeyword Keyword
|
||||||
HiLink chaiscriptExceptions Exception
|
hi def link chaiscriptStatement Statement
|
||||||
HiLink chaiscriptKeyword Keyword
|
hi def link chaiscriptRepeat Repeat
|
||||||
HiLink chaiscriptStatement Statement
|
hi def link chaiscriptString String
|
||||||
HiLink chaiscriptRepeat Repeat
|
hi def link chaiscriptNumber Number
|
||||||
HiLink chaiscriptString String
|
hi def link chaiscriptFloat Float
|
||||||
HiLink chaiscriptNumber Number
|
hi def link chaiscriptOperator Operator
|
||||||
HiLink chaiscriptFloat Float
|
hi def link chaiscriptConstant Constant
|
||||||
HiLink chaiscriptOperator Operator
|
hi def link chaiscriptCond Conditional
|
||||||
HiLink chaiscriptConstant Constant
|
hi def link chaiscriptFunction Function
|
||||||
HiLink chaiscriptCond Conditional
|
hi def link chaiscriptComment Comment
|
||||||
HiLink chaiscriptFunction Function
|
hi def link chaiscriptTodo Todo
|
||||||
HiLink chaiscriptComment Comment
|
hi def link chaiscriptError Error
|
||||||
HiLink chaiscriptTodo Todo
|
hi def link chaiscriptSpecial SpecialChar
|
||||||
HiLink chaiscriptError Error
|
hi def link chaiscriptFunc Identifier
|
||||||
HiLink chaiscriptSpecial SpecialChar
|
hi def link chaiscriptType Type
|
||||||
HiLink chaiscriptFunc Identifier
|
hi def link chaiscriptEval Special
|
||||||
HiLink chaiscriptType Type
|
|
||||||
|
|
||||||
delcommand HiLink
|
|
||||||
|
|
||||||
let b:current_syntax = "chaiscript"
|
let b:current_syntax = "chaiscript"
|
||||||
|
|
||||||
" vim: nowrap sw=2 sts=2 ts=8 noet ff=unix:
|
" vim: nowrap sw=2 sts=2 ts=8 noet
|
||||||
|
Loading…
x
Reference in New Issue
Block a user