Mercurial > vim
annotate runtime/syntax/lex.vim @ 15910:da4d1f69374e v8.1.0961
patch 8.1.0961: Mac: fsync may fail sometimes
commit https://github.com/vim/vim/commit/9166838420c2e2029270c4683f68aecd3db5a484
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Feb 21 12:16:12 2019 +0100
patch 8.1.0961: Mac: fsync may fail sometimes
Problem: Mac: fsync may fail sometimes.
Solution: Do not check errno. (Yee Cheng Chin, closes https://github.com/vim/vim/issues/4025)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 21 Feb 2019 12:30:08 +0100 |
parents | 46763b01cd9a |
children | 8edf0aeb71b9 |
rev | line source |
---|---|
7 | 1 " Vim syntax file |
2 " Language: Lex | |
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: 16 |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
6 " URL: http://mysite.verizon.net/astronaut/vim/index.html#SYNTAX_LEX |
7 | 7 " |
8 " Option: | |
9 " lex_uses_cpp : if this variable exists, then C++ is loaded rather than C | |
10 | |
10048
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3920
diff
changeset
|
11 " quit when a syntax file was already loaded |
43efa4f5a8ea
commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents:
3920
diff
changeset
|
12 if exists("b:current_syntax") |
7 | 13 finish |
14 endif | |
15 | |
2034 | 16 " Read the C/C++ syntax to start with |
3920 | 17 let s:Cpath= fnameescape(expand("<sfile>:p:h").(exists("g:lex_uses_cpp")? "/cpp.vim" : "/c.vim")) |
18 if !filereadable(s:Cpath) | |
19 for s:Cpath in split(globpath(&rtp,(exists("g:lex_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") | |
20 if filereadable(fnameescape(s:Cpath)) | |
21 let s:Cpath= fnameescape(s:Cpath) | |
22 break | |
7 | 23 endif |
3920 | 24 endfor |
7 | 25 endif |
3920 | 26 exe "syn include @lexCcode ".s:Cpath |
7 | 27 |
22 | 28 " --- ========= --- |
7 | 29 " --- Lex stuff --- |
22 | 30 " --- ========= --- |
7 | 31 |
2662 | 32 " Options Section |
33 syn match lexOptions '^%\s*option\>.*$' contains=lexPatString | |
34 | |
7 | 35 " Abbreviations Section |
2034 | 36 if has("folding") |
37 syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | |
38 else | |
39 syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | |
40 endif | |
7 | 41 syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp |
42 syn match lexAbbrv "^%[sx]" contained | |
43 syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude | |
2034 | 44 if has("folding") |
3920 | 45 syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode |
2034 | 46 syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell |
3920 | 47 syn region lexAbbrvComment fold start="\%^/\*" end="\*/" contains=@Spell |
2034 | 48 syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained |
49 else | |
3920 | 50 syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=@lexCcode |
2034 | 51 syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell |
3920 | 52 syn region lexAbbrvComment start="\%^/\*" end="\*/" contains=@Spell |
2034 | 53 syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained |
54 endif | |
7 | 55 |
56 "%% : Patterns {Actions} | |
2034 | 57 if has("folding") |
3920 | 58 syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%\ze%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude |
59 syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace | |
2662 | 60 syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode |
2034 | 61 syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained |
62 syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained | |
63 else | |
3920 | 64 syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude |
65 syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace | |
2662 | 66 syn region lexPatInclude matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode |
2034 | 67 syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained |
68 syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained | |
69 endif | |
70 syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | |
3920 | 71 syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s\+\ze{" contained nextgroup=lexPatTagZoneStart |
7 | 72 syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep |
3920 | 73 |
74 " Lex Patterns | |
75 syn region lexPattern start='[^ \t{}]' end="$" contained contains=lexPatRange | |
76 syn region lexPatRange matchgroup=Delimiter start='\[' skip='\\\\\|\\.' end='\]' contains=lexEscape | |
77 syn match lexEscape '\%(\\\\\)*\\.' contained | |
78 | |
2034 | 79 if has("folding") |
3920 | 80 syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment |
2034 | 81 syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell |
82 else | |
3920 | 83 syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment |
2034 | 84 syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell |
85 endif | |
3920 | 86 syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode |
7 | 87 syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment |
88 syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine | |
89 syn match lexSlashQuote +\(\\\\\)*\\"+ contained | |
2034 | 90 if has("folding") |
3920 | 91 syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=@lexCcode,lexCFunctions |
2034 | 92 else |
3920 | 93 syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions |
2034 | 94 endif |
7 | 95 |
3920 | 96 " Lex "functions" which may appear in C/C++ code blocks |
7 | 97 syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext |
98 syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap | |
99 | |
3920 | 100 " %% |
101 " lexAbbrevBlock | |
102 " %% | |
103 " lexPatBlock | |
104 " %% | |
105 " lexFinalCodeBlock | |
106 syn region lexFinalCodeBlock matchgroup=Todo start="%$"me=e-1 end="\%$" contained contains=@lexCcode | |
107 | |
7 | 108 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups |
109 syn cluster cParenGroup add=lex.* | |
110 syn cluster cDefineGroup add=lex.* | |
111 syn cluster cPreProcGroup add=lex.* | |
112 syn cluster cMultiGroup add=lex.* | |
113 | |
114 " Synchronization | |
115 syn sync clear | |
3920 | 116 syn sync minlines=500 |
7 | 117 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]" |
118 syn sync match lexSyncPat groupthere lexPatBlock "^<$" | |
119 syn sync match lexSyncPat groupthere lexPatBlock "^%%$" | |
120 | |
121 " The default highlighting. | |
10051
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
122 if !exists("skip_lex_syntax_inits") |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
123 hi def link lexAbbrvComment lexPatComment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
124 hi def link lexAbbrvRegExp Macro |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
125 hi def link lexAbbrv SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
126 hi def link lexBrace lexPat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
127 hi def link lexCFunctions Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
128 hi def link lexCstruct cStructure |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
129 hi def link lexMorePat SpecialChar |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
130 hi def link lexOptions PreProc |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
131 hi def link lexPatComment Comment |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
132 hi def link lexPat Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
133 hi def link lexPatString Function |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
134 hi def link lexPatTag Special |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
135 hi def link lexPatTagZone lexPatTag |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
136 hi def link lexSep Delimiter |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
137 hi def link lexSlashQuote lexPat |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
138 hi def link lexStartState Statement |
46763b01cd9a
commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents:
10048
diff
changeset
|
139 endif |
7 | 140 |
141 let b:current_syntax = "lex" | |
142 | |
143 " vim:ts=10 |