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

Unified Diff: ppapi/generators/idl_parser.py

Issue 197873009: Support scoped types in PPAPI IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compiling. 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
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/generators/idl_parser.py
diff --git a/ppapi/generators/idl_parser.py b/ppapi/generators/idl_parser.py
index 73b15ca3813cbd3395c2483fcc9769fd58a619bf..20044a579ea2f9d88af54e8a1dfb115534460956 100755
--- a/ppapi/generators/idl_parser.py
+++ b/ppapi/generators/idl_parser.py
@@ -268,6 +268,28 @@ class IDLParser(IDLLexer):
if self.parse_debug: DumpReduction('modifiers', p)
#
+# Scoped name is a name with an optional scope.
+#
+# Used for types and namespace names. eg. foo_bar.hello_world, or
+# foo_bar.hello_world.SomeType.
+#
+ def p_scoped_name(self, p):
+ """scoped_name : SYMBOL
Nils Barth (inactive) 2014/03/28 05:01:19 This should instead be: scoped_name : SYMBOL scope
mtomasz 2014/03/28 05:19:38 Done.
Nils Barth (inactive) 2014/03/28 05:25:13 Thanks! LGTM again!
+ | scoped_name '.' SYMBOL"""
+ p[0] = ''.join(p[1:])
+ if self.parse_debug: DumpReduction('scoped_name', p)
+
+#
+# Type reference
+#
+#
+ def p_typeref(self, p):
+ """typeref : scoped_name"""
+ p[0] = p[1]
+ if self.parse_debug: DumpReduction('typeref', p)
+
+
+#
# Comments
#
# Comments are optional list of C style comment objects. Comments are returned
@@ -296,9 +318,8 @@ class IDLParser(IDLLexer):
# We allow namespace names of the form foo.bar.baz.
def p_namespace_name(self, p):
- """namespace_name : SYMBOL
- | SYMBOL '.' namespace_name"""
- p[0] = "".join(p[1:])
+ """namespace_name : scoped_name"""
+ p[0] = p[1]
#
@@ -621,7 +642,7 @@ class IDLParser(IDLLexer):
if self.parse_debug: DumpReduction('param_list', p)
def p_param_item(self, p):
- """param_item : modifiers optional SYMBOL arrays identifier"""
+ """param_item : modifiers optional typeref arrays identifier"""
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4])
p[0] = self.BuildNamed('Param', p, 5, children)
@@ -760,7 +781,7 @@ class IDLParser(IDLLexer):
# A member attribute or function of a struct or interface.
#
def p_member_attribute(self, p):
- """member_attribute : modifiers SYMBOL arrays questionmark identifier"""
+ """member_attribute : modifiers typeref arrays questionmark identifier"""
typeref = self.BuildAttribute('TYPEREF', p[2])
children = ListFromConcat(p[1], typeref, p[3], p[4])
p[0] = self.BuildNamed('Member', p, 5, children)
@@ -774,7 +795,7 @@ class IDLParser(IDLLexer):
if self.parse_debug: DumpReduction('attribute', p)
def p_member_function(self, p):
- """member_function : modifiers static SYMBOL arrays SYMBOL param_list"""
+ """member_function : modifiers static typeref arrays SYMBOL param_list"""
typeref = self.BuildAttribute('TYPEREF', p[3])
children = ListFromConcat(p[1], p[2], typeref, p[4], p[6])
p[0] = self.BuildNamed('Member', p, 5, children)
« no previous file with comments | « no previous file | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698