| OLD | NEW |
| 1 # Copyright 2013 the V8 project authors. All rights reserved. | 1 # Copyright 2013 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 parser = argparse.ArgumentParser() | 89 parser = argparse.ArgumentParser() |
| 90 parser.add_argument('--html') | 90 parser.add_argument('--html') |
| 91 parser.add_argument('--re', default='src/lexer/lexer_py.re') | 91 parser.add_argument('--re', default='src/lexer/lexer_py.re') |
| 92 parser.add_argument('--input') | 92 parser.add_argument('--input') |
| 93 parser.add_argument('--code') | 93 parser.add_argument('--code') |
| 94 args = parser.parse_args() | 94 args = parser.parse_args() |
| 95 | 95 |
| 96 re_file = args.re | 96 re_file = args.re |
| 97 print "parsing %s" % re_file | 97 print "parsing %s" % re_file |
| 98 with open(re_file, 'r') as f: | 98 with open(re_file, 'r') as f: |
| 99 rule_processor = RuleProcessor.parse(f.read()) | 99 rule_processor = RuleProcessor.parse(f.read(), False) |
| 100 | 100 |
| 101 html_file = args.html | 101 html_file = args.html |
| 102 if html_file: | 102 if html_file: |
| 103 html = generate_html(rule_processor) | 103 html = generate_html(rule_processor) |
| 104 with open(args.html, 'w') as f: | 104 with open(args.html, 'w') as f: |
| 105 f.write(html) | 105 f.write(html) |
| 106 print "wrote html to %s" % html_file | 106 print "wrote html to %s" % html_file |
| 107 | 107 |
| 108 code_file = args.code | 108 code_file = args.code |
| 109 if code_file: | 109 if code_file: |
| 110 code = generate_code(rule_processor) | 110 code = generate_code(rule_processor) |
| 111 with open(code_file, 'w') as f: | 111 with open(code_file, 'w') as f: |
| 112 f.write(code) | 112 f.write(code) |
| 113 print "wrote code to %s" % code_file | 113 print "wrote code to %s" % code_file |
| 114 | 114 |
| 115 input_file = args.input | 115 input_file = args.input |
| 116 if input_file: | 116 if input_file: |
| 117 with open(input_file, 'r') as f: | 117 with open(input_file, 'r') as f: |
| 118 lex(rule_processor, f.read()) | 118 lex(rule_processor, f.read()) |
| OLD | NEW |