mirror of
https://github.com/Kitware/CMake.git
synced 2026-04-28 18:09:42 -05:00
vim-cmake-syntax 2017-08-30 (40f5f4f3)
Code extracted from:
https://github.com/pboettch/vim-cmake-syntax.git
at commit 40f5f4f356251802c0a12f63e5f717debbd0cadc (master).
Upstream Shortlog
-----------------
Daniel Hahler (1):
84967b5c Skip escaped quotes in cmakeString
Patrick Boettcher (11):
de7c9072 extract properties as well
5e4f9718 update keywords to latest cmake-revision
96ee5480 fix #1 - highlight escaped quotes in strings
d791d3ac README updated, install instruction
e12d6cb4 do not highlight cmake-commands in cmake-command argument-list
d2d564aa multi-line comments are now highlighted (again)
0e62850d update keywords to v3.9.1-460-gce2750817
65932f07 add test-framework and two tests
018855b2 add cpo-saving and restoring (taken from vim's upstream-syntax-files)
8fcb0a7d updated keywords to 3.9.20170830-ge0713
40f5f4f3 preparations to be for inclusion to vim-repo
This commit is contained in:
committed by
Patrick Boettcher
parent
e335771157
commit
88da716c42
+18
-8
File diff suppressed because one or more lines are too long
+19
-2
@@ -29,8 +29,8 @@ push @modules, "ExternalProject";
|
|||||||
# variables
|
# variables
|
||||||
open(CMAKE, "$cmake --help-variable-list|") or die "could not run cmake";
|
open(CMAKE, "$cmake --help-variable-list|") or die "could not run cmake";
|
||||||
while (<CMAKE>) {
|
while (<CMAKE>) {
|
||||||
|
next if /\</; # skip if containing < or >
|
||||||
chomp;
|
chomp;
|
||||||
next if /\</; # skip VARIABLES which contained <>-"templates"
|
|
||||||
push @variables, $_;
|
push @variables, $_;
|
||||||
}
|
}
|
||||||
close(CMAKE);
|
close(CMAKE);
|
||||||
@@ -70,11 +70,24 @@ my @generator_expr = extract_upper("$cmake --help-manual cmake-generator-express
|
|||||||
# properties
|
# properties
|
||||||
open(CMAKE, "$cmake --help-property-list|");
|
open(CMAKE, "$cmake --help-property-list|");
|
||||||
while (<CMAKE>) {
|
while (<CMAKE>) {
|
||||||
|
next if /\</; # skip if containing < or >
|
||||||
chomp;
|
chomp;
|
||||||
push @properties, $_;
|
push @properties, $_;
|
||||||
}
|
}
|
||||||
close(CMAKE);
|
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
|
# generate cmake.vim
|
||||||
open(IN, "<cmake.vim.in") or die "could not read cmake.vim.in";
|
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";
|
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";
|
print OUT " " x 12 , "\\ ", join(" ", sort keys %loop), "\n";
|
||||||
} elsif ($1 eq "DEPRECATED") {
|
} elsif ($1 eq "DEPRECATED") {
|
||||||
print OUT " " x 12 , "\\ ", join(" ", sort keys %deprecated), "\n";
|
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") {
|
} elsif ($1 eq "KEYWORDS") {
|
||||||
foreach my $k (sort keys %keywords) {
|
foreach my $k (sort keys %keywords) {
|
||||||
print OUT "syn keyword cmakeKW$k contained\n";
|
print OUT "syn keyword cmakeKW$k contained\n";
|
||||||
@@ -111,6 +126,9 @@ while(<IN>)
|
|||||||
}
|
}
|
||||||
} elsif ($1 eq "KEYWORDS_HIGHLIGHT") {
|
} elsif ($1 eq "KEYWORDS_HIGHLIGHT") {
|
||||||
print OUT join("\n", @keyword_hi), "\n";
|
print OUT join("\n", @keyword_hi), "\n";
|
||||||
|
} elsif ($1 eq "VERSION") {
|
||||||
|
$_ =~ s/\@VERSION\@/$version/;
|
||||||
|
print OUT $_;
|
||||||
} else {
|
} else {
|
||||||
print "ERROR do not know how to replace $1\n";
|
print "ERROR do not know how to replace $1\n";
|
||||||
}
|
}
|
||||||
@@ -128,7 +146,6 @@ sub extract_upper
|
|||||||
|
|
||||||
open(KW, $input);
|
open(KW, $input);
|
||||||
while (<KW>) {
|
while (<KW>) {
|
||||||
|
|
||||||
foreach my $w (m/\b([A-Z_]{2,})\b/g) {
|
foreach my $w (m/\b([A-Z_]{2,})\b/g) {
|
||||||
next
|
next
|
||||||
if exists $variables{$w} or # skip if it is a variable
|
if exists $variables{$w} or # skip if it is a variable
|
||||||
|
|||||||
+34
-20
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user