| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Nodes for PPAPI IDL AST""" | 6 """Nodes for PPAPI IDL AST""" |
| 7 | 7 |
| 8 # | 8 # |
| 9 # IDL Node | 9 # IDL Node |
| 10 # | 10 # |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 is_comment = True | 125 is_comment = True |
| 126 else: | 126 else: |
| 127 is_comment = False | 127 is_comment = False |
| 128 | 128 |
| 129 # Skip this node if it's a comment, and we are not printing comments | 129 # Skip this node if it's a comment, and we are not printing comments |
| 130 if not comments and is_comment: return | 130 if not comments and is_comment: return |
| 131 | 131 |
| 132 tab = ''.rjust(depth * 2) | 132 tab = ''.rjust(depth * 2) |
| 133 | 133 |
| 134 if is_comment: | 134 if is_comment: |
| 135 out.write('%sComment\n' % tab) |
| 135 for line in self.GetName().split('\n'): | 136 for line in self.GetName().split('\n'): |
| 136 out.write('%s%s\n' % (tab, line)) | 137 out.write('%s "%s"\n' % (tab, line)) |
| 137 else: | 138 else: |
| 138 out.write('%s%s\n' % (tab, self)) | 139 out.write('%s%s\n' % (tab, self)) |
| 139 properties = self.property_node.GetPropertyList() | 140 properties = self.property_node.GetPropertyList() |
| 140 if properties: | 141 if properties: |
| 141 out.write('%s Properties\n' % tab) | 142 out.write('%s Properties\n' % tab) |
| 142 for p in properties: | 143 for p in properties: |
| 144 if is_comment and p == 'NAME': |
| 145 # Skip printing the name for comments, since we printed above already |
| 146 continue |
| 143 out.write('%s %s : %s\n' % (tab, p, self.GetProperty(p))) | 147 out.write('%s %s : %s\n' % (tab, p, self.GetProperty(p))) |
| 144 for child in self.children: | 148 for child in self.children: |
| 145 child.Dump(depth+1, comments=comments, out=out) | 149 child.Dump(depth+1, comments=comments, out=out) |
| 146 | 150 |
| 147 # | 151 # |
| 148 # Search related functions | 152 # Search related functions |
| 149 # | 153 # |
| 150 | 154 |
| 151 # Check if node is of a given type | 155 # Check if node is of a given type |
| 152 def IsA(self, *typelist): | 156 def IsA(self, *typelist): |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 errors = StringTest() | 386 errors = StringTest() |
| 383 errors += ChildTest() | 387 errors += ChildTest() |
| 384 | 388 |
| 385 if errors: | 389 if errors: |
| 386 ErrOut.Log('IDLNode failed with %d errors.' % errors) | 390 ErrOut.Log('IDLNode failed with %d errors.' % errors) |
| 387 return -1 | 391 return -1 |
| 388 return 0 | 392 return 0 |
| 389 | 393 |
| 390 if __name__ == '__main__': | 394 if __name__ == '__main__': |
| 391 sys.exit(Main()) | 395 sys.exit(Main()) |
| OLD | NEW |