7
|
1 " 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
|
|
11 if version < 600
|
|
12 syntax clear
|
|
13 elseif exists("b:current_syntax")
|
|
14 finish
|
|
15 endif
|
|
16
|
|
17 " Read the Ada syntax to start with
|
|
18 if version < 600
|
|
19 so <sfile>:p:h/ada.vim
|
|
20 else
|
|
21 runtime! syntax/ada.vim
|
|
22 unlet b:current_syntax
|
|
23 endif
|
|
24
|
|
25 " Clusters
|
|
26 syn cluster ayaccActionGroup contains=ayaccDelim,cInParen,cTodo,cIncluded,ayaccDelim,ayaccCurlyError,ayaccUnionCurly,ayaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError
|
|
27 syn cluster ayaccUnionGroup contains=ayaccKey,cComment,ayaccCurly,cType,cStructure,cStorageClass,ayaccUnionCurly
|
|
28
|
|
29 " Yacc stuff
|
|
30 syn match ayaccDelim "^[ \t]*[:|;]"
|
|
31 syn match ayaccOper "@\d\+"
|
|
32
|
|
33 syn match ayaccKey "^[ \t]*%\(token\|type\|left\|right\|start\|ident\)\>"
|
|
34 syn match ayaccKey "[ \t]%\(prec\|expect\|nonassoc\)\>"
|
|
35 syn match ayaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
|
|
36 syn keyword ayaccKeyActn yyerrok yyclearin
|
|
37
|
|
38 syn match ayaccUnionStart "^%union" skipwhite skipnl nextgroup=ayaccUnion
|
|
39 syn region ayaccUnion contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
|
|
40 syn region ayaccUnionCurly contained matchgroup=ayaccCurly start="{" matchgroup=ayaccCurly end="}" contains=@ayaccUnionGroup
|
|
41 syn match ayaccBrkt contained "[<>]"
|
|
42 syn match ayaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=ayaccBrkt
|
|
43 syn match ayaccDefinition "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
|
|
44
|
|
45 " special Yacc separators
|
|
46 syn match ayaccSectionSep "^[ \t]*%%"
|
|
47 syn match ayaccSep "^[ \t]*%{"
|
|
48 syn match ayaccSep "^[ \t]*%}"
|
|
49
|
|
50 " I'd really like to highlight just the outer {}. Any suggestions???
|
|
51 syn match ayaccCurlyError "[{}]"
|
|
52 syn region ayaccAction matchgroup=ayaccCurly start="{" end="}" contains=ALLBUT,@ayaccActionGroup
|
|
53
|
|
54 if 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
|
|
82 endif
|
|
83
|
|
84 let b:current_syntax = "ayacc"
|
|
85
|
|
86 " vim: ts=15
|