Browse code

Added tal syntax highlight for nano

neauoire authored on 26/11/2021 16:11:18
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,51 @@
1
+# include this file in your ~/.nanorc:
2
+# include "path/to/uxntal.nanorc"
3
+
4
+syntax "uxntal" "\.tal$"
5
+
6
+# numbers
7
+color lightblue "[0-9a-f]{2}(\s|$)"
8
+color lightblue "[0-9a-f]{4}(\s|$)"
9
+
10
+# literal hex
11
+color cyan "#[0-9a-f]{2}(\s|$)"
12
+color cyan "#[0-9a-f]{4}(\s|$)"
13
+
14
+# absolute pad
15
+color bold,blue "\|[0-9a-f]{2}"
16
+color bold,blue "\|[0-9a-f]{4}"
17
+
18
+# labels
19
+# label define
20
+color green "@\S+"
21
+# sub-label define
22
+color green "&\S+"
23
+# literal addr absolute
24
+color magenta ";\S+"
25
+# literal addr relative
26
+color magenta ",\S+"
27
+# literal addr zero page
28
+color lightmagenta "\.\S+"
29
+
30
+# raw
31
+# character
32
+color lightred "'\S"
33
+# string
34
+color lightred ""\S+"
35
+# addr
36
+color lightyellow ":\S+"
37
+
38
+# include
39
+color lightcyan "~\S+"
40
+
41
+# macros definition
42
+color yellow "\%\S+"
43
+color yellow "[{}]"
44
+
45
+# instructions
46
+color bold,cyan "(BRK|LIT|INC|POP|DUP|NIP|SWP|OVR|ROT|EQU|NEQ|GTH|LTH|JMP|JCN|JSR|STH|LDZ|STZ|LDR|STR|LDA|STA|DEI|DEO|ADD|SUB|MUL|DIV|AND|ORA|EOR|SFT)[2kr]{,3}(\s|$)"
47
+
48
+# comments
49
+comment "( | )"
50
+color blue start="\(" end="\)"
51
+
0 52
similarity index 100%
1 53
rename from etc/tal.sublime-syntax
2 54
rename to etc/syntax-highlight/tal.sublime-syntax
... ...
@@ -282,8 +282,6 @@ parsetoken(char *w)
282 282
 		pushbyte((Uint8)w[1], 0);
283 283
 		return 1;
284 284
 	} else if(w[0] == '#') { /* immediate */
285
-		if(slen(w + 1) == 1)
286
-			pushbyte((Uint8)w[1], 1);
287 285
 		if(sihx(w + 1) && slen(w + 1) == 2)
288 286
 			pushbyte(shex(w + 1), 1);
289 287
 		else if(sihx(w + 1) && slen(w + 1) == 4)