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