tag:blogger.com,1999:blog-5246987755651065286.post5292636441042388683..comments2024-02-22T16:15:42.388-08:00Comments on cbloom rants: 06-13-12 - MSVC RegExp Find-Replacecbloomhttp://www.blogger.com/profile/10714564834899413045noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-5246987755651065286.post-15183047616670146122012-06-19T13:27:19.730-07:002012-06-19T13:27:19.730-07:00Another one :
I should be able to do "insert...Another one :<br /><br />I should be able to do "insert default args" using the compiler to do text-pasting.<br /><br />If you ever need to change or remove a default arg, you should be able to automatically paste the previous value into all places in the code that were using it.cbloomhttps://www.blogger.com/profile/10714564834899413045noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-30739870410049338992012-06-14T08:38:08.605-07:002012-06-14T08:38:08.605-07:00For renaming enum values, I've found Visual As...For renaming enum values, I've found Visual Assist to do a fair job, and it will even (try to) find references to them in comments. It's not impossible to confuse it, but it presents a nice summary of what it's going to do before it does it, so you can usually catch any problems before they occur. Serious hidden mistakes seem to be no more likely than if you did the change yourself.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-81017379888324780332012-06-14T08:30:21.377-07:002012-06-14T08:30:21.377-07:00Most regex engines provide facilities for word-bou...Most regex engines provide facilities for word-boundary matching (or more general boundary conditions).<br /><br />MSDN says that it wants '<' to match the beginning of a word, '>' to match the end of a word.<br /><br />http://msdn.microsoft.com/en-us/library/2k3te2cs(v=vs.80).aspxjohnbhttps://www.blogger.com/profile/15875751919051082588noreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-70290252016700262292012-06-14T01:45:56.333-07:002012-06-14T01:45:56.333-07:00And yeah, you want a find/replace engine embedded ...And yeah, you want a find/replace engine embedded in <i>a programming IDE</i> to be able to understand the syntax of the language, and e.g. (optionally) recognize token boundaries.<br /><br />Knowing about types is a lot harder, unfortunately:<br /><br />- it requires a full parse (and a full parse is a super PITA in C++ compared to C), <br /><br />- to do it right you need a more sophisticated c-preprocessor than the one in the compiler (you need one that keeps a tighter correlation between input tokens and output tokens, since the types come from output tokens but the strings you're replacing are input tokens)<br /><br />- #ifdefs fuck you regardless of whether you preprocessor macro expansion or notAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-5246987755651065286.post-19290800878458528812012-06-14T01:40:36.896-07:002012-06-14T01:40:36.896-07:00Doesn't work if "blah" contains comm...Doesn't work if "blah" contains commas, e.g. if blah is another function call with multiple parameters.<br /><br />(and in fact provably unparseable with regular expressions)<br /><br />Doesn't matter much if you avoid that sort of style, though, so you may have never run into it. But I think it's pretty perilous in general.Anonymousnoreply@blogger.com