OLD | NEW |
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 18 matching lines...) Expand all Loading... |
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 '*': 'asterisk', |
| 39 '<': 'lessThan', |
39 ',': 'comma', | 40 ',': 'comma', |
40 '/': 'solidus', | 41 '/': 'solidus', |
41 '\\': 'reverseSolidus', | 42 '\\': 'reverseSolidus', |
42 ':': 'colon', | 43 ':': 'colon', |
43 ';': 'semiColon', | 44 ';': 'semiColon', |
44 '#': 'hash', | 45 '#': 'hash', |
45 '^': 'circumflexAccent', | 46 '^': 'circumflexAccent', |
46 '$': 'dollarSign', | 47 '$': 'dollarSign', |
47 '|': 'verticalLine', | 48 '|': 'verticalLine', |
48 '~': 'tilde', | 49 '~': 'tilde', |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 94 |
94 def generate(self): | 95 def generate(self): |
95 array_size = 128 # SCHAR_MAX + 1 | 96 array_size = 128 # SCHAR_MAX + 1 |
96 token_lines = [' &CSSTokenizer::%s,' % token_type(i) | 97 token_lines = [' &CSSTokenizer::%s,' % token_type(i) |
97 if token_type(i) else ' 0,' | 98 if token_type(i) else ' 0,' |
98 for i in range(array_size)] | 99 for i in range(array_size)] |
99 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join(
token_lines), module_pyname=module_pyname) | 100 return CPP_TEMPLATE.format(array_size=array_size, token_lines='\n'.join(
token_lines), module_pyname=module_pyname) |
100 | 101 |
101 if __name__ == '__main__': | 102 if __name__ == '__main__': |
102 in_generator.Maker(MakeCSSTokenizerCodePointsWriter).main(sys.argv) | 103 in_generator.Maker(MakeCSSTokenizerCodePointsWriter).main(sys.argv) |
OLD | NEW |