home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / runtime / dos / syntax / ninja.vim < prev    next >
Encoding:
Text File  |  2012-05-31  |  2.0 KB  |  67 lines

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