@@ -56,7 +56,6 @@ public class Ctags implements Resettable {
56
56
private OutputStreamWriter ctagsIn ;
57
57
private BufferedReader ctagsOut ;
58
58
private static final String CTAGS_FILTER_TERMINATOR = "__ctags_done_with_file__" ;
59
- //default: setCtags(System.getProperty("org.opengrok.indexer.analysis.Ctags", "ctags"));
60
59
private String binary ;
61
60
private String CTagsExtraOptionsFile = null ;
62
61
private int tabSize ;
@@ -124,16 +123,15 @@ private void initialize() throws IOException {
124
123
command .add (binary );
125
124
command .add ("--c-kinds=+l" );
126
125
127
- if (env .isUniversalCtags ()) {
128
- command .add ("--langmap=clojure:+.cljs" );
129
- command .add ("--langmap=clojure:+.cljx" );
126
+ command .add ("--langmap=clojure:+.cljs" );
127
+ command .add ("--langmap=clojure:+.cljx" );
128
+
129
+ // Workaround for bug #14924: Don't get local variables in Java
130
+ // code since that creates many false positives.
131
+ // CtagsTest : bug14924 "too many methods" guards for this
132
+ // universal ctags are however safe, so enabling for them
133
+ command .add ("--java-kinds=+l" );
130
134
131
- // Workaround for bug #14924: Don't get local variables in Java
132
- // code since that creates many false positives.
133
- // CtagsTest : bug14924 "too many methods" guards for this
134
- // universal ctags are however safe, so enabling for them
135
- command .add ("--java-kinds=+l" );
136
- }
137
135
command .add ("--sql-kinds=+l" );
138
136
command .add ("--Fortran-kinds=+L" );
139
137
command .add ("--C++-kinds=+l" );
@@ -163,10 +161,6 @@ private void initialize() throws IOException {
163
161
164
162
addHaskellSupport (command );
165
163
166
- if (!env .isUniversalCtags ()) {
167
- addGoLangSupport (command );
168
- }
169
-
170
164
//temporarily use our defs until ctags will fix https://github.com/universal-ctags/ctags/issues/988
171
165
addClojureSupport (command );
172
166
@@ -198,19 +192,14 @@ private void initialize() throws IOException {
198
192
processBuilder = new ProcessBuilder (command );
199
193
200
194
ctags = processBuilder .start ();
201
- ctagsIn = env .isUniversalCtags () ? new OutputStreamWriter (
202
- ctags .getOutputStream (), StandardCharsets .UTF_8 ) :
203
- new OutputStreamWriter (ctags .getOutputStream ());
204
- ctagsOut = new BufferedReader (env .isUniversalCtags () ?
205
- new InputStreamReader (ctags .getInputStream (),
206
- StandardCharsets .UTF_8 ) : new InputStreamReader (
207
- ctags .getInputStream ()));
195
+ ctagsIn = new OutputStreamWriter (
196
+ ctags .getOutputStream (), StandardCharsets .UTF_8 );
197
+ ctagsOut = new BufferedReader (new InputStreamReader (ctags .getInputStream (),
198
+ StandardCharsets .UTF_8 ));
208
199
209
200
errThread = new Thread (() -> {
210
- try (BufferedReader error = new BufferedReader (
211
- env .isUniversalCtags () ? new InputStreamReader (
212
- ctags .getErrorStream (), StandardCharsets .UTF_8 ) :
213
- new InputStreamReader (ctags .getErrorStream ()))) {
201
+ try (BufferedReader error = new BufferedReader (new InputStreamReader (ctags .getErrorStream (),
202
+ StandardCharsets .UTF_8 ))) {
214
203
String s ;
215
204
while ((s = error .readLine ()) != null ) {
216
205
if (s .length () > 0 ) {
@@ -232,14 +221,7 @@ private void initialize() throws IOException {
232
221
private void addRustSupport (List <String > command ) {
233
222
command .add ("--langdef=rust" );
234
223
command .add ("--langmap=rust:+.rs" );
235
- if (!RuntimeEnvironment .getInstance ().isUniversalCtags ()) {
236
- command .add ("--regex-rust=/^[[:space:]]*(#\\ [[^]]+\\ ][[:space:]]*)*(pub[[:space:]]+)?(extern[[:space:]]+)?(\\ \" [^\\ \" ]+\\ \" [[:space:]]+)?(unsafe[[:space:]]+)?fn[[:space:]]+([[:alnum:]_]+)/\\ 6/h,functions,function definitions/" );
237
- command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?type[[:space:]]+([[:alnum:]_]+)/\\ 2/T,types,type definitions/" );
238
- command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?enum[[:space:]]+([[:alnum:]_]+)/\\ 2/g,enum,enumeration names/" );
239
- command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?struct[[:space:]]+([[:alnum:]_]+)/\\ 2/S,structure names/" );
240
- command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?mod[[:space:]]+([[:alnum:]_]+)/\\ 2/N,modules,module names/" );
241
- command .add ("--regex-rust=/^[[:space:]]*macro_rules![[:space:]]+([[:alnum:]_]+)/\\ 1/d,macros,macro definitions/" );
242
- }
224
+
243
225
// The following are not supported yet in Universal Ctags b13cb551
244
226
command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?(static|const)[[:space:]]+(mut[[:space:]]+)?([[:alnum:]_]+)/\\ 4/C,consts,static constants/" );
245
227
command .add ("--regex-rust=/^[[:space:]]*(pub[[:space:]]+)?(unsafe[[:space:]]+)?impl([[:space:]\n ]*<[^>]*>)?[[:space:]]+(([[:alnum:]_:]+)[[:space:]]*(<[^>]*>)?[[:space:]]+(for)[[:space:]]+)?([[:alnum:]_]+)/\\ 5 \\ 7 \\ 8/I,impls,trait implementations/" );
@@ -254,20 +236,14 @@ private void addPowerShellSupport(List<String> command) {
254
236
command .add ("--regex-Posh=/\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1/v,variable/" );
255
237
command .add ("--regex-Posh=/^[[:space:]]*(:[^[:space:]]+)/\\ 1/l,label/" );
256
238
257
- if (!RuntimeEnvironment .getInstance ().isUniversalCtags ()) {
258
- command .add ("--regex-Posh=/^[[:space:]]*([Ff]unction|[Ff]ilter)[[:space:]]+([^({[:space:]]+)[[:space:]]*(\\ (([^)]+)\\ ))?/\\ 2/f,function,functions/" );
259
- } else {
260
- command .add ("--_fielddef-Posh=signature,signatures" );
261
- command .add ("--fields-Posh=+{signature}" );
262
-
263
- // escaped variable markers
264
- command .add ("--regex-Posh=/`\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1//{exclusive}" );
265
- command .add ("--regex-Posh=/`\\ $(\\ {[^}]+\\ })/\\ 1//{exclusive}" );
266
- command .add ("--regex-Posh=/#.*\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1//{exclusive}" );
267
- command .add ("--regex-Posh=/#.*\\ $(\\ {[^}]+\\ })/\\ 1//{exclusive}" );
268
- command .add ("--regex-Posh=/^[[:space:]]*(function|filter)[[:space:]]+([^({[:space:]]+)[[:space:]]*(\\ (([^)]+)\\ ))?/\\ 2/f,function,functions/{icase}{exclusive}{_field=signature:(\\ 4)}" );
269
-
270
- }
239
+ command .add ("--_fielddef-Posh=signature,signatures" );
240
+ command .add ("--fields-Posh=+{signature}" );
241
+ // escaped variable markers
242
+ command .add ("--regex-Posh=/`\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1//{exclusive}" );
243
+ command .add ("--regex-Posh=/`\\ $(\\ {[^}]+\\ })/\\ 1//{exclusive}" );
244
+ command .add ("--regex-Posh=/#.*\\ $([[:alnum:]_]+([:.][[:alnum:]_]+)*)/\\ 1//{exclusive}" );
245
+ command .add ("--regex-Posh=/#.*\\ $(\\ {[^}]+\\ })/\\ 1//{exclusive}" );
246
+ command .add ("--regex-Posh=/^[[:space:]]*(function|filter)[[:space:]]+([^({[:space:]]+)[[:space:]]*(\\ (([^)]+)\\ ))?/\\ 2/f,function,functions/{icase}{exclusive}{_field=signature:(\\ 4)}" );
271
247
}
272
248
273
249
private void addPascalSupport (List <String > command ) {
@@ -317,10 +293,7 @@ private void addKotlinSupport(List<String> command) {
317
293
private void addClojureSupport (List <String > command ) {
318
294
command .add ("--langdef=clojure" ); // clojure support (patterns are from https://gist.github.com/kul/8704283)
319
295
command .add ("--langmap=clojure:+.clj" );
320
- if (!RuntimeEnvironment .getInstance ().isUniversalCtags ()) {
321
- command .add ("--regex-clojure=/\\ ([[:space:]]*defn[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/f,function/" );
322
- command .add ("--regex-clojure=/\\ ([[:space:]]*ns[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/n,namespace/" );
323
- }
296
+
324
297
command .add ("--regex-clojure=/\\ ([[:space:]]*create-ns[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/n,namespace/" );
325
298
command .add ("--regex-clojure=/\\ ([[:space:]]*def[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/d,definition/" );
326
299
command .add ("--regex-clojure=/\\ ([[:space:]]*defn-[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/p,private function/" );
@@ -333,14 +306,6 @@ private void addClojureSupport(List<String> command) {
333
306
command .add ("--regex-clojure=/\\ ([[:space:]]*intern[[:space:]]+([-[:alnum:]*+!_:\\ /.?]+)/\\ 1/v,intern/" );
334
307
}
335
308
336
- private void addGoLangSupport (List <String > command ) {
337
- command .add ("--langdef=golang" );
338
- command .add ("--langmap=golang:+.go" );
339
- command .add ("--regex-golang=/func([[:space:]]+([^)]+))?[[:space:]]+([a-zA-Z0-9_]+)/\\ 2/f,func/" );
340
- command .add ("--regex-golang=/var[[:space:]]+([a-zA-Z_][a-zA-Z0-9_]+)/\\ 1/v,var/" );
341
- command .add ("--regex-golang=/type[[:space:]]+([a-zA-Z_][a-zA-Z0-9_]+)/\\ 1/t,type/" );
342
- }
343
-
344
309
private void addHaskellSupport (List <String > command ) {
345
310
command .add ("--langdef=haskell" ); // below was added with #912
346
311
command .add ("--langmap=haskell:+.hs" );
0 commit comments