annotate runtime/syntax/yacc.vim @ 481:66080ac5dab7 v7.0130

updated for version 7.0130
author vimboss
date Mon, 15 Aug 2005 21:41:48 +0000
parents 3fc0f57ecb91
children a1059cda45f2
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4 " Last Change: Nov 18, 2002
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5 " Version: 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " URL: http://www.erols.com/astronaut/vim/index.html#vimlinks_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 " Read the C syntax to start with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if version >= 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 if exists("yacc_uses_cpp")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 runtime! syntax/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 runtime! syntax/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 elseif exists("yacc_uses_cpp")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 so <sfile>:p:h/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 so <sfile>:p:h/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 " Clusters
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 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
34 syn cluster yaccUnionGroup contains=yaccKey,cComment,yaccCurly,cType,cStructure,cStorageClass,yaccUnionCurly
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " Yacc stuff
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 syn match yaccDelim "^\s*[:|;]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 syn match yaccOper "@\d\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 syn match yaccKey "^\s*%\(token\|type\|left\|right\|start\|ident\|nonassoc\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 syn match yaccKey "\s%\(prec\|expect\)\>"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 syn match yaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 syn keyword yaccKeyActn yyerrok yyclearin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 syn region yaccUnion contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccUnionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 syn region yaccUnionCurly contained matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccUnionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 syn match yaccBrkt contained "[<>]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 syn match yaccDefinition "^[A-Za-z][A-Za-z0-9_]*[ \t]*:"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 " special Yacc separators
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn match yaccSectionSep "^[ \t]*%%"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn match yaccSep "^[ \t]*%{"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 syn match yaccSep "^[ \t]*%}"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 " I'd really like to highlight just the outer {}. Any suggestions???
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 syn match yaccCurlyError "[{}]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=ALLBUT,@yaccActionGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 " Define the default highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " For version 5.7 and earlier: only when not done already
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 " 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
65 if version >= 508 || !exists("did_yacc_syn_inits")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 if version < 508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 let did_yacchdl_syn_inits = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 command -nargs=+ HiLink hi link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 command -nargs=+ HiLink hi def link <args>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 " Internal yacc highlighting links
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 HiLink yaccBrkt yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 HiLink yaccKey yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 HiLink yaccOper yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 HiLink yaccUnionStart yaccKey
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 " External yacc highlighting links
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 HiLink yaccCurly Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 HiLink yaccCurlyError Error
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 HiLink yaccDefinition Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 HiLink yaccDelim Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 HiLink yaccKeyActn Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 HiLink yaccSectionSep Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 HiLink yaccSep Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 HiLink yaccStmt Statement
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 HiLink yaccType Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 " since Bram doesn't like my Delimiter :|
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 HiLink Delimiter Type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 delcommand HiLink
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let b:current_syntax = "yacc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 " vim: ts=15