X-Git-Url: http://nitlanguage.org diff --git a/misc/vim/syntax/nit.vim b/misc/vim/syntax/nit.vim index 50d86f4..8b68b53 100644 --- a/misc/vim/syntax/nit.vim +++ b/misc/vim/syntax/nit.vim @@ -18,14 +18,23 @@ " 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 + +syn match NITExprSubstLong "\\." contained +syn match NITExprSubstLong "{*\zs{{{\([^}]\|\n\)*}}}\ze}*" contained " Numbers and ASCII Codes syn match NITNumber "\<\(\d\+\.\d\+\|\d\+\)\>" @@ -36,28 +45,36 @@ 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="\\\\\|\\'" " Labels syn match NITLabel "\