annotate runtime/syntax/yacc.vim @ 1678:b60a569eb708 v7.2b.010

updated for version 7.2b-010
author vimboss
date Tue, 22 Jul 2008 16:58:47 +0000
parents 18ee39301b82
children 7bc41231fbc7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim syntax file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Yacc
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
3 " Maintainer: Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
4 " Last Change: Jan 09, 2008
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
5 " Version: 5
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 7
diff changeset
6 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 "
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
8 " Options: {{{1
683
a39b8af64334 updated for version 7.0205
vimboss
parents: 507
diff changeset
9 " g:yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
10 " g:yacc_minlines : see :help :he syn-sync-minlines -- default 50
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
11 " g:yacc_maxlines : see :help :he syn-sync-maxlines -- default 200
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
13 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
14 " For version 5.x: Clear all syntax items {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
22 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
23 " Read the C syntax to start with {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 if version >= 600
683
a39b8af64334 updated for version 7.0205
vimboss
parents: 507
diff changeset
25 if exists("g:yacc_uses_cpp")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 runtime! syntax/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 runtime! syntax/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 endif
683
a39b8af64334 updated for version 7.0205
vimboss
parents: 507
diff changeset
30 elseif exists("g:yacc_uses_cpp")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 so <sfile>:p:h/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 so <sfile>:p:h/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
36 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
37 " Clusters {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn cluster yaccActionGroup contains=yaccDelim,cInParen,cTodo,cIncluded,yaccDelim,yaccCurlyError,yaccUnionCurly,yaccUnion,cUserLabel,cOctalZero,cCppOut2,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCommentStartError,cParenError
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 syn cluster yaccUnionGroup contains=yaccKey,cComment,yaccCurly,cType,cStructure,cStorageClass,yaccUnionCurly
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
41 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
42 " Yacc stuff {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn match yaccDelim "^\s*[:|;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 syn match yaccOper "@\d\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn match yaccKey "^\s*%\(token\|type\|left\|right\|start\|ident\|nonassoc\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn match yaccKey "\s%\(prec\|expect\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match yaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn keyword yaccKeyActn yyerrok yyclearin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn region yaccUnion contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccUnionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn region yaccUnionCurly contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccUnionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn match yaccBrkt contained "[<>]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt
683
a39b8af64334 updated for version 7.0205
vimboss
parents: 507
diff changeset
56 syn match yaccDefinition "^[A-Za-z][A-Za-z0-9_]*\_s*:"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
58 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
59 " special Yacc separators {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 syn match yaccSectionSep "^[ \t]*%%"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 syn match yaccSep "^[ \t]*%{"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 syn match yaccSep "^[ \t]*%}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
64 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
65 " I'd really like to highlight just the outer {}. Any suggestions??? {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 syn match yaccCurlyError "[{}]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=ALLBUT,@yaccActionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
69 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
70 " Yacc synchronization: {{{1
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
71 if exists("g:yacc_maxlines")
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
72 exe "syn sync maxlines=".g:yacc_maxlines
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
73 else
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
74 syn sync maxlines=200
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
75 endif
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
76 if exists("g:yacc_minlines")
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
77 exe "syn sync minlines=".g:yacc_minlines
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
78 else
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
79 syn sync minlines=50
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
80 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
82 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
83 " Define the default highlighting. {{{1
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 " For version 5.8 and later: only when an item doesn't have highlighting yet
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 if version >= 508 || !exists("did_yacc_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 let did_yacchdl_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
94 " Internal yacc highlighting links {{{2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 HiLink yaccBrkt yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 HiLink yaccKey yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 HiLink yaccOper yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 HiLink yaccUnionStart yaccKey
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
100 " External yacc highlighting links {{{2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 HiLink yaccCurly Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 HiLink yaccCurlyError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 HiLink yaccDefinition Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 HiLink yaccDelim Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 HiLink yaccKeyActn Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 HiLink yaccSectionSep Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 HiLink yaccSep Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 HiLink yaccStmt Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 HiLink yaccType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
111 " since Bram doesn't like my Delimiter :| {{{2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 HiLink Delimiter Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 let b:current_syntax = "yacc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
118 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
119 " Modelines: {{{1
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
120 " vim: ts=15 fdm=marker