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

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

Issue 437643002: Support nullable types in mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 da728e7f7c87f4b07ae11ef6d7118d87185a36dc..575b5aacd6f0cefe95a367048d63c525c371c134 100644
--- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
+++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py
@@ -231,10 +231,18 @@ class Parser(object):
filename=self.filename, lineno=p.lineno(2))
def p_typename(self, p):
- """typename : basictypename
- | array
- | fixed_array
- | interfacerequest"""
+ """typename : nonnullable_typename QSTN
+ | nonnullable_typename"""
+ if len(p) == 2:
+ p[0] = p[1]
+ else:
+ p[0] = p[1] + "?"
+
+ def p_nonnullable_typename(self, p):
+ """nonnullable_typename : basictypename
+ | array
+ | fixed_array
+ | interfacerequest"""
p[0] = p[1]
def p_basictypename(self, p):
« no previous file with comments | « mojo/public/tools/bindings/pylib/mojom/parse/lexer.py ('k') | mojo/public/tools/bindings/pylib/mojom/parse/translate.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698