| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " Vim syntax file | 
					
						
							|  |  |  | " Language:	Lex | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | " Maintainer:	Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | " Last Change:	Aug 31, 2016 | 
					
						
							|  |  |  | " Version:	16 | 
					
						
							|  |  |  | " URL:	http://mysite.verizon.net/astronaut/vim/index.html#SYNTAX_LEX | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " | 
					
						
							|  |  |  | " Option: | 
					
						
							|  |  |  | "   lex_uses_cpp : if this variable exists, then C++ is loaded rather than C | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 23:26:57 +02:00
										 |  |  | " quit when a syntax file was already loaded | 
					
						
							|  |  |  | if exists("b:current_syntax") | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   finish | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | " Read the C/C++ syntax to start with | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | let s:Cpath= fnameescape(expand("<sfile>:p:h").(exists("g:lex_uses_cpp")? "/cpp.vim" : "/c.vim")) | 
					
						
							|  |  |  | if !filereadable(s:Cpath) | 
					
						
							|  |  |  |  for s:Cpath in split(globpath(&rtp,(exists("g:lex_uses_cpp")? "syntax/cpp.vim" : "syntax/c.vim")),"\n") | 
					
						
							|  |  |  |   if filereadable(fnameescape(s:Cpath)) | 
					
						
							|  |  |  |    let s:Cpath= fnameescape(s:Cpath) | 
					
						
							|  |  |  |    break | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  |   endif | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  endfor | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | exe "syn include @lexCcode ".s:Cpath | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-09-02 19:12:26 +00:00
										 |  |  | " --- ========= --- | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " --- Lex stuff --- | 
					
						
							| 
									
										
										
										
											2004-09-02 19:12:26 +00:00
										 |  |  | " --- ========= --- | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-12-10 20:35:50 +01:00
										 |  |  | " Options Section | 
					
						
							|  |  |  | syn match lexOptions '^%\s*option\>.*$' contains=lexPatString | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " Abbreviations Section | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if has("folding") | 
					
						
							|  |  |  |  syn region lexAbbrvBlock	fold start="^\(\h\+\s\|%{\)"	end="^\ze%%$"	skipnl	nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |  syn region lexAbbrvBlock	start="^\(\h\+\s\|%{\)"	end="^\ze%%$"	skipnl	nextgroup=lexPatBlock contains=lexAbbrv,lexInclude,lexAbbrvComment,lexStartState | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | syn match  lexAbbrv		"^\I\i*\s"me=e-1			skipwhite	contained nextgroup=lexAbbrvRegExp | 
					
						
							|  |  |  | syn match  lexAbbrv		"^%[sx]"					contained | 
					
						
							|  |  |  | syn match  lexAbbrvRegExp	"\s\S.*$"lc=1				contained nextgroup=lexAbbrv,lexInclude | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if has("folding") | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexInclude	fold matchgroup=lexSep	start="^%{"	end="%}"	contained	contains=@lexCcode | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexAbbrvComment	fold			start="^\s\+/\*"	end="\*/"	contains=@Spell | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexAbbrvComment	fold			start="\%^/\*"	end="\*/"	contains=@Spell | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexStartState	fold matchgroup=lexAbbrv	start="^%\a\+"	end="$"	contained | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexInclude	matchgroup=lexSep		start="^%{"	end="%}"	contained	contains=@lexCcode | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexAbbrvComment				start="^\s\+/\*"	end="\*/"	contains=@Spell | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexAbbrvComment				start="\%^/\*"	end="\*/"	contains=@Spell | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexStartState	matchgroup=lexAbbrv		start="^%\a\+"	end="$"	contained | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | "%% : Patterns {Actions} | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if has("folding") | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatBlock	fold matchgroup=Todo	start="^%%$" matchgroup=Todo	end="^%\ze%$"	skipnl	skipwhite	nextgroup=lexFinalCodeBlock	contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude | 
					
						
							|  |  |  |  syn region lexPat		fold			start=+\S+ skip="\\\\\|\\."	end="\s"me=e-1	skipwhite	contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace | 
					
						
							| 
									
										
										
										
											2010-12-10 20:35:50 +01:00
										 |  |  |  syn region lexPatInclude	fold matchgroup=lexSep	start="^%{"	end="%}"	contained	contains=lexPatCode | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexBrace	fold			start="\[" skip=+\\\\\|\\+	end="]"			contained | 
					
						
							|  |  |  |  syn region lexPatString	fold matchgroup=String	start=+"+	skip=+\\\\\|\\"+	matchgroup=String end=+"+	contained | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatBlock	matchgroup=Todo		start="^%%$" matchgroup=Todo	end="^%%$"	skipnl	skipwhite	nextgroup=lexFinalCodeBlock	contains=lexPatTag,lexPatTagZone,lexPatComment,lexPat,lexPatInclude | 
					
						
							|  |  |  |  syn region lexPat					start=+\S+ skip="\\\\\|\\."	end="\s"me=e-1	skipwhite	contained nextgroup=lexMorePat,lexPatSep,lexPattern contains=lexPatTag,lexPatString,lexSlashQuote,lexBrace | 
					
						
							| 
									
										
										
										
											2010-12-10 20:35:50 +01:00
										 |  |  |  syn region lexPatInclude	matchgroup=lexSep		start="^%{"	end="%}"	contained	contains=lexPatCode | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexBrace				start="\[" skip=+\\\\\|\\+	end="]"			contained | 
					
						
							|  |  |  |  syn region lexPatString	matchgroup=String		start=+"+	skip=+\\\\\|\\"+	matchgroup=String end=+"+	contained | 
					
						
							|  |  |  | endif | 
					
						
							|  |  |  | syn match  lexPatTag	"^<\I\i*\(,\I\i*\)*>"			contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | syn match  lexPatTagZone	"^<\I\i*\(,\I\i*\)*>\s\+\ze{"			contained nextgroup=lexPatTagZoneStart | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | syn match  lexPatTag	+^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+		contained nextgroup=lexPat,lexPatTag,lexMorePat,lexPatSep | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | " Lex Patterns | 
					
						
							|  |  |  | syn region lexPattern	start='[^ \t{}]'	end="$"			contained	contains=lexPatRange | 
					
						
							|  |  |  | syn region lexPatRange	matchgroup=Delimiter	start='\['	skip='\\\\\|\\.'	end='\]'	contains=lexEscape | 
					
						
							|  |  |  | syn match  lexEscape	'\%(\\\\\)*\\.'				contained | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if has("folding") | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatTagZoneStart matchgroup=lexPatTag	fold	start='{' end='}'	contained contains=lexPat,lexPatComment | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexPatComment	start="\s\+/\*" end="\*/"	fold	skipnl	contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatTagZoneStart matchgroup=lexPatTag		start='{' end='}'	contained contains=lexPat,lexPatComment | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  |  syn region lexPatComment	start="\s\+/\*" end="\*/"		skipnl	contained contains=cTodo skipwhite nextgroup=lexPatComment,lexPat,@Spell | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | syn match  lexPatCodeLine	"[^{\[].*"				contained contains=@lexCcode | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | syn match  lexMorePat	"\s*|\s*$"			skipnl	contained nextgroup=lexPat,lexPatTag,lexPatComment | 
					
						
							|  |  |  | syn match  lexPatSep	"\s\+"					contained nextgroup=lexMorePat,lexPatCode,lexPatCodeLine | 
					
						
							|  |  |  | syn match  lexSlashQuote	+\(\\\\\)*\\"+				contained | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | if has("folding") | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatCode matchgroup=Delimiter start="{" end="}"	fold	skipnl contained contains=@lexCcode,lexCFunctions | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  |  syn region lexPatCode matchgroup=Delimiter start="{" end="}"	skipnl	contained contains=@lexCcode,lexCFunctions | 
					
						
							| 
									
										
										
										
											2010-01-06 20:54:52 +01:00
										 |  |  | endif | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | " Lex "functions" which may appear in C/C++ code blocks | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | syn keyword lexCFunctions	BEGIN	input	unput	woutput	yyleng	yylook	yytext | 
					
						
							|  |  |  | syn keyword lexCFunctions	ECHO	output	winput	wunput	yyless	yymore	yywrap | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | " %% | 
					
						
							|  |  |  | "  lexAbbrevBlock | 
					
						
							|  |  |  | " %% | 
					
						
							|  |  |  | "  lexPatBlock | 
					
						
							|  |  |  | " %% | 
					
						
							|  |  |  | "  lexFinalCodeBlock | 
					
						
							|  |  |  | syn region lexFinalCodeBlock matchgroup=Todo start="%$"me=e-1 end="\%$"	contained	contains=@lexCcode | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude lex* groups | 
					
						
							|  |  |  | syn cluster cParenGroup	add=lex.* | 
					
						
							|  |  |  | syn cluster cDefineGroup	add=lex.* | 
					
						
							|  |  |  | syn cluster cPreProcGroup	add=lex.* | 
					
						
							|  |  |  | syn cluster cMultiGroup	add=lex.* | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " Synchronization | 
					
						
							|  |  |  | syn sync clear | 
					
						
							| 
									
										
										
										
											2012-11-15 21:28:22 +01:00
										 |  |  | syn sync minlines=500 | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | syn sync match lexSyncPat	grouphere  lexPatBlock	"^%[a-zA-Z]" | 
					
						
							|  |  |  | syn sync match lexSyncPat	groupthere lexPatBlock	"^<$" | 
					
						
							|  |  |  | syn sync match lexSyncPat	groupthere lexPatBlock	"^%%$" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " The default highlighting. | 
					
						
							| 
									
										
										
										
											2016-08-31 22:22:10 +02:00
										 |  |  | if !exists("skip_lex_syntax_inits") | 
					
						
							|  |  |  |  hi def link lexAbbrvComment	lexPatComment | 
					
						
							|  |  |  |  hi def link lexAbbrvRegExp	Macro | 
					
						
							|  |  |  |  hi def link lexAbbrv	SpecialChar | 
					
						
							|  |  |  |  hi def link lexBrace	lexPat | 
					
						
							|  |  |  |  hi def link lexCFunctions	Function | 
					
						
							|  |  |  |  hi def link lexCstruct	cStructure | 
					
						
							|  |  |  |  hi def link lexMorePat	SpecialChar | 
					
						
							|  |  |  |  hi def link lexOptions	PreProc | 
					
						
							|  |  |  |  hi def link lexPatComment	Comment | 
					
						
							|  |  |  |  hi def link lexPat		Function | 
					
						
							|  |  |  |  hi def link lexPatString	Function | 
					
						
							|  |  |  |  hi def link lexPatTag	Special | 
					
						
							|  |  |  |  hi def link lexPatTagZone	lexPatTag | 
					
						
							|  |  |  |  hi def link lexSep		Delimiter | 
					
						
							|  |  |  |  hi def link lexSlashQuote	lexPat | 
					
						
							|  |  |  |  hi def link lexStartState	Statement | 
					
						
							|  |  |  | endif | 
					
						
							| 
									
										
										
										
											2004-06-13 20:20:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | let b:current_syntax = "lex" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | " vim:ts=10 |