From aeb7d8757d7beced1d745874dde8624754afc93e Mon Sep 17 00:00:00 2001 From: "phoglund@webrtc.org" Date: Wed, 8 May 2013 13:56:23 +0000 Subject: [PATCH] Tweaked webrtc_reformat. Fixed variable names such as maskByte and stuff within brackets. Fixed bug where we would think that for instance foo_internal.h was the self include when the right answer was foo.h. Removed comment conversion: it was doing more damage than good. BUG= R=mflodman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/1442005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3983 4adac7df-926f-26a2-2b94-8c16560cd09d --- tools/refactoring/webrtc_reformat.py | 46 +++++++++------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/tools/refactoring/webrtc_reformat.py b/tools/refactoring/webrtc_reformat.py index e5606fef6..269d1c3f6 100755 --- a/tools/refactoring/webrtc_reformat.py +++ b/tools/refactoring/webrtc_reformat.py @@ -30,8 +30,19 @@ def LowerWord(obj): def DeCamelCase(text): - """De-camelize variable names.""" - pattern = re.compile(r'(?<=[ _*\(\&\!])([a-z]+)(? string_likeThis -> string_like_this. + """ + possible_tokens_before_vars = '[ _*\(\&\!\[]' + pattern = re.compile(r'(?<=' + possible_tokens_before_vars + ')' + + # Match some lower-case characters + '([a-z]+)' + + # Don't match kFoo, !kFoo, [kFoo], etc + '(?