summaryrefslogtreecommitdiffstats
path: root/Auxiliary/vim/extract-upper-case.pl
diff options
context:
space:
mode:
authorPatrick Boettcher <patrick.boettcher@posteo.de>2017-08-30 20:40:38 (GMT)
committerPatrick Boettcher <patrick.boettcher@posteo.de>2017-08-30 20:40:38 (GMT)
commit84d67356113ca349a1e14576cafc12a13988daa4 (patch)
tree673fb36fd15c9681c7d678e2788e419b10c37a19 /Auxiliary/vim/extract-upper-case.pl
parenta0ef210da8f8037340049ae99530f2bee6723bc3 (diff)
parent88da716c4281f498cb87591dc6b43b5d496e9ab7 (diff)
downloadCMake-84d67356113ca349a1e14576cafc12a13988daa4.zip
CMake-84d67356113ca349a1e14576cafc12a13988daa4.tar.gz
CMake-84d67356113ca349a1e14576cafc12a13988daa4.tar.bz2
Merge branch 'upstream-vim-cmake-syntax'
* upstream-vim-cmake-syntax: vim-cmake-syntax 2017-08-30 (40f5f4f3)
Diffstat (limited to 'Auxiliary/vim/extract-upper-case.pl')
-rwxr-xr-xAuxiliary/vim/extract-upper-case.pl21
1 files changed, 19 insertions, 2 deletions
diff --git a/Auxiliary/vim/extract-upper-case.pl b/Auxiliary/vim/extract-upper-case.pl
index ea77cbb..9e3c439 100755
--- a/Auxiliary/vim/extract-upper-case.pl
+++ b/Auxiliary/vim/extract-upper-case.pl
@@ -29,8 +29,8 @@ push @modules, "ExternalProject";
# variables
open(CMAKE, "$cmake --help-variable-list|") or die "could not run cmake";
while (<CMAKE>) {
+ next if /\</; # skip if containing < or >
chomp;
- next if /\</; # skip VARIABLES which contained <>-"templates"
push @variables, $_;
}
close(CMAKE);
@@ -70,11 +70,24 @@ my @generator_expr = extract_upper("$cmake --help-manual cmake-generator-express
# properties
open(CMAKE, "$cmake --help-property-list|");
while (<CMAKE>) {
+ next if /\</; # skip if containing < or >
chomp;
push @properties, $_;
}
close(CMAKE);
+# transform all properties in a hash
+my %properties = map { $_ => 1 } @properties;
+
+# version
+open(CMAKE, "$cmake --version|");
+my $version = 'unknown';
+while (<CMAKE>) {
+ chomp;
+ $version = $_ if /cmake version/;
+}
+close(CMAKE);
+
# generate cmake.vim
open(IN, "<cmake.vim.in") or die "could not read cmake.vim.in";
open(OUT, ">syntax/cmake.vim") or die "could not write to syntax/cmake.vim";
@@ -102,6 +115,8 @@ while(<IN>)
print OUT " " x 12 , "\\ ", join(" ", sort keys %loop), "\n";
} elsif ($1 eq "DEPRECATED") {
print OUT " " x 12 , "\\ ", join(" ", sort keys %deprecated), "\n";
+ } elsif ($1 eq "PROPERTIES") {
+ print OUT " " x 12 , "\\ ", join(" ", sort keys %properties), "\n";
} elsif ($1 eq "KEYWORDS") {
foreach my $k (sort keys %keywords) {
print OUT "syn keyword cmakeKW$k contained\n";
@@ -111,6 +126,9 @@ while(<IN>)
}
} elsif ($1 eq "KEYWORDS_HIGHLIGHT") {
print OUT join("\n", @keyword_hi), "\n";
+ } elsif ($1 eq "VERSION") {
+ $_ =~ s/\@VERSION\@/$version/;
+ print OUT $_;
} else {
print "ERROR do not know how to replace $1\n";
}
@@ -128,7 +146,6 @@ sub extract_upper
open(KW, $input);
while (<KW>) {
-
foreach my $w (m/\b([A-Z_]{2,})\b/g) {
next
if exists $variables{$w} or # skip if it is a variable