Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(366)

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/style/checkers/cpp.py

Issue 2305143003: webkitpy: Make all regex strings use raw string literals. (Closed)
Patch Set: Make all regex strings raw strings. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # -*- coding: utf-8 -*- 1 # -*- coding: utf-8 -*-
2 # 2 #
3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved. 3 # Copyright (C) 2009, 2010, 2012 Google Inc. All rights reserved.
4 # Copyright (C) 2009 Torch Mobile Inc. 4 # Copyright (C) 2009 Torch Mobile Inc.
5 # Copyright (C) 2009 Apple Inc. All rights reserved. 5 # Copyright (C) 2009 Apple Inc. All rights reserved.
6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) 6 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org)
7 # 7 #
8 # Redistribution and use in source and binary forms, with or without 8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions are 9 # modification, are permitted provided that the following conditions are
10 # met: 10 # met:
(...skipping 3629 matching lines...) Expand 10 before | Expand all | Expand 10 after
3640 Args: 3640 Args:
3641 processing_file: The name of the processing file. 3641 processing_file: The name of the processing file.
3642 line_number: The number of the line to check. 3642 line_number: The number of the line to check.
3643 line: The line of code to check. 3643 line: The line of code to check.
3644 error: The function to call with any errors found. 3644 error: The function to call with any errors found.
3645 """ 3645 """
3646 matched = search(r'\bstatic_cast<(\s*\w*:?:?\w+\s*\*+\s*)>', line) 3646 matched = search(r'\bstatic_cast<(\s*\w*:?:?\w+\s*\*+\s*)>', line)
3647 if not matched: 3647 if not matched:
3648 return 3648 return
3649 3649
3650 class_name = re.sub('[\*]', '', matched.group(1)) 3650 class_name = re.sub(r'[\*]', '', matched.group(1))
3651 class_name = class_name.strip() 3651 class_name = class_name.strip()
3652 # Ignore (for now) when the casting is to void*, 3652 # Ignore (for now) when the casting is to void*,
3653 if class_name == 'void': 3653 if class_name == 'void':
3654 return 3654 return
3655 3655
3656 namespace_pos = class_name.find(':') 3656 namespace_pos = class_name.find(':')
3657 if not namespace_pos == -1: 3657 if not namespace_pos == -1:
3658 class_name = class_name[namespace_pos + 2:] 3658 class_name = class_name[namespace_pos + 2:]
3659 3659
3660 header_file = ''.join((class_name, '.h')) 3660 header_file = ''.join((class_name, '.h'))
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
4183 4183
4184 def check(self, lines): 4184 def check(self, lines):
4185 _process_lines(self.file_path, self.file_extension, lines, 4185 _process_lines(self.file_path, self.file_extension, lines,
4186 self.handle_style_error, self.min_confidence) 4186 self.handle_style_error, self.min_confidence)
4187 4187
4188 4188
4189 # FIXME: Remove this function (requires refactoring unit tests). 4189 # FIXME: Remove this function (requires refactoring unit tests).
4190 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None): 4190 def process_file_data(filename, file_extension, lines, error, min_confidence, fs =None):
4191 checker = CppChecker(filename, file_extension, error, min_confidence, fs) 4191 checker = CppChecker(filename, file_extension, error, min_confidence, fs)
4192 checker.check(lines) 4192 checker.check(lines)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698