Skip to content

manipulate (un)?commenting in C++ files using @bundle-helper directive in comment

Notifications You must be signed in to change notification settings

Capobmb/bundle-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bundle-helper

Goで書かれた、C++ファイルのコメントアウト制御ツール。
※注意:開発中なので、デバッグ用のログがstderrに出まくっています。

競技プログラミングで用いられるbundleツールにoj-bundleがありますが、 #ifdef ディレクティブ内に#includeが含まれていたり #pragma が含まれていたりすると正常にincludeの展開が出来ないので、このツールを作成しました。
oj-bundle 実行前にそのようなコードをコメントアウトしておいて、正常にbundleが実行してから、コメントアウトを戻すといった操作が将来的にできるようになる予定です。

Usage

go run cmd/main.go /path/to/source.cpp
# /path/to/source.cpp.converted.cpp にコメントアウトが制御されたコードが出力されます

コメントアウトの制御方法

// @bundle-helper COMMAND でコメントアウトを制御できます

これが

// @bundle-helper comment_single_line
constexpr int willBeCommentedOut = 1;

// @bundle-helper uncomment_single_line
// constexpr int willBeUncommented = 1;

// @bundle-helper comment_block_begin
Class WillBeCommentedOut {
    int member;
};
// @bundle-helper comment_block_end

// @bundle-helper uncomment_block_begin
// Class WillBeUncommented {
//     int member;
// };
// @bundle-helper uncomment_block_end

↓こうなる

// @bundle-helper comment_single_line
// constexpr int willBeCommentedOut = 1;

// @bundle-helper uncomment_single_line
constexpr int willBeUncommented = 1;

// @bundle-helper comment_block_begin
// Class WillBeCommentedOut {
//     int member;
// };
// @bundle-helper comment_block_end

// @bundle-helper uncomment_block_begin
Class WillBeUncommented {
    int member;
};
// @bundle-helper uncomment_block_end

About

manipulate (un)?commenting in C++ files using @bundle-helper directive in comment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages