@@ -34,14 +34,13 @@ syntax keyword clojureVariable *1 *2 *3 *agent* *allow-unresolved-vars* *assert*
3434" * Must not contain any reader metacharacters except for ' and #
3535syntax match clojureKeyword " \v <:{1,2}%([^ \n\r\t ()\[\] {}";@^`~\\ %/]+/)*[^ \n\r\t ()\[\] {}";@^`~\\ %/]+:@<!>"
3636
37- syntax match clojureStringEscape " \\\\\|\\ [ btnfr"]\|\\ u [0-9a-fA-F] \{ 4 \} " contained
37+ syntax match clojureStringEscape " \v\\ %([ \\ btnfr"]|u \x {4}| [0-3] \o {2}| \o {1,2}) " contained
3838
39- syntax region clojureString start =/ L \= "/ skip =/ \\\\\| \\ "/ end =/ "/ contains =clojureStringEscape
39+ syntax region clojureString start =/ "/ skip =/ \\ "/ end =/ "/ contains =clojureStringEscape
4040
4141syntax match clojureCharacter " \\ ."
42- syntax match clojureCharacter " \\ o\o\{ 3\} "
43- syntax match clojureCharacter " \\ u[0-9a-fA-F]\{ 4\} "
44- syntax match clojureCharacter " \\ u\d\{ 4\} "
42+ syntax match clojureCharacter " \\ o\% ([0-3]\o\{ 2\}\|\o\{ 1,2\}\) "
43+ syntax match clojureCharacter " \\ u\x\{ 4\} "
4544syntax match clojureCharacter " \\ space"
4645syntax match clojureCharacter " \\ tab"
4746syntax match clojureCharacter " \\ newline"
@@ -55,10 +54,12 @@ for s:radix in range(2, 36)
5554endfor
5655unlet ! s: radix_chars s: radix
5756
58- syntax match clojureNumber " \< -\=\d\+\(\.\d *\)\=\( M\|\( [eE][-+]\?\d\+\)\)\?\> "
59- syntax match clojureNumber " \< -\=\d\+ N\?\> "
60- syntax match clojureNumber " \< -\= 0x\x\+\> "
61- syntax match clojureNumber " \< -\=\d\+ /\d\+\> "
57+ syntax match clojureSymbol " \v ([a-zA-Z!$&*_+=|<.>?-]|[^\x 00-\x 7F])+(:?([a-zA-Z0-9!#$%&*_+=|'<.>/?-]|[^\x 00-\x 7F]))*[#:]@<!"
58+
59+ syntax match clojureNumber " \< [-+]\=\d\+\(\.\d *\)\=\( M\|\( [eE][-+]\?\d\+\)\)\?\> "
60+ syntax match clojureNumber " \< [-+]\=\d\+ N\?\> "
61+ syntax match clojureNumber " \< [-+]\= 0x\x\+\> "
62+ syntax match clojureNumber " \< [-+]\=\d\+ /\d\+\> "
6263
6364syntax match clojureVarArg " &"
6465
@@ -73,7 +74,31 @@ syntax match clojureDispatch "\v#[\^'=<_]?"
7374" Clojure permits no more than 20 params.
7475syntax match clojureAnonArg " %\( 20\| 1\d\| [1-9]\| &\)\? "
7576
76- syntax match clojureSymbol " \v ([a-zA-Z!$&*_+=|<.>?-]|[^\x 00-\x 7F])+(:?([a-zA-Z0-9!#$%&*_+=|'<.>?-]|[^\x 00-\x 7F]))*[#:]@<!"
77+ syntax match clojureRegexpChar " \\ ." contained
78+ syntax match clojureRegexpSpecialChar " \v\\ {2}|\\ %([tnrfae]|c.|0%([0-7]{1,2}|[0-3][0-7]{2})|x\x {2}|u\x {4})" contained
79+ syntax cluster clojureRegexpChars contains =clojureRegexpChar,clojureRegexpSpecialChar
80+ " Charactar classes
81+ syntax match clojureRegexpPredefinedCharClass " \\ [dDsSwW]" contained
82+ syntax match clojureRegexpPosixCharClass " \v\\ [pP]\{ %(Lower|Upper|ASCII|Alpha|Digit|Alnum|Punct|Graph|Print|Blank|Cntrl|XDigit|Space|IsLatin|InGreek|Lu|IsAlphabetic|Sc|java%(LowerCase|UpperCase|Whitespace|Mirrored))\} " contained
83+ syntax region clojureRegexpCharClass start =" \\\@ <!\[ " end =" \\\@ <!\] " contained contains =clojureRegexpCharClasses,@clojureRegexpChars
84+ syntax cluster clojureRegexpCharClasses contains =clojureRegexpPredefinedCharClass,clojureRegexpPosixCharClass,clojureRegexpCharClass
85+ " Boundary
86+ syntax match clojureRegexpBoundary " \v\\ [bBAGZz]" contained
87+ syntax match clojureRegexpBoundary " \v\\ <@![^$]" contained
88+ " Quantification
89+ syntax match clojureRegexpQuantifier " \v\\ @<![?*+]\? ?" contained
90+ syntax match clojureRegexpQuantifier " \v\\ @<!\{\d +%(,|,\d +)?}\? ?" contained
91+ syntax match clojureRegexpOr " \v\< @!\| " contained
92+ " Back references
93+ syntax match clojureRegexpBackRef " \v\\ %(\d +|k\< [a-zA-z]+\> )" contained
94+ " Mode modifiers, mode-modified spans, lookaround, regular and atomic
95+ " grouping, and named-capturing.
96+ syntax match clojureRegexpMod " \v\( @<=\? [xdsmiu]?:?" contained
97+ syntax match clojureRegexpMod " \v\( @<=\? [=!>]" contained
98+ syntax match clojureRegexpMod " \v\( @<=\?\< [a-zA-Z]+\> " contained
99+
100+ syntax region clojureRegexpGroup start =" \\\@ <!(" matchgroup =clojureRegexpGroup end =" \\\@ <!)" contained contains =clojureRegexpMod,@clojureRegexpCharClasses
101+ syntax region clojureRegexp start =/ \# "/ skip =/ \\ "/ end =/ "/ contains =@clojureRegexpChars,@clojureRegexpCharClasses,clojureRegexpBoundary,clojureRegexpQuantifier,clojureRegexpOr,clojureRegexpBackRef,clojureRegexpGroup
77102
78103syntax match clojureComment " ;.*$" contains =clojureTodo,@Spell
79104syntax match clojureComment " #!.*$"
@@ -98,6 +123,17 @@ highlight default link clojureString String
98123highlight default link clojureStringEscape Character
99124highlight default link clojureRegexp Constant
100125
126+ highlight default link clojureRegexpChar Character
127+ highlight default link clojureRegexpSpecialChar Character
128+ highlight default link clojureRegexpCharClass Special
129+ highlight default link clojureRegexpPosixCharClass Special
130+ highlight default link clojureRegexpPredefinedCharClass Special
131+ highlight default link clojureRegexpBoundary Special
132+ highlight default link clojureRegexpMod Special
133+ highlight default link clojureRegexpOr Special
134+ highlight default link clojureRegexpBackRef Special
135+ highlight default link clojureRegexpGroup clojureRegexp
136+
101137highlight default link clojureVariable Identifier
102138highlight default link clojureCond Conditional
103139highlight default link clojureDefine Define
0 commit comments