xref: /vim-8.2.3635/runtime/syntax/ayacc.vim (revision f37506f6)
1" Vim syntax file
2" Language:	AYacc
3" Maintainer:	Mathieu Clabaut <[email protected]>
4" LastChange:	2011 Dec 25
5" Original:	Yacc, maintained by Dr. Charles E. Campbell, Jr.
6" Comment:	     Replaced sourcing c.vim file by ada.vim and rename yacc*
7"		in ayacc*
8
9" quit when a syntax file was already loaded
10if exists("b:current_syntax")
11   finish
12endif
13
14" Read the Ada syntax to start with
15runtime! syntax/ada.vim
16unlet b:current_syntax
17
18let s:cpo_save = &cpo
19set cpo&vim
20
21" Clusters
22syn cluster	ayaccActionGroup	contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
23syn cluster	ayaccUnionGroup	contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
24
25" Yacc stuff
26syn match	ayaccDelim	"^[ \t]*[:|;]"
27syn match	ayaccOper	"@\d\+"
28
29syn match	ayaccKey	"^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
30syn match	ayaccKey	"[ \t]%\(prec\|expect\|nonassoc\)\>"
31syn match	ayaccKey	"\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
32syn keyword	ayaccKeyActn	yyerrok yyclearin
33
34syn match	ayaccUnionStart	"^%union"	skipwhite skipnl nextgroup=ayaccUnion
35syn region	ayaccUnion	contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}"	contains=@ayaccUnionGroup
36syn region	ayaccUnionCurly	contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
37syn match	ayaccBrkt	contained "[<>]"
38syn match	ayaccType	"<[a-zA-Z_][a-zA-Z0-9_]*>"	contains=ayaccBrkt
39syn match	ayaccDefinition	"^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
40
41" special Yacc separators
42syn match	ayaccSectionSep	"^[ \t]*%%"
43syn match	ayaccSep	"^[ \t]*%{"
44syn match	ayaccSep	"^[ \t]*%}"
45
46" I'd really like to highlight just the outer {}.  Any suggestions???
47syn match	ayaccCurlyError	"[{}]"
48syn region	ayaccAction	matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
49
50
51" Internal ayacc highlighting links
52hi def link ayaccBrkt	ayaccStmt
53hi def link ayaccKey	ayaccStmt
54hi def link ayaccOper	ayaccStmt
55hi def link ayaccUnionStart	ayaccKey
56
57" External ayacc highlighting links
58hi def link ayaccCurly	Delimiter
59hi def link ayaccCurlyError	Error
60hi def link ayaccDefinition	Function
61hi def link ayaccDelim	Function
62hi def link ayaccKeyActn	Special
63hi def link ayaccSectionSep	Todo
64hi def link ayaccSep	Delimiter
65hi def link ayaccStmt	Statement
66hi def link ayaccType	Type
67
68" since Bram doesn't like my Delimiter :|
69hi def link Delimiter	Type
70
71let b:current_syntax = "ayacc"
72
73let &cpo = s:cpo_save
74unlet s:cpo_save
75" vim: ts=15
76