|
| 1 | +" vim syntax file |
| 2 | +" Language: Ada template |
| 3 | +" Maintainer: Jan Tomassi <[email protected]> |
| 4 | +" Last Change: 2024-10-26 |
| 5 | + |
| 6 | +" Quit when a (custom) syntax file was already loaded |
| 7 | +"" if exists("b:current_syntax") |
| 8 | +"" finish |
| 9 | +"" endif |
| 10 | + |
| 11 | +" let s:cpo_save = $cpo |
| 12 | +" set cpo&vim |
| 13 | + |
| 14 | +syn case match |
| 15 | +syn sync fromstart |
| 16 | +set foldmethod=syntax |
| 17 | +set conceallevel=1 |
| 18 | + |
| 19 | +syn match atTag "@_.\{-}_@" contained |
| 20 | +" =, /=, >, >=, <, <=, and, or, xor, in, not, & |
| 21 | +syn match atConditionOP "\(=\|/=\|>\|>=\|<\|<=\|and\|or\|xor\|in\|not\|&\)" contained |
| 22 | + |
| 23 | + |
| 24 | +syn match atIfH "\(@@IF@@\s\+\)\@<=.*$" contains=atConditionOP,atTag contained |
| 25 | +syn match atElsifH "\(@@ELSIF@@\s\+\)\@<=.*$" contains=atConditionOP,atTag contained |
| 26 | +syn match atElseE "\(@@ELSE@@\)\@<=.*$" contains=NONE |
| 27 | + |
| 28 | +syn region atIf transparent matchgroup=atCond start="\s*@@IF@@" end="\s*@@END_IF@@" fold contains=ALLBUT,atConditionOP,atElsifH,atElseE,@InlineHilight,@SetHilight,@ExtendHilight |
| 29 | +syn region atElse transparent matchgroup=atCond start="\s*@@ELSE@@" end="\s*@@END_IF@@"me=e-10 contains=ALLBUT,atConditionOP,atElse,atElsif,atIfH,atElsifH,@InlineHilight,@SetHilight,@ExtendHilight |
| 30 | +syn region atElsif transparent matchgroup=atCond start="\s*@@ELSIF@@" end="\s*@@END_IF@@"me=e-10 end="\s*@@ELSIF@@"me=e-9 end="\s*@@ELSE@@"me=e-8 contains=ALLBUT,atConditionOP,atIfH,atElseE,@InlineHilight,@SetHilight,@ExtendHilight |
| 31 | + |
| 32 | +syn region atInline matchgroup=atStmt start="\s*@@INLINE@@" start="\s*@@INLINE\(\(([^()\\]*\%(\\.[^()\\]*\)*)\)\{1}\|\(([^()\\]*\%(\\.[^()\\]*\)*)\)\{3}\)@@" end="\s*@@END_INLINE@@" fold contains=ALLBUT,atConditionOP,@IfHilight,@SetHilight,@ExtendHilight |
| 33 | +syn match atInlineE "\s*@@INLINE\%(([^()\\]*\%(\\.[^()\\]*\)*)\)\{2}@@" |
| 34 | + |
| 35 | +syn region atTable matchgroup=atStmt start=/\s*@@TABLE\('\(REVERSE\|TERMINATE_SECTIONS\|TERSE\|ALIGN_ON(\%(\%("[^"\\]*\%(\\.[^"\\]*\)*",\s*\)*\%("[^"\\]*\%(\\.[^"\\]*\)*"\)\))\)\)*@@/ end="\s*@@END_TABLE@@" fold contained contains=ALLBUT,atConditionOP,@IfHilight,@InlineHilight,@SetHilight,@ExtendHilight |
| 36 | +syn match atTableE1 /\(@@TABLE\('\(REVERSE\|TERMINATE_SECTIONS\|TERSE\|ALIGN_ON(\%(\%("[^"\\]*\%(\\.[^"\\]*\)*",\s*\)*\%("[^"\\]*\%(\\.[^"\\]*\)*"\)\))\)\)*@@\)\@<=.\+/ |
| 37 | +syn match atTableE2 /\(@@END_TABLE@@\)\@<=.\+/ |
| 38 | + |
| 39 | +syn region atMacro matchgroup=atStmt start=/\s*@@MACRO(.\{-})@@/ end=/\s*@@END_MACRO@@/ fold contains=ALLBUT,atConditionOP,@IfHilight,@InlineHilight,@SetHilight,@ExtendHilight |
| 40 | +syn match atMacroE1 /\(@@MACRO(.\{-})@@\)\@<=.+/ |
| 41 | +syn match atMacroE1 /\(@@END_MACRO@@\)\@<=.+/ |
| 42 | + |
| 43 | +syn region atInclude matchgroup=atStmt start="\s*@@INCLUDE@@" end="$" contains=atTag,atComment |
| 44 | + |
| 45 | +syn region atSet matchgroup=atStmt start="@@SET@@" end="$" contains=atSetH1 |
| 46 | +syn match atSetH1 /\(@@SET@@\s\+\)\@<=\w*/ contained nextgroup=atSetH2 |
| 47 | +syn match atSetH2 /\s=/ contained nextgroup=atSetH3 |
| 48 | +syn match atSetH3 /.*/ contained |
| 49 | + |
| 50 | +syn region atExtend matchgroup=atStmt start="@@EXTENDS@@" end="@@END_EXTENDS@@" fold contains=ALLBUT,atConditionOP,@IfHilight,@InlineHilight,@SetHilight |
| 51 | +syn region atBlock matchgroup=atStmt start="@@BLOCK(.\{-})@@" end="@@END_BLOCK@@" fold contains=ALLBUT,atConditionOP,@IfHilight,@InlineHilight,@SetHilight |
| 52 | + |
| 53 | +syn region atComment start="@@--" end="$" |
| 54 | +syn match atCommentEmpty "@@--\s*$" conceal |
| 55 | + |
| 56 | +syn cluster IfHilight add=atIfH,atElsifH,atElseE |
| 57 | +syn cluster InlineHilight add=atInlineE |
| 58 | +syn cluster SetHilight add=atSetH1,atSetH2,atSetH3 |
| 59 | +syn cluster ExtendHilight add=atSetH1,atSetH2,atSetH3 |
| 60 | + |
| 61 | +hi def link atComment Comment |
| 62 | +hi def link atStmt Statement |
| 63 | +hi def link atCond Conditional |
| 64 | + |
| 65 | +hi def link atTag Identifier |
| 66 | +hi def link atSetH1 Identifier |
| 67 | + |
| 68 | +hi def link atConditionOP Operator |
| 69 | +hi def link atSetH2 Operator |
| 70 | + |
| 71 | +hi def link atSetH3 String |
| 72 | + |
| 73 | +hi def link atElseE Error |
| 74 | +hi def link atInlineE Error |
| 75 | +hi def link atTableE1 Error |
| 76 | +hi def link atTableE2 Error |
| 77 | +hi def link atMacroE1 Error |
| 78 | +hi def link atMacroE1 Error |
0 commit comments