@@ -144,8 +144,9 @@ public List<String> getArgv() {
144
144
}
145
145
146
146
private void initialize () {
147
- command = new ArrayList <> ();
147
+ env . validateUniversalCtags ();
148
148
149
+ command = new ArrayList <>();
149
150
command .add (env .getCtags ());
150
151
command .add ("--c-kinds=+l" );
151
152
@@ -250,7 +251,9 @@ private void run() throws IOException {
250
251
}
251
252
252
253
private void addRustSupport (List <String > command ) {
253
- command .add ("--langdef=rust" );
254
+ if (!env .getCtagsLanguages ().contains ("Rust" )) { // Built-in would be capitalized.
255
+ command .add ("--langdef=rust" ); // Lower-case if user-defined.
256
+ }
254
257
defaultLangMap .add (".RS" , "rust" ); // Upper-case file spec
255
258
256
259
// The following are not supported yet in Universal Ctags b13cb551
@@ -264,9 +267,12 @@ private void addRustSupport(List<String> command) {
264
267
}
265
268
266
269
private void addPowerShellSupport (List <String > command ) {
267
- command .add ("--langdef=powershell" );
270
+ if (!env .getCtagsLanguages ().contains ("PowerShell" )) { // Built-in would be capitalized.
271
+ command .add ("--langdef=powershell" ); // Lower-case if user-defined.
272
+ }
268
273
defaultLangMap .add (".PS1" , "powershell" ); // Upper-case file spec
269
274
defaultLangMap .add (".PSM1" , "powershell" ); // Upper-case file spec
275
+
270
276
command .add ("--regex-powershell=/\\ $(\\ {[^}]+\\ })/\\ 1/v,variable/" );
271
277
command .add ("--regex-powershell=/\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1/v,variable/" );
272
278
command .add ("--regex-powershell=/^[[:space:]]*(:[^[:space:]]+)/\\ 1/l,label/" );
@@ -283,8 +289,11 @@ private void addPowerShellSupport(List<String> command) {
283
289
}
284
290
285
291
private void addPascalSupport (List <String > command ) {
286
- command .add ("--langdef=pascal" );
292
+ if (!env .getCtagsLanguages ().contains ("Pascal" )) { // Built-in would be capitalized.
293
+ command .add ("--langdef=pascal" ); // Lower-case if user-defined.
294
+ }
287
295
defaultLangMap .add (".PAS" , "pascal" ); // Upper-case file spec
296
+
288
297
command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*\\ ([[:space:]]*[[:alnum:]_][[:space:]]*\\ )/\\ 1/t,Type/" );
289
298
command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*class[[:space:]]*[^;]*$/\\ 1/c,Class/" );
290
299
command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*interface[[:space:]]*[^;]*$/\\ 1/i,interface/" );
@@ -298,7 +307,9 @@ private void addPascalSupport(List<String> command) {
298
307
}
299
308
300
309
private void addSwiftSupport (List <String > command ) {
301
- command .add ("--langdef=swift" );
310
+ if (!env .getCtagsLanguages ().contains ("Swift" )) { // Built-in would be capitalized.
311
+ command .add ("--langdef=swift" ); // Lower-case if user-defined.
312
+ }
302
313
defaultLangMap .add (".SWIFT" , "swift" ); // Upper-case file spec
303
314
command .add ("--regex-swift=/enum[[:space:]]+([^\\ {\\ }]+).*$/\\ 1/n,enum,enums/" );
304
315
command .add ("--regex-swift=/typealias[[:space:]]+([^:=]+).*$/\\ 1/t,typealias,typealiases/" );
@@ -311,9 +322,12 @@ private void addSwiftSupport(List<String> command) {
311
322
}
312
323
313
324
private void addKotlinSupport (List <String > command ) {
314
- command .add ("--langdef=kotlin" );
325
+ if (!env .getCtagsLanguages ().contains ("Kotlin" )) { // Built-in would be capitalized.
326
+ command .add ("--langdef=kotlin" ); // Lower-case if user-defined.
327
+ }
315
328
defaultLangMap .add (".KT" , "kotlin" ); // Upper-case file spec
316
329
defaultLangMap .add (".KTS" , "kotlin" ); // Upper-case file spec
330
+
317
331
command .add ("--regex-kotlin=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
318
332
"(private[^ ]*|protected)?[[:space:]]*class[[:space:]]+([[:alnum:]_:]+)/\\ 4/c,classes/" );
319
333
command .add ("--regex-kotlin=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
@@ -334,8 +348,13 @@ private void addKotlinSupport(List<String> command) {
334
348
command .add ("--regex-kotlin=/^[[:space:]]*import[[:space:]]+([[:alnum:]_.:]+)/\\ 1/I,imports/" );
335
349
}
336
350
351
+ /**
352
+ * Override Clojure support with patterns from https://gist.github.com/kul/8704283.
353
+ */
337
354
private void addClojureSupport (List <String > command ) {
338
- command .add ("--langdef=clojure" ); // clojure support (patterns are from https://gist.github.com/kul/8704283)
355
+ if (!env .getCtagsLanguages ().contains ("Clojure" )) { // Built-in would be capitalized.
356
+ command .add ("--langdef=clojure" ); // Lower-case if user-defined.
357
+ }
339
358
defaultLangMap .add (".CLJ" , "clojure" ); // Upper-case file spec
340
359
defaultLangMap .add (".CLJS" , "clojure" ); // Upper-case file spec
341
360
defaultLangMap .add (".CLJX" , "clojure" ); // Upper-case file spec
@@ -353,9 +372,12 @@ private void addClojureSupport(List<String> command) {
353
372
}
354
373
355
374
private void addHaskellSupport (List <String > command ) {
356
- command .add ("--langdef=haskell" ); // below was added with #912
375
+ if (!env .getCtagsLanguages ().contains ("Haskell" )) { // Built-in would be capitalized.
376
+ command .add ("--langdef=haskell" ); // below added with #912. Lowercase if user-defined.
377
+ }
357
378
defaultLangMap .add (".HS" , "haskell" ); // Upper-case file spec
358
379
defaultLangMap .add (".HSC" , "haskell" ); // Upper-case file spec
380
+
359
381
command .add ("--regex-haskell=/^[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/c,classes/" );
360
382
command .add ("--regex-haskell=/^[[:space:]]*data[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/t,types/" );
361
383
command .add ("--regex-haskell=/^[[:space:]]*newtype[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/t,types/" );
@@ -367,8 +389,11 @@ private void addHaskellSupport(List<String> command) {
367
389
}
368
390
369
391
private void addScalaSupport (List <String > command ) {
370
- command .add ("--langdef=scala" ); // below is bug 61 to get full scala support
392
+ if (!env .getCtagsLanguages ().contains ("Scala" )) { // Built-in would be capitalized.
393
+ command .add ("--langdef=scala" ); // below is bug 61 to get full scala support. Lower-case
394
+ }
371
395
defaultLangMap .add (".SCALA" , "scala" ); // Upper-case file spec
396
+
372
397
command .add ("--regex-scala=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
373
398
"(private|protected)?[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 4/c,classes/" );
374
399
command .add ("--regex-scala=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
0 commit comments