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

Subversion Repositories zipcpu

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

Go to most recent revision | 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
syn keyword zipopcode sub and add or xor lsr lsl asr lhi llo ldihi ldilo
77
syn keyword zipopcode mpyu mpys divu divs
78
syn keyword zipopcode brev popc rol mov cmp tst lod sto ldi
79
syn keyword zipopcode noop break brk lock
80
syn keyword zipopcode fpadd fpsub fpmul fpdiv dpcvt fpint
81
syn keyword zipopcode bz beq bnz bc brc brv bv bra blt bgt bge
82
syn keyword zipopcode clr halt wait clrf jmp ljmp not trap busy neg rtu
83
 
84
"delimiters
85
 
86
"operators
87
syn match zipoperators "[()#,]"
88
" syn match zipoperators "\(+\|\*\|-\|/\|\\\|^\|&\|\|=\)"
89
 
90
"TODO
91
syn match zipTodo      "\(TODO\|XXX\|FIXME\|NOTE\)"
92
 
93
syn keyword zipCondition z ne nz ge gt lt n c v
94
 
95
"The regex for different zip registers are given below
96
syn match zipregisters "[us]\=R\([0-9]\|1[0-5]\)\>"
97
syn keyword zipregisters gbl sp cc pc usp ucc upc
98
"floating point classes
99
 
100
"Data allocation syntax
101
syn match zipdata "word\s*\>"
102
syn match zipdata "fill\s*\>"
103
syn match zipdata "stringz\=\(\(\(\.ua\)\=\(\.msb\|\.lsb\)\=\)\|\(\(\.msb\|\.lsb\)\=\(\.ua\)\=\)\)\=\>"
104
 
105
" Define the default highlighting.
106
" For version 5.8 and later: only when an item doesn't have highlighting yet
107
if version >= 508 || !exists("did_zip_syn_inits")
108
        command -nargs=+ HiLink hi def link 
109
 
110
        "zip specific stuff
111
        HiLink zipLabel         Define
112
        HiLink zipComment       Comment
113
        HiLink zipDirective     Type
114
        HiLink zipopcode        Statement
115
        HiLink zipCondition     Statement
116
        HiLink zipregisters     Operator
117
        HiLink zipstring        String
118
        HiLink zipcharstr       Character
119
        HiLink zipDecimal       Number
120
        HiLink zipHex           Number
121
        HiLink zipBinary        Number
122
        HiLink zipOctal Number
123
        HiLink zipIdentifier    Identifier
124
        HiLink zipdata          Type
125
        HiLink zipdelimiter     Delimiter
126
        HiLink zipoperator      Operator
127
        HiLink zipTodo          Todo
128
 
129
        " HiLink ia64Float      Float
130
        delcommand HiLink
131
endif
132
 
133
let b:current_syntax = "zip"
134
 
135
" vim: ts=8 sw=2

powered by: WebSVN 2.1.0

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