annotate runtime/syntax/yacc.vim @ 18366:c6826a74ad9b v8.1.2177

patch 8.1.2177: Dart files are not recognized Commit: https://github.com/vim/vim/commit/afbdb905c37675851e79d21239f502cd8e4ced9e Author: Bram Moolenaar <Bram@vim.org> Date: Sat Oct 19 14:10:21 2019 +0200 patch 8.1.2177: Dart files are not recognized Problem: Dart files are not recognized. Solution: Add a filetype rule. (Eugene Ciurana, closes https://github.com/vim/vim/issues/5087)
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Oct 2019 14:15:04 +0200
parents a23c883685cb
children 8edf0aeb71b9
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
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
3 " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz>
16208
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
4 " Last Change: Mar 25, 2019
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
5 " Version: 16
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
6 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC
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
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
13 if exists("b:current_syntax")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
14 syntax clear
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
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
17 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
18 " Folding Support {{{1
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
19 if has("folding")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
20 com! -nargs=+ SynFold <args> fold
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
21 else
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
22 com! -nargs=+ SynFold <args>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
25 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
26 " Read the C syntax to start with {{{1
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
27 " Read the C/C++ syntax to start with
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
28 let s:Cpath= fnameescape(expand("<sfile>:p:h").(exists("g:yacc_uses_cpp")? "/cpp.vim" : "/c.vim"))
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
29 if !filereadable(s:Cpath)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
30 for s:Cpath in split(globpath(&rtp,(exists("g:yacc_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n")
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
31 if filereadable(fnameescape(s:Cpath))
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
32 let s:Cpath= fnameescape(s:Cpath)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
33 break
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
34 endif
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
35 endfor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
37 exe "syn include @yaccCode ".s:Cpath
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
39 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
40 " Yacc Clusters: {{{1
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
41 syn cluster yaccInitCluster contains=yaccKey,yaccKeyActn,yaccBrkt,yaccType,yaccString,yaccUnionStart,yaccHeader2,yaccComment,yaccDefines,yaccParseParam,yaccParseOption
6484
ce4ecfbebded Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 6479
diff changeset
42 syn cluster yaccRulesCluster contains=yaccNonterminal,yaccString,yaccComment
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
43
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
44 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
45 " Yacc Sections: {{{1
16208
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
46 SynFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
47 SynFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
48 SynFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
49 SynFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
50 SynFold syn region yaccRules matchgroup=yaccSectionSep start='^%%\ze\(\s*/[*/].*\)\=$' end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
51 SynFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%\ze\(\s*/[*/].*\)\=$' end='\%$' contains=@yaccCode contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
53 " ---------------------------------------------------------------------
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
54 " Yacc Commands: {{{1
2473
d55e70cabe2c Syntax file updates. (Charles Campbell)
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
55 syn match yaccDefines '^%define\s\+.*$'
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
56 syn match yaccParseParam '%\(parse\|lex\)-param\>' skipwhite nextgroup=yaccParseParamStr
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2473
diff changeset
57 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
58 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
59
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
60 syn match yaccDelim "[:|]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
61 syn match yaccOper "@\d\+" contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
63 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
64 syn match yaccKey "\s%\(prec\|expect\)\>" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
65 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
66 syn keyword yaccKeyActn yyerrok yyclearin contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
68 syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion contained
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
69 SynFold syn region yaccUnion matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccCode contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
70 syn match yaccBrkt "[<>]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
71 syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
73 SynFold 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
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
74 syn region yaccComment start="/\*" end="\*/"
16208
a23c883685cb Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
75 syn region yaccComment start="//" end="$"
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
76 syn match yaccString "'[^']*'" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
77
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
79 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
80 " 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
81 syn match yaccCurlyError "[{}]"
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
82 SynFold syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=@yaccCode,yaccVar contained
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
83 syn match yaccVar '\$\d\+\|\$\$\|\$<\I\i*>\$\|\$<\I\i*>\d\+' containedin=cParen,cPreProc,cMulti contained
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84
1624
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
85 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
86 " Yacc synchronization: {{{1
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
87 syn sync fromstart
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 " ---------------------------------------------------------------------
18ee39301b82 updated for version 7.2a
vimboss
parents: 683
diff changeset
90 " Define the default highlighting. {{{1
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
91 if !exists("skip_yacc_syn_inits")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
92 hi def link yaccBrkt yaccStmt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
93 hi def link yaccComment Comment
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
94 hi def link yaccCurly Delimiter
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
95 hi def link yaccCurlyError Error
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
96 hi def link yaccDefines cDefine
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
97 hi def link yaccDelim Delimiter
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
98 hi def link yaccKeyActn Special
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
99 hi def link yaccKey yaccStmt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
100 hi def link yaccNonterminal Function
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
101 hi def link yaccOper yaccStmt
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
102 hi def link yaccParseOption cDefine
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
103 hi def link yaccParseParam yaccParseOption
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
104 hi def link yaccSectionSep Todo
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
105 hi def link yaccSep Delimiter
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
106 hi def link yaccStmt Statement
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
107 hi def link yaccString String
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
108 hi def link yaccType Type
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
109 hi def link yaccUnionStart yaccKey
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
110 hi def link yaccVar Special
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 endif
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
112
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
113 " ---------------------------------------------------------------------
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1624
diff changeset
114 " Cleanup: {{{1
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3099
diff changeset
115 delcommand SynFold
7
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