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 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 self._error(msg, t) | 272 self._error(msg, t) |
273 | 273 |
274 @TOKEN(identifier) | 274 @TOKEN(identifier) |
275 def t_NAME(self, t): | 275 def t_NAME(self, t): |
276 t.type = self.keyword_map.get(t.value, "NAME") | 276 t.type = self.keyword_map.get(t.value, "NAME") |
277 return t | 277 return t |
278 | 278 |
279 # Ignore C and C++ style comments | 279 # Ignore C and C++ style comments |
280 def t_COMMENT(self, t): | 280 def t_COMMENT(self, t): |
281 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' | 281 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' |
282 pass | 282 t.lexer.lineno += t.value.count("\n") |
283 | 283 |
284 def t_error(self, t): | 284 def t_error(self, t): |
285 msg = 'Illegal character %s' % repr(t.value[0]) | 285 msg = "Illegal character %s" % repr(t.value[0]) |
286 self._error(msg, t) | 286 self._error(msg, t) |
OLD | NEW |