2 " Language: Racc input file
3 " Maintainer: Nikolai Weibull <now@bitwi.se>
4 " Latest Revision: 2006-07-09
6 if exists("b:current_syntax")
13 syn keyword raccTodo contained TODO FIXME XXX NOTE
15 syn region raccComment start='/\*' end='\*/'
16 \ contains=raccTodo,@Spell
17 syn region raccComment display oneline start='#' end='$'
18 \ contains=raccTodo,@Spell
20 syn region raccClass transparent matchgroup=raccKeyword
21 \ start='\<class\>' end='\<rule\>'he=e-4
22 \ contains=raccComment,raccPrecedence,
23 \ raccTokenDecl,raccExpect,raccOptions,raccConvert,
26 syn region raccPrecedence transparent matchgroup=raccKeyword
27 \ start='\<prechigh\>' end='\<preclow\>'
28 \ contains=raccComment,raccPrecSpec
30 syn keyword raccPrecSpec contained nonassoc left right
31 \ nextgroup=raccPrecToken,raccPrecString skipwhite
34 syn match raccPrecToken contained '\<\u[A-Z0-9]*\>'
35 \ nextgroup=raccPrecToken,raccPrecString skipwhite
38 syn region raccPrecString matchgroup=raccPrecString start=+"+
39 \ skip=+\\\\\|\\"+ end=+"+
40 \ contains=raccSpecial
41 \ nextgroup=raccPrecToken,raccPrecString skipwhite
43 syn region raccPrecString matchgroup=raccPrecString start=+'+
44 \ skip=+\\\\\|\\'+ end=+'+ contains=raccSpecial
45 \ nextgroup=raccPrecToken,raccPrecString skipwhite
48 syn keyword raccTokenDecl contained token
49 \ nextgroup=raccTokenR skipwhite skipnl
51 syn match raccTokenR contained '\<\u[A-Z0-9]*\>'
52 \ nextgroup=raccTokenR skipwhite skipnl
54 syn keyword raccExpect contained expect
55 \ nextgroup=raccNumber skipwhite skipnl
57 syn match raccNumber contained '\<\d\+\>'
59 syn keyword raccOptions contained options
60 \ nextgroup=raccOptionsR skipwhite skipnl
62 syn keyword raccOptionsR contained omit_action_call result_var
63 \ nextgroup=raccOptionsR skipwhite skipnl
65 syn region raccConvert transparent contained matchgroup=raccKeyword
66 \ start='\<convert\>' end='\<end\>'
67 \ contains=raccComment,raccConvToken skipwhite
70 syn match raccConvToken contained '\<\u[A-Z0-9]*\>'
71 \ nextgroup=raccString skipwhite skipnl
73 syn keyword raccStart contained start
74 \ nextgroup=raccTargetS skipwhite skipnl
76 syn match raccTargetS contained '\<\l[a-z0-9]*\>'
78 syn match raccSpecial contained '\\["'\\]'
80 syn region raccString start=+"+ skip=+\\\\\|\\"+ end=+"+
81 \ contains=raccSpecial
82 syn region raccString start=+'+ skip=+\\\\\|\\'+ end=+'+
83 \ contains=raccSpecial
85 syn region raccRules transparent matchgroup=raccKeyword start='\<rule\>'
86 \ end='\<end\>' contains=raccComment,raccString,
87 \ raccNumber,raccToken,raccTarget,raccDelimiter,
90 syn match raccTarget contained '\<\l[a-z0-9]*\>'
92 syn match raccDelimiter contained '[:|]'
94 syn match raccToken contained '\<\u[A-Z0-9]*\>'
96 syn include @raccRuby syntax/ruby.vim
98 syn region raccAction transparent matchgroup=raccDelimiter
99 \ start='{' end='}' contains=@raccRuby
101 syn region raccHeader transparent matchgroup=raccPreProc
102 \ start='^---- header.*' end='^----'he=e-4
105 syn region raccInner transparent matchgroup=raccPreProc
106 \ start='^---- inner.*' end='^----'he=e-4
109 syn region raccFooter transparent matchgroup=raccPreProc
110 \ start='^---- footer.*' end='^----'he=e-4
113 syn sync match raccSyncHeader grouphere raccHeader '^---- header'
114 syn sync match raccSyncInner grouphere raccInner '^---- inner'
115 syn sync match raccSyncFooter grouphere raccFooter '^---- footer'
117 hi def link raccTodo Todo
118 hi def link raccComment Comment
119 hi def link raccPrecSpec Type
120 hi def link raccPrecToken raccToken
121 hi def link raccPrecString raccString
122 hi def link raccTokenDecl Keyword
123 hi def link raccToken Identifier
124 hi def link raccTokenR raccToken
125 hi def link raccExpect Keyword
126 hi def link raccNumber Number
127 hi def link raccOptions Keyword
128 hi def link raccOptionsR Identifier
129 hi def link raccConvToken raccToken
130 hi def link raccStart Keyword
131 hi def link raccTargetS Type
132 hi def link raccSpecial special
133 hi def link raccString String
134 hi def link raccTarget Type
135 hi def link raccDelimiter Delimiter
136 hi def link raccPreProc PreProc
137 hi def link raccKeyword Keyword
139 let b:current_syntax = "racc"
141 let &cpo = s:cpo_save