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 imp | 5 import imp |
6 import os.path | 6 import os.path |
7 import sys | 7 import sys |
8 | 8 |
9 # Disable lint check for finding modules: | 9 # Disable lint check for finding modules: |
10 # pylint: disable=F0401 | 10 # pylint: disable=F0401 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ## Internal auxiliary methods | 50 ## Internal auxiliary methods |
51 ## | 51 ## |
52 def _error(self, msg, token): | 52 def _error(self, msg, token): |
53 raise LexError(self.filename, msg, token.lineno) | 53 raise LexError(self.filename, msg, token.lineno) |
54 | 54 |
55 ## | 55 ## |
56 ## Reserved keywords | 56 ## Reserved keywords |
57 ## | 57 ## |
58 keywords = ( | 58 keywords = ( |
59 'HANDLE', | 59 'HANDLE', |
60 'DATA_PIPE_CONSUMER', | |
61 'DATA_PIPE_PRODUCER', | |
62 'MESSAGE_PIPE', | |
63 'SHARED_BUFFER', | |
64 | 60 |
65 'IMPORT', | 61 'IMPORT', |
66 'MODULE', | 62 'MODULE', |
67 'STRUCT', | 63 'STRUCT', |
68 'INTERFACE', | 64 'INTERFACE', |
69 'ENUM', | 65 'ENUM', |
70 'CONST', | 66 'CONST', |
71 ) | 67 ) |
72 | 68 |
73 keyword_map = {} | 69 keyword_map = {} |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 return t | 277 return t |
282 | 278 |
283 # Ignore C and C++ style comments | 279 # Ignore C and C++ style comments |
284 def t_COMMENT(self, t): | 280 def t_COMMENT(self, t): |
285 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' | 281 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' |
286 pass | 282 pass |
287 | 283 |
288 def t_error(self, t): | 284 def t_error(self, t): |
289 msg = 'Illegal character %s' % repr(t.value[0]) | 285 msg = 'Illegal character %s' % repr(t.value[0]) |
290 self._error(msg, t) | 286 self._error(msg, t) |
OLD | NEW |