Skip to content

Commit a78a222

Browse files
committed
adapt to new Ctags
1 parent 6bc7c6e commit a78a222

File tree

2 files changed

+3
-50
lines changed
  • opengrok-indexer/src

2 files changed

+3
-50
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/Ctags.java

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ private void initialize() {
202202
addRustSupport(command);
203203
addPascalSupport(command);
204204
addPowerShellSupport(command);
205-
addTerraformSupport(command);
206205
//PLEASE add new languages ONLY with POSIX syntax (see above wiki link)
207206

208207
if (langMap == null) {
@@ -443,52 +442,6 @@ private void addScalaSupport(List<String> command) {
443442
command.add("--regex-scala=/^[[:space:]]*package[[:space:]]+([a-zA-Z0-9_.]+)/\\1/p/");
444443
}
445444

446-
private void addTerraformSupport(List<String> command) {
447-
if (!ctagsLanguages.contains("Terraform")) { // Built-in would be capitalized.
448-
command.add("--langdef=terraform"); // Lower-case if user-defined.
449-
}
450-
451-
/*
452-
* Ignore Terraform single-line comments with short-form (only two
453-
* separators following the pattern), exclusive matches.
454-
*/
455-
command.add("--regex-terraform=,^[[:space:]]*#,,{exclusive}");
456-
command.add("--regex-terraform=,^[[:space:]]*//,,{exclusive}");
457-
458-
/*
459-
* Terraform "resource block declares a resource of a given type ...
460-
* with a given local name...." Unfortunately there is no Posix
461-
* equivalent of {Identifier} from HCL.lexh, so we must approximate with
462-
* the possibility of leaving out some matches.
463-
*/
464-
command.add("--kinddef-terraform=r,resource,Resource\\ names");
465-
command.add("--kinddef-terraform=d,dataSource,Data\\ sources");
466-
command.add("--kinddef-terraform=m,module,Modules");
467-
command.add("--kinddef-terraform=o,outputValue,Output\\ values");
468-
command.add("--kinddef-terraform=p,provider,Providers");
469-
command.add("--kinddef-terraform=v,variable,Variables");
470-
command.add("--regex-terraform=" +
471-
"/^[[:space:]]*resource[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*" +
472-
"\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
473-
"\\1.\\2/r/");
474-
command.add("--regex-terraform=" +
475-
"/^[[:space:]]*data[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*" +
476-
"\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
477-
"\\1.\\2/d/");
478-
command.add("--regex-terraform=" +
479-
"/^[[:space:]]*module[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
480-
"\\1/m/");
481-
command.add("--regex-terraform=" +
482-
"/^[[:space:]]*output[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
483-
"\\1/o/");
484-
command.add("--regex-terraform=" +
485-
"/^[[:space:]]*provider[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
486-
"\\1/p/");
487-
command.add("--regex-terraform=" +
488-
"/^[[:space:]]*variable[[:space:]]*\\\"([[:alpha:]][-_[:alpha:]]*)\\\"[[:space:]]*\\{/" +
489-
"\\1/v/");
490-
}
491-
492445
/**
493446
* Run ctags on a file.
494447
* @param file file path to process

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/CtagsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ void testTfTags(final SingleTagTestData data) throws Exception {
153153

154154
private static List<SingleTagTestData> terraformTestParams() {
155155
return List.of(
156-
new SingleTagTestData("data_source", "aws_ami.example", "dataSource"),
156+
new SingleTagTestData("data_source", "example", "data"),
157157
new SingleTagTestData("module", "servers", "module"),
158-
new SingleTagTestData("output_value", "instance_ip_addr", "outputValue"),
158+
new SingleTagTestData("output_value", "instance_ip_addr", "output"),
159159
new SingleTagTestData("provider", "oci", "provider"),
160-
new SingleTagTestData("resource", "oci_core_vcn.test_vcn", "resource"),
160+
new SingleTagTestData("resource", "test_vcn", "resource"),
161161
new SingleTagTestData("variable", "availability_zone_names", "variable")
162162
);
163163
}

0 commit comments

Comments
 (0)