commit 9c7822280222afc01ad9c958cd36939fd8c0919a
parent 7ba9782459adba7b3e58f82a7df88da721319980
Author: neauoire <aliceffekt@gmail.com>
Date: Thu, 4 Feb 2021 18:25:49 -0800
Added sublime syntax
Diffstat:
3 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
@@ -26,11 +26,12 @@ cc uxn.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o uxn
- `( comment )`
```
-;value ( alloc zero-page variable )
+;value ( alloc a zero-page variable )
@0010 ( start at page 1 )
-,there [ ,0a ,05 GTH ] JMC
+,03 ,02 ADD ,05 EQU
+,there ROT JMC
:here
( when not equal )
diff --git a/examples/core.usm b/examples/core.usm
@@ -2,15 +2,15 @@
;var1
;var2
-;var3
+
+@0100
+
+:RESET ( --- )
,22 ,var1 STR ( store 0x22 in var1 )
,var1 LDR ( load var2, put value on stack )
-@0100 ( store program reset after zero-page )
-
-:RESET ( --- )
- BRK
+BRK
@c000 ( much further.. )
diff --git a/extras/usm.sublime-syntax b/extras/usm.sublime-syntax
@@ -0,0 +1,45 @@
+%YAML 1.2
+---
+# See http://www.sublimetext.com/docs/3/syntax.html
+name: Uxn Assembly
+scopeName: usm.
+fileTypes: [usm]
+file_extensions:
+ - usm
+scope: source.usm
+
+contexts:
+ prototype:
+ - include: comments
+
+ main:
+ - include: keywords
+ - include: numbers
+ - include: strings
+
+ numbers:
+ - match: '\@(\S+)\s?'
+ scope: punctuation.definition
+ pop: true
+
+ strings:
+ - match: '\:(\S+)\s?'
+ scope: string.control
+ pop: true
+ - match: '\;(\S+)\s?'
+ scope: string.control
+ pop: true
+ - match: '\,(\S+)\s?'
+ scope: keyword.control
+ pop: true
+ - match: '\.(\S+)\s?'
+ scope: keyword.control
+ pop: true
+
+ comments:
+ - match: '\('
+ scope: punctuation.definition.comment.tome
+ push:
+ - meta_scope: comment.line.double-slash.tome
+ - match: '\)'
+ pop: true