summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2018-04-05 01:12:34 (GMT)
committerGitHub <noreply@github.com>2018-04-05 01:12:34 (GMT)
commit4fd758a81bece5bc03bdb40c81de6886a06baa77 (patch)
treecbf1d54fb8d8122b5f0aa605684b6c9ff7e5baa7
parent6bcdc7bfd1ec8dd91f5a5e90d529b22210722f51 (diff)
parentbff884d550cdd4479b3a9aea29ebb0e9ff106e80 (diff)
downloadNinja-4fd758a81bece5bc03bdb40c81de6886a06baa77.zip
Ninja-4fd758a81bece5bc03bdb40c81de6886a06baa77.tar.gz
Ninja-4fd758a81bece5bc03bdb40c81de6886a06baa77.tar.bz2
Merge pull request #1356 from RedBeard0531/vim_syntax
Improve vim syntax definition
-rw-r--r--misc/ninja.vim14
1 files changed, 9 insertions, 5 deletions
diff --git a/misc/ninja.vim b/misc/ninja.vim
index 190d9ce..6912d0d 100644
--- a/misc/ninja.vim
+++ b/misc/ninja.vim
@@ -21,7 +21,10 @@ set cpo&vim
syn case match
-syn match ninjaComment /#.*/ contains=@Spell
+" Comments are only matched when the # is at the beginning of the line (with
+" optional whitespace), as long as the prior line didn't end with a $
+" continuation.
+syn match ninjaComment /\(\$\n\)\@<!\_^\s*#.*$/ contains=@Spell
" Toplevel statements are the ones listed here and
" toplevel variable assignments (ident '=' value).
@@ -38,12 +41,13 @@ syn match ninjaKeyword "^subninja\>"
" limited set of magic variables, 'build' allows general
" let assignments.
" manifest_parser.cc, ParseRule()
-syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent
-syn keyword ninjaRuleCommand contained command deps depfile description generator
+syn region ninjaRule start="^rule" end="^\ze\S" contains=TOP transparent
+syn keyword ninjaRuleCommand contained containedin=ninjaRule command
+ \ deps depfile description generator
\ pool restat rspfile rspfile_content
-syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent
-syn keyword ninjaPoolCommand contained depth
+syn region ninjaPool start="^pool" end="^\ze\S" contains=TOP transparent
+syn keyword ninjaPoolCommand contained containedin=ninjaPool depth
" Strings are parsed as follows:
" lexer.in.cc, ReadEvalString()