summaryrefslogtreecommitdiffstats
path: root/syntax/pasm.vim
blob: 1eaf27b2bc5eaabf92041bd326d86ade0653d693 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
" Vim syntax file
" Language:	Parrot Assembler
" Maintainer:	Scott Beck <scott@gossamer-threads.com>
" Last Change:	2002 Feb 28

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
  syntax clear
elseif exists("b:current_syntax")
  finish
endif

syn include @Pod syntax/pod.vim
syn region myPod start="^=pod" start="^=item" start="^=head" end="^=cut" keepend contains=@Pod

syn match pasmIdentifier "[A-Za-z0-9_]\+"
syn match pasmLabel      "[A-Za-z0-9_]\+:"he=e-1
syn match pasmComment    "#.*"

" Only have 32 registers
syn match pasmINT "I\(\([1-2][0-9]\)\|\(3[0-2]\)\|[1-9]\)"
syn match pasmSTR "S\(\([1-2][0-9]\)\|\(3[0-2]\)\|[1-9]\)"
syn match pasmFLT "N\(\([1-2][0-9]\)\|\(3[0-2]\)\|[1-9]\)"
syn match pasmPMC "P\(\([1-2][0-9]\)\|\(3[0-2]\)\|[1-9]\)"

syn match pasmNumber "[0-9]\+"
syn match pasmString +"[^"]\+"+

syn keyword pasmOpBasic         end noop
syn keyword pasmOpSystem        close err open readline ord print read time write
syn keyword pasmOpRegLoad       set set_keyed clone
syn keyword pasmOpCond          eq ne lt le gt ge if unless
syn keyword pasmOpArith         abs add cmod dec div inc mod mul not pow sub 
syn keyword pasmOpString        chopm concat repeat length substr 
syn keyword pasmOpMath          acos asec asin atan cos cosh exp ln log10 log2 sec sech sin sinh tan tanh
syn keyword pasmOpBit           and not or shl shr xor
syn keyword pasmOpFlags         debug bounds profile trace
syn keyword pasmOpReg           cleari clearn clearp clears popi popn popp pops pushi pushn pushp pushs
syn keyword pasmOpRegStack      entrytype save restore rotate_up
syn keyword pasmOpCtrlFlow      branch bsr jsr jump
syn keyword pasmOpSymbolTbl     find_global 
syn keyword pasmOpMisc          newinterp runinterp new find_type ret sleep setline getline setfile getfile setpackage getpackage warningson warningsoff

" Define the default highlighting.
" For version 5.7 and earlier: only when not done already
" For version 5.8 and later: only when an item doesn't have highlighting yet
if version >= 508 || !exists("did_pasm_syntax_inits")
  if version < 508
    let did_pasm_syntax_inits = 1
    command -nargs=+ HiLink hi link <args>
  else
    command -nargs=+ HiLink hi def link <args>
  endif

  HiLink pasmLabel       Label
  HiLink pasmIdentifier  Identifier
  HiLink pasmINT         Type
  HiLink pasmSTR         Type
  HiLink pasmFLT         Type
  HiLink pasmPMC         Type
  HiLink pasmNumber      Number
  HiLink pasmString      String
  HiLink pasmComment     Comment
  HiLink pasmOp          Statement
  HiLink pasmOpBasic     pasmOp
  HiLink pasmOpSystem    pasmOp
  HiLink pasmOpRegLoad   pasmOp
  HiLink pasmOpCond      pasmOp
  HiLink pasmOpArith     pasmOp
  HiLink pasmOpString    pasmOp
  HiLink pasmOpMath      pasmOp
  HiLink pasmOpBit       pasmOp
  HiLink pasmOpFlags     pasmOp
  HiLink pasmOpReg       pasmOp
  HiLink pasmOpRegStack  pasmOp
  HiLink pasmOpCtrlFlow  pasmOp
  HiLink pasmOpSymbolTbl pasmOp
  HiLink pasmOpMisc      pasmOp

  delcommand HiLink
endif

let b:current_syntax = "pasm"

" vim: ts=8