Skip to content

Commit 5526d18

Browse files
committed
Opening symbol of #(), #?() and #?@() is marked as parens
1 parent 7528876 commit 5526d18

File tree

3 files changed

+49
-22
lines changed

3 files changed

+49
-22
lines changed

Clojure (Sublimed).sublime-syntax

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ contexts:
3636
- include: comma
3737
- include: line_comment
3838
- include: reader_comment
39-
- include: form_comment
4039
- include: metadata
4140
- include: anonymous_fn
4241
- include: regexp
@@ -76,7 +75,7 @@ contexts:
7675

7776
reader_conditional:
7877
- match: '#\?@?'
79-
scope: punctuation.definition.reader_conditional.clojure
78+
scope: punctuation.definition.reader_conditional.clojure meta.parens.clojure punctuation.section.parens.begin.clojure
8079
push:
8180
- meta_scope: meta.reader_conditional.clojure
8281
- include: forms
@@ -113,25 +112,14 @@ contexts:
113112
- match: '(#)(\()'
114113
captures:
115114
1: punctuation.definition.anon_fn.clojure
116-
2: punctuation.section.parens.begin.clojure
115+
scope: punctuation.section.parens.begin.clojure
117116
push:
118117
- meta_scope: meta.parens.clojure meta.function.anon.clojure
119118
- match: \)
120119
scope: punctuation.section.parens.end.clojure
121120
pop: 2
122121
- include: main
123122

124-
form_comment:
125-
- match: '(\()[\s,]*comment'
126-
captures:
127-
1: punctuation.section.parens.begin.clojure
128-
push:
129-
- meta_scope: meta.parens.clojure comment.form.clojure
130-
- match: \)
131-
scope: punctuation.section.parens.end.clojure
132-
pop: 2
133-
- include: main
134-
135123
constant:
136124
- match: '{{wsb}}(nil|true|false){{wse}}'
137125
scope: constant.language.clojure
@@ -293,25 +281,23 @@ contexts:
293281
scope: punctuation.section.parens.begin.clojure
294282
branch_point: open_parens
295283
branch:
296-
- comment_first
284+
- form_comment_first
297285
- list_first
298286

299-
comment_first:
287+
form_comment_first:
300288
- meta_scope: comment.form.clojure
301-
- match: \)
302-
scope: punctuation.section.parens.end.clojure
303-
pop: 2
304289
- include: comma
305290
- include: line_comment
306291
- include: reader_comment
307292
- include: metadata
308293
- match: 'comment'
309-
pop: 1
310-
push: comment_rest
294+
set: form_comment_rest
295+
- match: \)
296+
fail: open_parens
311297
- match: '(?=\S)'
312298
fail: open_parens
313299

314-
comment_rest:
300+
form_comment_rest:
315301
- meta_scope: comment.form.clojure
316302
- match: \)
317303
scope: punctuation.section.parens.end.clojure

test_scheme/color_scheme.clj

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
; Constants
3+
nil true false \c \newline 123 1.23 10/20 :abc :abc.def/uvw.xyz #inst "1985-01-25"
4+
5+
; Symbols
6+
abc ab/cd
7+
8+
; Strings
9+
"" "abc" "\" \u221e"
10+
11+
; Top-level parens
12+
() [] {} #() #{} #?() #?@()
13+
14+
; Nested parens
15+
(() [] {} #() #{} #?() #?@())
16+
[() [] {} #() #{} #?() #?@()]
17+
{() [] {} #() #{} #?() #?@()}
18+
#{() [] {} #() #{} #?() #?@()}
19+
#(() [] {} #() #{} #?() #?@())
20+
([{}])
21+
(((((((((()))))))))) [[[[[[[[[[]]]]]]]]]] {{{{{{{{{{}}}}}}}}}}
22+
23+
; Definitions
24+
(def xyz)
25+
(def xyz xyz)
26+
(def xyz 123)
27+
(def 123 xyz)
28+
(def
29+
xyz)
30+
(do (def xyz))
31+
32+
; Punctuation
33+
,
34+
35+
; Meta
36+
; Quotes
37+
; Syntax quotes
38+
; Reader comments
39+
; Form comments

test_syntax/syntax_test_clojure.cljc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,8 @@
392392
; ^ punctuation.section.parens.end
393393

394394
; COMMENT BLOCK
395+
()
396+
; ^^ - comment
395397
(comment 123)
396398
; ^^^^^^^^^^^^^ comment.form.clojure
397399
(comment

0 commit comments

Comments
 (0)