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

Unified Diff: mojo/public/tools/bindings/pylib/mojom/parse/parser.py

Issue 295773002: Mojo: Mojom: Make specialized handle types (e.g., message_pipe) not keywords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review comments Created 6 years, 7 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/mojom/parse/parser.py
diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
index be75fc725ab94c9999249e9395438cabe37c0da0..a72f6d8384c581fec90dd4590b8c6f20d18f6ee4 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -193,20 +193,25 @@ class Parser(object):
def p_basictypename(self, p):
"""basictypename : identifier
- | HANDLE
- | specializedhandle"""
+ | handletype"""
p[0] = p[1]
- def p_specializedhandle(self, p):
- """specializedhandle : HANDLE LANGLE specializedhandlename RANGLE"""
- p[0] = "handle<" + p[3] + ">"
-
- def p_specializedhandlename(self, p):
- """specializedhandlename : DATA_PIPE_CONSUMER
- | DATA_PIPE_PRODUCER
- | MESSAGE_PIPE
- | SHARED_BUFFER"""
- p[0] = p[1]
+ def p_handletype(self, p):
+ """handletype : HANDLE
+ | HANDLE LANGLE identifier RANGLE"""
+ if len(p) == 2:
+ p[0] = p[1]
+ else:
+ if p[3] not in ('data_pipe_consumer',
+ 'data_pipe_producer',
+ 'message_pipe',
+ 'shared_buffer'):
+ # Note: We don't enable tracking of line numbers for everything, so we
+ # can't use |p.lineno(3)|.
+ raise ParseError(self.filename, "Invalid handle type %r:" % p[3],
+ lineno=p.lineno(1),
+ snippet=self._GetSnippet(p.lineno(1)))
+ p[0] = "handle<" + p[3] + ">"
def p_array(self, p):
"""array : typename LBRACKET RBRACKET"""

Powered by Google App Engine
This is Rietveld 408576698