Browse code

Added sublime syntax

neauoire authored on 05/02/2021 02:25:49
Showing 3 changed files
... ...
@@ -26,11 +26,12 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
26 26
 - `( comment )`
27 27
 
28 28
 ```
29
-;value ( alloc zero-page variable )
29
+;value ( alloc a zero-page variable )
30 30
 
31 31
 @0010 ( start at page 1 )
32 32
 
33
-,there [ ,0a ,05 GTH ] JMC
33
+,03 ,02 ADD ,05 EQU 
34
+,there ROT JMC
34 35
 
35 36
 :here
36 37
 	( when not equal )
... ...
@@ -2,15 +2,15 @@
2 2
 
3 3
 ;var1
4 4
 ;var2
5
-;var3
5
+
6
+@0100 
7
+
8
+:RESET ( --- )
6 9
 
7 10
 ,22 ,var1 STR ( store 0x22 in var1 )
8 11
 ,var1 LDR ( load var2, put value on stack )
9 12
 
10
-@0100 ( store program reset after zero-page )
11
-
12
-:RESET ( --- )
13
-  BRK
13
+BRK
14 14
 
15 15
 @c000 ( much further.. )
16 16
 
17 17
new file mode 100644
... ...
@@ -0,0 +1,45 @@
1
+%YAML 1.2
2
+---
3
+# See http://www.sublimetext.com/docs/3/syntax.html
4
+name: Uxn Assembly
5
+scopeName: usm.
6
+fileTypes: [usm]
7
+file_extensions:
8
+  - usm
9
+scope: source.usm
10
+
11
+contexts:
12
+  prototype:
13
+    - include: comments
14
+
15
+  main:
16
+    - include: keywords
17
+    - include: numbers
18
+    - include: strings
19
+
20
+  numbers:
21
+    - match: '\@(\S+)\s?'
22
+      scope: punctuation.definition
23
+      pop: true
24
+
25
+  strings:
26
+    - match: '\:(\S+)\s?'
27
+      scope: string.control
28
+      pop: true
29
+    - match: '\;(\S+)\s?'
30
+      scope: string.control
31
+      pop: true
32
+    - match: '\,(\S+)\s?'
33
+      scope: keyword.control
34
+      pop: true
35
+    - match: '\.(\S+)\s?'
36
+      scope: keyword.control
37
+      pop: true
38
+
39
+  comments:
40
+    - match: '\('
41
+      scope: punctuation.definition.comment.tome
42
+      push:
43
+        - meta_scope: comment.line.double-slash.tome
44
+        - match: '\)'
45
+          pop: true