| 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 """ Parser for PPAPI IDL """ | 6 """ Parser for PPAPI IDL """ |
| 7 | 7 |
| 8 # | 8 # |
| 9 # IDL Parser | 9 # IDL Parser |
| 10 # | 10 # |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 | 969 |
| 970 | 970 |
| 971 # | 971 # |
| 972 # Flatten Tree | 972 # Flatten Tree |
| 973 # | 973 # |
| 974 # Flattens the tree of IDLNodes for use in testing. | 974 # Flattens the tree of IDLNodes for use in testing. |
| 975 # | 975 # |
| 976 def FlattenTree(node): | 976 def FlattenTree(node): |
| 977 add_self = False | 977 add_self = False |
| 978 out = [] | 978 out = [] |
| 979 for child in node.children: | 979 for child in node.GetChildren(): |
| 980 if child.IsA('Comment'): | 980 if child.IsA('Comment'): |
| 981 add_self = True | 981 add_self = True |
| 982 else: | 982 else: |
| 983 out.extend(FlattenTree(child)) | 983 out.extend(FlattenTree(child)) |
| 984 | 984 |
| 985 if add_self: | 985 if add_self: |
| 986 out = [str(node)] + out | 986 out = [str(node)] + out |
| 987 return out | 987 return out |
| 988 | 988 |
| 989 | 989 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1219 errs = ast.GetProperty('ERRORS') | 1219 errs = ast.GetProperty('ERRORS') |
| 1220 if errs: | 1220 if errs: |
| 1221 ErrOut.Log('Found %d error(s).' % errs); | 1221 ErrOut.Log('Found %d error(s).' % errs); |
| 1222 InfoOut.Log("%d files processed." % len(filenames)) | 1222 InfoOut.Log("%d files processed." % len(filenames)) |
| 1223 return errs | 1223 return errs |
| 1224 | 1224 |
| 1225 | 1225 |
| 1226 if __name__ == '__main__': | 1226 if __name__ == '__main__': |
| 1227 sys.exit(Main(sys.argv[1:])) | 1227 sys.exit(Main(sys.argv[1:])) |
| 1228 | 1228 |
| OLD | NEW |