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 import sys | 6 import sys |
7 | 7 |
8 from idl_log import ErrOut, InfoOut, WarnOut | 8 from idl_log import ErrOut, InfoOut, WarnOut |
9 from idl_option import GetOption, Option, ParseOptions | 9 from idl_option import GetOption, Option, ParseOptions |
10 from idl_parser import ParseFiles | 10 from idl_parser import ParseFiles |
11 | 11 |
12 GeneratorList = [] | 12 GeneratorList = [] |
13 | 13 |
| 14 Option('out', 'List of output files', default='') |
14 Option('release', 'Which release to generate.', default='') | 15 Option('release', 'Which release to generate.', default='') |
15 Option('range', 'Which ranges in the form of MIN,MAX.', default='start,end') | 16 Option('range', 'Which ranges in the form of MIN,MAX.', default='start,end') |
16 | 17 |
17 class Generator(object): | 18 class Generator(object): |
18 """Base class for generators. | 19 """Base class for generators. |
19 | 20 |
20 This class provides a mechanism for adding new generator objects to the IDL | 21 This class provides a mechanism for adding new generator objects to the IDL |
21 driver. To use this class override the GenerateRelease and GenerateRange | 22 driver. To use this class override the GenerateRelease and GenerateRange |
22 members, and instantiate one copy of the class in the same module which | 23 members, and instantiate one copy of the class in the same module which |
23 defines it to register the generator. After the AST is generated, call the | 24 defines it to register the generator. After the AST is generated, call the |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 if not args: return Test() | 268 if not args: return Test() |
268 filenames = ParseOptions(args) | 269 filenames = ParseOptions(args) |
269 ast = ParseFiles(filenames) | 270 ast = ParseFiles(filenames) |
270 | 271 |
271 return Generator.Run(ast) | 272 return Generator.Run(ast) |
272 | 273 |
273 | 274 |
274 if __name__ == '__main__': | 275 if __name__ == '__main__': |
275 GeneratorReleaseTest('Test Gen', 'testgen', 'Generator Class Test.') | 276 GeneratorReleaseTest('Test Gen', 'testgen', 'Generator Class Test.') |
276 sys.exit(Main(sys.argv[1:])) | 277 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |