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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 'INT_CONST_DEC', 'INT_CONST_HEX', | 85 'INT_CONST_DEC', 'INT_CONST_HEX', |
86 'FLOAT_CONST', | 86 'FLOAT_CONST', |
87 | 87 |
88 # String literals | 88 # String literals |
89 'STRING_LITERAL', | 89 'STRING_LITERAL', |
90 | 90 |
91 # Operators | 91 # Operators |
92 'MINUS', | 92 'MINUS', |
93 'PLUS', | 93 'PLUS', |
94 'AMP', | 94 'AMP', |
| 95 'QSTN', |
95 | 96 |
96 # Assignment | 97 # Assignment |
97 'EQUALS', | 98 'EQUALS', |
98 | 99 |
99 # Request / response | 100 # Request / response |
100 'RESPONSE', | 101 'RESPONSE', |
101 | 102 |
102 # Delimiters | 103 # Delimiters |
103 'LPAREN', 'RPAREN', # ( ) | 104 'LPAREN', 'RPAREN', # ( ) |
104 'LBRACKET', 'RBRACKET', # [ ] | 105 'LBRACKET', 'RBRACKET', # [ ] |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 | 166 |
166 # Newlines | 167 # Newlines |
167 def t_NEWLINE(self, t): | 168 def t_NEWLINE(self, t): |
168 r'\n+' | 169 r'\n+' |
169 t.lexer.lineno += len(t.value) | 170 t.lexer.lineno += len(t.value) |
170 | 171 |
171 # Operators | 172 # Operators |
172 t_MINUS = r'-' | 173 t_MINUS = r'-' |
173 t_PLUS = r'\+' | 174 t_PLUS = r'\+' |
174 t_AMP = r'&' | 175 t_AMP = r'&' |
| 176 t_QSTN = r'\?' |
175 | 177 |
176 # = | 178 # = |
177 t_EQUALS = r'=' | 179 t_EQUALS = r'=' |
178 | 180 |
179 # => | 181 # => |
180 t_RESPONSE = r'=>' | 182 t_RESPONSE = r'=>' |
181 | 183 |
182 # Delimiters | 184 # Delimiters |
183 t_LPAREN = r'\(' | 185 t_LPAREN = r'\(' |
184 t_RPAREN = r'\)' | 186 t_RPAREN = r'\)' |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 return t | 246 return t |
245 | 247 |
246 # Ignore C and C++ style comments | 248 # Ignore C and C++ style comments |
247 def t_COMMENT(self, t): | 249 def t_COMMENT(self, t): |
248 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' | 250 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' |
249 t.lexer.lineno += t.value.count("\n") | 251 t.lexer.lineno += t.value.count("\n") |
250 | 252 |
251 def t_error(self, t): | 253 def t_error(self, t): |
252 msg = "Illegal character %s" % repr(t.value[0]) | 254 msg = "Illegal character %s" % repr(t.value[0]) |
253 self._error(msg, t) | 255 self._error(msg, t) |
OLD | NEW |