@@ -61,7 +61,6 @@ public class Ctags implements Resettable {
61
61
62
62
private final RuntimeEnvironment env ;
63
63
private volatile boolean closing ;
64
- private final LangTreeMap defaultLangMap = new LangTreeMap ();
65
64
private LangMap langMap ;
66
65
private List <String > command ;
67
66
private Process ctags ;
@@ -74,8 +73,13 @@ public class Ctags implements Resettable {
74
73
75
74
private boolean junit_testing = false ;
76
75
76
+ /**
77
+ * Initializes an instance with the current
78
+ * {@link AnalyzerGuru#getLangMap()}.
79
+ */
77
80
public Ctags () {
78
81
env = RuntimeEnvironment .getInstance ();
82
+ langMap = AnalyzerGuru .getLangMap ();
79
83
}
80
84
81
85
/**
@@ -166,15 +170,6 @@ private void initialize() {
166
170
command .add ("--fields=-anf+iKnS" );
167
171
command .add ("--excmd=pattern" );
168
172
169
- defaultLangMap .clear ();
170
- defaultLangMap .add (".KSHLIB" , "sh" ); // RFE #17849. Upper-case file spec
171
- defaultLangMap .add (".PLB" , "sql" ); // RFE #19208. Upper-case file spec
172
- defaultLangMap .add (".PLS" , "sql" ); // RFE #19208. Upper-case file spec
173
- defaultLangMap .add (".PLD" , "sql" ); // RFE #19208. Upper-case file spec
174
- defaultLangMap .add (".PKS" , "sql" ); // RFE #19208 ? Upper-case file spec
175
- defaultLangMap .add (".PKB" , "sql" ); // # 1763. Upper-case file spec
176
- defaultLangMap .add (".PCK" , "sql" ); // # 1763. Upper-case file spec
177
-
178
173
//Ideally all below should be in ctags, or in outside config file,
179
174
//we might run out of command line SOON
180
175
//Also note, that below ctags definitions HAVE to be in POSIX
@@ -200,10 +195,10 @@ private void initialize() {
200
195
201
196
//PLEASE add new languages ONLY with POSIX syntax (see above wiki link)
202
197
203
- if (langMap ! = null ) {
204
- command . addAll ( langMap . mergeSecondary ( defaultLangMap ). getCtagsArgs () );
198
+ if (langMap = = null ) {
199
+ LOGGER . warning ( " langMap property is null" );
205
200
} else {
206
- command .addAll (defaultLangMap .getCtagsArgs ());
201
+ command .addAll (langMap .getCtagsArgs ());
207
202
}
208
203
209
204
/* Add extra command line options for ctags. */
@@ -254,7 +249,6 @@ private void addRustSupport(List<String> command) {
254
249
if (!env .getCtagsLanguages ().contains ("Rust" )) { // Built-in would be capitalized.
255
250
command .add ("--langdef=rust" ); // Lower-case if user-defined.
256
251
}
257
- defaultLangMap .add (".RS" , "rust" ); // Upper-case file spec
258
252
259
253
// The following are not supported yet in Universal Ctags b13cb551
260
254
command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?(static|const)[[:space:]]+(mut[[:space:]]+)?" +
@@ -270,8 +264,6 @@ private void addPowerShellSupport(List<String> command) {
270
264
if (!env .getCtagsLanguages ().contains ("PowerShell" )) { // Built-in would be capitalized.
271
265
command .add ("--langdef=powershell" ); // Lower-case if user-defined.
272
266
}
273
- defaultLangMap .add (".PS1" , "powershell" ); // Upper-case file spec
274
- defaultLangMap .add (".PSM1" , "powershell" ); // Upper-case file spec
275
267
276
268
command .add ("--regex-powershell=/\\ $(\\ {[^}]+\\ })/\\ 1/v,variable/" );
277
269
command .add ("--regex-powershell=/\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1/v,variable/" );
@@ -292,7 +284,6 @@ private void addPascalSupport(List<String> command) {
292
284
if (!env .getCtagsLanguages ().contains ("Pascal" )) { // Built-in would be capitalized.
293
285
command .add ("--langdef=pascal" ); // Lower-case if user-defined.
294
286
}
295
- defaultLangMap .add (".PAS" , "pascal" ); // Upper-case file spec
296
287
297
288
command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*\\ ([[:space:]]*[[:alnum:]_][[:space:]]*\\ )/\\ 1/t,Type/" );
298
289
command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*class[[:space:]]*[^;]*$/\\ 1/c,Class/" );
@@ -310,7 +301,7 @@ private void addSwiftSupport(List<String> command) {
310
301
if (!env .getCtagsLanguages ().contains ("Swift" )) { // Built-in would be capitalized.
311
302
command .add ("--langdef=swift" ); // Lower-case if user-defined.
312
303
}
313
- defaultLangMap . add ( ".SWIFT" , "swift" ); // Upper-case file spec
304
+
314
305
command .add ("--regex-swift=/enum[[:space:]]+([^\\ {\\ }]+).*$/\\ 1/n,enum,enums/" );
315
306
command .add ("--regex-swift=/typealias[[:space:]]+([^:=]+).*$/\\ 1/t,typealias,typealiases/" );
316
307
command .add ("--regex-swift=/protocol[[:space:]]+([^:\\ {]+).*$/\\ 1/p,protocol,protocols/" );
@@ -325,8 +316,6 @@ private void addKotlinSupport(List<String> command) {
325
316
if (!env .getCtagsLanguages ().contains ("Kotlin" )) { // Built-in would be capitalized.
326
317
command .add ("--langdef=kotlin" ); // Lower-case if user-defined.
327
318
}
328
- defaultLangMap .add (".KT" , "kotlin" ); // Upper-case file spec
329
- defaultLangMap .add (".KTS" , "kotlin" ); // Upper-case file spec
330
319
331
320
command .add ("--regex-kotlin=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
332
321
"(private[^ ]*|protected)?[[:space:]]*class[[:space:]]+([[:alnum:]_:]+)/\\ 4/c,classes/" );
@@ -355,9 +344,6 @@ private void addClojureSupport(List<String> command) {
355
344
if (!env .getCtagsLanguages ().contains ("Clojure" )) { // Built-in would be capitalized.
356
345
command .add ("--langdef=clojure" ); // Lower-case if user-defined.
357
346
}
358
- defaultLangMap .add (".CLJ" , "clojure" ); // Upper-case file spec
359
- defaultLangMap .add (".CLJS" , "clojure" ); // Upper-case file spec
360
- defaultLangMap .add (".CLJX" , "clojure" ); // Upper-case file spec
361
347
362
348
command .add ("--regex-clojure=/\\ ([[:space:]]*create-ns[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/n,namespace/" );
363
349
command .add ("--regex-clojure=/\\ ([[:space:]]*def[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/d,definition/" );
@@ -375,8 +361,6 @@ private void addHaskellSupport(List<String> command) {
375
361
if (!env .getCtagsLanguages ().contains ("Haskell" )) { // Built-in would be capitalized.
376
362
command .add ("--langdef=haskell" ); // below added with #912. Lowercase if user-defined.
377
363
}
378
- defaultLangMap .add (".HS" , "haskell" ); // Upper-case file spec
379
- defaultLangMap .add (".HSC" , "haskell" ); // Upper-case file spec
380
364
381
365
command .add ("--regex-haskell=/^[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/c,classes/" );
382
366
command .add ("--regex-haskell=/^[[:space:]]*data[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/t,types/" );
@@ -392,7 +376,6 @@ private void addScalaSupport(List<String> command) {
392
376
if (!env .getCtagsLanguages ().contains ("Scala" )) { // Built-in would be capitalized.
393
377
command .add ("--langdef=scala" ); // below is bug 61 to get full scala support. Lower-case
394
378
}
395
- defaultLangMap .add (".SCALA" , "scala" ); // Upper-case file spec
396
379
397
380
command .add ("--regex-scala=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
398
381
"(private|protected)?[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 4/c,classes/" );
0 commit comments