blob: fedd0e80a0bcaafc47c3037186f6fb29c2c97e79 [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>
Bram Moolenaarb6b046b2011-12-30 13:11:27 +01004" LastChange: 2011 Dec 25
Bram Moolenaar071d4272004-06-13 20:20:40 +00005" 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
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010025let s:cpo_save = &cpo
26set cpo&vim
27
Bram Moolenaar071d4272004-06-13 20:20:40 +000028" Clusters
29syn cluster ayaccActionGroup contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
30syn cluster ayaccUnionGroup contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
31
32" Yacc stuff
33syn match ayaccDelim "^[ \t]*[:|;]"
34syn match ayaccOper "@\d\+"
35
36syn match ayaccKey "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
37syn match ayaccKey "[ \t]%\(prec\|expect\|nonassoc\)\>"
38syn match ayaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
39syn keyword ayaccKeyActn yyerrok yyclearin
40
41syn match ayaccUnionStart "^%union" skipwhite skipnl nextgroup=ayaccUnion
42syn region ayaccUnion contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
43syn region ayaccUnionCurly contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
44syn match ayaccBrkt contained "[<>]"
45syn match ayaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=ayaccBrkt
46syn match ayaccDefinition "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
47
48" special Yacc separators
49syn match ayaccSectionSep "^[ \t]*%%"
50syn match ayaccSep "^[ \t]*%{"
51syn match ayaccSep "^[ \t]*%}"
52
53" I'd really like to highlight just the outer {}. Any suggestions???
54syn match ayaccCurlyError "[{}]"
55syn region ayaccAction matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
56
57if version >= 508 || !exists("did_ayacc_syntax_inits")
58 if version < 508
59 let did_ayacc_syntax_inits = 1
60 command -nargs=+ HiLink hi link <args>
61 else
62 command -nargs=+ HiLink hi def link <args>
63 endif
64
65 " Internal ayacc highlighting links
66 HiLink ayaccBrkt ayaccStmt
67 HiLink ayaccKey ayaccStmt
68 HiLink ayaccOper ayaccStmt
69 HiLink ayaccUnionStart ayaccKey
70
71 " External ayacc highlighting links
72 HiLink ayaccCurly Delimiter
73 HiLink ayaccCurlyError Error
74 HiLink ayaccDefinition Function
75 HiLink ayaccDelim Function
76 HiLink ayaccKeyActn Special
77 HiLink ayaccSectionSep Todo
78 HiLink ayaccSep Delimiter
79 HiLink ayaccStmt Statement
80 HiLink ayaccType Type
81
82 " since Bram doesn't like my Delimiter :|
83 HiLink Delimiter Type
84 delcommand HiLink
85endif
86
87let b:current_syntax = "ayacc"
88
Bram Moolenaarb6b046b2011-12-30 13:11:27 +010089let &cpo = s:cpo_save
90unlet s:cpo_save
Bram Moolenaar071d4272004-06-13 20:20:40 +000091" vim: ts=15