From 2fc20ad0b11e60ecfacc653024f2b582acad6e86 Mon Sep 17 00:00:00 2001 From: Moon Flower Date: Mon, 11 Aug 2025 11:34:18 +0330 Subject: ir2 initial release! --- pu2/p2m-syntax/README.md | 9 +++ pu2/p2m-syntax/language-configuration.json | 30 +++++++++ pu2/p2m-syntax/p2m-asm-syntax-0.0.1.vsix | Bin 0 -> 3130 bytes pu2/p2m-syntax/package.json | 30 +++++++++ pu2/p2m-syntax/syntaxes/p2m.tmLanguage | 105 +++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+) create mode 100644 pu2/p2m-syntax/README.md create mode 100644 pu2/p2m-syntax/language-configuration.json create mode 100644 pu2/p2m-syntax/p2m-asm-syntax-0.0.1.vsix create mode 100644 pu2/p2m-syntax/package.json create mode 100644 pu2/p2m-syntax/syntaxes/p2m.tmLanguage (limited to 'pu2/p2m-syntax') diff --git a/pu2/p2m-syntax/README.md b/pu2/p2m-syntax/README.md new file mode 100644 index 0000000..4dab972 --- /dev/null +++ b/pu2/p2m-syntax/README.md @@ -0,0 +1,9 @@ +# P2M Assembly - VSCode Syntax Extension + +This extension provides basic TextMate-based highlighting for PU2 / `.p2m` assembly files. + +## Install for development + +1. Run this script to create the files. +2. Open the `p2m-syntax` folder in VS Code and press `F5` to run an Extension Development Host with the grammar. +3. Optionally pack with `vsce package` to create a .vsix. diff --git a/pu2/p2m-syntax/language-configuration.json b/pu2/p2m-syntax/language-configuration.json new file mode 100644 index 0000000..92ebca0 --- /dev/null +++ b/pu2/p2m-syntax/language-configuration.json @@ -0,0 +1,30 @@ +{ + "comments": { + "lineComment": "#" + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "'", "close": "'", "notIn": ["string"] }, + { "open": "\"", "close": "\"", "notIn": ["string"] } + ], + "surroundingPairs": [ + { "open": "{", "close": "}" }, + { "open": "[", "close": "]" }, + { "open": "(", "close": ")" }, + { "open": "'", "close": "'" }, + { "open": "\"", "close": "\"" } + ], + "folding": { + "markers": { + "start": "^\\s*\\{", + "end": "^\\s*\\}" + } + } +} diff --git a/pu2/p2m-syntax/p2m-asm-syntax-0.0.1.vsix b/pu2/p2m-syntax/p2m-asm-syntax-0.0.1.vsix new file mode 100644 index 0000000..65e5608 Binary files /dev/null and b/pu2/p2m-syntax/p2m-asm-syntax-0.0.1.vsix differ diff --git a/pu2/p2m-syntax/package.json b/pu2/p2m-syntax/package.json new file mode 100644 index 0000000..71b10a7 --- /dev/null +++ b/pu2/p2m-syntax/package.json @@ -0,0 +1,30 @@ +{ + "name": "p2m-asm-syntax", + "displayName": "P2M Assembly (p2m)", + "description": "TextMate grammar for the PU2 / .p2m assembly + small language config for VS Code.", + "version": "0.0.1", + "publisher": "moonflower", + "engines": { + "vscode": "^1.50.0" + }, + "categories": [ + "Programming Languages" + ], + "contributes": { + "languages": [ + { + "id": "p2m", + "aliases": ["p2m", "P2M", "p2m-asm"], + "extensions": [".p2m"], + "configuration": "./language-configuration.json" + } + ], + "grammars": [ + { + "language": "p2m", + "scopeName": "source.p2m", + "path": "./syntaxes/p2m.tmLanguage" + } + ] + } +} 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 @@ + + + + + name + P2M Assembly + + scopeName + source.p2m + + fileTypes + + p2m + + + patterns + + + + + name + comment.line.number-sign.p2m + match + #.*$ + + + + + name + punctuation.section.block.p2m + match + [\{\}] + + + + + name + keyword.control.mnemonic.p2m + match + \b(?:hlt|imm|lod|str|swp|add|sub|and|nnd)\b + + + + + name + variable.other.register.p2m + match + \b(?:a|b|c|v)\b + + + + + name + variable.other.memory.p2m + match + \bm\[\s*\d+\s*\] + + + + + name + variable.parameter.memory-index.p2m + match + @\d+ + + + + + name + constant.numeric.hex.p2m + match + \b0x[0-9A-Fa-f]+\b + + + name + constant.numeric.decimal.p2m + match + \b\d+\b + + + + + name + string.quoted.single.p2m + match + '(.) + + + + + name + comment.block.annotation.p2m + match + \([^\)]*\) + + + + + repository + + scope + source.p2m + + -- cgit v1.2.3