OLD | NEW |
---|---|
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 15 matching lines...) Expand all Loading... | |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 """Functions shared by various parts of the code generator. | 29 """Functions shared by various parts of the code generator. |
30 | 30 |
31 Extends IdlType and IdlUnion type with |enum_validation_expression| property. | 31 Extends IdlType and IdlUnion type with |enum_validation_expression| property. |
32 | 32 |
33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler | 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler |
34 """ | 34 """ |
35 | 35 |
36 # FIXME: eliminate this file if possible | |
Nils Barth (inactive)
2014/06/13 03:19:56
This file is necessary for shared functions, so re
| |
37 | |
38 import re | 36 import re |
39 | 37 |
40 from idl_types import IdlType, IdlUnionType | 38 from idl_types import IdlType, IdlUnionType |
41 import idl_types | 39 import idl_types |
42 from v8_globals import includes | 40 from v8_globals import includes |
43 import v8_types | 41 import v8_types |
44 | 42 |
45 ACRONYMS = ['CSS', 'HTML', 'IME', 'JS', 'SVG', 'URL', 'WOFF', 'XML', 'XSLT'] | 43 ACRONYMS = [ |
44 'CSSOM', # must come *before* CSS to match full acronym | |
45 'CSS', | |
46 'HTML', | |
47 'IME', | |
48 'JS', | |
49 'SVG', | |
50 'URL', | |
51 'WOFF', | |
52 'XML', | |
53 'XSLT', | |
54 ] | |
46 | 55 |
47 | 56 |
48 ################################################################################ | 57 ################################################################################ |
49 # Extended attribute parsing | 58 # Extended attribute parsing |
50 ################################################################################ | 59 ################################################################################ |
51 | 60 |
52 def extended_attribute_value_contains(extended_attribute_value, value): | 61 def extended_attribute_value_contains(extended_attribute_value, value): |
53 return (extended_attribute_value and | 62 return (extended_attribute_value and |
54 value in re.split('[|&]', extended_attribute_value)) | 63 value in re.split('[|&]', extended_attribute_value)) |
55 | 64 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 | 248 |
240 The returned function checks if a method/attribute is enabled. | 249 The returned function checks if a method/attribute is enabled. |
241 Given extended attribute RuntimeEnabled=FeatureName, return: | 250 Given extended attribute RuntimeEnabled=FeatureName, return: |
242 RuntimeEnabledFeatures::{featureName}Enabled | 251 RuntimeEnabledFeatures::{featureName}Enabled |
243 """ | 252 """ |
244 extended_attributes = definition_or_member.extended_attributes | 253 extended_attributes = definition_or_member.extended_attributes |
245 if 'RuntimeEnabled' not in extended_attributes: | 254 if 'RuntimeEnabled' not in extended_attributes: |
246 return None | 255 return None |
247 feature_name = extended_attributes['RuntimeEnabled'] | 256 feature_name = extended_attributes['RuntimeEnabled'] |
248 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) | 257 return 'RuntimeEnabledFeatures::%sEnabled' % uncapitalize(feature_name) |
OLD | NEW |