diff --git a/src/struct.ts b/src/struct.ts index 7aa5801..e3e0b55 100644 --- a/src/struct.ts +++ b/src/struct.ts @@ -202,6 +202,7 @@ export class Struct { if (!method.isInherited) { out += method.generateTypedef(); out += `extern ${method.generateDefinition()}`; + out += `extern ${method.generateDefinition('_unedited')}`; out += method.generateNewMethodTest(this.#directParent, '', ''); } } @@ -260,6 +261,8 @@ export class Struct { if (!method.isInherited) { init += `${INDENT}${method.getName()} = (${method.getType()}) ${toHex(method.address)};\n`; declarations += method.generateDefinition(); + init += `${INDENT}${method.getName()}_unedited = (${method.getType()}) ${toHex(method.address)};\n`; + declarations += method.generateDefinition('_unedited'); } } diff --git a/src/vtable.ts b/src/vtable.ts index 2c6b777..fee31e2 100644 --- a/src/vtable.ts +++ b/src/vtable.ts @@ -130,6 +130,7 @@ export class VTable { if (info) { const type = `${info.getType()} *`; out += `extern ${type}${info.getName()}_vtable_addr;\n`; + out += `extern ${info.generateDefinition('_non_virtual')}`; out += info.generateNewMethodTest(directParent, '*', '_vtable_addr'); } } @@ -166,6 +167,8 @@ export class VTable { const type = `${info.getType()} *`; init += `${INDENT}${info.getName()}_vtable_addr = (${type}) ${toHex(vtableAddress)};\n`; declarations += `${type}${info.getName()}_vtable_addr;\n`; + init += `${INDENT}${info.getName()}_non_virtual = *${info.getName()}_vtable_addr;\n`; + declarations += info.generateDefinition('_non_virtual'); } } } diff --git a/syntax-highlighting/def.nanorc b/syntax-highlighting/def.nanorc index 926abe1..6f65e84 100644 --- a/syntax-highlighting/def.nanorc +++ b/syntax-highlighting/def.nanorc @@ -1,17 +1,34 @@ syntax def "\.def$" comment "//" +# Mistakes +# Missing semicolon +color red "[^;]$" +# Missing type +color red "^(((static|virtual)-)?method|property|static-property(-array)?) [a-zA-Z_][a-zA-Z0-9_]* ?(\(|=)" +# Missing prefix +color red "^[^ ]+" +# Missing vtable +color red "^(vtable(-size|-destructor-offset))? .+$" + +# Reset +color normal "(\(|\))" + # Commands -color magenta "\<(extends|size|vtable(-size|-destructor-offset)?|property|static-property|((static|virtual)-)?method|constructor)\>" +color magenta "^(extends|size|vtable(-size|-destructor-offset)?|property|static-property|((static|virtual)-)?method|constructor)\>" # Types -color green "\<(char|uchar|short|ushort|int|uint|float|bool|void|std::(string|vector|map))\>" +color green "\<((u?(char|short|int))|float|bool|void|std::(string|vector|map))\>" # Numbers color yellow "0x[a-f0-9]+" +# Non-hex numbers +color red " [0-9][a-f0-9]+;" # Comments color brightblue "//.*" +# Whitespace. +color normal "[[:space:]]+" # Trailing whitespace. color ,green "[[:space:]]+$"