2 " Language: Parrot IMCC
3 " Maintainer: Luke Palmer <fibonaci@babylonia.flatirons.org>
4 " Modified: Joshua Isom
5 " Last Change: Jan 6 2006
7 " For installation please read:
11 " For version 5.x: Clear all syntax items
12 " For version 6.x: Quit when a syntax file was already loaded
16 elseif exists("b:current_syntax")
22 syn include @Pod syntax/pod.vim
23 syn region pirPod start="^=[a-z]" end="^=cut" keepend contains=@Pod fold
25 syn keyword pirType int float num string pmc
26 syn match pirPMC /\.\(Compiler\|Continuation\|Coroutine\|CSub\|NCI\|Eval\|Sub\|Scratchpad\)/
27 syn match pirPMC /\.\(BigInt\|Boolean\|Complex\|Float\|Integer\|PMC\|String\|Hash\)/
28 syn match pirPMC /\.\(Fixed\|Resizable\)\(Boolean\|Float\|Integer\|PMC\|String\)Array/
29 syn match pirPMC /\.\(IntList\|Iterator\|Key\|ManagedStruct\|UnManagedStruct\|Pointer\)/
30 syn match pirPMC /\.\(FloatVal\|Multi\|S\|String\)\?Array/
31 syn match pirPMC /\.Perl\(Array\|Env\|Hash\|Int\|Num\|Scalar\|String\|Undef\)/
32 syn match pirPMC /\.Parrot\(Class\|Interpreter\|IO\|Library\|Object\|Thread\)/
33 syn keyword pirPMC self
35 syn keyword pirOp goto if unless global addr
37 syn match pirDirectiveSub /\.\(sub\|end\s*$\)/
38 syn match pirDirectiveMacro /\.\(macro\|endm\)/
39 syn match pirDirective /\.\(pcc_sub\|emit\|eom\)/
40 syn match pirDirective /\.\(local\|sym\|const\|lex\|global\|globalconst\)/
41 syn match pirDirective /\.\(endnamespace\|namespace\)/
42 syn match pirDirective /\.\(param\|arg\|return\|yield\)/
43 syn match pirDirective /\.\(pragma\|HLL\|include\|loadlib\)/
44 syn match pirDirective /\.\(pcc_begin\|pcc_call\|pcc_end\|invocant\|meth_call\|nci_call\)/
45 syn match pirDirective /\.\(pcc_begin_return\|pcc_end_return\)/
46 syn match pirDirective /\.\(pcc_begin_yield\|pcc_end_yield\)/
48 syn match pirDirective /:\(main\|method\|load\|init\|anon\|multi\|immediate\|outer\|lex\|vtable|nsentry\|subid\)/
49 syn match pirDirective /:\(flat\|slurpy\|optional\|opt_flag\|named\)/
52 syn match pirDirective /\.\I\i*(/he=e-1
55 " pirWord before pirRegister
56 " FIXME :: in identifiers and labels
57 syn match pirWord /[A-Za-z_][A-Za-z0-9_]*/
58 syn match pirComment /#.*/
59 syn match pirLabel /[A-Za-z0-9_]\+:/he=e-1
60 syn match pirRegister /[INPS]\([12][0-9]\|3[01]\|[0-9]\)/
61 syn match pirDollarRegister /\$[INPS][0-9]\+/
63 syn match pirNumber /[+-]\?[0-9]\+\(\.[0-9]*\([Ee][+-]\?[0-9]\+\)\?\)\?/
64 syn match pirNumber /0[xX][0-9a-fA-F]\+/
65 syn match pirNumber /0[oO][0-7]\+/
66 syn match pirNumber /0[bB][01]\+/
68 syn region pirString start=/"/ skip=/\\"/ end=/"/ contains=pirStringSpecial
69 syn region pirString start=/<<"\z(\I\i*\)"/ end=/^\z1$/ contains=pirStringSpecial
70 syn region pirString start=/<<'\z(\I\i*\)'/ end=/^\z1$/
71 syn region pirString start=/'/ end=/'/
72 syn match pirStringSpecial "\\\([abtnvfre\\"]\|\o\{1,3\}\|x{\x\{1,8\}}\|x\x\{1,2\}\|u\x\{4\}\|U\x\{8\}\|c[A-Z]\)" contained
74 " Define the default highlighting.
75 " For version 5.7 and earlier: only when not done already
76 " For version 5.8 and later: only when an item doesn't have highlighting yet
77 if version >= 508 || !exists("did_pasm_syntax_inits")
79 let did_pasm_syntax_inits = 1
80 command -nargs=+ HiLink hi link <args>
82 command -nargs=+ HiLink hi def link <args>
87 HiLink pirComment Comment
89 HiLink pirRegister Identifier
90 HiLink pirDollarRegister Identifier
93 HiLink pirString String
94 HiLink pirStringSpecial Special
95 HiLink pirNumber Number
96 HiLink pirDirective Macro
97 HiLink pirDirectiveSub Macro
98 HiLink pirDirectiveMacro Macro
99 HiLink pirOp Conditional
104 let b:current_syntax = "pir"
107 syn region foldManual start=/^\s*#.*{{{/ end=/^\s*#.*}}}/ contains=ALL keepend fold
108 syn region foldMakro start=/\.macro/ end=/^\s*\.endm/ contains=ALLBUT,pirDirectiveMacro keepend fold
109 syn region foldSub start=/\.sub/ end=/^\s*\.end/ contains=ALLBUT,pirDirectiveSub,pirDirectiveMacro keepend fold
110 syn region foldIf start=/^\s*if.*goto\s*\z(\I\i*\)\s*$/ end=/^\s*\z1:\s*$/ contains=ALLBUT,pirDirectiveSub,pirDirectiveMacro keepend fold
111 syn region foldUnless start=/^\s*unless.*goto\s*\z(\I\i*\)\s*$/ end=/^\s*\z1:\s*$/ contains=ALLBUT,pirDirectiveSub,pirDirectiveMacro keepend fold
113 " Ops -- dynamically generated from ops2vim.pl