OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 import sys | 6 import sys |
7 import os.path | 7 import os.path |
8 | 8 |
9 # Try to load the ply module, if not, then assume it is in the third_party | 9 # Try to load the ply module, if not, then assume it is in the third_party |
10 # directory. | 10 # directory. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 raise LexError(self.filename, token.lineno, msg) | 48 raise LexError(self.filename, token.lineno, msg) |
49 | 49 |
50 ## | 50 ## |
51 ## Reserved keywords | 51 ## Reserved keywords |
52 ## | 52 ## |
53 keywords = ( | 53 keywords = ( |
54 'HANDLE', | 54 'HANDLE', |
55 'DATA_PIPE_CONSUMER', | 55 'DATA_PIPE_CONSUMER', |
56 'DATA_PIPE_PRODUCER', | 56 'DATA_PIPE_PRODUCER', |
57 'MESSAGE_PIPE', | 57 'MESSAGE_PIPE', |
| 58 'SHARED_BUFFER', |
58 | 59 |
59 'IMPORT', | 60 'IMPORT', |
60 'MODULE', | 61 'MODULE', |
61 'STRUCT', | 62 'STRUCT', |
62 'INTERFACE', | 63 'INTERFACE', |
63 'ENUM', | 64 'ENUM', |
64 ) | 65 ) |
65 | 66 |
66 keyword_map = {} | 67 keyword_map = {} |
67 for keyword in keywords: | 68 for keyword in keywords: |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 return t | 288 return t |
288 | 289 |
289 # Ignore C and C++ style comments | 290 # Ignore C and C++ style comments |
290 def t_COMMENT(self, t): | 291 def t_COMMENT(self, t): |
291 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' | 292 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' |
292 pass | 293 pass |
293 | 294 |
294 def t_error(self, t): | 295 def t_error(self, t): |
295 msg = 'Illegal character %s' % repr(t.value[0]) | 296 msg = 'Illegal character %s' % repr(t.value[0]) |
296 self._error(msg, t) | 297 self._error(msg, t) |
OLD | NEW |