Merged from the latest developing branch.
[MacVim/jjgod.git] / runtime / syntax / aflex.vim
blob592c98e4f3051705770cc32543ac64eb8bc4b75c
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*
10 " For version 5.x: Clear all syntax items
11 " For version 6.x: Quit when a syntax file was already loaded
12 if version < 600
13    syntax clear
14 elseif exists("b:current_syntax")
15    finish
16 endif
18 " Read the Ada syntax to start with
19 if version < 600
20    so <sfile>:p:h/ada.vim
21 else
22    runtime! syntax/ada.vim
23    unlet b:current_syntax
24 endif
27 " --- AfLex stuff ---
29 "I'd prefer to use aflex.* , but it doesn't handle forward definitions yet
30 syn 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
31 syn 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
33 " Abbreviations Section
34 syn region aflexAbbrvBlock      start="^\([a-zA-Z_]\+\t\|%{\)" end="^%%$"me=e-2 skipnl  nextgroup=aflexPatBlock contains=aflexAbbrv,aflexInclude,aflexAbbrvComment
35 syn match  aflexAbbrv           "^\I\i*\s"me=e-1                        skipwhite       contained nextgroup=aflexAbbrvRegExp
36 syn match  aflexAbbrv           "^%[sx]"                                        contained
37 syn match  aflexAbbrvRegExp     "\s\S.*$"lc=1                           contained nextgroup=aflexAbbrv,aflexInclude
38 syn region aflexInclude matchgroup=aflexSep     start="^%{" end="%}"    contained       contains=ALLBUT,@aflexListGroup
39 syn region aflexAbbrvComment    start="^\s\+/\*"        end="\*/"
41 "%% : Patterns {Actions}
42 syn region aflexPatBlock        matchgroup=Todo start="^%%$" matchgroup=Todo end="^%%$" skipnl skipwhite contains=aflexPat,aflexPatTag,aflexPatComment
43 syn region aflexPat             start=+\S+ skip="\\\\\|\\."     end="\s"me=e-1  contained nextgroup=aflexMorePat,aflexPatSep contains=aflexPatString,aflexSlashQuote,aflexBrace
44 syn region aflexBrace   start="\[" skip=+\\\\\|\\+              end="]"         contained
45 syn region aflexPatString       matchgroup=String start=+"+     skip=+\\\\\|\\"+        matchgroup=String end=+"+       contained
46 syn match  aflexPatTag  "^<\I\i*\(,\I\i*\)*>*"                  contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
47 syn match  aflexPatTag  +^<\I\i*\(,\I\i*\)*>*\(\\\\\)*\\"+              contained nextgroup=aflexPat,aflexPatTag,aflexMorePat,aflexPatSep
48 syn region aflexPatComment      start="^\s*/\*" end="\*/"               skipnl  contained contains=cTodo nextgroup=aflexPatComment,aflexPat,aflexPatString,aflexPatTag
49 syn match  aflexPatCodeLine     ".*$"                                   contained contains=ALLBUT,@aflexListGroup
50 syn match  aflexMorePat "\s*|\s*$"                      skipnl  contained nextgroup=aflexPat,aflexPatTag,aflexPatComment
51 syn match  aflexPatSep  "\s\+"                                  contained nextgroup=aflexMorePat,aflexPatCode,aflexPatCodeLine
52 syn match  aflexSlashQuote      +\(\\\\\)*\\"+                          contained
53 syn region aflexPatCode matchgroup=Delimiter start="{" matchgroup=Delimiter end="}"     skipnl contained contains=ALLBUT,@aflexListPatCodeGroup
55 syn keyword aflexCFunctions     BEGIN   input   unput   woutput yyleng  yylook  yytext
56 syn keyword aflexCFunctions     ECHO    output  winput  wunput  yyless  yymore  yywrap
58 " <c.vim> includes several ALLBUTs; these have to be treated so as to exclude aflex* groups
59 syn cluster cParenGroup add=aflex.*
60 syn cluster cDefineGroup        add=aflex.*
61 syn cluster cPreProcGroup       add=aflex.*
62 syn cluster cMultiGroup add=aflex.*
64 " Synchronization
65 syn sync clear
66 syn sync minlines=300
67 syn sync match aflexSyncPat     grouphere  aflexPatBlock        "^%[a-zA-Z]"
68 syn sync match aflexSyncPat     groupthere aflexPatBlock        "^<$"
69 syn sync match aflexSyncPat     groupthere aflexPatBlock        "^%%$"
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
75 if 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
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
96 endif
98 let b:current_syntax = "aflex"
100 " vim:ts=10