blob: aa8b5f84fe5c4bf1da06f9af3b48f51b3f94b65f [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001
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
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020010" quit when a syntax file was already loaded
11if exists("b:current_syntax")
Bram Moolenaar071d4272004-06-13 20:20:40 +000012 finish
13endif
14
15" Read the Ada syntax to start with
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020016runtime! syntax/ada.vim
17unlet b:current_syntax
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
19
20" --- AfLex stuff ---
21
22"I'd prefer to use aflex.* , but it doesn't handle forward definitions yet
23syn 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
24syn 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
25
26" Abbreviations Section
27syn region aflexAbbrvBlock start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2 skipnl nextgroup=aflexPatBlock contains=aflexAbbrv,aflexInclude,aflexAbbrvComment
28syn match aflexAbbrv "^\I\i*\s"me=e-1 skipwhite contained nextgroup=aflexAbbrvRegExp
29syn match aflexAbbrv "^%[sx]" contained
30syn match aflexAbbrvRegExp "\s\S.*$"lc=1 contained nextgroup=aflexAbbrv,aflexInclude
31syn region aflexInclude matchgroup=aflexSep start="^%{" end="%}" contained contains=ALLBUT,@aflexListGroup
32syn region aflexAbbrvComment start="^\s\+/\*" end="\*/"
33
34"%% : Patterns {Actions}
35syn region aflexPatBlock matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=aflexPat,aflexPatTag,aflexPatComment
36syn region aflexPat start=+\S+ skip="\\\\\|\\." end="\s"me=e-1 contained nextgroup=aflexMorePat,aflexPatSep contains=aflexPatString,aflexSlashQuote,aflexBrace
37syn region aflexBrace start="\[" skip=+\\\\\|\\+ end="]" contained
38syn region aflexPatString matchgroup=String start=+"+ skip=+\\\\\|\\"+ matchgroup=String end=+"+ contained
39syn match aflexPatTag "^<\I\i*\(,\I\i*\)*>*" contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
40syn match aflexPatTag +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+ contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
41syn region aflexPatComment start="^\s*/\*" end="\*/" skipnl contained contains=cTodo nextgroup=aflexPatComment,aflexPat,aflexPatString,aflexPatTag
42syn match aflexPatCodeLine ".*$" contained contains=ALLBUT,@aflexListGroup
43syn match aflexMorePat "\s*|\s*$" skipnl contained nextgroup=aflexPat,aflexPatTag,aflexPatComment
44syn match aflexPatSep "\s\+" contained nextgroup=aflexMorePat,aflexPatCode,aflexPatCodeLine
45syn match aflexSlashQuote +\(\\\\\)*\\"+ contained
46syn region aflexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" skipnl contained contains=ALLBUT,@aflexListPatCodeGroup
47
48syn keyword aflexCFunctions BEGIN input unput woutput yyleng yylook yytext
49syn keyword aflexCFunctions ECHO output winput wunput yyless yymore yywrap
50
51" <c.vim> includes several ALLBUTs; these have to be treated so as to exclude aflex* groups
52syn cluster cParenGroup add=aflex.*
53syn cluster cDefineGroup add=aflex.*
54syn cluster cPreProcGroup add=aflex.*
55syn cluster cMultiGroup add=aflex.*
56
57" Synchronization
58syn sync clear
59syn sync minlines=300
60syn sync match aflexSyncPat grouphere aflexPatBlock "^%[a-zA-Z]"
61syn sync match aflexSyncPat groupthere aflexPatBlock "^<$"
62syn sync match aflexSyncPat groupthere aflexPatBlock "^%%$"
63
64" Define the default highlighting.
Bram Moolenaar89bcfda2016-08-30 23:26:57 +020065" Only when an item doesn't have highlighting yet
Bram Moolenaarf37506f2016-08-31 22:22:10 +020066hi def link aflexSlashQuote aflexPat
67hi def link aflexBrace aflexPat
68hi def link aflexAbbrvComment aflexPatComment
Bram Moolenaar071d4272004-06-13 20:20:40 +000069
Bram Moolenaarf37506f2016-08-31 22:22:10 +020070hi def link aflexAbbrv SpecialChar
71hi def link aflexAbbrvRegExp Macro
72hi def link aflexCFunctions Function
73hi def link aflexMorePat SpecialChar
74hi def link aflexPat Function
75hi def link aflexPatComment Comment
76hi def link aflexPatString Function
77hi def link aflexPatTag Special
78hi def link aflexSep Delimiter
Bram Moolenaar071d4272004-06-13 20:20:40 +000079
80let b:current_syntax = "aflex"
81
82" vim:ts=10