blob: d0ba6728510fa976ae05a3e969ec3e817a7c74fd [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: JAL
3" Version: 0.1
4" Last Change: 2003 May 11
5" Maintainer: Mark Gross <mark@thegnar.org>
6" This is a syntax definition for the JAL language.
7" It is based on the Source Forge compiler source code.
8" https://sourceforge.net/projects/jal/
9"
10" TODO test.
11
12" For version 5.x: Clear all syntax items
13" For version 6.x: Quit when a syntax file was already loaded
14if version < 600
15 syntax clear
16elseif exists("b:current_syntax")
17 finish
18endif
19
20syn case ignore
21syn sync lines=250
22
23syn keyword picTodo NOTE TODO XXX contained
24
25syn match picIdentifier "[a-z_$][a-z0-9_$]*"
26syn match picLabel "^[A-Z_$][A-Z0-9_$]*"
27syn match picLabel "^[A-Z_$][A-Z0-9_$]*:"me=e-1
28
29syn match picASCII "A\='.'"
30syn match picBinary "B'[0-1]\+'"
31syn match picDecimal "D'\d\+'"
32syn match picDecimal "\d\+"
33syn match picHexadecimal "0x\x\+"
34syn match picHexadecimal "H'\x\+'"
35syn match picHexadecimal "[0-9]\x*h"
36syn match picOctal "O'[0-7]\o*'"
37
38syn match picComment ";.*" contains=picTodo
39
40syn region picString start=+"+ end=+"+
41
42syn keyword picRegister indf tmr0 pcl status fsr port_a port_b port_c port_d port_e x84_eedata x84_eeadr pclath intcon
43syn keyword picRegister f877_tmr1l f877_tmr1h f877_t1con f877_t2con f877_ccpr1l f877_ccpr1h f877_ccp1con
44syn keyword picRegister f877_pir1 f877_pir2 f877_pie1 f877_adcon1 f877_adcon0 f877_pr2 f877_adresl f877_adresh
45syn keyword picRegister f877_eeadr f877_eedath f877_eeadrh f877_eedata f877_eecon1 f877_eecon2 f628_EECON2
46syn keyword picRegister f877_rcsta f877_txsta f877_spbrg f877_txreg f877_rcreg f628_EEDATA f628_EEADR f628_EECON1
47
48" Register --- bits
49" STATUS
50syn keyword picRegisterPart status_c status_dc status_z status_pd
51syn keyword picRegisterPart status_to status_rp0 status_rp1 status_irp
52
53" pins
54syn keyword picRegisterPart pin_a0 pin_a1 pin_a2 pin_a3 pin_a4 pin_a5
55syn keyword picRegisterPart pin_b0 pin_b1 pin_b2 pin_b3 pin_b4 pin_b5 pin_b6 pin_b7
56syn keyword picRegisterPart pin_c0 pin_c1 pin_c2 pin_c3 pin_c4 pin_c5 pin_c6 pin_c7
57syn keyword picRegisterPart pin_d0 pin_d1 pin_d2 pin_d3 pin_d4 pin_d5 pin_d6 pin_d7
58syn keyword picRegisterPart pin_e0 pin_e1 pin_e2
59
60syn keyword picPortDir port_a_direction port_b_direction port_c_direction port_d_direction port_e_direction
61
62syn match picPinDir "pin_a[012345]_direction"
63syn match picPinDir "pin_b[01234567]_direction"
64syn match picPinDir "pin_c[01234567]_direction"
65syn match picPinDir "pin_d[01234567]_direction"
66syn match picPinDir "pin_e[012]_direction"
67
68
69" INTCON
70syn keyword picRegisterPart intcon_gie intcon_eeie intcon_peie intcon_t0ie intcon_inte
71syn keyword picRegisterPart intcon_rbie intcon_t0if intcon_intf intcon_rbif
72
73" TIMER
74syn keyword picRegisterPart t1ckps1 t1ckps0 t1oscen t1sync tmr1cs tmr1on tmr1ie tmr1if
75
76"cpp bits
77syn keyword picRegisterPart ccp1x ccp1y
78
79" adcon bits
80syn keyword picRegisterPart adcon0_go adcon0_ch0 adcon0_ch1 adcon0_ch2
81
82" EECON
83syn keyword picRegisterPart eecon1_rd eecon1_wr eecon1_wren eecon1_wrerr eecon1_eepgd
84syn keyword picRegisterPart f628_eecon1_rd f628_eecon1_wr f628_eecon1_wren f628_eecon1_wrerr
85
86" usart
87syn keyword picRegisterPart tx9 txen sync brgh tx9d
88syn keyword picRegisterPart spen rx9 cren ferr oerr rx9d
89syn keyword picRegisterPart TXIF RCIF
90
91" OpCodes...
92syn keyword picOpcode addlw andlw call clrwdt goto iorlw movlw option retfie retlw return sleep sublw tris
93syn keyword picOpcode xorlw addwf andwf clrf clrw comf decf decfsz incf incfsz retiw iorwf movf movwf nop
94syn keyword picOpcode rlf rrf subwf swapf xorwf bcf bsf btfsc btfss skpz skpnz setz clrz skpc skpnc setc clrc
95syn keyword picOpcode skpdc skpndc setdc clrdc movfw tstf bank page HPAGE mullw mulwf cpfseq cpfsgt cpfslt banka bankb
96
97
98syn keyword jalBoolean true false
99syn keyword jalBoolean off on
100syn keyword jalBit high low
101syn keyword jalConstant Input Output all_input all_output
102syn keyword jalConditional if else then elsif end if
103syn keyword jalLabel goto
104syn keyword jalRepeat for while forever loop
105syn keyword jalStatement procedure function
106syn keyword jalStatement return end volatile const var
107syn keyword jalType bit byte
108
109syn keyword jalModifier interrupt assembler asm put get
110syn keyword jalStatement out in is begin at
111syn keyword jalDirective pragma jump_table target target_clock target_chip name error test assert
112syn keyword jalPredefined hs xt rc lp internal 16c84 16f84 16f877 sx18 sx28 12c509a 12c508
113syn keyword jalPredefined 12ce674 16f628 18f252 18f242 18f442 18f452 12f629 12f675 16f88
114syn keyword jalPredefined 16f876 16f873 sx_12 sx18 sx28 pic_12 pic_14 pic_16
115
116syn keyword jalDirective chip osc clock fuses cpu watchdog powerup protection
117
118syn keyword jalFunction bank_0 bank_1 bank_2 bank_3 bank_4 bank_5 bank_6 bank_7 trisa trisb trisc trisd trise
119syn keyword jalFunction _trisa_flush _trisb_flush _trisc_flush _trisd_flush _trise_flush
120
121syn keyword jalPIC local idle_loop
122
123syn region jalAsm matchgroup=jalAsmKey start="\<assembler\>" end="\<end assembler\>" contains=jalComment,jalPreProc,jalLabel,picIdentifier, picLabel,picASCII,picDecimal,picHexadecimal,picOctal,picComment,picString,picRegister,picRigisterPart,picOpcode,picDirective,jalPIC
124syn region jalAsm matchgroup=jalAsmKey start="\<asm\>" end=/$/ contains=jalComment,jalPreProc,jalLabel,picIdentifier, picLabel,picASCII,picDecimal,picHexadecimal,picOctal,picComment,picString,picRegister,picRigisterPart,picOpcode,picDirective,jalPIC
125
126syn region jalPsudoVars matchgroup=jalPsudoVarsKey start="\<'put\>" end="/<is/>" contains=jalComment
127
128syn match jalStringEscape contained "#[12][0-9]\=[0-9]\="
129syn match jalIdentifier "\<[a-zA-Z_][a-zA-Z0-9_]*\>"
130syn match jalSymbolOperator "[+\-/*=]"
131syn match jalSymbolOperator "!"
132syn match jalSymbolOperator "<"
133syn match jalSymbolOperator ">"
134syn match jalSymbolOperator "<="
135syn match jalSymbolOperator ">="
136syn match jalSymbolOperator "!="
137syn match jalSymbolOperator "=="
138syn match jalSymbolOperator "<<"
139syn match jalSymbolOperator ">>"
140syn match jalSymbolOperator "|"
141syn match jalSymbolOperator "&"
142syn match jalSymbolOperator "%"
143syn match jalSymbolOperator "?"
144syn match jalSymbolOperator "[()]"
145syn match jalSymbolOperator "[\^.]"
146syn match jalLabel "[\^]*:"
147
148syn match jalNumber "-\=\<\d[0-9_]\+\>"
149syn match jalHexNumber "0x[0-9A-Fa-f_]\+\>"
150syn match jalBinNumber "0b[01_]\+\>"
151
152" String
153"wrong strings
154syn region jalStringError matchgroup=jalStringError start=+"+ end=+"+ end=+$+ contains=jalStringEscape
155
156"right strings
157syn region jalString matchgroup=jalString start=+'+ end=+'+ oneline contains=jalStringEscape
158" To see the start and end of strings:
159syn region jalString matchgroup=jalString start=+"+ end=+"+ oneline contains=jalStringEscapeGPC
160
161syn keyword jalTodo contained TODO
162syn region jalComment start=/-- / end=/$/ oneline contains=jalTodo
163syn region jalComment start=/--\t/ end=/$/ oneline contains=jalTodo
164syn match jalComment /--\_$/
165syn region jalPreProc start="include" end=/$/ contains=JalComment,jalToDo
166
167
168if exists("jal_no_tabs")
169 syn match jalShowTab "\t"
170endif
171
172
173" Define the default highlighting.
174" For version 5.7 and earlier: only when not done already
175" For version 5.8 and later: only when an item doesn't have highlighting yet
176if version >= 508 || !exists("did_jal_syn_inits")
177if version < 508
178 let did_jal_syn_inits = 1
179 command -nargs=+ HiLink hi link <args>
180else
181 command -nargs=+ HiLink hi def link <args>
182endif
183
184 HiLink jalAcces jalStatement
185 HiLink jalBoolean Boolean
186 HiLink jalBit Boolean
187 HiLink jalComment Comment
188 HiLink jalConditional Conditional
189 HiLink jalConstant Constant
190 HiLink jalDelimiter Identifier
191 HiLink jalDirective PreProc
192 HiLink jalException Exception
193 HiLink jalFloat Float
194 HiLink jalFunction Function
195 HiLink jalPsudoVarsKey Function
196 HiLink jalLabel Label
197 HiLink jalMatrixDelimiter Identifier
198 HiLink jalModifier Type
199 HiLink jalNumber Number
200 HiLink jalBinNumber Number
201 HiLink jalHexNumber Number
202 HiLink jalOperator Operator
203 HiLink jalPredefined Constant
204 HiLink jalPreProc PreProc
205 HiLink jalRepeat Repeat
206 HiLink jalStatement Statement
207 HiLink jalString String
208 HiLink jalStringEscape Special
209 HiLink jalStringEscapeGPC Special
210 HiLink jalStringError Error
211 HiLink jalStruct jalStatement
212 HiLink jalSymbolOperator jalOperator
213 HiLink jalTodo Todo
214 HiLink jalType Type
215 HiLink jalUnclassified Statement
216 HiLink jalAsm Assembler
217 HiLink jalError Error
218 HiLink jalAsmKey Statement
219 HiLink jalPIC Statement
220
221 HiLink jalShowTab Error
222
223 HiLink picTodo Todo
224 HiLink picComment Comment
225 HiLink picDirective Statement
226 HiLink picLabel Label
227 HiLink picString String
228
229 HiLink picOpcode Keyword
230 HiLink picRegister Structure
231 HiLink picRegisterPart Special
232 HiLink picPinDir SPecial
233 HiLink picPortDir SPecial
234
235 HiLink picASCII String
236 HiLink picBinary Number
237 HiLink picDecimal Number
238 HiLink picHexadecimal Number
239 HiLink picOctal Number
240
241 HiLink picIdentifier Identifier
242
243 delcommand HiLink
244endif
245
246
247let b:current_syntax = "jal"
248
249" vim: ts=8 sw=2