16ca4c06021e88d34c55fb3300fe34d0d6125e21
[alioth/jupp.git] / syntax / asm.jsf.in
1 # $MirOS: contrib/code/jupp/syntax/asm.jsf.in,v 1.3 2012/09/02 14:46:51 tg Exp $
2 #-
3 # JOE syntax highlight file for assembly language
4
5 # Highlights ';' comments, C-preprocessor stuff and C-like constants.
6
7 # Some assembly languages do not use C-preprocessor and use '#' for
8 # comments.  For them, eliminate all states up to ':idle'. and change the
9 # ";" line in 'idle' to '#'.
10
11 # For UNIX assembly ';' actually separates instructions, but I've only seen
12 # this for 'rep; movsb'.  If it bothers you eliminate the ';' line in
13 # ':idle'.
14
15 # This highlighter is too strict for numeric constants.  Many assembly
16 # languages allow '000009', which looks like a bad octal constant in C/UNIX.
17
18
19 # Always reparse from beginning
20 -
21
22
23 =Idle
24 =Bad            bold red
25 =Preproc        blue
26 =Define         bold blue
27 =Comment        green
28 =IncLocal       cyan
29 =IncSystem      bold cyan
30 =Constant       cyan
31 =Escape         bold cyan
32 =Type           bold
33 =Keyword        bold
34 =CppKeyword     bold
35 =Brace
36 =Control
37
38 :reset Idle
39         *               first           noeat
40         " \t"           reset
41
42 :first Idle
43         *               idle            noeat
44         "#"             pre             recolor=-1
45
46 :pre Preproc
47         *               preproc         noeat
48         " \t"           pre
49         "a-z"           preident        recolor=-1 buffer
50
51 :preident Preproc
52         *               preproc         noeat strings
53         "define"        predef
54         "include"       preinc
55 done
56         "a-z"           preident
57
58 :preinc Preproc
59         *               preinc
60         " \t"           preinc_ws
61         "\n"            reset
62         
63 :preinc_ws Preproc
64         *               prebad          recolor=-1
65         " \t"           preinc_ws
66         "\""            preinc_local    recolor=-1
67         "<"             preinc_system   recolor=-1
68
69 :preinc_local IncLocal
70         *               preinc_local
71         "\"\n"          reset
72         
73 :preinc_system IncSystem
74         *               preinc_system
75         ">\n"           reset
76
77 :prebad Bad     
78         *               prebad
79         "\n"            reset
80
81
82 :predef Preproc
83         *               predef
84         " \t"           predef_ws
85         "\n"            reset
86         
87 :predef_ws Preproc
88         *               prebad          recolor=-1
89         " \t"           predef_ws
90         "a-zA-Z0-9_"    predef_ident    recolor=-1
91
92 :predef_ident Define
93         *               idle            noeat
94         "a-zA-Z0-9_"    predef_ident
95
96
97 :preproc Preproc
98         *               preproc
99         "\n"            reset
100         "\\"            preproc_cont
101         "/"             preproc_slash
102         
103 :preproc_slash Preproc
104         *               preproc         noeat
105         "*"             comment         recolor=-2
106         "/"             line_comment    recolor=-2
107         
108 :preproc_cont Preproc
109         *               preproc_cont
110         "\n"            preproc
111
112 # All following states are for when we're not in a preprocessor line
113
114 :idle Idle
115         *               idle
116         ";"             line_comment    recolor=-1
117         "\n"            reset
118         "/"             slash
119         "0"             first_digit     recolor=-1
120         "1-9"           decimal recolor=-1
121         "."             maybe_float
122         "\""            string          recolor=-1
123         "'"             char            recolor=-1
124         "a-zA-Z_"       ident           buffer
125         "{}"            brace           recolor=-1
126         ",:=()><[]*&|!~+\-%^"   control         recolor=-1
127
128 :brace Brace
129         *       idle    noeat
130
131 :control Control
132         *       idle    noeat
133
134 :slash Idle
135         *               idle            noeat recolor=-2        # Not sure about this
136         "*"             comment         recolor=-2
137         "/"             line_comment    recolor=-2
138
139 :comment Comment
140         *               comment
141         "*"             maybe_end_comment
142
143 :maybe_end_comment Comment
144         *               comment
145         "/"             idle
146         "*"             maybe_end_comment
147
148 :line_comment Comment
149         *               line_comment
150         "\n"            reset
151
152 :first_digit Constant
153         *               idle    noeat
154         "xX"            hex
155         "."             float
156         "eE"            epart
157         "0-7"           octal
158         "89"            bad_number      recolor=-1
159
160 :bad_number Bad
161         *               idle    noeat
162         "0-9"           bad_number
163
164 :octal Constant
165         *               idle    noeat
166         "0-7"           octal
167         "89"            bad_number      recolor=-1
168
169 :hex Constant
170         *               idle    noeat
171         "0-9A-Fa-f"     hex
172
173 :decimal Constant
174         *               idle    noeat
175         "0-9"           decimal
176         "eE"            epart
177         "."             float
178
179 :maybe_float Constant
180         *               idle    recolor=-2      noeat
181         "0-9"           float           recolor=-2
182
183 :float Constant
184         *               idle    noeat
185         "eE"            epart
186         "0-9"           float
187
188 :epart Constant
189         *               idle    noeat
190         "0-9+\-"        enum
191
192 :enum Constant
193         *               idle    noeat
194         "0-9"           enum
195
196 :string Constant
197         *               string
198         "\""            idle
199         "\\"            string_escape   recolor=-1
200         "%"             string_control  recolor=-1
201
202 :string_escape Escape
203         *               string
204         "x"             string_hex1
205         "0-7"           string_octal2
206         "\n"            string          recolor=-2
207
208 :string_hex1 Escape
209         *               string          noeat
210         "0-9a-fA-F"     string_hex2
211
212 :string_hex2 Escape
213         *               string          noeat
214         "0-9a-fA-F"     string
215
216 :string_octal2 Escape
217         *               string          noeat
218         "0-7"           string_octal3
219
220 :string_octal3 Escape
221         *               string          noeat
222         "0-7"           string
223
224 :string_control Escape
225         *               string_control
226         "\n"            reset
227         "diouxXeEfFgGaAcspn%SC" string
228
229 :char Constant
230         *               char
231         "\n"            reset
232         "'"             idle
233         "\\"            char_escape     recolor=-1
234
235 :char_escape    Escape
236         *               char
237         "x"             char_hex1
238         "0-7"           char_octal2
239         "\n"            char            recolor=-2
240
241 :char_hex1 Escape
242         *               char            noeat
243         "0-9a-fA-F"     char_hex2
244
245 :char_hex2 Escape
246         *               char            noeat
247         "0-9a-fA-F"     char
248
249 :char_octal2 Escape
250         *               char            noeat
251         "0-7"           char_octal3
252
253 :char_octal3 Escape
254         *               char            noeat
255         "0-7"           char
256
257 :ident Idle
258         *               idle            noeat
259         "a-zA-Z0-9_"    ident