zen0wu / topcoder-greed

greedy editor for topcoder arena
Apache License 2.0
229 stars 48 forks source link

Filtering source code before submit #174

Open marecik16 opened 8 years ago

marecik16 commented 8 years ago

It would be very useful, if there would be some possibility of simple filtering of source code before submit.

For example: there is a macro DEBUG(...) in my code, which I don't want to execute on the arena, but I want to execute it locally. The proper definitions of this macro is hidden between "begin cut"/"end cut" lines and only a one additional line with dummy define:

define DEBUG(...)

is sent to arena. My problem is that this simple additional line in my template sometimes causes "to many unused code" warning (it the solutions is very short) and I lose valuable seconds to fix it. So I think that the best option for me would be removing all lines with DEBUG keyword (similar to: grep -v DEBUG), but I do not know how to automatize this process with Greed.

Edit: This idea can be simply extended further to removing all unused defines/typedefs. For example: it there is only one line with keyword VI (after applying "begin"/"end cut") then remove it (because by default this line contains a definition "typedef VI vector < int > ;").