annotate runtime/syntax/lex.vim @ 26773:80e134cbee4b v8.2.3915

patch 8.2.3915: illegal memory access when completing with invalid bytes Commit: https://github.com/vim/vim/commit/4b28ba3245df8274303c79429972f9dc9438e4aa Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 27 19:28:37 2021 +0000 patch 8.2.3915: illegal memory access when completing with invalid bytes Problem: illegal memory access when completing with invalid bytes. Solution: Avoid going over the end of the completion text.
author Bram Moolenaar <Bram@vim.org>
date Mon, 27 Dec 2021 20:30:03 +0100
parents 29c5f168c6fd
children 02bd0fe77c68
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
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
2 " Language: Lex and Flex
19180
8edf0aeb71b9 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 10051
diff changeset
3 " Maintainer: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
4 " Contributor: Robert A. van Engelen <engelen@acm.org>
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
5 " Last Change: Apr 24, 2020
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
6 " Version: 18
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7
10048
43efa4f5a8ea commit https://github.com/vim/vim/commit/89bcfda6834aba724d12554a34b9ed49f5789fd5
Christian Brabandt <cb@256bit.org>
parents: 3920
diff changeset
8 " 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
9 if exists("b:current_syntax")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
13 " Read the C++ syntax to start with
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
14 let s:Cpath= fnameescape(expand("<sfile>:p:h")."/cpp.vim")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
15 if !filereadable(s:Cpath)
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
16 for s:Cpath in split(globpath(&rtp,"syntax/cpp.vim"),"\n")
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
17 if filereadable(fnameescape(s:Cpath))
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
18 let s:Cpath= fnameescape(s:Cpath)
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
19 break
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
21 endfor
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 endif
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
23 exe "syn include @lexCcode ".s:Cpath
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
25 " --- ========= ---
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 " --- Lex stuff ---
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
27 " --- ========= ---
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
29 " Definitions
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
30 " %%
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
31 " Rules
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
32 " %%
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
33 " User Code
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
34 "
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
35 " --- ======= ---
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
36 " --- Example ---
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
37 " --- ======= ---
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
38 "
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
39 " // this is a valid lex file
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
40 " // indented initial code block
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
41 " #include <stdlib.h>
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
42 " %{
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
43 " // initial code block
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
44 " #include <stdio.h>
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
45 " const char *sep = "";
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
46 " %}
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
47 " %option outfile="scanner.c" noyywrap nodefault
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
48 " %x COMMENT
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
49 " id [A-Za-z_][A-Za-z0-9_]*
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
50 " %%
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
51 " // indented initial action code block
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
52 " printf("BEGIN");
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
53 " {id} printf("%s%s", sep, yytext); sep = "";
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
54 " . |
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
55 " \n { sep = "\n"; }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
56 " "/*" { BEGIN COMMENT; }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
57 " "//".* { }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
58 " <COMMENT>{
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
59 " "*/" { BEGIN INITIAL; }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
60 " .|\n
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
61 " }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
62 " <*><<EOF>> { // end of file
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
63 " printf("\nEND\n");
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
64 " yyterminate();
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
65 " }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
66 " %%
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
67 " void scan()
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
68 " {
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
69 " while (yylex())
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
70 " continue;
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
71 " }
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
72 " /* main program */
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
73 " int main()
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
74 " {
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
75 " scan();
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
76 " }
2662
916c90b37ea9 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2034
diff changeset
77
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
78 " Definitions Section with initial code blocks, abbreviations, options, states
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
79 if has("folding")
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
80 syn region lexAbbrvBlock fold start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
81 else
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
82 syn region lexAbbrvBlock start="^\S" end="^\ze%%" skipnl nextgroup=lexPatBlock contains=lexOptions,lexAbbrv,lexInitialCodeBlock,lexInclude,lexAbbrvComment,lexStartState
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
83 endif
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
84 syn match lexOptions "^%\a\+\(\s.*\|[^{]*\)$" contains=lexOptionsEq,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
85 syn match lexOptionsEq "=" skipwhite contained
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
86 syn match lexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=lexAbbrvPat
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
87 syn match lexAbbrvPat "\s\S.*$"lc=1 contained contains=lexPatAbbrv,lexPatString,lexSlashQuote,lexBrace,lexSlashBrace nextgroup=lexAbbrv,lexInclude
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
88 syn match lexStartState "^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?\(\s\+\I\i*\)\+\s*$" contained contains=lexStartStateCmd
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
89 syn match lexStartStateCmd '^%\(xs\?\|s\)\(t\(a\(t\(e\?\)\?\)\?\)\?\)\?' contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
90 if has("folding")
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
91 syn region lexInitialCodeBlock fold start="^\s\+" end="^\S"me=e-1 contains=@lexCcode
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
92 syn region lexInclude fold matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
93 syn region lexAbbrvComment fold start="^\s*//" end="$" contains=@Spell
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
94 syn region lexAbbrvComment fold start="^\s*/\*" end="\*/" contains=@Spell
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
95 else
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
96 syn region lexInitialCodeBlock start="^\s\+" end="^\S"me=e-1 contains=@lexCcode
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
97 syn region lexInclude matchgroup=lexSep start="^%\a*{" end="^%\?}" contained contains=@lexCcode,lexCFunctions
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
98 syn region lexAbbrvComment start="^\s*//" end="$" contains=@Spell
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
99 syn region lexAbbrvComment start="^\s*/\*" end="\*/" contains=@Spell
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
100 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
102 " Rules Section with patterns and actions
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
103 if has("folding")
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
104 syn region lexPatBlock fold matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
105 syn region lexPat fold start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
106 syn region lexPatInclude fold matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
107 syn region lexBrace fold matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
108 syn region lexPatString fold matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
109 else
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
110 syn region lexPatBlock matchgroup=Todo start="^%%" matchgroup=Todo end="^\ze%%" skipnl skipwhite nextgroup=lexFinalCodeBlock contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
111 syn region lexPat start="\S" skip="\\\\\|\\\s" end="\ze\(\s*$\|\s\+\(\h\|{\W\|{$\|[-+*]\|//\|/\*\)\)" skipwhite contained nextgroup=lexMorePat,lexPatSep,lexPatEnd contains=lexPatTag,lexPatString,lexSlashQuote,lexPatAbbrv,lexBrace,lexSlashBrace
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
112 syn region lexPatInclude matchgroup=lexSep start="^%{" end="^%}" contained contains=@lexCcode
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
113 syn region lexBrace matchgroup=Character start="\[" skip="\\.\|\[:\a\+:\]\|\[\.\a\+\.\]\|\[=.=\]" end="\]" contained
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
114 syn region lexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
115 endif
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
116 syn match lexPatAbbrv "{\I\i*}"hs=s+1,he=e-1 contained
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
117 syn match lexPatTag "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>" contained nextgroup=lexPat,lexMorePat,lexPatSep,lexPatEnd
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
118 syn match lexPatTagZone "^<\^\?\(\I\i*\|\*\)\(,\^\?\(\I\i*\|\*\)\)*>\s*{$"me=e-1 contained nextgroup=lexPatTagZoneStart
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
119
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
120 if has("folding")
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
121 syn region lexPatTagZoneStart fold matchgroup=lexPatTag start='{$' end='^}' skipnl skipwhite contained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
122 syn region lexPatComment fold start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
123 syn region lexPatComment fold start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
124 else
23047
29c5f168c6fd Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20241
diff changeset
125 syn region lexPatTagZoneStart matchgroup=lexPatTag start='{' end='^}' skipnl skipwhite contained contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatSep,lexPatInclude
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
126 syn region lexPatComment start="//" end="$" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
127 syn region lexPatComment start="/\*" end="\*/" skipnl contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
128 endif
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
129 syn match lexPatEnd "\s*$" skipnl contained
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
130 syn match lexPatCodeLine "[^{\[].*" contained contains=@lexCcode,lexCFunctions
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
131 syn match lexMorePat "\s*|\s*$" skipnl contained nextgroup=lexPat,lexPatTag,lexPatComment
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
132 syn match lexPatSep "\s\+" contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 syn match lexSlashQuote +\(\\\\\)*\\"+ contained
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
134 syn match lexSlashBrace +\(\\\\\)*\\\[+ contained
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
135 if has("folding")
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
136 syn region lexPatCode fold matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
137 else
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
138 syn region lexPatCode matchgroup=Delimiter start="{" end="}" skipnl contained contains=@lexCcode,lexCFunctions
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 507
diff changeset
139 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
141 " User Code Section with final code block
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
142 syn region lexFinalCodeBlock matchgroup=Todo start="^%%" end="\%$" contained contains=@lexCcode
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
144 " Lex macros which may appear in C/C++ code blocks
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
145 syn keyword lexCFunctions BEGIN ECHO REJECT yytext YYText yyleng YYLeng yymore yyless yywrap yylook
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
146 syn keyword lexCFunctions yyrestart yyterminate yylineno yycolumno yyin yyout
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
147 syn keyword lexCFunctions input unput output winput wunput woutput
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
148 syn keyword lexCFunctions yyinput yyunput yyoutput yywinput yywunput yywoutput
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
149
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
151 syn cluster cParenGroup add=lex.*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 syn cluster cDefineGroup add=lex.*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 syn cluster cPreProcGroup add=lex.*
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
154 syn cluster cMultiGroup add=lex.*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 " Synchronization
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 syn sync clear
3920
c53344bacabf Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2662
diff changeset
158 syn sync minlines=500
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 syn sync match lexSyncPat grouphere lexPatBlock "^%[a-zA-Z]"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 syn sync match lexSyncPat groupthere lexPatBlock "^<$"
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
161 syn sync match lexSyncPat groupthere lexPatBlock "^%%"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 " The default highlighting.
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
164 if !exists("skip_lex_syntax_inits")
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
165 hi def link lexAbbrvComment lexPatComment
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
166 hi def link lexAbbrvPat lexPat
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
167 hi def link lexAbbrv Special
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
168 hi def link lexBrace lexPat
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
169 hi def link lexCFunctions PreProc
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
170 hi def link lexMorePat Special
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
171 hi def link lexOptions PreProc
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
172 hi def link lexOptionsEq Operator
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
173 hi def link lexPatComment Comment
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
174 hi def link lexPat Function
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
175 hi def link lexPatString lexPat
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
176 hi def link lexPatAbbrv Special
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
177 hi def link lexPatTag Statement
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
178 hi def link lexPatTagZone lexPatTag
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
179 hi def link lexSep Delimiter
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
180 hi def link lexSlashQuote lexPat
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
181 hi def link lexSlashBrace lexPat
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
182 hi def link lexStartState lexPatTag
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
183 hi def link lexStartStateCmd Special
10051
46763b01cd9a commit https://github.com/vim/vim/commit/f37506f60f87d52a9e8850e30067645e2b13783c
Christian Brabandt <cb@256bit.org>
parents: 10048
diff changeset
184 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 let b:current_syntax = "lex"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187
20241
56265f711890 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19180
diff changeset
188 " vim:ts=8