diff --git a/after/syntax/ats.vim b/after/syntax/ats.vim index 0f6be19..613b23e 100644 --- a/after/syntax/ats.vim +++ b/after/syntax/ats.vim @@ -9,4 +9,18 @@ syntax match logicalOr '||' conceal cchar=∨ " FIXME boring white? hi! link Conceal Keyword +" store and remove current syntax value +let old_syntax = b:current_syntax +unlet b:current_syntax + +syn include @c syntax/c.vim +unlet b:current_syntax + +syn region madBlock matchgroup=atsCBlock start="%{" end="%}" contains=@c + +hi def link atsCBlock Special + +" restore current syntax value +let b:current_syntax = old_syntax + setlocal conceallevel=1 diff --git a/syntax/ats.vim b/syntax/ats.vim index 3bb3c5b..cdacc31 100644 --- a/syntax/ats.vim +++ b/syntax/ats.vim @@ -9,14 +9,43 @@ syn keyword atsTodo TODO FIXME contained syn match atsComment "\v\/\/.*$" syn region atsNestComment start="(\*" end="\*)" contains=atsNestComment,atsTodo,@Spell -syn keyword atsKeyword staload overload with fun +syn match atsIdentifier "\v[a-zA-Z][a-zA-Z_0-9]*" -syn keyword atsType void bool string char int uint charNZ strnptr Strptr0 Strptr1 +syn match atsChar "\v'.'" +syn match atsUint "\v[0-9]+u" +syn match atsInt "\v[0-9]+" + +syn match atsSpecial +\v\\["nt]+ + +syn region atsString start=+"+ end=+"+ contains=atsSpecial + +syn keyword atsKeyword staload dynload overload with fun symintr include +syn keyword atsKeyword lam llam + +syn match atsArrow "\v\=\>+" + +syn keyword atsFixity infixr infixl prefix postfix + +syn keyword atsType void bool string char int uint charNZ strnptr Strptr0 Strptr1 nat +syn keyword atsType datavtype datatype vtypedef dataviewtype viewtypdef typedef +syn keyword atsType implement primplmnt extern + +syn match atsSpecial "\v[@\[\]]" + +syn match atsMacro "\v\#.*$" + +highlight link atsFixity Underlined +highlight link atsSpecial Special +highlight link atsString String +highlight link atsUint Number +highlight link atsInt Number +highlight link atsChar Character highlight link atsComment Comment highlight link atsNestComment Comment highlight link atsKeyword Keyword highlight link atsType Type +highlight link atsIdentifier Identifier let b:current_syntax = 'ats'