From 6b4d6d923910f66830d511d4dd8cb3ca4552bd02 Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Sun, 21 Jan 2024 18:19:13 -0500 Subject: [PATCH 1/2] Add (u)short --- src/index.ts | 1 + src/property.ts | 6 ++++++ syntax-highlighting/def.nanorc | 2 +- syntax-highlighting/ksyntaxhighlighting.xml | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index e62055d..000765f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -154,6 +154,7 @@ function makeMainHeader(output: string) { result += '#pragma GCC diagnostic ignored "-Wunused-function"\n'; result += '\n// Shortcuts\n'; result += 'typedef unsigned char uchar;\n'; + result += 'typedef unsigned short ushort;\n'; result += 'typedef unsigned int uint;\n'; result += '\n// Forward Declarations\n'; for (const name in STRUCTURE_FILES) { diff --git a/src/property.ts b/src/property.ts index 6c1014a..e1a83dc 100644 --- a/src/property.ts +++ b/src/property.ts @@ -52,6 +52,9 @@ export class SimpleProperty implements Property { } else if (this.#type === 'char' || this.#type === 'uchar') { // Character return 1; + } else if (this.#type === 'short' || this.#type === 'ushort') { + // Short + return 2; } else if (this.#type.startsWith('std::vector<')) { // C++ Vector return 12; @@ -82,6 +85,9 @@ export class SimpleProperty implements Property { } else if (this.#type === 'char' || this.#type === 'uchar') { // Character return 1; + } else if (this.#type === 'short' || this.#type === 'ushort') { + // Short + return 1; } else if (this.#type.startsWith('std::vector<')) { // C++ Vector return 4; diff --git a/syntax-highlighting/def.nanorc b/syntax-highlighting/def.nanorc index f4ff968..15eb237 100644 --- a/syntax-highlighting/def.nanorc +++ b/syntax-highlighting/def.nanorc @@ -5,7 +5,7 @@ comment "//" color magenta "\<(extends|size|vtable(-size)?|property|static-property(-array)?|((static|virtual)-)?method|constructor)\>" # Types -color green "\<(char|uchar|int|uint|float|bool|void|std::(string|vector|map))\>" +color green "\<(char|uchar|short|ushort|int|uint|float|bool|void|std::(string|vector|map))\>" # Numbers color yellow "0x[a-f0-9]+" diff --git a/syntax-highlighting/ksyntaxhighlighting.xml b/syntax-highlighting/ksyntaxhighlighting.xml index 85ab9c9..b355ed4 100644 --- a/syntax-highlighting/ksyntaxhighlighting.xml +++ b/syntax-highlighting/ksyntaxhighlighting.xml @@ -17,6 +17,8 @@ char uchar + short + ushort int uint float -- 2.45.2 From 0b696bd55b31416929d0a29d84ad50ab5ba0ceae Mon Sep 17 00:00:00 2001 From: Bigjango13 Date: Sun, 21 Jan 2024 18:42:52 -0500 Subject: [PATCH 2/2] Fix short alignment --- src/property.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/property.ts b/src/property.ts index e1a83dc..28fa3da 100644 --- a/src/property.ts +++ b/src/property.ts @@ -87,7 +87,7 @@ export class SimpleProperty implements Property { return 1; } else if (this.#type === 'short' || this.#type === 'ushort') { // Short - return 1; + return 2; } else if (this.#type.startsWith('std::vector<')) { // C++ Vector return 4; -- 2.45.2