X-Git-Url: http://nitlanguage.org diff --git a/misc/vim/syntax/nit.vim b/misc/vim/syntax/nit.vim index cc44ac6..2930d81 100644 --- a/misc/vim/syntax/nit.vim +++ b/misc/vim/syntax/nit.vim @@ -18,46 +18,64 @@ " See the License for the specific language governing permissions and " limitations under the License. -if exists("b:current_syntax") - finish +if !exists("main_syntax") + if version < 600 + syntax clear + elseif exists("b:current_syntax") + finish + endif + " we define it here so that included files can test for it + let main_syntax='nit' endif " Expression Substitution and Backslash Notation syn match NITExprSubstError "{\|}" contained syn match NITExprSubst "\\." contained -syn match NITExprSubst "{[^}]*}" contained +syn match NITExprSubst "{\([^}]\|\n\)*}" contained -" Numbers and ASCII Codes -syn match NITNumber "\<\(\d\+\.\d\+\|\d\+\)\>" +syn match NITExprSubstLong "\\." contained +syn match NITExprSubstLong "{*\zs{{{\([^}]\|\n\)*}}}\ze}*" contained + +" Numbers +syn match NITNumber "\<\([0-9_]\+\|0[bB][01_]\+\|0[oO][0-7_]\+\|0[xX][0-9a-fA-F_]\+\)\([iu]\(8\|16\|32\)\)\?\>" +syn match NITNumber "\<[0-9_]\+\.[0-9_]\+\>" " Identifiers 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="\"" 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 syn match NITLabel "\