OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [zip.vim] - Blame information for rev 202

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 69 dgisselq
" Vim syntax file
2
" Language:     Zip CPU Assembly Language
3
" Maintainer:   Dan Gisselquist
4 198 dgisselq
" Last Change:  2016 Sep 24
5 69 dgisselq
"
6 198 dgisselq
"/////////////////////////////////////////////////////////////////////////////
7
"/
8
"/ Filename:    zip.vim
9
"/
10
"/ Project:     Zip CPU -- a small, lightweight, RISC CPU soft core
11
"/
12
"/ Purpose:     A VIM syntax file for hilighting Zip Assembly files within
13
"/              vim.
14
"/
15
"/
16
"/ Creator:     Dan Gisselquist, Ph.D.
17
"/              Gisselquist Technology, LLC
18
"/
19
"///////////////////////////////////////////////////////////////////////////////
20
"/
21
"/ Copyright (C) 2015-2016, Gisselquist Technology, LLC
22
"/
23
"/ This program is free software (firmware): you can redistribute it and/or
24
"/ modify it under the terms of  the GNU General Public License as published
25
"/ by the Free Software Foundation, either version 3 of the License, or (at
26
"/ your option) any later version.
27
"/
28
"/ This program is distributed in the hope that it will be useful, but WITHOUT
29
"/ ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
30
"/ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
31
"/ for more details.
32
"/
33
"/ License:     GPL, v3, as defined and found on www.gnu.org,
34
"/              http://www.gnu.org/licenses/gpl.html
35
"/
36
"/
37
"///////////////////////////////////////////////////////////////////////////////
38
"/
39
"/
40 69 dgisselq
" This is a ZipCPU syntax highlight definition file for use with VIM.
41
 
42
" Run this wih :set syntax=zip
43
"       Look up new-filetype for autodetection
44
 
45
if exists("b:current_syntax")
46
  finish
47
endif
48
 
49
"ignore case for assembly
50
syn case ignore
51
 
52
"  Identifier Keyword characters (defines \k)
53
if version >= 600
54
        setlocal iskeyword=@,48-57,#,$,:,?,@-@,_,~
55
endif
56
 
57
syn sync minlines=5
58
 
59
syn region zipComment start=";" end="$" contains=zipTodo,@Spell
60
syn region zipComment start="//" end="$" contains=zipTodo,@Spell
61
syn region zipComment start="/\*" end="\*/" contains=zipTodo,@Spell
62
" syn match zipComment ";.*" contains=zipTodo
63
 
64
syn match zipIdentifier "[a-zA-Z_$][a-zA-Z0-9_$]*"
65
" syn match zipDirective                "\.[a-zA-Z_$][a-zA-Z_$.]\+"
66
syn match zipLabel              "[a-zA-Z_$.][a-zA-Z0-9_$.]*\s\=:\>"he=e-1
67
syn region zipstring            start=+"+ skip=+\\\\\|\\"+ end=+"+
68
syn region zipcharstr           start=+'+ skip=+\\\\\|\\'+ end=+'+
69
syn match zipOctal              "\$\=0[0-7_]*\>"
70
syn match zipBinary             "\$\=0[bB][01_]*\>"
71
syn match zipHex                "\$\=0[xX][0-9a-fA-F_]*\>"
72
syn match zipDecimal            "\$\=[1-9_][0-9_]*\>"
73
" syn match zipFloat            "\$\=[0-9_]*\.[0-9_]*\([eE][+-]\=[0-9_]*\)\=\>"
74
 
75
"simple instructions
76 202 dgisselq
syn keyword zipopcode sub and add or xor lsr lsl asr
77
syn keyword zipopcode brev ldilo mpyuhi mpyshi mpy mov divu divs
78
syn keyword zipopcode cmp tst test lw sw lh sh lb sb ldi
79
syn keyword zipopcode fpadd fpsub fpmul fpdiv fpi2f fpf2i
80 69 dgisselq
syn keyword zipopcode noop break brk lock
81 202 dgisselq
syn keyword zipopcode bz beq bnz bne bc bnc bv bra blt bge ljmp jsr ljsr
82
syn keyword zipopcode clr halt wait jmp ljmp not trap busy neg rtu retn
83
syn keyword zipopcode sim sexit nexit sdump ndump snoop sdump sstr nstr
84 69 dgisselq
 
85
"delimiters
86
 
87
"operators
88
syn match zipoperators "[()#,]"
89
" syn match zipoperators "\(+\|\*\|-\|/\|\\\|^\|&\|\|=\)"
90
 
91
"TODO
92
syn match zipTodo      "\(TODO\|XXX\|FIXME\|NOTE\)"
93
 
94 202 dgisselq
syn keyword zipCondition z ne nz ge lt n nc c v
95 69 dgisselq
 
96
"The regex for different zip registers are given below
97
syn match zipregisters "[us]\=R\([0-9]\|1[0-5]\)\>"
98 202 dgisselq
syn keyword zipregisters gbl sp cc pc lr fp ulr ufp usp ucc upc
99 69 dgisselq
"floating point classes
100
 
101
"Data allocation syntax
102 202 dgisselq
syn match zipdata "\.ascii\s*\>"
103
syn match zipdata "\.asciz\s*\>"
104
syn match zipdata "\.byte\s*\>"
105
syn match zipdata "\.short\s*\>"
106
syn match zipdata "\.word\s*\>"
107
syn match zipdata "\.int\s*\>"
108
syn match zipdata "\.long\s*\>"
109
syn match zipdata "\.single\s*\>"
110
syn match zipdata "\.float\s*\>"
111
syn match zipdata "\.skip\s*\>"
112
syn match zipdata "\.fill\s*\>"
113
syn match zipdata "\.set\s*\>"
114
syn match zipdata "string8\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
115
syn match zipdata "string16\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
116
syn match zipdata "string32\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
117
syn match zipdata "string64\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
118 69 dgisselq
 
119
" Define the default highlighting.
120
" For version 5.8 and later: only when an item doesn't have highlighting yet
121
if version >= 508 || !exists("did_zip_syn_inits")
122
        command -nargs=+ HiLink hi def link 
123
 
124
        "zip specific stuff
125
        HiLink zipLabel         Define
126
        HiLink zipComment       Comment
127
        HiLink zipDirective     Type
128
        HiLink zipopcode        Statement
129
        HiLink zipCondition     Statement
130
        HiLink zipregisters     Operator
131
        HiLink zipstring        String
132
        HiLink zipcharstr       Character
133
        HiLink zipDecimal       Number
134
        HiLink zipHex           Number
135
        HiLink zipBinary        Number
136
        HiLink zipOctal Number
137
        HiLink zipIdentifier    Identifier
138
        HiLink zipdata          Type
139
        HiLink zipdelimiter     Delimiter
140
        HiLink zipoperator      Operator
141
        HiLink zipTodo          Todo
142
 
143
        " HiLink ia64Float      Float
144
        delcommand HiLink
145
endif
146
 
147
let b:current_syntax = "zip"
148
 
149
" vim: ts=8 sw=2

powered by: WebSVN 2.1.0

© copyright 1999-2022 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.