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

Side by Side Diff: Source/build/scripts/make_mediaquery_tokenizer_codepoints.py

Issue 252743004: A thread safe CSS calc parser for sizes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed CSSCalc tests that assert Created 6 years, 7 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 | Source/core/core.gypi » ('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 in_generator 7 import in_generator
8 import sys 8 import sys
9 import os 9 import os
10 10
(...skipping 17 matching lines...) Expand all
28 def token_type(i): 28 def token_type(i):
29 codepoints = {'(': 'leftParenthesis', 29 codepoints = {'(': 'leftParenthesis',
30 ')': 'rightParenthesis', 30 ')': 'rightParenthesis',
31 '[': 'leftBracket', 31 '[': 'leftBracket',
32 ']': 'rightBracket', 32 ']': 'rightBracket',
33 '{': 'leftBrace', 33 '{': 'leftBrace',
34 '}': 'rightBrace', 34 '}': 'rightBrace',
35 '+': 'plusOrFullStop', 35 '+': 'plusOrFullStop',
36 '.': 'plusOrFullStop', 36 '.': 'plusOrFullStop',
37 '-': 'hyphenMinus', 37 '-': 'hyphenMinus',
38 '*': 'asterisk',
38 ',': 'comma', 39 ',': 'comma',
39 '/': 'solidus', 40 '/': 'solidus',
40 '\\': 'reverseSolidus', 41 '\\': 'reverseSolidus',
41 ':': 'colon', 42 ':': 'colon',
42 ';': 'semiColon', 43 ';': 'semiColon',
43 } 44 }
44 whitespace = '\n\r\t\f ' 45 whitespace = '\n\r\t\f '
45 quotes = '"\'' 46 quotes = '"\''
46 c = chr(i) 47 c = chr(i)
47 if c in whitespace: 48 if c in whitespace:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 def generate(self): 85 def generate(self):
85 array_size = 128 # SCHAR_MAX + 1 86 array_size = 128 # SCHAR_MAX + 1
86 token_lines = [' &MediaQueryTokenizer::%s,' % token_type(i) 87 token_lines = [' &MediaQueryTokenizer::%s,' % token_type(i)
87 if token_type(i) else ' 0,' 88 if token_type(i) else ' 0,'
88 for i in range(array_size)] 89 for i in range(array_size)]
89 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join( token_lines), module_pyname=module_pyname) 90 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join( token_lines), module_pyname=module_pyname)
90 91
91 if __name__ == '__main__': 92 if __name__ == '__main__':
92 in_generator.Maker(MakeMediaQueryTokenizerCodePointsWriter).main(sys.argv) 93 in_generator.Maker(MakeMediaQueryTokenizerCodePointsWriter).main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | Source/core/core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698