| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 if debug: | 413 if debug: |
| 414 # Turn off optimization and caching, and write out tables, | 414 # Turn off optimization and caching, and write out tables, |
| 415 # to help debugging | 415 # to help debugging |
| 416 optimize = False | 416 optimize = False |
| 417 outputdir = None | 417 outputdir = None |
| 418 picklefile = None | 418 picklefile = None |
| 419 write_tables = True | 419 write_tables = True |
| 420 if outputdir: | 420 if outputdir: |
| 421 picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle'
) | 421 picklefile = picklefile or os.path.join(outputdir, 'parsetab.pickle'
) |
| 422 | 422 |
| 423 lexer = lexer or BlinkIDLLexer() | 423 lexer = lexer or BlinkIDLLexer(debug=debug, |
| 424 outputdir=outputdir, |
| 425 optimize=optimize) |
| 424 self.lexer = lexer | 426 self.lexer = lexer |
| 425 self.tokens = lexer.KnownTokens() | 427 self.tokens = lexer.KnownTokens() |
| 426 # Using SLR (instead of LALR) generates the table faster, | 428 # Using SLR (instead of LALR) generates the table faster, |
| 427 # but produces the same output. This is ok b/c Web IDL (and Blink IDL) | 429 # but produces the same output. This is ok b/c Web IDL (and Blink IDL) |
| 428 # is an SLR grammar (as is often the case for simple LL(1) grammars). | 430 # is an SLR grammar (as is often the case for simple LL(1) grammars). |
| 429 # | 431 # |
| 430 # Optimized mode substantially decreases startup time (by disabling | 432 # Optimized mode substantially decreases startup time (by disabling |
| 431 # error checking), and also allows use of Python's optimized mode. | 433 # error checking), and also allows use of Python's optimized mode. |
| 432 # See: Using Python's Optimized Mode | 434 # See: Using Python's Optimized Mode |
| 433 # http://www.dabeaz.com/ply/ply.html#ply_nn38 | 435 # http://www.dabeaz.com/ply/ply.html#ply_nn38 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 460 try: | 462 try: |
| 461 outputdir = argv[1] | 463 outputdir = argv[1] |
| 462 except IndexError as err: | 464 except IndexError as err: |
| 463 print 'Usage: %s OUTPUT_DIR' % argv[0] | 465 print 'Usage: %s OUTPUT_DIR' % argv[0] |
| 464 return 1 | 466 return 1 |
| 465 parser = BlinkIDLParser(outputdir=outputdir) | 467 parser = BlinkIDLParser(outputdir=outputdir) |
| 466 | 468 |
| 467 | 469 |
| 468 if __name__ == '__main__': | 470 if __name__ == '__main__': |
| 469 sys.exit(main(sys.argv)) | 471 sys.exit(main(sys.argv)) |
| OLD | NEW |