| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ Parser for PPAPI IDL """ | 7 """ Parser for PPAPI IDL """ |
| 8 | 8 |
| 9 # | 9 # |
| 10 # IDL Parser | 10 # IDL Parser |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 if errs: | 998 if errs: |
| 999 ErrOut.Log("Failed namespace test.") | 999 ErrOut.Log("Failed namespace test.") |
| 1000 else: | 1000 else: |
| 1001 InfoOut.Log("Passed namespace test.") | 1001 InfoOut.Log("Passed namespace test.") |
| 1002 return errs | 1002 return errs |
| 1003 | 1003 |
| 1004 default_dirs = ['.', 'trusted', 'dev'] | 1004 default_dirs = ['.', 'trusted', 'dev'] |
| 1005 def ParseFiles(filenames): | 1005 def ParseFiles(filenames): |
| 1006 parser = IDLParser() | 1006 parser = IDLParser() |
| 1007 filenodes = [] | 1007 filenodes = [] |
| 1008 errors = 0 | |
| 1009 | 1008 |
| 1010 if not filenames: | 1009 if not filenames: |
| 1011 filenames = [] | 1010 filenames = [] |
| 1012 srcroot = GetOption('srcroot') | 1011 srcroot = GetOption('srcroot') |
| 1013 for dir in default_dirs: | 1012 for dirname in default_dirs: |
| 1014 srcdir = os.path.join(srcroot, dir, '*.idl') | 1013 srcdir = os.path.join(srcroot, dirname, '*.idl') |
| 1015 srcdir = os.path.normpath(srcdir) | 1014 srcdir = os.path.normpath(srcdir) |
| 1016 filenames += sorted(glob.glob(srcdir)) | 1015 filenames += sorted(glob.glob(srcdir)) |
| 1017 | 1016 |
| 1018 for filename in filenames: | 1017 for filename in filenames: |
| 1019 filenode = parser.ParseFile(filename) | 1018 filenode = parser.ParseFile(filename) |
| 1020 filenodes.append(filenode) | 1019 filenodes.append(filenode) |
| 1021 | 1020 |
| 1022 ast = IDLAst(filenodes) | 1021 ast = IDLAst(filenodes) |
| 1023 if GetOption('dump_tree'): ast.Dump(0) | 1022 if GetOption('dump_tree'): ast.Dump(0) |
| 1024 | 1023 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1042 ast = ParseFiles(filenames) | 1041 ast = ParseFiles(filenames) |
| 1043 errs = ast.GetProperty('ERRORS') | 1042 errs = ast.GetProperty('ERRORS') |
| 1044 if errs: | 1043 if errs: |
| 1045 ErrOut.Log('Found %d error(s).' % errs); | 1044 ErrOut.Log('Found %d error(s).' % errs); |
| 1046 InfoOut.Log("%d files processed." % len(filenames)) | 1045 InfoOut.Log("%d files processed." % len(filenames)) |
| 1047 return errs | 1046 return errs |
| 1048 | 1047 |
| 1049 if __name__ == '__main__': | 1048 if __name__ == '__main__': |
| 1050 sys.exit(Main(sys.argv[1:])) | 1049 sys.exit(Main(sys.argv[1:])) |
| 1051 | 1050 |
| OLD | NEW |