@@ -61,7 +61,6 @@ public class Ctags implements Resettable {
6161
6262 private final RuntimeEnvironment env ;
6363 private volatile boolean closing ;
64- private final LangTreeMap defaultLangMap = new LangTreeMap ();
6564 private LangMap langMap ;
6665 private List <String > command ;
6766 private Process ctags ;
@@ -74,8 +73,13 @@ public class Ctags implements Resettable {
7473
7574 private boolean junit_testing = false ;
7675
76+ /**
77+ * Initializes an instance with the current
78+ * {@link AnalyzerGuru#getLangMap()}.
79+ */
7780 public Ctags () {
7881 env = RuntimeEnvironment .getInstance ();
82+ langMap = AnalyzerGuru .getLangMap ();
7983 }
8084
8185 /**
@@ -166,15 +170,6 @@ private void initialize() {
166170 command .add ("--fields=-anf+iKnS" );
167171 command .add ("--excmd=pattern" );
168172
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-
178173 //Ideally all below should be in ctags, or in outside config file,
179174 //we might run out of command line SOON
180175 //Also note, that below ctags definitions HAVE to be in POSIX
@@ -200,10 +195,10 @@ private void initialize() {
200195
201196 //PLEASE add new languages ONLY with POSIX syntax (see above wiki link)
202197
203- if (langMap ! = null ) {
204- command . addAll ( langMap . mergeSecondary ( defaultLangMap ). getCtagsArgs () );
198+ if (langMap = = null ) {
199+ LOGGER . warning ( " langMap property is null" );
205200 } else {
206- command .addAll (defaultLangMap .getCtagsArgs ());
201+ command .addAll (langMap .getCtagsArgs ());
207202 }
208203
209204 /* Add extra command line options for ctags. */
@@ -254,7 +249,6 @@ private void addRustSupport(List<String> command) {
254249 if (!env .getCtagsLanguages ().contains ("Rust" )) { // Built-in would be capitalized.
255250 command .add ("--langdef=rust" ); // Lower-case if user-defined.
256251 }
257- defaultLangMap .add (".RS" , "rust" ); // Upper-case file spec
258252
259253 // The following are not supported yet in Universal Ctags b13cb551
260254 command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?(static|const)[[:space:]]+(mut[[:space:]]+)?" +
@@ -270,8 +264,6 @@ private void addPowerShellSupport(List<String> command) {
270264 if (!env .getCtagsLanguages ().contains ("PowerShell" )) { // Built-in would be capitalized.
271265 command .add ("--langdef=powershell" ); // Lower-case if user-defined.
272266 }
273- defaultLangMap .add (".PS1" , "powershell" ); // Upper-case file spec
274- defaultLangMap .add (".PSM1" , "powershell" ); // Upper-case file spec
275267
276268 command .add ("--regex-powershell=/\\ $(\\ {[^}]+\\ })/\\ 1/v,variable/" );
277269 command .add ("--regex-powershell=/\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1/v,variable/" );
@@ -292,7 +284,6 @@ private void addPascalSupport(List<String> command) {
292284 if (!env .getCtagsLanguages ().contains ("Pascal" )) { // Built-in would be capitalized.
293285 command .add ("--langdef=pascal" ); // Lower-case if user-defined.
294286 }
295- defaultLangMap .add (".PAS" , "pascal" ); // Upper-case file spec
296287
297288 command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*\\ ([[:space:]]*[[:alnum:]_][[:space:]]*\\ )/\\ 1/t,Type/" );
298289 command .add ("--regex-pascal=/([[:alnum:]_]+)[[:space:]]*=[[:space:]]*class[[:space:]]*[^;]*$/\\ 1/c,Class/" );
@@ -310,7 +301,7 @@ private void addSwiftSupport(List<String> command) {
310301 if (!env .getCtagsLanguages ().contains ("Swift" )) { // Built-in would be capitalized.
311302 command .add ("--langdef=swift" ); // Lower-case if user-defined.
312303 }
313- defaultLangMap . add ( ".SWIFT" , "swift" ); // Upper-case file spec
304+
314305 command .add ("--regex-swift=/enum[[:space:]]+([^\\ {\\ }]+).*$/\\ 1/n,enum,enums/" );
315306 command .add ("--regex-swift=/typealias[[:space:]]+([^:=]+).*$/\\ 1/t,typealias,typealiases/" );
316307 command .add ("--regex-swift=/protocol[[:space:]]+([^:\\ {]+).*$/\\ 1/p,protocol,protocols/" );
@@ -325,8 +316,6 @@ private void addKotlinSupport(List<String> command) {
325316 if (!env .getCtagsLanguages ().contains ("Kotlin" )) { // Built-in would be capitalized.
326317 command .add ("--langdef=kotlin" ); // Lower-case if user-defined.
327318 }
328- defaultLangMap .add (".KT" , "kotlin" ); // Upper-case file spec
329- defaultLangMap .add (".KTS" , "kotlin" ); // Upper-case file spec
330319
331320 command .add ("--regex-kotlin=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
332321 "(private[^ ]*|protected)?[[:space:]]*class[[:space:]]+([[:alnum:]_:]+)/\\ 4/c,classes/" );
@@ -355,9 +344,6 @@ private void addClojureSupport(List<String> command) {
355344 if (!env .getCtagsLanguages ().contains ("Clojure" )) { // Built-in would be capitalized.
356345 command .add ("--langdef=clojure" ); // Lower-case if user-defined.
357346 }
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
361347
362348 command .add ("--regex-clojure=/\\ ([[:space:]]*create-ns[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/n,namespace/" );
363349 command .add ("--regex-clojure=/\\ ([[:space:]]*def[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/d,definition/" );
@@ -375,8 +361,6 @@ private void addHaskellSupport(List<String> command) {
375361 if (!env .getCtagsLanguages ().contains ("Haskell" )) { // Built-in would be capitalized.
376362 command .add ("--langdef=haskell" ); // below added with #912. Lowercase if user-defined.
377363 }
378- defaultLangMap .add (".HS" , "haskell" ); // Upper-case file spec
379- defaultLangMap .add (".HSC" , "haskell" ); // Upper-case file spec
380364
381365 command .add ("--regex-haskell=/^[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/c,classes/" );
382366 command .add ("--regex-haskell=/^[[:space:]]*data[[:space:]]+([a-zA-Z0-9_]+)/\\ 1/t,types/" );
@@ -392,7 +376,6 @@ private void addScalaSupport(List<String> command) {
392376 if (!env .getCtagsLanguages ().contains ("Scala" )) { // Built-in would be capitalized.
393377 command .add ("--langdef=scala" ); // below is bug 61 to get full scala support. Lower-case
394378 }
395- defaultLangMap .add (".SCALA" , "scala" ); // Upper-case file spec
396379
397380 command .add ("--regex-scala=/^[[:space:]]*((abstract|final|sealed|implicit|lazy)[[:space:]]*)*" +
398381 "(private|protected)?[[:space:]]*class[[:space:]]+([a-zA-Z0-9_]+)/\\ 4/c,classes/" );
0 commit comments