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

Side by Side Diff: client/dom/scripts/idlrenderer.py

Issue 9426043: Parse function-style extended attributes part #1 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « client/dom/scripts/idlnode.py ('k') | client/dom/scripts/idlrenderer_test.py » ('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/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 from idlnode import * 6 from idlnode import *
7 7
8 8
9 def render(idl_node, indent_str=' '): 9 def render(idl_node, indent_str=' '):
10 output = [] 10 output = []
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 elif isinstance(node, IDLExtAttrs): 98 elif isinstance(node, IDLExtAttrs):
99 if len(node): 99 if len(node):
100 w('[') 100 w('[')
101 i = 0 101 i = 0
102 for k in sorted(node): 102 for k in sorted(node):
103 if i > 0: 103 if i > 0:
104 w(', ') 104 w(', ')
105 w(k) 105 w(k)
106 v = node[k] 106 v = node[k]
107 if v is not None: 107 if v is not None:
108 w('=%s' % v.__str__()) 108 if isinstance(v, IDLExtAttrFunctionValue):
109 if v.id:
110 w('=')
111 w(v)
112 else:
113 w('=%s' % v.__str__())
109 i += 1 114 i += 1
110 w('] ') 115 w('] ')
116 elif isinstance(node, IDLExtAttrFunctionValue):
117 if node.id:
118 w(node.id)
119 w('(')
120 w(node.arguments, ', ')
121 w(')')
111 elif isinstance(node, IDLAttribute): 122 elif isinstance(node, IDLAttribute):
112 w(node.annotations) 123 w(node.annotations)
113 w(node.ext_attrs) 124 w(node.ext_attrs)
114 if node.is_fc_getter: 125 if node.is_fc_getter:
115 w('getter ') 126 w('getter ')
116 if node.is_fc_setter: 127 if node.is_fc_setter:
117 w('setter ') 128 w('setter ')
118 w('attribute %s %s' % (node.type.id, node.id)) 129 w('attribute %s %s' % (node.type.id, node.id))
119 if node.raises: 130 if node.raises:
120 w(' raises (%s)' % node.raises.id) 131 w(' raises (%s)' % node.raises.id)
(...skipping 27 matching lines...) Expand all
148 w('in ') 159 w('in ')
149 if node.is_optional: 160 if node.is_optional:
150 w('optional ') 161 w('optional ')
151 w('%s %s' % (node.type.id, node.id)) 162 w('%s %s' % (node.type.id, node.id))
152 else: 163 else:
153 raise TypeError("Expected str or IDLNode but %s found" % 164 raise TypeError("Expected str or IDLNode but %s found" %
154 type(node)) 165 type(node))
155 166
156 w(idl_node) 167 w(idl_node)
157 return ''.join(output) 168 return ''.join(output)
OLDNEW
« no previous file with comments | « client/dom/scripts/idlnode.py ('k') | client/dom/scripts/idlrenderer_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698