1
2" Vim syntax file
3" Language:	AfLex (from Lex syntax file)
4" Maintainer:	Mathieu Clabaut <mathieu.clabaut@free.fr>
5" LastChange:	02 May 2001
6" Original:	Lex, maintained by Dr. Charles E. Campbell, Jr.
7" Comment:	Replaced sourcing c.vim file by ada.vim and rename lex*
8"		in aflex*
9
10" For version 5.x: Clear all syntax items
11" For version 6.x: Quit when a syntax file was already loaded
12if version < 600
13   syntax clear
14elseif exists("b:current_syntax")
15   finish
16endif
17
18" Read the Ada syntax to start with
19if version < 600
20   so <sfile>:p:h/ada.vim
21else
22   runtime! syntax/ada.vim
23   unlet b:current_syntax
24endif
25
26
27" --- AfLex stuff ---
28
29"I'd prefer to use aflex.* , but it doesn't handle forward definitions yet
30syn cluster aflexListGroup		contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatString,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,aflexPatCode,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
31syn cluster aflexListPatCodeGroup	contains=aflexAbbrvBlock,aflexAbbrv,aflexAbbrv,aflexAbbrvRegExp,aflexInclude,aflexPatBlock,aflexPat,aflexBrace,aflexPatTag,aflexPatTag,aflexPatComment,aflexPatCodeLine,aflexMorePat,aflexPatSep,aflexSlashQuote,cInParen,cUserLabel,cOctalZero,cCppSkip,cErrInBracket,cErrInParen,cOctalError,cCppOut2
32
33" Abbreviations Section
34syn region aflexAbbrvBlock	start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2	skipnl	nextgroup=aflexPatBlock contains=aflexAbbrv,aflexInclude,aflexAbbrvComment
35syn match  aflexAbbrv		"^\I\i*\s"me=e-1			skipwhite	contained nextgroup=aflexAbbrvRegExp
36syn match  aflexAbbrv		"^%[sx]"					contained
37syn match  aflexAbbrvRegExp	"\s\S.*$"lc=1				contained nextgroup=aflexAbbrv,aflexInclude
38syn region aflexInclude	matchgroup=aflexSep	start="^%{" end="%}"	contained	contains=ALLBUT,@aflexListGroup
39syn region aflexAbbrvComment	start="^\s\+/\*"	end="\*/"
40
41"%% : Patterns {Actions}
42syn region aflexPatBlock	matchgroup=Todo	start="^%%$" matchgroup=Todo end="^%%$"	skipnl skipwhite contains=aflexPat,aflexPatTag,aflexPatComment
43syn region aflexPat		start=+\S+ skip="\\\\\|\\."	end="\s"me=e-1	contained nextgroup=aflexMorePat,aflexPatSep contains=aflexPatString,aflexSlashQuote,aflexBrace
44syn region aflexBrace	start="\[" skip=+\\\\\|\\+		end="]"		contained
45syn region aflexPatString	matchgroup=String start=+"+	skip=+\\\\\|\\"+	matchgroup=String end=+"+	contained
46syn match  aflexPatTag	"^<\I\i*\(,\I\i*\)*>*"			contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
47syn match  aflexPatTag	+^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+		contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
48syn region aflexPatComment	start="^\s*/\*" end="\*/"		skipnl	contained contains=cTodo nextgroup=aflexPatComment,aflexPat,aflexPatString,aflexPatTag
49syn match  aflexPatCodeLine	".*$"					contained contains=ALLBUT,@aflexListGroup
50syn match  aflexMorePat	"\s*|\s*$"			skipnl	contained nextgroup=aflexPat,aflexPatTag,aflexPatComment
51syn match  aflexPatSep	"\s\+"					contained nextgroup=aflexMorePat,aflexPatCode,aflexPatCodeLine
52syn match  aflexSlashQuote	+\(\\\\\)*\\"+				contained
53syn region aflexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"	skipnl contained contains=ALLBUT,@aflexListPatCodeGroup
54
55syn keyword aflexCFunctions	BEGIN	input	unput	woutput	yyleng	yylook	yytext
56syn keyword aflexCFunctions	ECHO	output	winput	wunput	yyless	yymore	yywrap
57
58" <c.vim> includes several ALLBUTs; these have to be treated so as to exclude aflex* groups
59syn cluster cParenGroup	add=aflex.*
60syn cluster cDefineGroup	add=aflex.*
61syn cluster cPreProcGroup	add=aflex.*
62syn cluster cMultiGroup	add=aflex.*
63
64" Synchronization
65syn sync clear
66syn sync minlines=300
67syn sync match aflexSyncPat	grouphere  aflexPatBlock	"^%[a-zA-Z]"
68syn sync match aflexSyncPat	groupthere aflexPatBlock	"^<$"
69syn sync match aflexSyncPat	groupthere aflexPatBlock	"^%%$"
70
71" Define the default highlighting.
72" For version 5.7 and earlier: only when not done already
73" For version 5.8 and later: only when an item doesn't have highlighting yet
74
75if version >= 508 || !exists("did_aflex_syntax_inits")
76   if version < 508
77      let did_aflex_syntax_inits = 1
78      command -nargs=+ HiLink hi link <args>
79   else
80      command -nargs=+ HiLink hi def link <args>
81   endif
82  HiLink	aflexSlashQuote	aflexPat
83  HiLink	aflexBrace		aflexPat
84  HiLink aflexAbbrvComment	aflexPatComment
85
86  HiLink	aflexAbbrv		SpecialChar
87  HiLink	aflexAbbrvRegExp	Macro
88  HiLink	aflexCFunctions	Function
89  HiLink	aflexMorePat	SpecialChar
90  HiLink	aflexPat		Function
91  HiLink	aflexPatComment	Comment
92  HiLink	aflexPatString	Function
93  HiLink	aflexPatTag		Special
94  HiLink	aflexSep		Delimiter
95  delcommand HiLink
96endif
97
98let b:current_syntax = "aflex"
99
100" vim:ts=10
101