Skip to content

Commit 194623c

Browse files
committed
Fix extant tests
* Unicode binary properties must be matched case insensitively (except for leading `Is`) * Remove \. and similar tests (they are not escape sequences in the sense of \t) * Change test fns for java and unicode properties
1 parent 6dcd4f6 commit 194623c

3 files changed

Lines changed: 14 additions & 22 deletions

File tree

clj/src/vim_clojure_static/generate.clj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,11 @@
154154

155155
(def vim-unicode-binary-char-classes
156156
"Vimscript literal `syntax match` for Unicode Binary properties."
157+
;; Though the docs do not mention it, the property name is matched case
158+
;; insensitively like the other Unicode properties.
157159
(syntax-match-properties
158160
:clojureRegexpUnicodeCharClass
159-
"Is%%(%s)"
161+
"\\cIs%%(%s)"
160162
(map string/lower-case (:binary character-properties))))
161163

162164
(def vim-unicode-category-char-classes

clj/test/syntax_test.clj

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,6 @@
141141
"\\cA" regexp-escape
142142
"\\c1" !regexp-escape
143143
"\\c" !regexp-escape
144-
;; Additional escape sequences not mentioned in the official documenation.
145-
"\\." regexp-escape
146-
"\\*" regexp-escape
147-
"\\?" regexp-escape
148-
"\\{" regexp-escape
149-
"\\}" regexp-escape
150-
"\\[" regexp-escape
151-
"\\]" regexp-escape
152-
"\\(" regexp-escape
153-
"\\)" regexp-escape
154144

155145
;;;; Character classes
156146

@@ -213,28 +203,28 @@
213203
;;;; java.lang.Character classes (simple java character type)
214204

215205
;; \p{javaLowerCase} Equivalent to java.lang.Character.isLowerCase()
216-
"\\p{javaLowerCase}" regexp-posix-char-class
206+
"\\p{javaLowerCase}" regexp-java-char-class
217207
;; \p{javaUpperCase} Equivalent to java.lang.Character.isUpperCase()
218-
"\\p{javaUpperCase}" regexp-posix-char-class
208+
"\\p{javaUpperCase}" regexp-java-char-class
219209
;; \p{javaWhitespace} Equivalent to java.lang.Character.isWhitespace()
220-
"\\p{javaWhitespace}" regexp-posix-char-class
210+
"\\p{javaWhitespace}" regexp-java-char-class
221211
;; \p{javaMirrored} Equivalent to java.lang.Character.isMirrored()
222-
"\\p{javaMirrored}" regexp-posix-char-class
212+
"\\p{javaMirrored}" regexp-java-char-class
223213

224214
;;;; Classes for Unicode scripts, blocks, categories and binary properties
225215

226216
;; \p{IsLatin} A Latin script character (script)
227-
"\\p{IsLatin}" regexp-posix-char-class
217+
"\\p{IsLatin}" regexp-unicode-char-class
228218
;; \p{InGreek} A character in the Greek block (block)
229-
"\\p{InGreek}" regexp-posix-char-class
219+
"\\p{InGreek}" regexp-unicode-char-class
230220
;; \p{Lu} An uppercase letter (category)
231-
"\\p{Lu}" regexp-posix-char-class
221+
"\\p{Lu}" regexp-unicode-char-class
232222
;; \p{IsAlphabetic} An alphabetic character (binary property)
233-
"\\p{IsAlphabetic}" regexp-posix-char-class
223+
"\\p{IsAlphabetic}" regexp-unicode-char-class
234224
;; \p{Sc} A currency symbol
235-
"\\p{Sc}" regexp-posix-char-class
225+
"\\p{Sc}" regexp-unicode-char-class
236226
;; \P{InGreek} Any character except one in the Greek block (negation)
237-
"\\P{InGreek}" regexp-posix-char-class
227+
"\\P{InGreek}" regexp-unicode-char-class
238228
;; [\p{L}&&[^\p{Lu}]] Any letter except an uppercase letter (subtraction)
239229

240230
;;;; Invalid classes

syntax/clojure.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ syntax cluster clojureRegexpEscapes contains=clojureRegexpEscape,clojureRegexpQu
8585
" Java version 1.7.0_17
8686
syntax match clojureRegexpPosixCharClass "\v\\[pP]\{%(ASCII|Alnum|Alpha|Blank|Cntrl|Digit|Graph|Lower|Print|Punct|Space|Upper|XDigit)\}" contained display
8787
syntax match clojureRegexpJavaCharClass "\v\\[pP]\{java%(Alphabetic|Defined|Digit|ISOControl|IdentifierIgnorable|Ideographic|JavaIdentifierPart|JavaIdentifierStart|Letter|LetterOrDigit|LowerCase|Mirrored|SpaceChar|TitleCase|UnicodeIdentifierPart|UnicodeIdentifierStart|UpperCase|Whitespace)\}" contained display
88-
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{Is%(alnum|alphabetic|assigned|blank|control|digit|graph|hex_digit|hexdigit|ideographic|letter|lowercase|noncharacter_code_point|noncharactercodepoint|print|punctuation|titlecase|uppercase|white_space|whitespace|word)\}" contained display
88+
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\cIs%(alnum|alphabetic|assigned|blank|control|digit|graph|hex_digit|hexdigit|ideographic|letter|lowercase|noncharacter_code_point|noncharactercodepoint|print|punctuation|titlecase|uppercase|white_space|whitespace|word)\}" contained display
8989
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]%(C|L|M|N|P|S|Z)" contained display
9090
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{%(Is|gc\=|general_category\=)?%(C[cfnos]|L[CDlmotu]|M[cen]|N[dlo]|P[cdefios]|S[ckmo]|Z[lps])\}" contained display
9191
syntax match clojureRegexpUnicodeCharClass "\v\\[pP]\{\c%(Is|sc\=|script\=)%(arab|arabic|armenian|armi|armn|avestan|avst|bali|balinese|bamu|bamum|batak|batk|beng|bengali|bopo|bopomofo|brah|brahmi|brai|braille|bugi|buginese|buhd|buhid|canadian_aboriginal|cans|cari|carian|cham|cher|cherokee|common|copt|coptic|cprt|cuneiform|cypriot|cyrillic|cyrl|deseret|deva|devanagari|dsrt|egyp|egyptian_hieroglyphs|ethi|ethiopic|geor|georgian|glag|glagolitic|goth|gothic|greek|grek|gujarati|gujr|gurmukhi|guru|han|hang|hangul|hani|hano|hanunoo|hebr|hebrew|hira|hiragana|imperial_aramaic|inherited|inscriptional_pahlavi|inscriptional_parthian|ital|java|javanese|kaithi|kali|kana|kannada|katakana|kayah_li|khar|kharoshthi|khmer|khmr|knda|kthi|lana|lao|laoo|latin|latn|lepc|lepcha|limb|limbu|linb|linear_b|lisu|lyci|lycian|lydi|lydian|malayalam|mand|mandaic|meetei_mayek|mlym|mong|mongolian|mtei|myanmar|mymr|new_tai_lue|nko|nkoo|ogam|ogham|ol_chiki|olck|old_italic|old_persian|old_south_arabian|old_turkic|oriya|orkh|orya|osma|osmanya|phag|phags_pa|phli|phnx|phoenician|prti|rejang|rjng|runic|runr|samaritan|samr|sarb|saur|saurashtra|shavian|shaw|sinh|sinhala|sund|sundanese|sylo|syloti_nagri|syrc|syriac|tagalog|tagb|tagbanwa|tai_le|tai_tham|tai_viet|tale|talu|tamil|taml|tavt|telu|telugu|tfng|tglg|thaa|thaana|thai|tibetan|tibt|tifinagh|ugar|ugaritic|unknown|vai|vaii|xpeo|xsux|yi|yiii|zinh|zyyy|zzzz)\}" contained display

0 commit comments

Comments
 (0)