Mercurial > vim
annotate runtime/syntax/yacc.vim @ 12226:2b965b3dd20c v8.0.0993
patch 8.0.0993: sometimes an xterm sends an extra CTRL-X
commit https://github.com/vim/vim/commit/f6d9f96b2d67327bbadd7210acc7c6028439bbcd
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Aug 24 20:21:16 2017 +0200
patch 8.0.0993: sometimes an xterm sends an extra CTRL-X
Problem: Sometimes an xterm sends an extra CTRL-X after the response for
the background color. Related to t_RS.
Solution: Check for the CTRL-X after the terminating 0x7.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 24 Aug 2017 20:30:04 +0200 |
parents | 46763b01cd9a |
children | a23c883685cb |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Yacc | |
3920 | 3 " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
4 " Last Change: Aug 31, 2016 |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
5 " Version: 15 |
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 | 7 " |
1624 | 8 " Options: {{{1 |
683 | 9 " g:yacc_uses_cpp : if this variable exists, then C++ is loaded rather than C |
7 | 10 |
1624 | 11 " --------------------------------------------------------------------- |
2034 | 12 " this version of syntax/yacc.vim requires 6.0 or later |
13 if exists("b:current_syntax") | |
14 syntax clear | |
15 endif | |
16 | |
17 " --------------------------------------------------------------------- | |
18 " Folding Support {{{1 | |
19 if has("folding") | |
3920 | 20 com! -nargs=+ SynFold <args> fold |
2034 | 21 else |
3920 | 22 com! -nargs=+ SynFold <args> |
7 | 23 endif |
24 | |
1624 | 25 " --------------------------------------------------------------------- |
26 " Read the C syntax to start with {{{1 | |
3920 | 27 " Read the C/C++ syntax to start with |
28 let s:Cpath= fnameescape(expand("<sfile>:p:h").(exists("g:yacc_uses_cpp")? "/cpp.vim" : "/c.vim")) | |
29 if !filereadable(s:Cpath) | |
30 for s:Cpath in split(globpath(&rtp,(exists("g:yacc_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") | |
31 if filereadable(fnameescape(s:Cpath)) | |
32 let s:Cpath= fnameescape(s:Cpath) | |
33 break | |
34 endif | |
35 endfor | |
7 | 36 endif |
3920 | 37 exe "syn include @yaccCode ".s:Cpath |
7 | 38 |
1624 | 39 " --------------------------------------------------------------------- |
2034 | 40 " Yacc Clusters: {{{1 |
2662 | 41 syn cluster yaccInitCluster contains=yaccKey,yaccKeyActn,yaccBrkt,yaccType,yaccString,yaccUnionStart,yaccHeader2,yaccComment,yaccDefines,yaccParseParam,yaccParseOption |
6484 | 42 syn cluster yaccRulesCluster contains=yaccNonterminal,yaccString,yaccComment |
2034 | 43 |
44 " --------------------------------------------------------------------- | |
45 " Yacc Sections: {{{1 | |
3920 | 46 SynFold 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 |
47 SynFold 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 | |
48 SynFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained | |
49 SynFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty | |
50 SynFold syn region yaccRules matchgroup=yaccSectionSep start='^%%$' end='^%%$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained | |
51 SynFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%$' end='\%$' contains=@yaccCode contained | |
7 | 52 |
1624 | 53 " --------------------------------------------------------------------- |
2034 | 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 | 56 syn match yaccParseParam '%\(parse\|lex\)-param\>' skipwhite nextgroup=yaccParseParamStr |
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 | 60 syn match yaccDelim "[:|]" contained |
61 syn match yaccOper "@\d\+" contained | |
7 | 62 |
2034 | 63 syn match yaccKey "^\s*%\(token\|type\|left\|right\|start\|ident\|nonassoc\)\>" contained |
64 syn match yaccKey "\s%\(prec\|expect\)\>" contained | |
65 syn match yaccKey "\$\(<[a-zA-Z_][a-zA-Z_0-9]*>\)\=[\$0-9]\+" contained | |
66 syn keyword yaccKeyActn yyerrok yyclearin contained | |
7 | 67 |
2034 | 68 syn match yaccUnionStart "^%union" skipwhite skipnl nextgroup=yaccUnion contained |
3920 | 69 SynFold syn region yaccUnion matchgroup=yaccCurly start="{" matchgroup=yaccCurly end="}" contains=@yaccCode contained |
2034 | 70 syn match yaccBrkt "[<>]" contained |
71 syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt contained | |
7 | 72 |
3920 | 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 | 74 syn region yaccComment start="/\*" end="\*/" |
75 syn match yaccString "'[^']*'" contained | |
76 | |
7 | 77 |
1624 | 78 " --------------------------------------------------------------------- |
79 " I'd really like to highlight just the outer {}. Any suggestions??? {{{1 | |
2034 | 80 syn match yaccCurlyError "[{}]" |
3920 | 81 SynFold syn region yaccAction matchgroup=yaccCurly start="{" end="}" contains=@yaccCode,yaccVar contained |
82 syn match yaccVar '\$\d\+\|\$\$\|\$<\I\i*>\$\|\$<\I\i*>\d\+' containedin=cParen,cPreProc,cMulti contained | |
7 | 83 |
1624 | 84 " --------------------------------------------------------------------- |
85 " Yacc synchronization: {{{1 | |
2034 | 86 syn sync fromstart |
7 | 87 |
1624 | 88 " --------------------------------------------------------------------- |
89 " Define the default highlighting. {{{1 | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
90 if !exists("skip_yacc_syn_inits") |
3920 | 91 hi def link yaccBrkt yaccStmt |
92 hi def link yaccComment Comment | |
93 hi def link yaccCurly Delimiter | |
94 hi def link yaccCurlyError Error | |
95 hi def link yaccDefines cDefine | |
96 hi def link yaccDelim Delimiter | |
97 hi def link yaccKeyActn Special | |
98 hi def link yaccKey yaccStmt | |
99 hi def link yaccNonterminal Function | |
100 hi def link yaccOper yaccStmt | |
101 hi def link yaccParseOption cDefine | |
102 hi def link yaccParseParam yaccParseOption | |
103 hi def link yaccSectionSep Todo | |
104 hi def link yaccSep Delimiter | |
105 hi def link yaccStmt Statement | |
106 hi def link yaccString String | |
107 hi def link yaccType Type | |
108 hi def link yaccUnionStart yaccKey | |
109 hi def link yaccVar Special | |
7 | 110 endif |
2034 | 111 |
112 " --------------------------------------------------------------------- | |
113 " Cleanup: {{{1 | |
3920 | 114 delcommand SynFold |
7 | 115 let b:current_syntax = "yacc" |
116 | |
1624 | 117 " --------------------------------------------------------------------- |
118 " Modelines: {{{1 | |
119 " vim: ts=15 fdm=marker |