| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 'INT_CONST_DEC', 'INT_CONST_HEX', | 82 'INT_CONST_DEC', 'INT_CONST_HEX', |
| 83 'FLOAT_CONST', | 83 'FLOAT_CONST', |
| 84 'CHAR_CONST', | 84 'CHAR_CONST', |
| 85 | 85 |
| 86 # String literals | 86 # String literals |
| 87 'STRING_LITERAL', | 87 'STRING_LITERAL', |
| 88 | 88 |
| 89 # Operators | 89 # Operators |
| 90 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', | 90 'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD', |
| 91 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', | 91 'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT', |
| 92 'AMP', |
| 92 | 93 |
| 93 # Assignment | 94 # Assignment |
| 94 'EQUALS', | 95 'EQUALS', |
| 95 | 96 |
| 96 # Request / response | 97 # Request / response |
| 97 'RESPONSE', | 98 'RESPONSE', |
| 98 | 99 |
| 99 # Delimiters | 100 # Delimiters |
| 100 'LPAREN', 'RPAREN', # ( ) | 101 'LPAREN', 'RPAREN', # ( ) |
| 101 'LBRACKET', 'RBRACKET', # [ ] | 102 'LBRACKET', 'RBRACKET', # [ ] |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 t_MINUS = r'-' | 177 t_MINUS = r'-' |
| 177 t_TIMES = r'\*' | 178 t_TIMES = r'\*' |
| 178 t_DIVIDE = r'/' | 179 t_DIVIDE = r'/' |
| 179 t_MOD = r'%' | 180 t_MOD = r'%' |
| 180 t_OR = r'\|' | 181 t_OR = r'\|' |
| 181 t_AND = r'&' | 182 t_AND = r'&' |
| 182 t_NOT = r'~' | 183 t_NOT = r'~' |
| 183 t_XOR = r'\^' | 184 t_XOR = r'\^' |
| 184 t_LSHIFT = r'<<' | 185 t_LSHIFT = r'<<' |
| 185 t_RSHIFT = r'>>' | 186 t_RSHIFT = r'>>' |
| 187 t_AMP = r'&' |
| 186 | 188 |
| 187 # = | 189 # = |
| 188 t_EQUALS = r'=' | 190 t_EQUALS = r'=' |
| 189 | 191 |
| 190 # => | 192 # => |
| 191 t_RESPONSE = r'=>' | 193 t_RESPONSE = r'=>' |
| 192 | 194 |
| 193 # Delimiters | 195 # Delimiters |
| 194 t_LPAREN = r'\(' | 196 t_LPAREN = r'\(' |
| 195 t_RPAREN = r'\)' | 197 t_RPAREN = r'\)' |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 return t | 274 return t |
| 273 | 275 |
| 274 # Ignore C and C++ style comments | 276 # Ignore C and C++ style comments |
| 275 def t_COMMENT(self, t): | 277 def t_COMMENT(self, t): |
| 276 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' | 278 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' |
| 277 t.lexer.lineno += t.value.count("\n") | 279 t.lexer.lineno += t.value.count("\n") |
| 278 | 280 |
| 279 def t_error(self, t): | 281 def t_error(self, t): |
| 280 msg = "Illegal character %s" % repr(t.value[0]) | 282 msg = "Illegal character %s" % repr(t.value[0]) |
| 281 self._error(msg, t) | 283 self._error(msg, t) |
| OLD | NEW |