vim: look for `{ in deciding to highlight ffi language name. eg "C".
[nit.git] / misc / vim / syntax / nit.vim
index 8b68b53..9c3ede7 100644 (file)
@@ -44,8 +44,8 @@ syn match NITClass            "\<\u\w*"
 syn match NITAttribute         "\<_\h\w*"
 
 " Literal strings
-syn region NITString matchgroup=NITStringDelimit start="\"" end="\"" skip="\\\\\|\\\"" contains=NITExprSubst,NITExprSubstError
-syn region NITString matchgroup=NITStringDelimit start="\"\"\"" end="\"*\zs\"\"\"" skip="\\\\\|\\\"" contains=NITExprSubstLong
+syn region NITString matchgroup=NITStringDelimit start="\"" end="\"" skip="\\\\\|\\\"" contains=NITExprSubst,NITExprSubstError,@Spell
+syn region NITString matchgroup=NITStringDelimit start="\"\"\"" end="\"*\zs\"\"\"" skip="\\\\\|\\\"" contains=NITExprSubstLong,@Spell
 syn region NITString matchgroup=NITStringDelimit start="'"  end="'"  skip="\\\\\|\\'"
 
 " Labels
@@ -82,7 +82,7 @@ exec "syn sync minlines=" . NIT_minlines
 
 " Comments and Documentation
 syn match  NITSharpBang        "\%^#!.*"
-syn match  NITComment  "#.*" contains=NITTodo
+syn match  NITComment  "#.*" contains=NITTodo,@Spell
 
 " Keywords
 syn keyword NITKeyword  abstract intern new
@@ -131,25 +131,31 @@ hi def link NITFFIDelimiters              Keyword
 " FFI Python
 syntax include @FFIPython syntax/python.vim
 unlet b:current_syntax
-syn match NITFFILanguage       '"Python"' nextgroup=NITFFIBlockPython skipwhite
+syn match NITFFILanguage       /\c"Python"\ze.*`{/ nextgroup=NITFFIBlockPython skipwhite
 syn region NITFFIBlockPython matchgroup=NITFFI start='`{' matchgroup=NITFFI end='`}' keepend fold contains=@FFIPython
 
 " FFI Java
 syntax include @FFIJava syntax/java.vim
 unlet b:current_syntax
-syn match NITFFILanguage       '"Java"' nextgroup=NITFFIBlockJava skipwhite
+syn match NITFFILanguage       /\c"Java\(\| inner\)"\ze.*`{/ nextgroup=NITFFIBlockJava skipwhite
 syn region NITFFIBlockJava matchgroup=NITFFI start='`{' matchgroup=NITFFI end='`}' keepend fold contains=@FFIJava
 
 " FFI C++
 syntax include @FFICpp syntax/cpp.vim
 unlet b:current_syntax
-syn match NITFFILanguage       '"C++"' nextgroup=NITFFIBlockCpp skipwhite
+syn match NITFFILanguage       /\c"C++\(\| header\| body\)"\ze.*`{/ nextgroup=NITFFIBlockCpp skipwhite
 syn region NITFFIBlockCpp matchgroup=NITFFI start='`{' matchgroup=NITFFI end='`}' keepend fold contains=@FFICpp
 
+" FFI Objective-C
+syntax include @FFIObjC syntax/objc.vim
+unlet b:current_syntax
+syn match NITFFILanguage       /\c"ObjC\(\| Header\| Body\)"\ze.*`{/ nextgroup=NITFFIBlockObjC skipwhite
+syn region NITFFIBlockObjC matchgroup=NITFFI start='`{' matchgroup=NITFFI end='`}' keepend fold contains=@FFIObjC
+
 " FFI C (the last one is the default)
 syntax include @FFIC syntax/c.vim
 unlet b:current_syntax
-syn match NITFFILanguage               '"C\(\| header\| body\)"'       nextgroup=NITFFIBlockC skipwhite
+syn match NITFFILanguage               /\c"C\(\| header\| body\)"\ze.*`{/      nextgroup=NITFFIBlockC skipwhite
 syn region NITFFIBlockC matchgroup=NITFFI start='`{' matchgroup=NITFFI end='`}' keepend fold contains=@FFIC
 
 hi def link NITFFILanguage             Define