annotate runtime/syntax/yacc.vim @ 3848:a2fe24ec6a0d v7.3.681

updated for version 7.3.681 Problem: List of distributed files picks up backup files. Solution: Make tutor patterns more specific.
author Bram Moolenaar <bram@vim.org>
date Wed, 03 Oct 2012 21:48:43 +0200
parents 887d6d91882e
children c53344bacabf
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>
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
4 " Last Change: Aug 12, 2010
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
5 " Version: 9
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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
11 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
12 " this version of syntax/yacc.vim requires 6.0 or later
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 if version < 600
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
14 finish
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
15 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
16 if exists("b:current_syntax")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
17 syntax clear
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
18 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
19
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
20 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
21 " Folding Support {{{1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
22 if has("folding")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
23 com! -nargs=+ HiFold <args> fold
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
24 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
25 com! -nargs=+ HiFold <args>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
28 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
29 " Read the C syntax to start with {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
30 if exists("g:yacc_uses_cpp")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
31 syn include @yaccCode <sfile>:p:h/cpp.vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 else
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
33 syn include @yaccCode <sfile>:p:h/c.vim
7
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 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
37 " Yacc Clusters: {{{1
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
38 syn cluster yaccInitCluster contains=yaccKey,yaccKeyActn,yaccBrkt,yaccType,yaccString,yaccUnionStart,yaccHeader2,yaccComment,yaccDefines,yaccParseParam,yaccParseOption
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
39 syn cluster yaccRulesCluster contains=yaccNonterminal,yaccString
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
40
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
41 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
42 " Yacc Sections: {{{1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
43 HiFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
44 HiFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
45 HiFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
46 HiFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
47 HiFold syn region yaccRules matchgroup=yaccSectionSep start='^%%$' end='^%%$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
48 HiFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%$' end='\%$' contains=@yaccCode contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
50 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
51 " Yacc Commands: {{{1
2473
d55e70cabe2c Syntax file updates. (Charles Campbell)
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
52 syn match yaccDefines '^%define\s\+.*$'
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
53 syn match yaccParseParam '%\(parse\|lex\)-param\>' skipwhite nextgroup=yaccParseParamStr
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
54 syn match yaccParseOption '%\%(api\.pure\|pure-parser\|locations\|error-verbose\)\>'
2473
d55e70cabe2c Syntax file updates. (Charles Campbell)
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
55 syn region yaccParseParamStr contained matchgroup=Delimiter start='{' end='}' contains=cStructure
d55e70cabe2c Syntax file updates. (Charles Campbell)
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
56
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
57 syn match yaccDelim "[:|]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
58 syn match yaccOper "@\d\+" contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
60 syn match yaccKey "^\s*%\(token\|type\|left\|right\|start\|ident\|nonassoc\)\>" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
61 syn match yaccKey "\s%\(prec\|expect\)\>" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
62 syn match yaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
63 syn keyword yaccKeyActn yyerrok yyclearin contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
65 syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
66 HiFold syn region yaccUnion matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccCode contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
67 syn match yaccBrkt "[<>]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
68 syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
70 HiFold syn region yaccNonterminal start="^\s*\a\w*\ze\_s*\(/\*\_.\{-}\*/\)\=\_s*:" matchgroup=yaccDelim end=";" matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=yaccAction,yaccDelim,yaccString,yaccComment contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
71 syn region yaccComment start="/\*" end="\*/"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
72 syn match yaccString "'[^']*'" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
73
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
75 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
76 " I'd really like to highlight just the outer {}. Any suggestions??? {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
77 syn match yaccCurlyError "[{}]"
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
78 HiFold syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=@yaccCode contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
80 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
81 " Yacc synchronization: {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
82 syn sync fromstart
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
84 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
85 " Define the default highlighting. {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
86 if !exists("did_yacc_syn_inits")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
87 command -nargs=+ HiLink hi def link <args>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
89 " Internal yacc highlighting links {{{2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 HiLink yaccBrkt yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 HiLink yaccKey yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 HiLink yaccOper yaccStmt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 HiLink yaccUnionStart yaccKey
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
95 " External yacc highlighting links {{{2
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
96 HiLink yaccComment Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 HiLink yaccCurly Delimiter
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 HiLink yaccCurlyError Error
2473
d55e70cabe2c Syntax file updates. (Charles Campbell)
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
99 HiLink yaccDefines cDefine
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
100 HiLink yaccParseParam yaccParseOption
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
101 HiLink yaccParseOption cDefine
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
102 HiLink yaccNonterminal Function
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
103 HiLink yaccDelim Delimiter
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 HiLink yaccKeyActn Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 HiLink yaccSectionSep Todo
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 HiLink yaccSep Delimiter
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
107 HiLink yaccString String
7
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
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
116
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
117 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
118 " Cleanup: {{{1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
119 delcommand HiFold
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 let b:current_syntax = "yacc"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
122 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
123 " Modelines: {{{1
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
124 " vim: ts=15 fdm=marker