OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 # | |
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 4 # found in the LICENSE file. |
6 | 5 |
7 """ Parser for PPAPI IDL """ | 6 """ Parser for PPAPI IDL """ |
8 | 7 |
9 # | 8 # |
10 # IDL Parser | 9 # IDL Parser |
11 # | 10 # |
12 # The parser is uses the PLY yacc library to build a set of parsing rules based | 11 # The parser is uses the PLY yacc library to build a set of parsing rules based |
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 if errs: | 968 if errs: |
970 ErrOut.Log("%s test failed with %d error(s)." % (filename, errs)) | 969 ErrOut.Log("%s test failed with %d error(s)." % (filename, errs)) |
971 total_errs += errs | 970 total_errs += errs |
972 | 971 |
973 if total_errs: | 972 if total_errs: |
974 ErrOut.Log("Failed parsing test.") | 973 ErrOut.Log("Failed parsing test.") |
975 else: | 974 else: |
976 InfoOut.Log("Passed parsing test.") | 975 InfoOut.Log("Passed parsing test.") |
977 return total_errs | 976 return total_errs |
978 | 977 |
| 978 |
979 def TestNamespaceFiles(filter): | 979 def TestNamespaceFiles(filter): |
980 idldir = os.path.split(sys.argv[0])[0] | 980 idldir = os.path.split(sys.argv[0])[0] |
981 idldir = os.path.join(idldir, 'test_namespace', '*.idl') | 981 idldir = os.path.join(idldir, 'test_namespace', '*.idl') |
982 filenames = glob.glob(idldir) | 982 filenames = glob.glob(idldir) |
983 testnames = [] | 983 testnames = [] |
984 | 984 |
985 for filename in filenames: | 985 for filename in filenames: |
986 if filter and filename not in filter: continue | 986 if filter and filename not in filter: continue |
987 testnames.append(filename) | 987 testnames.append(filename) |
988 | 988 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 return 0 | 1042 return 0 |
1043 | 1043 |
1044 # Otherwise, build the AST | 1044 # Otherwise, build the AST |
1045 ast = ParseFiles(filenames) | 1045 ast = ParseFiles(filenames) |
1046 errs = ast.GetProperty('ERRORS') | 1046 errs = ast.GetProperty('ERRORS') |
1047 if errs: | 1047 if errs: |
1048 ErrOut.Log('Found %d error(s).' % errs); | 1048 ErrOut.Log('Found %d error(s).' % errs); |
1049 InfoOut.Log("%d files processed." % len(filenames)) | 1049 InfoOut.Log("%d files processed." % len(filenames)) |
1050 return errs | 1050 return errs |
1051 | 1051 |
| 1052 |
1052 if __name__ == '__main__': | 1053 if __name__ == '__main__': |
1053 sys.exit(Main(sys.argv[1:])) | 1054 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |