diff options
author | bashi <bashi@chromium.org> | 2015-08-18 19:11:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 02:11:59 +0000 |
commit | cb5c1661b199801a9763919353702c9ea020be01 (patch) | |
tree | 1aba7a362f6b5e49f29a1270af1609691bdccdac | |
parent | 62ca3f0326203cca221bba6f0ee038ff292ecc66 (diff) | |
download | chromium_src-cb5c1661b199801a9763919353702c9ea020be01.zip chromium_src-cb5c1661b199801a9763919353702c9ea020be01.tar.gz chromium_src-cb5c1661b199801a9763919353702c9ea020be01.tar.bz2 |
Support FrozenArray in idl_parser.py
Spec: http://heycam.github.io/webidl/#idl-frozen-array
Almost the same as sequence<T>.
BUG=515920
Review URL: https://codereview.chromium.org/1295083004
Cr-Commit-Position: refs/heads/master@{#344129}
-rwxr-xr-x | tools/idl_parser/idl_lexer.py | 1 | ||||
-rwxr-xr-x | tools/idl_parser/idl_parser.py | 6 | ||||
-rw-r--r-- | tools/idl_parser/test_parser/interface_web.idl | 12 |
3 files changed, 17 insertions, 2 deletions
diff --git a/tools/idl_parser/idl_lexer.py b/tools/idl_parser/idl_lexer.py index abbed37..1f186d7 100755 --- a/tools/idl_parser/idl_lexer.py +++ b/tools/idl_parser/idl_lexer.py @@ -80,6 +80,7 @@ class IDLLexer(object): 'exception' : 'EXCEPTION', 'false' : 'FALSE', 'float' : 'FLOAT', + 'FrozenArray' : 'FROZENARRAY', 'getter': 'GETTER', 'implements' : 'IMPLEMENTS', 'Infinity' : 'INFINITY', diff --git a/tools/idl_parser/idl_parser.py b/tools/idl_parser/idl_parser.py index f8e509f..3dc2b53 100755 --- a/tools/idl_parser/idl_parser.py +++ b/tools/idl_parser/idl_parser.py @@ -886,7 +886,8 @@ class IDLParser(object): """NonAnyType : PrimitiveType TypeSuffix | PromiseType Null | identifier TypeSuffix - | SEQUENCE '<' Type '>' Null""" + | SEQUENCE '<' Type '>' Null + | FROZENARRAY '<' Type '>' Null""" if len(p) == 3: if type(p[1]) == str: typeref = self.BuildNamed('Typeref', p, 1) @@ -895,7 +896,8 @@ class IDLParser(object): p[0] = ListFromConcat(typeref, p[2]) if len(p) == 6: - p[0] = self.BuildProduction('Sequence', p, 1, ListFromConcat(p[3], p[5])) + cls = 'Sequence' if p[1] == 'sequence' else 'FrozenArray' + p[0] = self.BuildProduction(cls, p, 1, ListFromConcat(p[3], p[5])) # [79] NOT IMPLEMENTED (BufferRelatedType) diff --git a/tools/idl_parser/test_parser/interface_web.idl b/tools/idl_parser/test_parser/interface_web.idl index 90b0e83..a2c9ae6 100644 --- a/tools/idl_parser/test_parser/interface_web.idl +++ b/tools/idl_parser/test_parser/interface_web.idl @@ -369,3 +369,15 @@ interface MyIfaceSerializer { serializer = [getter]; serializer = [name1, name2]; }; + +/* TREE + *Interface(MyIfaceFrozenArray) + * Attribute(foo) + * Type() + * FrozenArray() + * Type() + * PrimitiveType(DOMString) + */ +interface MyIfaceFrozenArray { + readonly attribute FrozenArray<DOMString> foo; +}; |