summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/idl_parser/idl_parser.py8
-rw-r--r--tools/idl_parser/test_parser/interface_web.idl17
2 files changed, 23 insertions, 2 deletions
diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py
index af0bd05..0fa9b61 100755
--- a/tools/idl_parser/idl_parser.py
+++ b/tools/idl_parser/idl_parser.py
@@ -324,8 +324,12 @@ class IDLParser(object):
# [17]
def p_DefaultValue(self, p):
"""DefaultValue : ConstValue
- | string"""
- if type(p[1]) == str:
+ | string
+ | '[' ']'"""
+ if len(p) == 3:
+ p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'sequence'),
+ self.BuildAttribute('VALUE', '[]'))
+ elif type(p[1]) == str:
p[0] = ListFromConcat(self.BuildAttribute('TYPE', 'DOMString'),
self.BuildAttribute('NAME', p[1]))
else:
diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl
index e42075b..cff2cd0 100644
--- a/tools/idl_parser/test_parser/interface_web.idl
+++ b/tools/idl_parser/test_parser/interface_web.idl
@@ -75,6 +75,23 @@ interface MyIFaceBig {
};
/* TREE
+ *Interface(MyIfaceEmptySequenceDefalutValue)
+ * Operation(foo)
+ * Arguments()
+ * Argument(arg)
+ * Type()
+ * Sequence()
+ * Type()
+ * PrimitiveType(DOMString)
+ * Default()
+ * Type()
+ * PrimitiveType(void)
+ */
+interface MyIfaceEmptySequenceDefalutValue {
+ void foo(optional sequence<DOMString> arg = []);
+};
+
+/* TREE
*Interface(MyIFaceBig2)
* Const(nullValue)
* PrimitiveType(DOMString)