aboutsummaryrefslogtreecommitdiff
path: root/pu2/p2m-syntax/syntaxes
diff options
context:
space:
mode:
Diffstat (limited to 'pu2/p2m-syntax/syntaxes')
-rw-r--r--pu2/p2m-syntax/syntaxes/p2m.tmLanguage105
1 files changed, 105 insertions, 0 deletions
diff --git a/pu2/p2m-syntax/syntaxes/p2m.tmLanguage b/pu2/p2m-syntax/syntaxes/p2m.tmLanguage
new file mode 100644
index 0000000..3aa35e0
--- /dev/null
+++ b/pu2/p2m-syntax/syntaxes/p2m.tmLanguage
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>name</key>
+ <string>P2M Assembly</string>
+
+ <key>scopeName</key>
+ <string>source.p2m</string>
+
+ <key>fileTypes</key>
+ <array>
+ <string>p2m</string>
+ </array>
+
+ <key>patterns</key>
+ <array>
+
+ <!-- comments -->
+ <dict>
+ <key>name</key>
+ <string>comment.line.number-sign.p2m</string>
+ <key>match</key>
+ <string>#.*$</string>
+ </dict>
+
+ <!-- block braces -->
+ <dict>
+ <key>name</key>
+ <string>punctuation.section.block.p2m</string>
+ <key>match</key>
+ <string>[\{\}]</string>
+ </dict>
+
+ <!-- mnemonics / instructions -->
+ <dict>
+ <key>name</key>
+ <string>keyword.control.mnemonic.p2m</string>
+ <key>match</key>
+ <string>\b(?:hlt|imm|lod|str|swp|add|sub|and|nnd)\b</string>
+ </dict>
+
+ <!-- registers (single-letter a b c v) -->
+ <dict>
+ <key>name</key>
+ <string>variable.other.register.p2m</string>
+ <key>match</key>
+ <string>\b(?:a|b|c|v)\b</string>
+ </dict>
+
+ <!-- memory references like m[10] -->
+ <dict>
+ <key>name</key>
+ <string>variable.other.memory.p2m</string>
+ <key>match</key>
+ <string>\bm\[\s*\d+\s*\]</string>
+ </dict>
+
+ <!-- at-index references like @0 -->
+ <dict>
+ <key>name</key>
+ <string>variable.parameter.memory-index.p2m</string>
+ <key>match</key>
+ <string>@\d+</string>
+ </dict>
+
+ <!-- numeric literals -->
+ <dict>
+ <key>name</key>
+ <string>constant.numeric.hex.p2m</string>
+ <key>match</key>
+ <string>\b0x[0-9A-Fa-f]+\b</string>
+ </dict>
+ <dict>
+ <key>name</key>
+ <string>constant.numeric.decimal.p2m</string>
+ <key>match</key>
+ <string>\b\d+\b</string>
+ </dict>
+
+ <!-- quoted chars -->
+ <dict>
+ <key>name</key>
+ <string>string.quoted.single.p2m</string>
+ <key>match</key>
+ <string>'(.)</string>
+ </dict>
+
+ <!-- inline annotations -->
+ <dict>
+ <key>name</key>
+ <string>comment.block.annotation.p2m</string>
+ <key>match</key>
+ <string>\([^\)]*\)</string>
+ </dict>
+
+ </array>
+
+ <key>repository</key>
+ <dict/>
+ <key>scope</key>
+ <string>source.p2m</string>
+ </dict>
+</plist>