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