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

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

Issue 226263002: Mojo: Move mojo/public/bindings to mojo/public/tools/bindings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
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.
11 try: 11 try:
12 # Disable lint check which fails to find the ply module. 12 # Disable lint check which fails to find the ply module.
13 # pylint: disable=F0401 13 # pylint: disable=F0401
14 from ply.lex import TOKEN 14 from ply.lex import TOKEN
15 except ImportError: 15 except ImportError:
16 # This assumes this file is in src/mojo/public/tools/bindings/pylib/parse/.
16 module_path, module_name = os.path.split(__file__) 17 module_path, module_name = os.path.split(__file__)
17 third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir, 18 third_party = os.path.join(module_path, os.pardir, os.pardir, os.pardir,
18 os.pardir, os.pardir, 'third_party') 19 os.pardir, os.pardir, os.pardir, 'third_party')
19 sys.path.append(third_party) 20 sys.path.append(third_party)
20 # pylint: disable=F0401 21 # pylint: disable=F0401
21 from ply.lex import TOKEN 22 from ply.lex import TOKEN
22 23
23 24
24 class LexError(Exception): 25 class LexError(Exception):
25 def __init__(self, filename, lineno, msg): 26 def __init__(self, filename, lineno, msg):
26 self.filename = filename 27 self.filename = filename
27 self.lineno = lineno 28 self.lineno = lineno
28 self.msg = msg 29 self.msg = msg
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 return t 279 return t
279 280
280 # Ignore C and C++ style comments 281 # Ignore C and C++ style comments
281 def t_COMMENT(self, t): 282 def t_COMMENT(self, t):
282 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)' 283 r'(/\*(.|\n)*?\*/)|(//.*(\n[ \t]*//.*)*)'
283 pass 284 pass
284 285
285 def t_error(self, t): 286 def t_error(self, t):
286 msg = 'Illegal character %s' % repr(t.value[0]) 287 msg = 'Illegal character %s' % repr(t.value[0])
287 self._error(msg, t) 288 self._error(msg, t)
OLDNEW
« no previous file with comments | « mojo/public/tools/bindings/pylib/parse/__init__.py ('k') | mojo/public/tools/bindings/pylib/parse/mojo_lexer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698