summaryrefslogtreecommitdiffstats
path: root/runtime/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/syntax')
-rw-r--r--runtime/syntax/diff.vim17
-rw-r--r--runtime/syntax/dune.vim5
-rw-r--r--runtime/syntax/fstab.vim4
-rw-r--r--runtime/syntax/gift.vim216
-rw-r--r--runtime/syntax/ocaml.vim61
-rw-r--r--runtime/syntax/opam.vim38
-rw-r--r--runtime/syntax/sexplib.vim88
-rw-r--r--runtime/syntax/sml.vim91
8 files changed, 447 insertions, 73 deletions
diff --git a/runtime/syntax/diff.vim b/runtime/syntax/diff.vim
index ac43d6650a..408556ac13 100644
--- a/runtime/syntax/diff.vim
+++ b/runtime/syntax/diff.vim
@@ -2,7 +2,7 @@
" Language: Diff (context or unified)
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Translations by Jakson Alves de Aquino.
-" Last Change: 2020 Dec 07
+" Last Change: 2020 Dec 30
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -348,11 +348,16 @@ syn match diffLine "^\d\+\(,\d\+\)\=[cda]\d\+\>.*"
syn match diffFile "^diff\>.*"
syn match diffFile "^Index: .*"
syn match diffFile "^==== .*"
-" Old style diff uses *** for old and --- for new.
-" Unified diff uses --- for old and +++ for new; names are wrong but it works.
-syn match diffOldFile "^+++ .*"
-syn match diffOldFile "^\*\*\* .*"
-syn match diffNewFile "^--- .*"
+
+if search('^@@ -\S\+ +\S\+ @@', 'nw', '', 100)
+ " unified
+ syn match diffOldFile "^--- .*"
+ syn match diffNewFile "^+++ .*"
+else
+ " context / old style
+ syn match diffOldFile "^\*\*\* .*"
+ syn match diffNewFile "^--- .*"
+endif
" Used by git
syn match diffIndexLine "^index \x\x\x\x.*"
diff --git a/runtime/syntax/dune.vim b/runtime/syntax/dune.vim
index f901813d24..b4254057c0 100644
--- a/runtime/syntax/dune.vim
+++ b/runtime/syntax/dune.vim
@@ -1,7 +1,8 @@
+" Vim syntax file
" Language: Dune buildsystem
" Maintainer: Markus Mottl <markus.mottl@gmail.com>
" Anton Kochkov <anton.kochkov@gmail.com>
-" URL: https://github.com/rgrinberg/vim-ocaml
+" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
" 2019 Feb 27 - Add newer keywords to the syntax (Simon Cruanes)
" 2018 May 8 - Check current_syntax (Kawahara Satoru)
@@ -28,7 +29,7 @@ syn keyword lispKey ppx_runtime_libraries virtual_deps js_of_ocaml link_flags
syn keyword lispKey javascript_files flags ocamlc_flags ocamlopt_flags pps staged_pps
syn keyword lispKey library_flags c_flags c_library_flags kind package action
syn keyword lispKey deps targets locks fallback
-syn keyword lispKey inline_tests tests names
+syn keyword lispKey inline_tests tests test names
syn keyword lispAtom true false
diff --git a/runtime/syntax/fstab.vim b/runtime/syntax/fstab.vim
index 6b17b5a35e..318488713b 100644
--- a/runtime/syntax/fstab.vim
+++ b/runtime/syntax/fstab.vim
@@ -1,8 +1,8 @@
" Vim syntax file
" Language: fstab file
" Maintainer: Radu Dineiu <radu.dineiu@gmail.com>
-" URL: https://raw.github.com/rid9/vim-fstab/master/fstab.vim
-" Last Change: 2020 Aug 06
+" URL: https://raw.github.com/rid9/vim-fstab/master/syntax/fstab.vim
+" Last Change: 2020 Dec 30
" Version: 1.4
"
" Credits:
diff --git a/runtime/syntax/gift.vim b/runtime/syntax/gift.vim
new file mode 100644
index 0000000000..3f8d631ec0
--- /dev/null
+++ b/runtime/syntax/gift.vim
@@ -0,0 +1,216 @@
+" Vim syntax file
+"
+" Language: Moodle GIFT (General Import Format Template)
+" Maintainer: Selim Temizer (http://selimtemizer.com)
+" Creation: November 28, 2020
+" Latest Revision: December 21, 2020
+" Note: The order of entities in this file is important!
+
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax")
+ finish
+endif
+
+
+setlocal conceallevel=1
+
+"-----------------------------------------------
+" GIFT entities
+
+syn match giftS "\~" contained "GIFT special characters
+syn match giftS "=" contained
+syn match giftS "#" contained
+syn match giftS "{" contained
+syn match giftS "}" contained
+syn match giftS ":" contained
+
+syn match giftES "\\\~" contained conceal cchar=~ "GIFT escaped special characters
+syn match giftES "\\=" contained conceal cchar==
+syn match giftES "\\#" contained conceal cchar=#
+syn match giftES "\\{" contained conceal cchar={
+syn match giftES "\\}" contained conceal cchar=}
+syn match giftES "\\:" contained conceal cchar=:
+
+syn match giftEN "\\n" contained conceal cchar=n "GIFT escaped newline
+
+syn match giftFormat "\[html]" contained "GIFT formats
+syn match giftFormat "\[plain]" contained
+syn match giftFormat "\[moodle]" contained
+syn match giftFormat "\[markdown]" contained
+
+"--------------------------------------------------------
+" HTML entities
+
+syn match giftH "<" contained "HTML characters that might need to be handled/escaped
+syn match giftH ">" contained
+syn match giftH "&" contained
+
+syn match giftEH "&lt;" contained conceal cchar=< "HTML escaped characters
+syn match giftEH "&gt;" contained conceal cchar=>
+syn match giftEH "&amp;" contained conceal cchar=&
+syn match giftEH "&nbsp;" contained conceal cchar=_
+
+"-------------------------------------------------------
+" Answer components: Feedback and general feedback
+
+syn match giftFB "#\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|#\|####\|}\)" contained contains=giftF "Feedback block
+syn match giftF "#\zs\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|#\|####\|}\)" contained contains=@giftCEF "Feedback
+
+syn match giftGFB "####\_.\{-}\(\_^\|[^\\]\)\ze}" contained contains=giftGF "General feedback block
+syn match giftGF "####\zs\_.\{-}\(\_^\|[^\\]\)\ze}" contained contains=@giftCEF "General feedback
+
+"------------------------------------------------------
+" Answer components: Other components
+
+syn keyword giftTF T TRUE F FALSE contained
+
+syn match giftNum1 "[-+]\=[.0-9]\+" contained "Something matching a number
+
+syn match giftNum2 "[-+]\=[.0-9]\+\s*:\s*[-+]\=[.0-9]\+" contained contains=giftNum2D "Number with error margin
+syn match giftNum2D ":" contained "Associated delimiter
+
+syn match giftNum3 "[-+]\=[.0-9]\+\s*\.\.\s*[-+]\=[.0-9]\+" contained contains=giftNum3D "Number as min/max range
+syn match giftNum3D "\.\." contained "Associated delimiter
+
+syn match giftWeightB "%-*[0-9]\{1,2}\.\?[0-9]*%" contained contains=giftWeight "Weight block
+syn match giftWeight "%\zs-*[0-9]\{1,2}\.\?[0-9]*\ze%" contained "Weight
+
+"-----------------------------------------------------
+" Answer choices
+
+syn match giftWrongNum "\~\zs\_.\{-}\(\_^\|[^\\]\)\ze\(####\|}\)" contained contains=@giftCEFF "Wrong numeric choice
+syn match giftRightNum "=\zs\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|####\|}\)" contained contains=@giftCEFFW,@giftNums "Right numeric choice
+
+syn match giftWrong "\~\zs\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|####\|}\)" contained contains=@giftCEFFW "Wrong choice
+syn match giftRight "=\zs\_.\{-}\(\ze->\|\(\_^\|[^\\]\)\ze\(=\|\~\|####\|}\)\)" contained contains=@giftCEFFW "Right choice
+syn match giftMatchB "->\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|####\|}\)" contained contains=giftMatch "Match choice block
+syn match giftMatch "->\zs\_.\{-}\(\_^\|[^\\]\)\ze\(=\|\~\|####\|}\)" contained contains=@giftCE "Match choice
+
+"----------------------------------------------------
+" Answer
+
+syn match giftAnswer "{\_.\{-}\(\_^\|[^\\]\)}" contained keepend contains=@giftA "General answer
+syn match giftAnswer "{}" contained "Minimal answer
+
+syn match giftAnswerNum "{\_[[:space:]]*#\_[^#]\_.\{-}\(\_^\|[^\\]\)}" contained keepend contains=@giftANum "Numeric answer
+syn match giftAnswerNumD "{\zs\_[[:space:]]*#" contained "Associated delimiter
+
+"---------------------------------------------------
+" Question
+
+" The first pattern matches the last question at the end of the file (in case there is no empty line coming after).
+" However, it slows down parsing (and especially scrolling up), therefore it is commented out.
+
+"syn match giftQuestion "[^{[:space:]]\_.\{-}\%$" keepend contains=@giftCEF,giftAnswer,giftAnswerNum
+ syn match giftQuestion "[^{[:space:]]\_.\{-}\n\(\s*\n\)\+" keepend contains=@giftCEF,giftAnswer,giftAnswerNum
+
+"--------------------------------------------------
+" Question name
+
+syn match giftName "::\_.\{-}::" contains=@giftCE,giftNameD "Question name
+syn match giftNameD "::" contained "Associated delimiter
+
+"-------------------------------------------------
+" Category
+
+syn match giftCategoryB "^\s*\$CATEGORY:.*\n\+" contains=giftCategory "Category block
+syn match giftCategory "^\s*\$CATEGORY:\zs.*\ze\n" contained "Category
+
+"------------------------------------------------
+" Comments (may need to be the last entity)
+
+syn keyword giftTodo FIXME TODO NOTE FIX XXX contained
+
+syn match giftIdB "\[id:\(\\]\|[^][:cntrl:]]\)\+]" contained contains=giftId "Id block
+syn match giftId "\[id:\zs\(\\]\|[^][:cntrl:]]\)\+\ze]" contained "Id
+
+syn match giftTagB "\[tag:\(\\]\|[^]<>`[:cntrl:]]\)\+]" contained contains=giftTag "Tag block
+syn match giftTag "\[tag:\zs\(\\]\|[^]<>`[:cntrl:]]\)\+\ze]" contained "Tag
+
+syn match giftComment "^\s*//.*" contains=giftTodo,giftIdB,giftTagB
+
+"-----------------------------------------------
+" Clusters
+
+"Comments and entities (to be escaped)
+syn cluster giftCE contains=giftComment,giftS,giftES,giftEN,giftH,giftEH
+
+"The above plus format
+syn cluster giftCEF contains=@giftCE,giftFormat
+
+"The above plus feedback block
+syn cluster giftCEFF contains=@giftCEF,giftFB
+
+"The above plus weight block
+syn cluster giftCEFFW contains=@giftCEFF,giftWeightB
+
+"Possible numerical representations
+syn cluster giftNums contains=giftNum1,giftNum2,giftNum3
+
+"Possible contents of answers
+syn cluster giftA contains=giftComment,giftTF,giftWrong,giftRight,giftMatchB,giftFB,giftGFB
+
+"Possible contents of numerical answers
+syn cluster giftANum contains=giftAnswerNumD,giftComment,@giftNums,giftWrongNum,giftRightNum,giftFB,giftGFB
+
+"-----------------------------------------------
+
+let b:current_syntax = "gift"
+
+"-----------------------------------------------
+
+hi Conceal ctermbg=NONE ctermfg=Blue guibg=NONE guifg=Blue
+hi Feedback ctermbg=NONE ctermfg=DarkCyan guibg=NONE guifg=DarkCyan
+hi GFeedback ctermbg=NONE ctermfg=DarkGreen guibg=NONE guifg=DarkGreen
+hi WeightB ctermbg=NONE ctermfg=DarkYellow guibg=NONE guifg=DarkYellow
+
+"-----------------------------------------------
+
+hi def link giftS Error
+hi def link giftES Conceal
+hi def link giftEN Conceal
+hi def link giftFormat LineNr
+
+hi def link giftH Error
+hi def link giftEH Conceal
+
+hi def link giftFB PreProc
+hi def link giftF Feedback
+hi def link giftGFB Title
+hi def link giftGF GFeedback
+
+hi def link giftTF Question
+hi def link giftNum1 Question
+hi def link giftNum2 Question
+hi def link giftNum2D Special
+hi def link giftNum3 Question
+hi def link giftNum3D Special
+hi def link giftWeightB WeightB
+hi def link giftWeight Identifier
+
+hi def link giftWrongNum Constant
+hi def link giftRightNum Question
+hi def link giftWrong Constant
+hi def link giftRight Question
+hi def link giftMatchB ModeMsg
+hi def link giftMatch Constant
+
+hi def link giftAnswer MoreMsg
+hi def link giftAnswerNum MoreMsg
+hi def link giftAnswerNumD Identifier
+
+hi def link giftQuestion Identifier
+
+hi def link giftName PreProc
+hi def link giftNameD Directory
+
+hi def link giftCategoryB LineNr
+hi def link giftCategory Directory
+
+hi def link giftTodo Todo
+hi def link giftIdB LineNr
+hi def link giftId Title
+hi def link giftTagB LineNr
+hi def link giftTag Constant
+hi def link giftComment Comment
diff --git a/runtime/syntax/ocaml.vim b/runtime/syntax/ocaml.vim
index 42913f228e..af3efd3dab 100644
--- a/runtime/syntax/ocaml.vim
+++ b/runtime/syntax/ocaml.vim
@@ -4,7 +4,7 @@
" Maintainers: Markus Mottl <markus.mottl@gmail.com>
" Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de>
" Issac Trotts <ijtrotts@ucdavis.edu>
-" URL: https://github.com/rgrinberg/vim-ocaml
+" URL: https://github.com/ocaml/vim-ocaml
" Last Change:
" 2018 Nov 08 - Improved highlighting of operators (Maƫlan)
" 2018 Apr 22 - Improved support for PPX (Andrey Popp)
@@ -18,14 +18,20 @@
" can be distinguished from begin/end, which is used for indentation,
" and folding. (David Baelde)
-" quit when a syntax file was already loaded
+" Quit when a syntax file was already loaded
if exists("b:current_syntax") && b:current_syntax == "ocaml"
finish
endif
+let s:keepcpo = &cpo
+set cpo&vim
+
" ' can be used in OCaml identifiers
setlocal iskeyword+='
+" ` is part of the name of polymorphic variants
+setlocal iskeyword+=`
+
" OCaml is case sensitive.
syn case match
@@ -123,7 +129,7 @@ syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSi
syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr
" "open"
-syn region ocamlNone matchgroup=ocamlKeyword start="\<open\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*\>" contains=@ocamlAllErrs,ocamlComment
+syn match ocamlKeyword "\<open\>" skipwhite skipempty nextgroup=ocamlFullMod
" "include"
syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod
@@ -225,7 +231,18 @@ syn match ocamlStar "*"
syn match ocamlAngle "<"
syn match ocamlAngle ">"
" Custom indexing operators:
-syn match ocamlIndexingOp "\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\(()\|\[]\|{}\)\(<-\)\?"
+syn region ocamlIndexing matchgroup=ocamlIndexingOp
+ \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*("
+ \ end=")\(\_s*<-\)\?"
+ \ contains=ALLBUT,@ocamlContained,ocamlParenErr
+syn region ocamlIndexing matchgroup=ocamlIndexingOp
+ \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*\["
+ \ end="]\(\_s*<-\)\?"
+ \ contains=ALLBUT,@ocamlContained,ocamlBrackErr
+syn region ocamlIndexing matchgroup=ocamlIndexingOp
+ \ start="\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\_s*{"
+ \ end="}\(\_s*<-\)\?"
+ \ contains=ALLBUT,@ocamlContained,ocamlBraceErr
" Extension operators (has to be declared before regular infix operators):
syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+"
" Infix and prefix operators:
@@ -283,7 +300,6 @@ syn sync match ocamlSigSync grouphere ocamlSig "\<sig\>"
syn sync match ocamlSigSync groupthere ocamlSig "\<end\>"
" Define the default highlighting.
-" Only when an item doesn't have highlighting yet
hi def link ocamlBraceErr Error
hi def link ocamlBrackErr Error
@@ -308,14 +324,17 @@ hi def link ocamlModPath Include
hi def link ocamlObject Include
hi def link ocamlModule Include
hi def link ocamlModParam1 Include
+hi def link ocamlGenMod Include
hi def link ocamlModType Include
hi def link ocamlMPRestr3 Include
hi def link ocamlFullMod Include
+hi def link ocamlFuncWith Include
+hi def link ocamlModParam Include
hi def link ocamlModTypeRestr Include
hi def link ocamlWith Include
hi def link ocamlMTDef Include
-hi def link ocamlSigEncl ocamlModule
-hi def link ocamlStructEncl ocamlModule
+hi def link ocamlSigEncl ocamlModule
+hi def link ocamlStructEncl ocamlModule
hi def link ocamlScript Include
@@ -326,24 +345,25 @@ hi def link ocamlModPreRHS Keyword
hi def link ocamlMPRestr2 Keyword
hi def link ocamlKeyword Keyword
hi def link ocamlMethod Include
+hi def link ocamlArrow Keyword
hi def link ocamlKeyChar Keyword
hi def link ocamlAnyVar Keyword
hi def link ocamlTopStop Keyword
-hi def link ocamlRefAssign ocamlKeyChar
-hi def link ocamlEqual ocamlKeyChar
-hi def link ocamlStar ocamlInfixOp
-hi def link ocamlAngle ocamlInfixOp
-hi def link ocamlCons ocamlInfixOp
+hi def link ocamlRefAssign ocamlKeyChar
+hi def link ocamlEqual ocamlKeyChar
+hi def link ocamlStar ocamlInfixOp
+hi def link ocamlAngle ocamlInfixOp
+hi def link ocamlCons ocamlInfixOp
-hi def link ocamlPrefixOp ocamlOperator
-hi def link ocamlInfixOp ocamlOperator
-hi def link ocamlExtensionOp ocamlOperator
-hi def link ocamlIndexingOp ocamlOperator
+hi def link ocamlPrefixOp ocamlOperator
+hi def link ocamlInfixOp ocamlOperator
+hi def link ocamlExtensionOp ocamlOperator
+hi def link ocamlIndexingOp ocamlOperator
if exists("ocaml_highlight_operators")
hi def link ocamlInfixOpKeyword ocamlOperator
- hi def link ocamlOperator Operator
+ hi def link ocamlOperator Operator
else
hi def link ocamlInfixOpKeyword Keyword
endif
@@ -353,7 +373,7 @@ hi def link ocamlCharacter Character
hi def link ocamlNumber Number
hi def link ocamlFloat Float
hi def link ocamlString String
-hi def link ocamlQuotedStringDelim Identifier
+hi def link ocamlQuotedStringDelim Identifier
hi def link ocamlLabel Identifier
@@ -363,8 +383,11 @@ hi def link ocamlTodo Todo
hi def link ocamlEncl Keyword
-hi def link ocamlPpxEncl ocamlEncl
+hi def link ocamlPpxEncl ocamlEncl
let b:current_syntax = "ocaml"
+let &cpo = s:keepcpo
+unlet s:keepcpo
+
" vim: ts=8
diff --git a/runtime/syntax/opam.vim b/runtime/syntax/opam.vim
new file mode 100644
index 0000000000..9ac1d41ce7
--- /dev/null
+++ b/runtime/syntax/opam.vim
@@ -0,0 +1,38 @@
+" Vim syntax file
+" Language: OPAM - OCaml package manager
+" Maintainer: Markus Mottl <markus.mottl@gmail.com>
+" URL: https://github.com/ocaml/vim-ocaml
+" Last Change:
+" 2020 Dec 31 - Added header (Markus Mottl)
+
+if exists("b:current_syntax")
+ finish
+endif
+
+" need %{vars}%
+" env: [[CAML_LD_LIBRARY_PATH = "%{lib}%/stublibs"]]
+syn keyword opamKeyword1 remove depends pin-depends depopts conflicts env packages patches version maintainer tags license homepage authors doc install author available name depexts substs synopsis description
+syn match opamKeyword2 "\v(bug-reports|post-messages|ocaml-version|opam-version|dev-repo|build-test|build-doc|build)"
+
+syn keyword opamTodo FIXME NOTE NOTES TODO XXX contained
+syn match opamComment "#.*$" contains=opamTodo,@Spell
+syn match opamOperator ">\|<\|=\|<=\|>="
+
+syn region opamInterpolate start=/%{/ end=/}%/ contained
+syn region opamString start=/"/ end=/"/ contains=opamInterpolate
+syn region opamSeq start=/\[/ end=/\]/ contains=ALLBUT,opamKeyword1,opamKeyword2
+syn region opamExp start=/{/ end=/}/ contains=ALLBUT,opamKeyword1,opamKeyword2
+
+hi link opamKeyword1 Keyword
+hi link opamKeyword2 Keyword
+
+hi link opamString String
+hi link opamExp Function
+hi link opamSeq Statement
+hi link opamOperator Operator
+hi link opamComment Comment
+hi link opamInterpolate Identifier
+
+let b:current_syntax = "opam"
+
+" vim: ts=2 sw=2
diff --git a/runtime/syntax/sexplib.vim b/runtime/syntax/sexplib.vim
new file mode 100644
index 0000000000..55dd3fb494
--- /dev/null
+++ b/runtime/syntax/sexplib.vim
@@ -0,0 +1,88 @@
+" Vim syntax file
+" Language: S-expressions as used in Sexplib
+" Filenames: *.sexp
+" Maintainers: Markus Mottl <markus.mottl@gmail.com>
+" URL: https://github.com/ocaml/vim-ocaml
+" Last Change: 2020 Dec 31 - Updated header for Vim contribution (MM)
+" 2017 Apr 11 - Improved matching of negative numbers (MM)
+" 2012 Jun 20 - Fixed a block comment highlighting bug (MM)
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+ syntax clear
+elseif exists("b:current_syntax") && b:current_syntax == "sexplib"
+ finish
+endif
+
+" Sexplib is case sensitive.
+syn case match
+
+" Comments
+syn keyword sexplibTodo contained TODO FIXME XXX NOTE
+syn region sexplibBlockComment matchgroup=sexplibComment start="#|" matchgroup=sexplibComment end="|#" contains=ALLBUT,sexplibQuotedAtom,sexplibUnquotedAtom,sexplibEncl,sexplibComment
+syn match sexplibSexpComment "#;" skipwhite skipempty nextgroup=sexplibQuotedAtomComment,sexplibUnquotedAtomComment,sexplibListComment,sexplibComment
+syn region sexplibQuotedAtomComment start=+"+ skip=+\\\\\|\\"+ end=+"+ contained
+syn match sexplibUnquotedAtomComment /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*/ contained
+syn region sexplibListComment matchgroup=sexplibComment start="(" matchgroup=sexplibComment end=")" contained contains=ALLBUT,sexplibEncl,sexplibString,sexplibQuotedAtom,sexplibUnquotedAtom,sexplibTodo,sexplibNumber,sexplibFloat
+syn match sexplibComment ";.*" contains=sexplibTodo
+
+" Atoms
+syn match sexplibUnquotedAtom /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*/
+syn region sexplibQuotedAtom start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn match sexplibNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>"
+syn match sexplibNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>"
+syn match sexplibNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>"
+syn match sexplibNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>"
+syn match sexplibFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>"
+
+" Lists
+syn region sexplibEncl transparent matchgroup=sexplibEncl start="(" matchgroup=sexplibEncl end=")" contains=ALLBUT,sexplibParenErr
+
+" Errors
+syn match sexplibUnquotedAtomErr /\([^;()" \t#|]\|#[^;()" \t|]\||[^;()" \t#]\)[^;()" \t]*\(#|\||#\)[^;()" \t]*/
+syn match sexplibParenErr ")"
+
+" Synchronization
+syn sync minlines=50
+syn sync maxlines=500
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_sexplib_syntax_inits")
+ if version < 508
+ let did_sexplib_syntax_inits = 1
+ command -nargs=+ HiLink hi link <args>
+ else
+ command -nargs=+ HiLink hi def link <args>
+ endif
+
+ HiLink sexplibParenErr Error
+ HiLink sexplibUnquotedAtomErr Error
+
+ HiLink sexplibComment Comment
+ HiLink sexplibSexpComment Comment
+ HiLink sexplibQuotedAtomComment Include
+ HiLink sexplibUnquotedAtomComment Comment
+ HiLink sexplibBlockComment Comment
+ HiLink sexplibListComment Comment
+
+ HiLink sexplibBoolean Boolean
+ HiLink sexplibCharacter Character
+ HiLink sexplibNumber Number
+ HiLink sexplibFloat Float
+ HiLink sexplibUnquotedAtom Identifier
+ HiLink sexplibEncl Identifier
+ HiLink sexplibQuotedAtom Keyword
+
+ HiLink sexplibTodo Todo
+
+ HiLink sexplibEncl Keyword
+
+ delcommand HiLink
+endif
+
+let b:current_syntax = "sexplib"
+
+" vim: ts=8
diff --git a/runtime/syntax/sml.vim b/runtime/syntax/sml.vim
index fa4524f93d..afff5304e6 100644
--- a/runtime/syntax/sml.vim
+++ b/runtime/syntax/sml.vim
@@ -3,13 +3,16 @@
" Filenames: *.sml *.sig
" Maintainers: Markus Mottl <markus.mottl@gmail.com>
" Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it>
-" URL: http://www.ocaml.info/vim/syntax/sml.vim
-" Last Change: 2006 Oct 23 - Fixed character highlighting bug (MM)
-" 2002 Jun 02 - Fixed small typo (MM)
-" 2001 Nov 20 - Fixed small highlighting bug with modules (MM)
+" Last Change: 2019 Oct 01 - Only spell check strings & comments (Chuan Wei Foo)
+" 2015 Aug 31 - Fixed opening of modules (Ramana Kumar)
+" 2006 Oct 23 - Fixed character highlighting bug (MM)
" quit when a syntax file was already loaded
if exists("b:current_syntax")
+
+" Disable spell checking of syntax.
+syn spell notoplevel
+
finish
endif
@@ -52,7 +55,7 @@ syn region smlEncl transparent matchgroup=smlKeyword start="#\[" matchgroup=sm
" Comments
-syn region smlComment start="(\*" end="\*)" contains=smlComment,smlTodo
+syn region smlComment start="(\*" end="\*)" contains=smlComment,smlTodo,@Spell
syn keyword smlTodo contained TODO FIXME XXX
@@ -82,7 +85,7 @@ syn region smlSig matchgroup=smlModule start="\<sig\>" matchgroup=smlModule en
syn region smlModSpec matchgroup=smlKeyword start="\<structure\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contained contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlModTRWith,smlMPRestr
" "open"
-syn region smlNone matchgroup=smlKeyword start="\<open\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment
+syn region smlNone matchgroup=smlKeyword start="\<open\>" matchgroup=smlModule end="\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment
" "structure" - somewhat complicated stuff ;-)
syn region smlModule matchgroup=smlKeyword start="\<\(structure\|functor\)\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlPreDef
@@ -136,7 +139,7 @@ syn match smlModPath "\u\(\w\|'\)*\."he=e-1
syn match smlCharacter +#"\\""\|#"."\|#"\\\d\d\d"+
syn match smlCharErr +#"\\\d\d"\|#"\\\d"+
-syn region smlString start=+"+ skip=+\\\\\|\\"+ end=+"+
+syn region smlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell
syn match smlFunDef "=>"
syn match smlRefAssign ":="
@@ -149,9 +152,9 @@ syn match smlKeyChar ";"
syn match smlKeyChar "\*"
syn match smlKeyChar "="
-syn match smlNumber "\<-\=\d\+\>"
-syn match smlNumber "\<-\=0[x|X]\x\+\>"
-syn match smlReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=[fl]\=\>"
+syn match smlNumber "\<-\=\d\+\>"
+syn match smlNumber "\<-\=0[x|X]\x\+\>"
+syn match smlReal "\<-\=\d\+\.\d*\([eE][-+]\=\d\+\)\=[fl]\=\>"
" Synchronization
syn sync minlines=20
@@ -167,49 +170,49 @@ syn sync match smlSigSync groupthere smlSig "\<end\>"
" Define the default highlighting.
" Only when an item doesn't have highlighting yet
-hi def link smlBraceErr Error
-hi def link smlBrackErr Error
-hi def link smlParenErr Error
+hi def link smlBraceErr Error
+hi def link smlBrackErr Error
+hi def link smlParenErr Error
-hi def link smlCommentErr Error
+hi def link smlCommentErr Error
-hi def link smlEndErr Error
-hi def link smlThenErr Error
+hi def link smlEndErr Error
+hi def link smlThenErr Error
-hi def link smlCharErr Error
+hi def link smlCharErr Error
-hi def link smlComment Comment
+hi def link smlComment Comment
-hi def link smlModPath Include
-hi def link smlModule Include
-hi def link smlModParam1 Include
-hi def link smlModType Include
-hi def link smlMPRestr3 Include
-hi def link smlFullMod Include
+hi def link smlModPath Include
+hi def link smlModule Include
+hi def link smlModParam1 Include
+hi def link smlModType Include
+hi def link smlMPRestr3 Include
+hi def link smlFullMod Include
hi def link smlModTypeRestr Include
-hi def link smlWith Include
-hi def link smlMTDef Include
+hi def link smlWith Include
+hi def link smlMTDef Include
hi def link smlConstructor Constant
-hi def link smlModPreRHS Keyword
-hi def link smlMPRestr2 Keyword
-hi def link smlKeyword Keyword
-hi def link smlFunDef Keyword
-hi def link smlRefAssign Keyword
-hi def link smlKeyChar Keyword
-hi def link smlAnyVar Keyword
-hi def link smlTopStop Keyword
-hi def link smlOperator Keyword
-
-hi def link smlBoolean Boolean
-hi def link smlCharacter Character
-hi def link smlNumber Number
-hi def link smlReal Float
-hi def link smlString String
-hi def link smlType Type
-hi def link smlTodo Todo
-hi def link smlEncl Keyword
+hi def link smlModPreRHS Keyword
+hi def link smlMPRestr2 Keyword
+hi def link smlKeyword Keyword
+hi def link smlFunDef Keyword
+hi def link smlRefAssign Keyword
+hi def link smlKeyChar Keyword
+hi def link smlAnyVar Keyword
+hi def link smlTopStop Keyword
+hi def link smlOperator Keyword
+
+hi def link smlBoolean Boolean
+hi def link smlCharacter Character
+hi def link smlNumber Number
+hi def link smlReal Float
+hi def link smlString String
+hi def link smlType Type
+hi def link smlTodo Todo
+hi def link smlEncl Keyword
let b:current_syntax = "sml"