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

Unified Diff: mojo/public/tools/bindings/pylib/parse/mojo_parser.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, 9 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/pylib/parse/mojo_parser.py
diff --git a/mojo/public/tools/bindings/pylib/parse/mojo_parser.py b/mojo/public/tools/bindings/pylib/parse/mojo_parser.py
index 75e0e95063397f57383d78187ac3d1bc0111f175..c3c961ed0d2b9e76198e4e276b50572105c01339 100755
--- a/mojo/public/tools/bindings/pylib/parse/mojo_parser.py
+++ b/mojo/public/tools/bindings/pylib/parse/mojo_parser.py
@@ -56,7 +56,7 @@ class ParseError(Exception):
def __str__(self):
return "%s: Error: Unexpected end of file" % self.filename if self.eof \
else "%s:%d: Error: Unexpected %r:\n%s" % (
- self.filename, self.lineno + 1, self.bad_char, self.snippet)
+ self.filename, self.lineno, self.bad_char, self.snippet)
def __repr__(self):
return str(self)
@@ -334,9 +334,8 @@ class Parser(object):
# TODO(vtl): Can we figure out what's missing?
raise ParseError(self.filename, eof=True)
- lineno = e.lineno + 1
- snippet = self.source.split('\n')[lineno]
- raise ParseError(self.filename, lineno=lineno, snippet=snippet,
+ snippet = self.source.split('\n')[e.lineno - 1]
+ raise ParseError(self.filename, lineno=e.lineno, snippet=snippet,
bad_char=e.value)
« no previous file with comments | « mojo/public/tools/bindings/pylib/parse/mojo_lexer.py ('k') | mojo/public/tools/bindings/pylib/parse/mojo_parser_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698