OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2012 The Native Client 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 """ | 6 """ |
7 A simple recursive-descent parser for the table file format. | 7 A simple recursive-descent parser for the table file format. |
8 | 8 |
9 The grammar implemented here is roughly (taking some liberties with whitespace | 9 The grammar implemented here is roughly (taking some liberties with whitespace |
10 and comment parsing): | 10 and comment parsing): |
11 | 11 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 _line_no += 1 | 115 _line_no += 1 |
116 _line = _in.readline() | 116 _line = _in.readline() |
117 if _line: | 117 if _line: |
118 _line = re.sub(r'#.*', '', _line).strip() | 118 _line = re.sub(r'#.*', '', _line).strip() |
119 else: | 119 else: |
120 _line = None | 120 _line = None |
121 | 121 |
122 | 122 |
123 def unexpected(): | 123 def unexpected(): |
124 raise Exception('Line %d: Unexpected line in input: %s' % (_line_no, _line)) | 124 raise Exception('Line %d: Unexpected line in input: %s' % (_line_no, _line)) |
OLD | NEW |