blob: be91e2f7ef1255f70f2af4baab18288a8dec6533 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: AYacc
3" Maintainer: Mathieu Clabaut <mathieu.clabaut@free.fr>
4" LastChange: 02 May 2001
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" For version 5.x: Clear all syntax items
10" For version 6.x: Quit when a syntax file was already loaded
11if version < 600
12 syntax clear
13elseif exists("b:current_syntax")
14 finish
15endif
16
17" Read the Ada syntax to start with
18if version < 600
19 so <sfile>:p:h/ada.vim
20else
21 runtime! syntax/ada.vim
22 unlet b:current_syntax
23endif
24
25" Clusters
26syn cluster ayaccActionGroup contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
27syn cluster ayaccUnionGroup contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
28
29" Yacc stuff
30syn match ayaccDelim "^[ \t]*[:|;]"
31syn match ayaccOper "@\d\+"
32
33syn match ayaccKey "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
34syn match ayaccKey "[ \t]%\(prec\|expect\|nonassoc\)\>"
35syn match ayaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
36syn keyword ayaccKeyActn yyerrok yyclearin
37
38syn match ayaccUnionStart "^%union" skipwhite skipnl nextgroup=ayaccUnion
39syn region ayaccUnion contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
40syn region ayaccUnionCurly contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
41syn match ayaccBrkt contained "[<>]"
42syn match ayaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=ayaccBrkt
43syn match ayaccDefinition "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
44
45" special Yacc separators
46syn match ayaccSectionSep "^[ \t]*%%"
47syn match ayaccSep "^[ \t]*%{"
48syn match ayaccSep "^[ \t]*%}"
49
50" I'd really like to highlight just the outer {}. Any suggestions???
51syn match ayaccCurlyError "[{}]"
52syn region ayaccAction matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
53
54if version >= 508 || !exists("did_ayacc_syntax_inits")
55 if version < 508
56 let did_ayacc_syntax_inits = 1
57 command -nargs=+ HiLink hi link <args>
58 else
59 command -nargs=+ HiLink hi def link <args>
60 endif
61
62 " Internal ayacc highlighting links
63 HiLink ayaccBrkt ayaccStmt
64 HiLink ayaccKey ayaccStmt
65 HiLink ayaccOper ayaccStmt
66 HiLink ayaccUnionStart ayaccKey
67
68 " External ayacc highlighting links
69 HiLink ayaccCurly Delimiter
70 HiLink ayaccCurlyError Error
71 HiLink ayaccDefinition Function
72 HiLink ayaccDelim Function
73 HiLink ayaccKeyActn Special
74 HiLink ayaccSectionSep Todo
75 HiLink ayaccSep Delimiter
76 HiLink ayaccStmt Statement
77 HiLink ayaccType Type
78
79 " since Bram doesn't like my Delimiter :|
80 HiLink Delimiter Type
81 delcommand HiLink
82endif
83
84let b:current_syntax = "ayacc"
85
86" vim: ts=15