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