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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_css_tokenizer_codepoints.py

Issue 2611823003: ABANDONED CL: Changes to compile and pass tests after Big Blink Rename (excluding functions). (Closed)
Patch Set: Inducing merge conflicts to force human review and changes after rename. Created 3 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
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 in_generator 7 import in_generator
8 import sys 8 import sys
9 import os 9 import os
10 10
11 module_basename = os.path.basename(__file__) 11 module_basename = os.path.basename(__file__)
12 module_pyname = os.path.splitext(module_basename)[0] + '.py' 12 module_pyname = os.path.splitext(module_basename)[0] + '.py'
13 13
14 CPP_TEMPLATE = """ 14 CPP_TEMPLATE = """
15 // Copyright 2014 The Chromium Authors. All rights reserved. 15 // Copyright 2014 The Chromium Authors. All rights reserved.
16 // Use of this source code is governed by a BSD-style license that can be 16 // Use of this source code is governed by a BSD-style license that can be
17 // found in the LICENSE file. 17 // found in the LICENSE file.
18 18
19 // Auto-generated by {module_pyname} 19 // Auto-generated by {module_pyname}
20 20
21 const CSSTokenizer::CodePoint CSSTokenizer::codePoints[{array_size}] = {{ 21 const CSSTokenizer::CodePoint CSSTokenizer::kCodePoints[{array_size}] = {{
22 {token_lines} 22 {token_lines}
23 }}; 23 }};
24 const unsigned codePointsNumber = {array_size}; 24 const unsigned codePointsNumber = {array_size};
25 """ 25 """
26 26
27 27
28 def token_type(i): 28 def token_type(i):
29 codepoints = {'(': 'leftParenthesis', 29 codepoints = {'(': 'leftParenthesis',
30 ')': 'rightParenthesis', 30 ')': 'rightParenthesis',
31 '[': 'leftBracket', 31 '[': 'leftBracket',
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 def generate(self): 79 def generate(self):
80 array_size = 128 # SCHAR_MAX + 1 80 array_size = 128 # SCHAR_MAX + 1
81 token_lines = [' &CSSTokenizer::%s,' % token_type(i) 81 token_lines = [' &CSSTokenizer::%s,' % token_type(i)
82 if token_type(i) else ' 0,' 82 if token_type(i) else ' 0,'
83 for i in range(array_size)] 83 for i in range(array_size)]
84 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join( token_lines), module_pyname=module_pyname) 84 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join( token_lines), module_pyname=module_pyname)
85 85
86 if __name__ == '__main__': 86 if __name__ == '__main__':
87 in_generator.Maker(MakeCSSTokenizerCodePointsWriter).main(sys.argv) 87 in_generator.Maker(MakeCSSTokenizerCodePointsWriter).main(sys.argv)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698