annotate runtime/syntax/lex.vim @ 3273:c75a8d2404bd v7.3.405

updated for version 7.3.405 Problem: When xterm gets back the function keys it may delete the urxvt mouse termcap code. Solution: Check for the whole code, not just the start. (Egmont Koblinger)
author Bram Moolenaar <bram@vim.org>
date Fri, 20 Jan 2012 17:15:51 +0100
parents 916c90b37ea9
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: Lex
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
3 " Maintainer: Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz>
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
4 " Last Change: Nov 01, 2010
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
5 " Version: 12
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 36
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 "
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 " Option:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 " lex_uses_cpp : if this variable exists, then C++ is loaded rather than C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " For version 5.x: Clear all syntax items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " For version 6.x: Quit when a syntax file was already loaded
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 if version < 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14 syntax clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 elseif exists("b:current_syntax")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
19 " Read the C/C++ syntax to start with
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 if version >= 600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 if exists("lex_uses_cpp")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 runtime! syntax/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24 runtime! syntax/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 unlet b:current_syntax
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 if exists("lex_uses_cpp")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 so <sfile>:p:h/cpp.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 so <sfile>:p:h/c.vim
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
35 " --- ========= ---
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 " --- Lex stuff ---
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
37 " --- ========= ---
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
39 " Options Section
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
40 syn match lexOptions '^%\s*option\>.*$' contains=lexPatString
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
41
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
42 "I'd prefer to use lex.* , but vim doesn't handle forward definitions yet
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 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
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
44 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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 " Abbreviations Section
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
47 if has("folding")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
48 syn region lexAbbrvBlock fold start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
49 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
50 syn region lexAbbrvBlock start="^\(\h\+\s\|%{\)" end="^\ze%%$" skipnl nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
51 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvRegExp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 syn match lexAbbrv "^%[sx]" contained
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 syn match lexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=lexAbbrv,lexInclude
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
55 if has("folding")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
56 syn region lexInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
57 syn region lexAbbrvComment fold start="^\s\+/\*" end="\*/" contains=@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
58 syn region lexStartState fold matchgroup=lexAbbrv start="^%\a\+" end="$" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
59 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
60 syn region lexInclude matchgroup=lexSep start="^%{" end="%}" contained contains=ALLBUT,@lexListGroup
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
61 syn region lexAbbrvComment start="^\s\+/\*" end="\*/" contains=@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
62 syn region lexStartState matchgroup=lexAbbrv start="^%\a\+" end="$" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
63 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 "%% : Patterns {Actions}
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
66 if has("folding")
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
67 syn region lexPatBlock fold matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
68 syn region lexPat fold start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
69 syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
70 syn region lexBrace fold start="\[" skip=+\\\\\|\\+ end="]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
71 syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
72 else
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
73 syn region lexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
74 syn region lexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=lexMorePat,lexPatSep contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
75 syn region lexPatInclude matchgroup=lexSep start="^%{" end="%}" contained contains=lexPatCode
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
76 syn region lexBrace start="\[" skip=+\\\\\|\\+ end="]" contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
77 syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
78 endif
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
79 syn match lexPatTag "^<\I\i*\(,\I\i*\)*>" contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
80 syn match lexPatTagZone "^<\I\i*\(,\I\i*\)*>\s*\ze{" contained nextgroup=lexPatTagZoneStart
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 syn match lexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
82 if has("folding")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
83 syn region lexPatTagZoneStart matchgroup=lexPatTag fold start='{' end='}' contained contains=lexPat,lexPatComment
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
84 syn region lexPatComment start="\s\+/\*" end="\*/" fold skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
85 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
86 syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='}' contained contains=lexPat,lexPatComment
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
87 syn region lexPatComment start="\s\+/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
88 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 syn match lexPatCodeLine ".*$" contained contains=ALLBUT,@lexListGroup
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 syn match lexSlashQuote +\(\\\\\)*\\"+ contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
93 if has("folding")
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
94 syn region lexPatCode matchgroup=Delimiter start="{" end="}" fold skipnl contained contains=ALLBUT,@lexListPatCodeGroup
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
95 else
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
96 syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=ALLBUT,@lexListPatCodeGroup
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
97 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 syn keyword lexCFunctions BEGIN input unput woutput yyleng yylook yytext
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 syn keyword lexCFunctions ECHO output winput wunput yyless yymore yywrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 syn cluster cParenGroup add=lex.*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 syn cluster cDefineGroup add=lex.*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 syn cluster cPreProcGroup add=lex.*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 syn cluster cMultiGroup add=lex.*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 syn sync clear
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 syn sync minlines=300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 syn sync match lexSyncPat groupthere lexPatBlock "^<$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 syn sync match lexSyncPat groupthere lexPatBlock "^%%$"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 " The default highlighting.
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
116 hi def link lexAbbrvComment lexPatComment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
117 hi def link lexBrace lexPat
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
118 hi def link lexPatTagZone lexPatTag
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
119 hi def link lexSlashQuote lexPat
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
121 hi def link lexAbbrvRegExp Macro
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 hi def link lexAbbrv SpecialChar
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 hi def link lexCFunctions Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 hi def link lexMorePat SpecialChar
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
125 hi def link lexOptions PreProc
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
126 hi def link lexPatComment Comment
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 hi def link lexPat Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 hi def link lexPatString Function
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 hi def link lexPatTag Special
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 hi def link lexSep Delimiter
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
131 hi def link lexStartState Statement
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 let b:current_syntax = "lex"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
135 " vim:ts=10