Fix for namespace swapping

This commit is contained in:
Edward R. Gonzalez 2023-07-20 01:03:31 -04:00
parent 5efd14322e
commit 4d5cbd3e8d
10 changed files with 81 additions and 83 deletions

6
.vscode/launch.json vendored
View File

@ -47,10 +47,10 @@
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/refactor.exe", "program": "${workspaceFolder}/build/refactor.exe",
"args": [ "args": [
"-source=./refactor.cpp", "-src=./project/refactor.cpp",
"-destination=./Test/refactor.cpp", "-dst=./Test/refactor.cpp",
"-specification=./Test/zpl.refactor" "-spec=./Test/zpl.refactor"
], ],
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",

View File

@ -79,8 +79,6 @@ With the refactors applied a meson configuraiton is setup (`meson.build` in test
* Can have a heavy memory cost, so most likely do not want on by default. * Can have a heavy memory cost, so most likely do not want on by default.
* Make comments ignored by default, and just have ability to specify custom comments. * Make comments ignored by default, and just have ability to specify custom comments.
* Would need a directive to add refactors to comments. * Would need a directive to add refactors to comments.
* Directive to add cpp namespaces on specific lines of a file, or near specific signatures.
* This can honestly be done also with placing words on specific lines..
* Provide a GUI build. * Provide a GUI build.
* Provide as a single-header library. * Provide as a single-header library.
* Could add a test case where this library is refactored into pure C (most likely c99 or c11). * Could add a test case where this library is refactored into pure C (most likely c99 or c11).

View File

@ -34,8 +34,8 @@ namespace zpl_random_, rng_
namespace zpl_pr, process_ namespace zpl_pr, process_
namespace zpl__, __ namespace zpl__, __
namespace ZPL_ADT_, EADT namespace ZPL_ADT_, EADT
namespace ZPL_ALLOCATION_, EAllocation namespace ZPL_ALLOCATION_, EAllocation_
namespace ZPL_CSV_ERROR, ECSV_Error namespace ZPL_CSV_ERROR, ECSV_Error_
namespace ZPL_FILE_MODE_, EFileMode_ namespace ZPL_FILE_MODE_, EFileMode_
namespace ZPL_FILE_ERROR_, EFileError_ namespace ZPL_FILE_ERROR_, EFileError_
namespace ZPL_SEEK_WHENCE_, ESeekWhence_ namespace ZPL_SEEK_WHENCE_, ESeekWhence_

View File

@ -568,7 +568,7 @@ void refactor()
Token entry {}; Token entry {};
entry.Start = pos; entry.Start = pos;
entry.End = pos + length; entry.End = pos + sig_length;
entry.Sig = nspace->Sig; entry.Sig = nspace->Sig;
buffer_size += sig_length; buffer_size += sig_length;
@ -576,7 +576,7 @@ void refactor()
if ( nspace->Sub != nullptr ) if ( nspace->Sub != nullptr )
{ {
entry.Sub = nspace->Sub; entry.Sub = nspace->Sub;
buffer_size += zpl_string_length( entry.Sub ) - length; buffer_size += zpl_string_length( entry.Sub ) - sig_length;
} }
zpl_array_append( tokens, entry ); zpl_array_append( tokens, entry );