Mercurial > vim
comparison runtime/syntax/lex.vim @ 2034:7bc41231fbc7
Update runtime files.
author | Bram Moolenaar <bram@zimbu.org> |
---|---|
date | Wed, 06 Jan 2010 20:54:52 +0100 |
parents | a1059cda45f2 |
children | 916c90b37ea9 |
comparison
equal
deleted
inserted
replaced
2033:de5a43c5eedc | 2034:7bc41231fbc7 |
---|---|
1 " Vim syntax file | 1 " Vim syntax file |
2 " Language: Lex | 2 " Language: Lex |
3 " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> | 3 " Maintainer: Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> |
4 " Last Change: Sep 06, 2005 | 4 " Last Change: Sep 11, 2009 |
5 " Version: 7 | 5 " Version: 10 |
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 " Option: |
9 " lex_uses_cpp : if this variable exists, then C++ is loaded rather than C | 9 " lex_uses_cpp : if this variable exists, then C++ is loaded rather than C |
10 | 10 |
14 syntax clear | 14 syntax clear |
15 elseif exists("b:current_syntax") | 15 elseif exists("b:current_syntax") |
16 finish | 16 finish |
17 endif | 17 endif |
18 | 18 |
19 " Read the C syntax to start with | 19 " Read the C/C++ syntax to start with |
20 if version >= 600 | 20 if version >= 600 |
21 if exists("lex_uses_cpp") | 21 if exists("lex_uses_cpp") |
22 runtime! syntax/cpp.vim | 22 runtime! syntax/cpp.vim |
23 else | 23 else |
24 runtime! syntax/c.vim | 24 runtime! syntax/c.vim |
34 | 34 |
35 " --- ========= --- | 35 " --- ========= --- |
36 " --- Lex stuff --- | 36 " --- Lex stuff --- |
37 " --- ========= --- | 37 " --- ========= --- |
38 | 38 |
39 "I'd prefer to use lex.* , but it doesn't handle forward definitions yet | 39 "I'd prefer to use lex.* , but vim doesn't handle forward definitions yet |
40 syn cluster lexListGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatString,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,lexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError | 40 syn cluster lexListGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatString,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,lexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError |
41 syn cluster lexListPatCodeGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatTag,lexPatTag,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError | 41 syn cluster lexListPatCodeGroup contains=lexAbbrvBlock,lexAbbrv,lexAbbrv,lexAbbrvRegExp,lexInclude,lexPatBlock,lexPat,lexBrace,lexPatTag,lexPatTag,lexPatTagZoneStart,lexPatComment,lexPatCodeLine,lexMorePat,lexPatSep,lexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2,cCommentStartError,cParenError |
42 | 42 |
43 " Abbreviations Section | 43 " Abbreviations Section |
44 syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | 44 if has("folding") |
45 syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | |
46 else | |
47 syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | |
48 endif | |
45 syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp | 49 syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp |
46 syn match lexAbbrv "^%[sx]" contained | 50 syn match lexAbbrv "^%[sx]" contained |
47 syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude | 51 syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude |
48 syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup | 52 if has("folding") |
49 syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell | 53 syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup |
50 syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained | 54 syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell |
55 syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained | |
56 else | |
57 syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup | |
58 syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell | |
59 syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained | |
60 endif | |
51 | 61 |
52 "%% : Patterns {Actions} | 62 "%% : Patterns {Actions} |
53 syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPat,lexPatTag,lexPatComment | 63 if has("folding") |
54 syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatString,lexSlashQuote,lexBrace | 64 syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat |
55 syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained | 65 syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace |
56 syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained | 66 syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained |
57 syn match lexPatTag "^<\I\i*\(,\I\i*\)*>*" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | 67 syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained |
68 else | |
69 syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat | |
70 syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace | |
71 syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained | |
72 syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained | |
73 endif | |
74 syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | |
75 syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s*\ze{" contained nextgroup=lexPatTagZoneStart | |
58 syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | 76 syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep |
59 syn region lexPatComment start="^\s*/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell | 77 if has("folding") |
78 syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment | |
79 syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell | |
80 else | |
81 syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment | |
82 syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell | |
83 endif | |
60 syn match lexPatCodeLine ".*$" contained contains=ALLBUT,@lexListGroup | 84 syn match lexPatCodeLine ".*$" contained contains=ALLBUT,@lexListGroup |
61 syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment | 85 syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment |
62 syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine | 86 syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine |
63 syn match lexSlashQuote +\(\\\\\)*\\"+ contained | 87 syn match lexSlashQuote +\(\\\\\)*\\"+ contained |
64 syn region lexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" skipnl contained contains=ALLBUT,@lexListPatCodeGroup | 88 if has("folding") |
89 syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=ALLBUT,@lexListPatCodeGroup | |
90 else | |
91 syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=ALLBUT,@lexListPatCodeGroup | |
92 endif | |
65 | 93 |
66 syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext | 94 syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext |
67 syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap | 95 syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap |
68 | 96 |
69 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups | 97 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups |
78 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]" | 106 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]" |
79 syn sync match lexSyncPat groupthere lexPatBlock "^<$" | 107 syn sync match lexSyncPat groupthere lexPatBlock "^<$" |
80 syn sync match lexSyncPat groupthere lexPatBlock "^%%$" | 108 syn sync match lexSyncPat groupthere lexPatBlock "^%%$" |
81 | 109 |
82 " The default highlighting. | 110 " The default highlighting. |
111 hi def link lexAbbrvComment lexPatComment | |
112 hi def link lexBrace lexPat | |
113 hi def link lexPatTagZone lexPatTag | |
83 hi def link lexSlashQuote lexPat | 114 hi def link lexSlashQuote lexPat |
84 hi def link lexBrace lexPat | |
85 hi def link lexAbbrvComment lexPatComment | |
86 | 115 |
87 hi def link lexAbbrvRegExp Macro | 116 hi def link lexAbbrvRegExp Macro |
88 hi def link lexAbbrv SpecialChar | 117 hi def link lexAbbrv SpecialChar |
89 hi def link lexCFunctions Function | 118 hi def link lexCFunctions Function |
90 hi def link lexMorePat SpecialChar | 119 hi def link lexMorePat SpecialChar |