| 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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 filenames = [] | 1011 filenames = [] |
| 1012 srcroot = GetOption('srcroot') | 1012 srcroot = GetOption('srcroot') |
| 1013 dirs = default_dirs | 1013 dirs = default_dirs |
| 1014 if GetOption('include_private'): | 1014 if GetOption('include_private'): |
| 1015 dirs += ['private'] | 1015 dirs += ['private'] |
| 1016 for dirname in dirs: | 1016 for dirname in dirs: |
| 1017 srcdir = os.path.join(srcroot, dirname, '*.idl') | 1017 srcdir = os.path.join(srcroot, dirname, '*.idl') |
| 1018 srcdir = os.path.normpath(srcdir) | 1018 srcdir = os.path.normpath(srcdir) |
| 1019 filenames += sorted(glob.glob(srcdir)) | 1019 filenames += sorted(glob.glob(srcdir)) |
| 1020 | 1020 |
| 1021 if not filenames: |
| 1022 ErrOut.Log('No sources provided.') |
| 1023 |
| 1021 for filename in filenames: | 1024 for filename in filenames: |
| 1022 filenode = parser.ParseFile(filename) | 1025 filenode = parser.ParseFile(filename) |
| 1023 filenodes.append(filenode) | 1026 filenodes.append(filenode) |
| 1024 | 1027 |
| 1025 ast = IDLAst(filenodes) | 1028 ast = IDLAst(filenodes) |
| 1026 if GetOption('dump_tree'): ast.Dump(0) | 1029 if GetOption('dump_tree'): ast.Dump(0) |
| 1027 | 1030 |
| 1028 Lint(ast) | 1031 Lint(ast) |
| 1029 return ast | 1032 return ast |
| 1030 | 1033 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1045 ast = ParseFiles(filenames) | 1048 ast = ParseFiles(filenames) |
| 1046 errs = ast.GetProperty('ERRORS') | 1049 errs = ast.GetProperty('ERRORS') |
| 1047 if errs: | 1050 if errs: |
| 1048 ErrOut.Log('Found %d error(s).' % errs); | 1051 ErrOut.Log('Found %d error(s).' % errs); |
| 1049 InfoOut.Log("%d files processed." % len(filenames)) | 1052 InfoOut.Log("%d files processed." % len(filenames)) |
| 1050 return errs | 1053 return errs |
| 1051 | 1054 |
| 1052 | 1055 |
| 1053 if __name__ == '__main__': | 1056 if __name__ == '__main__': |
| 1054 sys.exit(Main(sys.argv[1:])) | 1057 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |