| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 %%} | 70 %%} |
| 71 %%struct-type | 71 %%struct-type |
| 72 struct Value; | 72 struct Value; |
| 73 %%omit-struct-type | 73 %%omit-struct-type |
| 74 %%language=C++ | 74 %%language=C++ |
| 75 %%readonly-tables | 75 %%readonly-tables |
| 76 %%compare-strncmp | 76 %%compare-strncmp |
| 77 %%define class-name %(class_name)sHash | 77 %%define class-name %(class_name)sHash |
| 78 %%define lookup-function-name findValueImpl | 78 %%define lookup-function-name findValueImpl |
| 79 %%define hash-function-name value_hash_function | 79 %%define hash-function-name value_hash_function |
| 80 %%define slot-name nameOffset | 80 %%define slot-name name_offset |
| 81 %%define word-array-name value_word_list | 81 %%define word-array-name value_word_list |
| 82 %%pic | 82 %%pic |
| 83 %%enum | 83 %%enum |
| 84 %%%% | 84 %%%% |
| 85 %(value_keyword_to_enum_map)s | 85 %(value_keyword_to_enum_map)s |
| 86 %%%% | 86 %%%% |
| 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 ASSERT(id > 0 && id < numCSSValueKeywords); |
| 98 return valueListStringPool + valueListStringOffsets[id - 1]; | 98 return valueListStringPool + valueListStringOffsets[id - 1]; |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { | 101 bool isValueAllowedInMode(unsigned short id, CSSParserMode mode) { |
| 102 switch (id) { | 102 switch (id) { |
| 103 %(ua_sheet_mode_values_keywords)s | 103 %(ua_sheet_mode_values_keywords)s |
| 104 return isUASheetBehavior(mode); | 104 return IsUASheetBehavior(mode); |
| 105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s | 105 %(quirks_mode_or_ua_sheet_mode_values_keywords)s |
| 106 return isUASheetBehavior(mode) || isQuirksModeBehavior(mode); | 106 return IsUASheetBehavior(mode) || IsQuirksModeBehavior(mode); |
| 107 default: | 107 default: |
| 108 return true; | 108 return true; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace blink | 112 } // namespace blink |
| 113 """ | 113 """ |
| 114 | 114 |
| 115 | 115 |
| 116 class CSSValueKeywordsWriter(json5_generator.Writer): | 116 class CSSValueKeywordsWriter(json5_generator.Writer): |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 # CalledProcessError like subprocess would do when shell=True is set. | 180 # CalledProcessError like subprocess would do when shell=True is set. |
| 181 try: | 181 try: |
| 182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s
ubprocess.PIPE, universal_newlines=True) | 182 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=s
ubprocess.PIPE, universal_newlines=True) |
| 183 return gperf.communicate(gperf_input)[0] | 183 return gperf.communicate(gperf_input)[0] |
| 184 except OSError: | 184 except OSError: |
| 185 raise subprocess.CalledProcessError(127, gperf_args, output='Command
not found.') | 185 raise subprocess.CalledProcessError(127, gperf_args, output='Command
not found.') |
| 186 | 186 |
| 187 | 187 |
| 188 if __name__ == "__main__": | 188 if __name__ == "__main__": |
| 189 json5_generator.Maker(CSSValueKeywordsWriter).main() | 189 json5_generator.Maker(CSSValueKeywordsWriter).main() |
| OLD | NEW |