Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
sml.vim243 linesDownload Raw Back to syntax
1" Vim syntax file2" Language:     SML3" Filenames:    *.sml *.sig4" Maintainer:   Markus Mottl <markus.mottl@gmail.com>5" Previous Maintainer: Fabrizio Zeno Cornelli <zeno@filibusta.crema.unimi.it> (invalid)6" Last Change:  2025 Nov 11 - Improve special constant matching (Doug Kearns)7"               2025 Nov 07 - Update Number Regex8"               2022 Apr 019"               2015 Aug 31 - Fixed opening of modules (Ramana Kumar)10"               2006 Oct 23 - Fixed character highlighting bug (MM)11 12" quit when a syntax file was already loaded13if exists("b:current_syntax")14  finish15endif16 17" Disable spell checking of syntax.18syn spell notoplevel19 20" SML is case sensitive.21syn case match22 23" lowercase identifier - the standard way to match24syn match    smlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/25 26syn match    smlKeyChar    "|"27 28" Errors29syn match    smlBraceErr   "}"30syn match    smlBrackErr   "\]"31syn match    smlParenErr   ")"32syn match    smlCommentErr "\*)"33syn match    smlThenErr    "\<then\>"34 35" Error-highlighting of "end" without synchronization:36" as keyword or as error (default)37if exists("sml_noend_error")38  syn match    smlKeyword    "\<end\>"39else40  syn match    smlEndErr     "\<end\>"41endif42 43" Some convenient clusters44syn cluster  smlAllErrs contains=smlBraceErr,smlBrackErr,smlParenErr,smlCommentErr,smlEndErr,smlThenErr45 46syn cluster  smlAENoParen contains=smlBraceErr,smlBrackErr,smlCommentErr,smlEndErr,smlThenErr47 48syn cluster  smlContained contains=smlTodo,smlPreDef,smlModParam,smlModParam1,smlPreMPRestr,smlMPRestr,smlMPRestr1,smlMPRestr2,smlMPRestr3,smlModRHS,smlFuncWith,smlFuncStruct,smlModTypeRestr,smlModTRWith,smlWith,smlWithRest,smlModType,smlFullMod49 50 51" Enclosing delimiters52syn region   smlEncl transparent matchgroup=smlKeyword start="(" matchgroup=smlKeyword end=")" contains=ALLBUT,@smlContained,smlParenErr53syn region   smlEncl transparent matchgroup=smlKeyword start="{" matchgroup=smlKeyword end="}"  contains=ALLBUT,@smlContained,smlBraceErr54syn region   smlEncl transparent matchgroup=smlKeyword start="\[" matchgroup=smlKeyword end="\]" contains=ALLBUT,@smlContained,smlBrackErr55syn region   smlEncl transparent matchgroup=smlKeyword start="#\[" matchgroup=smlKeyword end="\]" contains=ALLBUT,@smlContained,smlBrackErr56 57 58" Comments59syn region   smlComment start="(\*" end="\*)" contains=smlComment,smlTodo,@Spell60syn keyword  smlTodo contained TODO FIXME XXX61 62 63" let64syn region   smlEnd matchgroup=smlKeyword start="\<let\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr65 66" local67syn region   smlEnd matchgroup=smlKeyword start="\<local\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr68 69" abstype70syn region   smlNone matchgroup=smlKeyword start="\<abstype\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr71 72" begin73syn region   smlEnd matchgroup=smlKeyword start="\<begin\>" matchgroup=smlKeyword end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr74 75" if76syn region   smlNone matchgroup=smlKeyword start="\<if\>" matchgroup=smlKeyword end="\<then\>" contains=ALLBUT,@smlContained,smlThenErr77 78 79"" Modules80 81" "struct"82syn region   smlStruct matchgroup=smlModule start="\<struct\>" matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr83 84" "sig"85syn region   smlSig matchgroup=smlModule start="\<sig\>" matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr,smlModule86syn region   smlModSpec matchgroup=smlKeyword start="\<structure\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contained contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlModTRWith,smlMPRestr87 88" "open"89syn region   smlNone matchgroup=smlKeyword start="\<open\>" matchgroup=smlModule end="\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contains=@smlAllErrs,smlComment90 91" "structure" - somewhat complicated stuff ;-)92syn region   smlModule matchgroup=smlKeyword start="\<\(structure\|functor\)\>" matchgroup=smlModule end="\<\u\(\w\|'\)*\>" contains=@smlAllErrs,smlComment skipwhite skipempty nextgroup=smlPreDef93syn region   smlPreDef start="."me=e-1 matchgroup=smlKeyword end="\l\|="me=e-1 contained contains=@smlAllErrs,smlComment,smlModParam,smlModTypeRestr,smlModTRWith nextgroup=smlModPreRHS94syn region   smlModParam start="([^*]" end=")" contained contains=@smlAENoParen,smlModParam195syn match    smlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=smlPreMPRestr96 97syn region   smlPreMPRestr start="."me=e-1 end=")"me=e-1 contained contains=@smlAllErrs,smlComment,smlMPRestr,smlModTypeRestr98 99syn region   smlMPRestr start=":" end="."me=e-1 contained contains=@smlComment skipwhite skipempty nextgroup=smlMPRestr1,smlMPRestr2,smlMPRestr3100syn region   smlMPRestr1 matchgroup=smlModule start="\ssig\s\=" matchgroup=smlModule end="\<end\>" contained contains=ALLBUT,@smlContained,smlEndErr,smlModule101syn region   smlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=smlKeyword end="->" contained contains=@smlAllErrs,smlComment,smlModParam skipwhite skipempty nextgroup=smlFuncWith102syn match    smlMPRestr3 "\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*" contained103syn match    smlModPreRHS "=" contained skipwhite skipempty nextgroup=smlModParam,smlFullMod104syn region   smlModRHS start="." end=".\w\|([^*]"me=e-2 contained contains=smlComment skipwhite skipempty nextgroup=smlModParam,smlFullMod105syn match    smlFullMod "\<\u\(\w\|'\)*\(\.\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=smlFuncWith106 107syn region   smlFuncWith start="([^*]"me=e-1 end=")" contained contains=smlComment,smlWith,smlFuncStruct108syn region   smlFuncStruct matchgroup=smlModule start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=smlModule end="\<end\>" contains=ALLBUT,@smlContained,smlEndErr109 110syn match    smlModTypeRestr "\<\w\(\w\|'\)*\(\.\w\(\w\|'\)*\)*\>" contained111syn region   smlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@smlAENoParen,smlWith112syn match    smlWith "\<\(\u\(\w\|'\)*\.\)*\w\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=smlWithRest113syn region   smlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@smlContained114 115" "signature"116syn region   smlKeyword start="\<signature\>" matchgroup=smlModule end="\<\w\(\w\|'\)*\>" contains=smlComment skipwhite skipempty nextgroup=smlMTDef117syn match    smlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s118 119syn keyword  smlKeyword  and andalso case120syn keyword  smlKeyword  datatype else eqtype121syn keyword  smlKeyword  exception fn fun handle122syn keyword  smlKeyword  in infix infixl infixr123syn keyword  smlKeyword  match nonfix of orelse124syn keyword  smlKeyword  raise handle type125syn keyword  smlKeyword  val where while with withtype126 127syn keyword  smlType     bool char exn int list option128syn keyword  smlType     real string unit129 130syn keyword  smlOperator div mod not or quot rem131 132syn keyword  smlBoolean      true false133syn match    smlConstructor  "(\s*)"134syn match    smlConstructor  "\[\s*\]"135syn match    smlConstructor  "#\[\s*\]"136syn match    smlConstructor  "\u\(\w\|'\)*\>"137 138" Module prefix139syn match    smlModPath      "\u\(\w\|'\)*\."he=e-1140 141" Strings and Characters142syn match    smlEscapeErr    "\\."                 contained143syn match    smlEscape       "\\[abtnvfr"\\]"      contained144syn match    smlEscapeErr    "\\^."                contained145syn match    smlEscape       "\\^[@A-Z[\\\]^_]"    contained146syn match    smlEscapeErr    "\\\d\{1,2}"          contained147syn match    smlEscape       "\\\d\{3}"            contained148syn match    smlEscapeErr    "\\u\x\{0,3}"         contained149syn match    smlEscape       "\\u\x\{4}"           contained150syn match    smlEscape       "\\\_[[:space:]]\+\\" contained151syn cluster  smlEscape       contains=smlEscape,smlEscapeErr152 153syn region   smlString       start=+"+ end=+"+ contains=@smlEscape,@Spell154 155syn match    smlCharacter    +#"[^\\"]"+156syn match    smlCharacter    +#"\\."+       contains=@smlEscape157syn match    smlCharacter    +#"\\^."+      contains=@smlEscape158syn match    smlCharacter    +#"\\\d\{3}"+  contains=@smlEscape159syn match    smlCharacter    +#"\\u\x\{4}"+ contains=@smlEscape160 161syn match    smlFunDef       "=>"162syn match    smlRefAssign    ":="163syn match    smlTopStop      ";;"164syn match    smlOperator     "\^"165syn match    smlOperator     "::"166syn match    smlAnyVar       "\<_\>"167syn match    smlKeyChar      "!"168syn match    smlKeyChar      ";"169syn match    smlKeyChar      "\*"170syn match    smlKeyChar      "="171 172syn match    smlNumber        "\~\=\<\d\+\>"173syn match    smlNumber        "\~\=\<0x\x\+\>"174syn match    smlWord          "\<0w\d\+\>"175syn match    smlWord          "\<0wx\x\+\>"176syn match    smlReal          "\~\=\<\d\+\.\d\+\>"177syn match    smlReal          "\~\=\<\d\+\%(\.\d\+\)\=[eE]\~\=\d\+\>"178 179" Synchronization180syn sync minlines=20181syn sync maxlines=500182 183syn sync match smlEndSync     grouphere  smlEnd     "\<begin\>"184syn sync match smlEndSync     groupthere smlEnd     "\<end\>"185syn sync match smlStructSync  grouphere  smlStruct  "\<struct\>"186syn sync match smlStructSync  groupthere smlStruct  "\<end\>"187syn sync match smlSigSync     grouphere  smlSig     "\<sig\>"188syn sync match smlSigSync     groupthere smlSig     "\<end\>"189 190" Define the default highlighting.191" Only when an item doesn't have highlighting yet192 193hi def link smlBraceErr     Error194hi def link smlBrackErr     Error195hi def link smlParenErr     Error196 197hi def link smlCommentErr   Error198 199hi def link smlEndErr       Error200hi def link smlThenErr      Error201 202hi def link smlEscapeErr    Error203 204hi def link smlComment      Comment205 206hi def link smlModPath      Include207hi def link smlModule       Include208hi def link smlModParam1    Include209hi def link smlModType      Include210hi def link smlMPRestr3     Include211hi def link smlFullMod      Include212hi def link smlModTypeRestr Include213hi def link smlWith         Include214hi def link smlMTDef        Include215 216hi def link smlConstructor  Constant217 218hi def link smlModPreRHS    Keyword219hi def link smlMPRestr2     Keyword220hi def link smlKeyword      Keyword221hi def link smlFunDef       Keyword222hi def link smlRefAssign    Keyword223hi def link smlKeyChar      Keyword224hi def link smlAnyVar       Keyword225hi def link smlTopStop      Keyword226hi def link smlOperator     Keyword227 228hi def link smlBoolean      Boolean229hi def link smlCharacter    Character230hi def link smlNumber       Number231hi def link smlWord         Number232hi def link smlReal         Float233hi def link smlString       String234hi def link smlEscape       Special235hi def link smlType         Type236hi def link smlTodo         Todo237hi def link smlEncl         Keyword238 239 240let b:current_syntax = "sml"241 242" vim: ts=8243 
codekingpro/portable-devtools · Team Ai