summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpeter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-06 15:41:43 +0000
committerpeter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-06 15:41:43 +0000
commitb108a5b96a0007c854721cc80ecc0c1efe73aa56 (patch)
tree7b252a87b34165de135bab54dae15e02ad08437f
parent18bef56842b6f1b5dbf7efca544cb01dda66ebfb (diff)
downloadchromium_src-b108a5b96a0007c854721cc80ecc0c1efe73aa56.zip
chromium_src-b108a5b96a0007c854721cc80ecc0c1efe73aa56.tar.gz
chromium_src-b108a5b96a0007c854721cc80ecc0c1efe73aa56.tar.bz2
Introduce support for ExtendedAttributeIdentList in the IDL parser.
BUG=399653 Review URL: https://codereview.chromium.org/447543002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@287775 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xtools/idl_parser/idl_parser.py24
-rwxr-xr-xtools/idl_parser/idl_ppapi_parser.py5
-rw-r--r--tools/idl_parser/test_parser/extattr_ppapi.idl8
-rw-r--r--tools/idl_parser/test_parser/interface_web.idl19
4 files changed, 51 insertions, 5 deletions
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py
index a8cd82f..a19785b 100755
--- a/tools/idl_parser/idl_parser.py
+++ b/tools/idl_parser/idl_parser.py
@@ -654,15 +654,17 @@ class IDLParser(object):
# We only support:
# [ identifier ]
+ # [ identifier ( ArgumentList ) ]
# [ identifier = identifier ]
- # [ identifier ( ArgumentList )]
- # [ identifier = identifier ( ArgumentList )]
+ # [ identifier = ( IdentifierList ) ]
+ # [ identifier = identifier ( ArgumentList ) ]
# [66] map directly to [91-93, 95]
# [67-69, 71] are unsupported
def p_ExtendedAttribute(self, p):
"""ExtendedAttribute : ExtendedAttributeNoArgs
| ExtendedAttributeArgList
| ExtendedAttributeIdent
+ | ExtendedAttributeIdentList
| ExtendedAttributeNamedArgList"""
p[0] = p[1]
@@ -855,7 +857,17 @@ class IDLParser(object):
else:
p[0] = p[1]
- # [89-90] NOT IMPLEMENTED (IdentifierList)
+ # [89]
+ def p_IdentifierList(self, p):
+ """IdentifierList : identifier Identifiers"""
+ p[0] = ListFromConcat(p[1], p[2])
+
+ # [90]
+ def p_Identifiers(self, p):
+ """Identifiers : ',' identifier Identifiers
+ |"""
+ if len(p) > 1:
+ p[0] = ListFromConcat(p[2], p[3])
# [91]
def p_ExtendedAttributeNoArgs(self, p):
@@ -874,7 +886,11 @@ class IDLParser(object):
value = self.BuildAttribute('VALUE', p[3])
p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
- # [94] NOT IMPLEMENTED (ExtendedAttributeIdentList)
+ # [94]
+ def p_ExtendedAttributeIdentList(self, p):
+ """ExtendedAttributeIdentList : identifier '=' '(' IdentifierList ')'"""
+ value = self.BuildAttribute('VALUE', p[4])
+ p[0] = self.BuildNamed('ExtAttribute', p, 1, value)
# [95]
def p_ExtendedAttributeNamedArgList(self, p):
diff --git a/tools/idl_parser/idl_ppapi_parser.py b/tools/idl_parser/idl_ppapi_parser.py
index 639a841..07963ea 100755
--- a/tools/idl_parser/idl_ppapi_parser.py
+++ b/tools/idl_parser/idl_ppapi_parser.py
@@ -239,9 +239,11 @@ class IDLPPAPIParser(IDLParser):
# We only support:
# [ identifier ]
- # [ identifier = identifier ]
# [ identifier ( ArgumentList )]
# [ identifier ( ValueList )]
+ # [ identifier = identifier ]
+ # [ identifier = ( IdentifierList )]
+ # [ identifier = ConstValue ]
# [ identifier = identifier ( ArgumentList )]
# [51] map directly to 74-77
# [52-54, 56] are unsupported
@@ -250,6 +252,7 @@ class IDLPPAPIParser(IDLParser):
| ExtendedAttributeArgList
| ExtendedAttributeValList
| ExtendedAttributeIdent
+ | ExtendedAttributeIdentList
| ExtendedAttributeIdentConst
| ExtendedAttributeNamedArgList"""
p[0] = p[1]
diff --git a/tools/idl_parser/test_parser/extattr_ppapi.idl b/tools/idl_parser/test_parser/extattr_ppapi.idl
index 0206901..07afbc0 100644
--- a/tools/idl_parser/test_parser/extattr_ppapi.idl
+++ b/tools/idl_parser/test_parser/extattr_ppapi.idl
@@ -89,3 +89,11 @@ symatics should exist. This is an exact match.
*/
[foo=1.2e-3] interface Foo {};
+
+/* TREE
+ *Interface(Foo)
+ * ExtAttributes()
+ * ExtAttribute(foo)
+ */
+
+[foo=(bar, baz)] interface Foo {};
diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl
index da1dfcd..8d41e91 100644
--- a/tools/idl_parser/test_parser/interface_web.idl
+++ b/tools/idl_parser/test_parser/interface_web.idl
@@ -162,3 +162,22 @@ interface MyIFaceStringifiers {
stringifier DOMString namedStringifier();
stringifier attribute DOMString stringValue;
};
+
+/* TREE
+ *Interface(MyExtendedAttributeInterface)
+ * Operation(method)
+ * Arguments()
+ * Type()
+ * PrimitiveType(void)
+ * ExtAttributes()
+ * ExtAttribute(Attr)
+ * ExtAttribute(MethodIdentList)
+ * ExtAttributes()
+ * ExtAttribute(MyExtendedAttribute)
+ * ExtAttribute(MyExtendedIdentListAttribute)
+ */
+[MyExtendedAttribute,
+ MyExtendedIdentListAttribute=(Foo, Bar, Baz)]
+interface MyExtendedAttributeInterface {
+ [Attr, MethodIdentList=(Foo, Bar)] void method();
+};