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