Skip to content
This repository was archived by the owner on Nov 5, 2021. It is now read-only.

Commit b6f47a5

Browse files
authored
Merge pull request #37 from avelino/clojure
Clojure: added more keywords
2 parents 32838ab + 4f1958a commit b6f47a5

File tree

2 files changed

+74
-18
lines changed

2 files changed

+74
-18
lines changed

src/clojure/clojure.test.ts

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ testTokenization('clojure', [
2727
{ startIndex: 8, type: 'string.clj'},
2828
],
2929
},
30+
{
31+
line: 'in-ns "user',
32+
tokens: [
33+
{ startIndex: 0, type: 'keyword.clj' },
34+
{ startIndex: 5, type: 'white.clj' },
35+
{ startIndex: 6, type: 'string.clj' },
36+
],
37+
},
3038
],
3139

3240
// comments

src/clojure/clojure.ts

+66-18
Original file line numberDiff line numberDiff line change
@@ -44,32 +44,77 @@ export const language = <ILanguage>{
4444

4545
keywords: [
4646
'ns',
47-
'ns-unmap',
47+
'ns\-unmap',
48+
'create\-ns',
49+
'in\-ns',
4850
'fn',
4951
'def',
5052
'defn',
5153
'defmacro',
5254
'defmulti',
5355
'defonce',
54-
'bound\\-fn',
56+
'require',
57+
'import',
58+
'new',
59+
'refer',
60+
'pos',
61+
'pos\?',
62+
'filter',
63+
'map',
64+
'reduce',
65+
'repeat',
66+
'key',
67+
'rest',
68+
'concat',
69+
'into',
70+
'reverse',
71+
'iterate',
72+
'range',
73+
'drop',
74+
'drop\-while',
75+
'take',
76+
'take\-while',
77+
'neg',
78+
'neg?',
79+
'bound\-fn',
5580
'if',
56-
'if\\-not',
81+
'if\-not',
82+
'if\-let',
5783
'case,',
84+
'contains',
85+
'conj',
86+
'disj',
87+
'sort',
88+
'get',
89+
'assoc',
90+
'merge',
91+
'keys',
92+
'vals',
93+
'nth',
94+
'first',
95+
'last',
96+
'count',
97+
'contains?',
5898
'cond',
5999
'condp',
60-
'cond\\-\\>',
61-
'cond\\-\\>\\>',
100+
'cond\-\>',
101+
'cond\-\>\>',
62102
'when',
63103
'while',
64-
'when\\-not',
65-
'when\\-first',
104+
'when\-not',
105+
'when\-let',
106+
'when\-first',
66107
'do',
67108
'future',
68109
'comment',
69110
'doto',
70111
'locking',
71112
'proxy',
72-
'as\\-\\>',
113+
'println',
114+
'type',
115+
'meta',
116+
'var',
117+
'as\-\>',
73118
'reify',
74119
'deftype',
75120
'defrecord',
@@ -78,7 +123,7 @@ export const language = <ILanguage>{
78123
'extend-protocol',
79124
'extend-type',
80125
'specify',
81-
'specify\\!',
126+
'specify\!',
82127
'try',
83128
'catch',
84129
'finally',
@@ -87,29 +132,32 @@ export const language = <ILanguage>{
87132
'binding',
88133
'loop',
89134
'for',
135+
'seq',
90136
'doseq',
91137
'dotimes',
92-
'when\\-let',
93-
'if\\-let',
94-
'when\\-some',
95-
'if\\-some',
96-
'this\\-as',
138+
'when\-let',
139+
'if\-let',
140+
'when\-some',
141+
'if\-some',
142+
'this\-as',
97143
'defmethod',
98144
'testing',
99145
'deftest',
100146
'are',
101-
'use\\-fixtures',
147+
'use\-fixtures',
148+
'use',
149+
'remove',
102150
'run',
103-
'run\\*',
151+
'run\*',
104152
'fresh',
105153
'alt!',
106154
'alt!!',
107155
'go',
108-
'go\\-loop',
156+
'go\-loop',
109157
'thread',
110158
],
111159

112-
constants: ['true', 'false', 'nil'],
160+
constants: ['true', 'false', 'nil', 'boolean', 'str'],
113161

114162
operators: ['=', 'not=', '<', '<=', '>', '>=', 'and', 'or', 'not', 'inc', 'dec', 'max', 'min', 'rem', 'bit-and', 'bit-or', 'bit-xor', 'bit-not'],
115163

0 commit comments

Comments
 (0)