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

Side by Side Diff: build/android/gyp/java_cpp_enum.py

Issue 842043003: Use parens in multilne C++ -> Java enum generator directives. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | build/android/gyp/java_cpp_enum_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2014 The Chromium Authors. All rights reserved. 3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 import collections 7 import collections
8 import re 8 import re
9 import optparse 9 import optparse
10 import os 10 import os
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 118
119 119
120 class HeaderParser(object): 120 class HeaderParser(object):
121 single_line_comment_re = re.compile(r'\s*//') 121 single_line_comment_re = re.compile(r'\s*//')
122 multi_line_comment_start_re = re.compile(r'\s*/\*') 122 multi_line_comment_start_re = re.compile(r'\s*/\*')
123 enum_line_re = re.compile(r'^\s*(\w+)(\s*\=\s*([^,\n]+))?,?') 123 enum_line_re = re.compile(r'^\s*(\w+)(\s*\=\s*([^,\n]+))?,?')
124 enum_end_re = re.compile(r'^\s*}\s*;\.*$') 124 enum_end_re = re.compile(r'^\s*}\s*;\.*$')
125 generator_directive_re = re.compile( 125 generator_directive_re = re.compile(
126 r'^\s*//\s+GENERATED_JAVA_(\w+)\s*:\s*([\.\w]+)$') 126 r'^\s*//\s+GENERATED_JAVA_(\w+)\s*:\s*([\.\w]+)$')
127 multi_line_generator_directive_start_re = re.compile( 127 multi_line_generator_directive_start_re = re.compile(
128 r'^\s*//\s+GENERATED_JAVA_(\w+)\s*:\s*([\.\w]*)\\$') 128 r'^\s*//\s+GENERATED_JAVA_(\w+)\s*:\s*\(([\.\w]*)$')
129 multi_line_directive_continuation_re = re.compile( 129 multi_line_directive_continuation_re = re.compile(
130 r'^\s*//\s+([\.\w]+)\\$') 130 r'^\s*//\s+([\.\w]+)$')
131 multi_line_directive_end_re = re.compile( 131 multi_line_directive_end_re = re.compile(
132 r'^\s*//\s+([\.\w]*)$') 132 r'^\s*//\s+([\.\w]*)\)$')
133 133
134 optional_class_or_struct_re = r'(class|struct)?' 134 optional_class_or_struct_re = r'(class|struct)?'
135 enum_name_re = r'(\w+)' 135 enum_name_re = r'(\w+)'
136 optional_fixed_type_re = r'(\:\s*(\w+\s*\w+?))?' 136 optional_fixed_type_re = r'(\:\s*(\w+\s*\w+?))?'
137 enum_start_re = re.compile(r'^\s*enum\s+' + optional_class_or_struct_re + 137 enum_start_re = re.compile(r'^\s*enum\s+' + optional_class_or_struct_re +
138 '\s*' + enum_name_re + '\s*' + optional_fixed_type_re + '\s*{\s*$') 138 '\s*' + enum_name_re + '\s*' + optional_fixed_type_re + '\s*{\s*$')
139 139
140 def __init__(self, lines, path=None): 140 def __init__(self, lines, path=None):
141 self._lines = lines 141 self._lines = lines
142 self._path = path 142 self._path = path
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 output_paths = DoGenerate(options, args) 315 output_paths = DoGenerate(options, args)
316 316
317 if options.assert_files_list: 317 if options.assert_files_list:
318 AssertFilesList(output_paths, options.assert_files_list) 318 AssertFilesList(output_paths, options.assert_files_list)
319 319
320 return " ".join(output_paths) 320 return " ".join(output_paths)
321 321
322 if __name__ == '__main__': 322 if __name__ == '__main__':
323 DoMain(sys.argv[1:]) 323 DoMain(sys.argv[1:])
OLDNEW
« no previous file with comments | « no previous file | build/android/gyp/java_cpp_enum_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698