OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 import os.path | 3 import os.path |
4 import re | 4 import re |
5 import subprocess | 5 import subprocess |
6 import sys | 6 import sys |
7 | 7 |
8 from name_utilities import enum_for_css_keyword | 8 from name_utilities import enum_for_css_keyword |
9 from name_utilities import upper_first_letter | 9 from name_utilities import upper_first_letter |
10 import json5_generator | 10 import json5_generator |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 #if defined(__clang__) | 88 #if defined(__clang__) |
89 #pragma clang diagnostic pop | 89 #pragma clang diagnostic pop |
90 #endif | 90 #endif |
91 | 91 |
92 const Value* FindValue(const char* str, unsigned int len) { | 92 const Value* FindValue(const char* str, unsigned int len) { |
93 return CSSValueKeywordsHash::findValueImpl(str, len); | 93 return CSSValueKeywordsHash::findValueImpl(str, len); |
94 } | 94 } |
95 | 95 |
96 const char* getValueName(CSSValueID id) { | 96 const char* getValueName(CSSValueID id) { |
97 ASSERT(id > 0 && id < numCSSValueKeywords); | 97 DCHECK_GT(id, 0); |
| 98 DCHECK_LT(id, numCSSValueKeywords); |
98 return valueListStringPool + valueListStringOffsets[id - 1]; | 99 return valueListStringPool + valueListStringOffsets[id - 1]; |
99 } | 100 } |
100 | 101 |
101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { | 102 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { |
102 switch (id) { | 103 switch (id) { |
103 %(ua_sheet_mode_values_keywords)s | 104 %(ua_sheet_mode_values_keywords)s |
104 return IsUASheetBehavior(mode); | 105 return IsUASheetBehavior(mode); |
105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s | 106 %(quirks_mode_or_ua_sheet_mode_values_keywords)s |
106 return IsUASheetBehavior(mode) || IsQuirksModeBehavior(mode); | 107 return IsUASheetBehavior(mode) || IsQuirksModeBehavior(mode); |
107 default: | 108 default: |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 # CalledProcessError like subprocess would do when shell=True is set. | 181 # CalledProcessError like subprocess would do when shell=True is set. |
181 try: | 182 try: |
182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s
ubprocess.PIPE, universal_newlines=True) | 183 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s
ubprocess.PIPE, universal_newlines=True) |
183 return gperf.communicate(gperf_input)[0] | 184 return gperf.communicate(gperf_input)[0] |
184 except OSError: | 185 except OSError: |
185 raise subprocess.CalledProcessError(127, gperf_args, output='Command
not found.') | 186 raise subprocess.CalledProcessError(127, gperf_args, output='Command
not found.') |
186 | 187 |
187 | 188 |
188 if __name__ == "__main__": | 189 if __name__ == "__main__": |
189 json5_generator.Maker(CSSValueKeywordsWriter).main() | 190 json5_generator.Maker(CSSValueKeywordsWriter).main() |
OLD | NEW |