1" ninja build file syntax. 2" Language: ninja build file as described at 3" http://martine.github.com/ninja/manual.html 4" Version: 1.0 5" Last Change: 2012 Jan 04 6" Maintainer: Nicolas Weber <[email protected]> 7 8" ninja lexer and parser are at 9" https://github.com/martine/ninja/blob/master/src/lexer.in.cc 10" https://github.com/martine/ninja/blob/master/src/parsers.cc 11 12if exists("b:current_syntax") 13 finish 14endif 15 16syn case match 17 18" Toplevel statements are the ones listed here and 19" toplevel variable assignments (ident '=' value). 20" lexer.in.cc, ReadToken() and parsers.cc, Parse() 21syn match ninjaKeyword "^build\>" 22syn match ninjaKeyword "^rule\>" 23syn match ninjaKeyword "^default\>" 24syn match ninjaKeyword "^include\>" 25syn match ninjaKeyword "^subninja\>" 26 27" Both 'build' and 'rule' begin a variable scope that ends 28" on the first line without indent. 'rule' allows only a 29" limited set of magic variables, 'build' allows general 30" let assignments. 31" parsers.cc, ParseRule() 32syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent 33syn keyword ninjaRuleCommand contained command depfile description generator restat 34 35" Strings are parsed as follows: 36" lexer.in.cc, ReadEvalString() 37" simple_varname = [a-zA-Z0-9_-]+; 38" varname = [a-zA-Z0-9_.-]+; 39" $$ -> $ 40" $\n -> line continuation 41" '$ ' -> escaped space 42" $simple_varname -> variable 43" ${varname} -> variable 44 45syn match ninjaWrapLineOperator "\$$" 46syn match ninjaSimpleVar "\$[a-zA-Z0-9_-]\+" 47syn match ninjaVar "\${[a-zA-Z0-9_.-]\+}" 48 49" operators are: 50" variable assignment = 51" rule definition : 52" implicit dependency | 53" order-only dependency || 54syn match ninjaOperator "\(=\|:\||\|||\)\ze\s" 55 56hi def link ninjaKeyword Keyword 57hi def link ninjaRuleCommand Statement 58hi def link ninjaWrapLineOperator ninjaOperator 59hi def link ninjaOperator Operator 60hi def link ninjaSimpleVar ninjaVar 61hi def link ninjaVar Identifier 62 63let b:current_syntax = "ninja" 64