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..9b65cbc9bb537d3637f04b0603fc0cb78437d82e 100644 |
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py |
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py |
@@ -193,20 +193,23 @@ 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', |
darin (slow to review)
2014/05/19 21:14:33
nit: you might list these one per line so that fut
viettrungluu
2014/05/19 21:22:34
Done.
|
+ '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""" |