treetop.vim 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. " Vim syntax file
  2. " Language: Treetop
  3. " Previous Maintainer: Nikolai Weibull <now@bitwi.se>
  4. " Latest Revision: 2011-03-14
  5. if exists("b:current_syntax")
  6. finish
  7. endif
  8. let s:cpo_save = &cpo
  9. set cpo&vim
  10. syn keyword treetopTodo
  11. \ contained
  12. \ TODO
  13. \ FIXME
  14. \ XXX
  15. \ NOTE
  16. syn match treetopComment
  17. \ '#.*'
  18. \ display
  19. \ contains=treetopTodo
  20. syn include @treetopRuby syntax/ruby.vim
  21. unlet b:current_syntax
  22. syn keyword treetopKeyword
  23. \ require
  24. \ end
  25. syn region treetopKeyword
  26. \ matchgroup=treetopKeyword
  27. \ start='\<\%(grammar\|include\|module\)\>\ze\s'
  28. \ end='$'
  29. \ transparent
  30. \ oneline
  31. \ keepend
  32. \ contains=@treetopRuby
  33. syn keyword treetopKeyword
  34. \ rule
  35. \ nextgroup=treetopRuleName
  36. \ skipwhite skipnl
  37. syn match treetopGrammarName
  38. \ '\u\w*'
  39. \ contained
  40. syn match treetopRubyModuleName
  41. \ '\u\w*'
  42. \ contained
  43. syn match treetopRuleName
  44. \ '\h\w*'
  45. \ contained
  46. syn region treetopString
  47. \ matchgroup=treetopStringDelimiter
  48. \ start=+"+
  49. \ end=+"+
  50. syn region treetopString
  51. \ matchgroup=treetopStringDelimiter
  52. \ start=+'+
  53. \ end=+'+
  54. syn region treetopCharacterClass
  55. \ matchgroup=treetopCharacterClassDelimiter
  56. \ start=+\[+
  57. \ skip=+\\\]+
  58. \ end=+\]+
  59. syn region treetopRubyBlock
  60. \ matchgroup=treetopRubyBlockDelimiter
  61. \ start=+{+
  62. \ end=+}+
  63. \ contains=@treetopRuby
  64. syn region treetopSemanticPredicate
  65. \ matchgroup=treetopSemanticPredicateDelimiter
  66. \ start=+[!&]{+
  67. \ end=+}+
  68. \ contains=@treetopRuby
  69. syn region treetopSubclassDeclaration
  70. \ matchgroup=treetopSubclassDeclarationDelimiter
  71. \ start=+<+
  72. \ end=+>+
  73. \ contains=@treetopRuby
  74. syn match treetopEllipsis
  75. \ +''+
  76. hi def link treetopTodo Todo
  77. hi def link treetopComment Comment
  78. hi def link treetopKeyword Keyword
  79. hi def link treetopGrammarName Constant
  80. hi def link treetopRubyModuleName Constant
  81. hi def link treetopRuleName Identifier
  82. hi def link treetopString String
  83. hi def link treetopStringDelimiter treetopString
  84. hi def link treetopCharacterClass treetopString
  85. hi def link treetopCharacterClassDelimiter treetopCharacterClass
  86. hi def link treetopRubyBlockDelimiter PreProc
  87. hi def link treetopSemanticPredicateDelimiter PreProc
  88. hi def link treetopSubclassDeclarationDelimiter PreProc
  89. hi def link treetopEllipsis Special
  90. let b:current_syntax = 'treetop'
  91. let &cpo = s:cpo_save
  92. unlet s:cpo_save