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