Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Side by Side Diff: mojo/public/tools/bindings/pylib/parse/mojo_lexer.py

Issue 226983002: Mojo: Mojom: Test the parser when there's no module declared. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/parse/mojo_parser.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 octal_or_hex_ordinal_disallowed = r'@((0[0-9]+)|('+hex_prefix+hex_digits+'))' 165 octal_or_hex_ordinal_disallowed = r'@((0[0-9]+)|('+hex_prefix+hex_digits+'))'
166 166
167 ## 167 ##
168 ## Rules for the normal state 168 ## Rules for the normal state
169 ## 169 ##
170 t_ignore = ' \t\r' 170 t_ignore = ' \t\r'
171 171
172 # Newlines 172 # Newlines
173 def t_NEWLINE(self, t): 173 def t_NEWLINE(self, t):
174 r'\n+' 174 r'\n+'
175 t.lexer.lineno += t.value.count("\n") 175 t.lexer.lineno += len(t.value)
176 176
177 # Operators 177 # Operators
178 t_PLUS = r'\+' 178 t_PLUS = r'\+'
179 t_MINUS = r'-' 179 t_MINUS = r'-'
180 t_TIMES = r'\*' 180 t_TIMES = r'\*'
181 t_DIVIDE = r'/' 181 t_DIVIDE = r'/'
182 t_MOD = r'%' 182 t_MOD = r'%'
183 t_OR = r'\|' 183 t_OR = r'\|'
184 t_AND = r'&' 184 t_AND = r'&'
185 t_NOT = r'~' 185 t_NOT = r'~'
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return t 279 return t
280 280
281 # Ignore C and C++ style comments 281 # Ignore C and C++ style comments
282 def t_COMMENT(self, t): 282 def t_COMMENT(self, t):
283 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' 283 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
284 pass 284 pass
285 285
286 def t_error(self, t): 286 def t_error(self, t):
287 msg = 'Illegal character %s' % repr(t.value[0]) 287 msg = 'Illegal character %s' % repr(t.value[0])
288 self._error(msg, t) 288 self._error(msg, t)
OLDNEW
« no previous file with comments | « no previous file | mojo/public/tools/bindings/pylib/parse/mojo_parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698