Commit f75a39e4 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

IDL parser: Drop support of 2 legacy keywords

Now we don't use keywords "creator" nor "legacycaller".
This CL drops these legacy keywords and reconstruct the parsing
patterns.  This change does not change output ASTs, as a result.

The new pattern ignores OperationNameKeyword to allow "includes"
as an operation's name, because the case is cought by the leading
"_" rule.

cf. https://github.com/heycam/webidl/issues/767



Bug: 839389
Change-Id: Idccb1853a82d629504464f0dad5fbe82702c083d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809134Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697519}
parent 522f6fdc
...@@ -60,7 +60,6 @@ class IDLLexer(object): ...@@ -60,7 +60,6 @@ class IDLLexer(object):
'ByteString' : 'BYTESTRING', 'ByteString' : 'BYTESTRING',
'callback' : 'CALLBACK', 'callback' : 'CALLBACK',
'const' : 'CONST', 'const' : 'CONST',
'creator' : 'CREATOR',
'deleter' : 'DELETER', 'deleter' : 'DELETER',
'dictionary' : 'DICTIONARY', 'dictionary' : 'DICTIONARY',
'DOMString' : 'DOMSTRING', 'DOMString' : 'DOMSTRING',
...@@ -75,7 +74,6 @@ class IDLLexer(object): ...@@ -75,7 +74,6 @@ class IDLLexer(object):
'inherit' : 'INHERIT', 'inherit' : 'INHERIT',
'interface' : 'INTERFACE', 'interface' : 'INTERFACE',
'iterable': 'ITERABLE', 'iterable': 'ITERABLE',
'legacycaller' : 'LEGACYCALLER',
'long' : 'LONG', 'long' : 'LONG',
'maplike': 'MAPLIKE', 'maplike': 'MAPLIKE',
'mixin': 'MIXIN', 'mixin': 'MIXIN',
......
...@@ -271,14 +271,12 @@ class IDLParser(object): ...@@ -271,14 +271,12 @@ class IDLParser(object):
"""ArgumentNameKeyword : ATTRIBUTE """ArgumentNameKeyword : ATTRIBUTE
| CALLBACK | CALLBACK
| CONST | CONST
| CREATOR
| DELETER | DELETER
| DICTIONARY | DICTIONARY
| ENUM | ENUM
| GETTER | GETTER
| INCLUDES | INCLUDES
| INHERIT | INHERIT
| LEGACYCALLER
| NAMESPACE | NAMESPACE
| PARTIAL | PARTIAL
| SETTER | SETTER
...@@ -509,41 +507,34 @@ class IDLParser(object): ...@@ -509,41 +507,34 @@ class IDLParser(object):
p[0] = p[1] p[0] = p[1]
def p_Operation(self, p): def p_Operation(self, p):
"""Operation : ReturnType OperationRest """Operation : RegularOperation
| SpecialOperation""" | SpecialOperation"""
if len(p) == 3: p[0] = p[1]
p[2].AddChildren(p[1])
p[0] = p[2]
else:
p[0] = p[1]
def p_SpecialOperation(self, p): def p_RegularOperation(self, p):
"""SpecialOperation : Special Specials ReturnType OperationRest""" """RegularOperation : ReturnType OperationRest"""
p[4].AddChildren(ListFromConcat(p[1], p[2], p[3])) p[2].AddChildren(p[1])
p[0] = p[4] p[0] = p[2]
def p_Specials(self, p): def p_SpecialOperation(self, p):
"""Specials : Special Specials """SpecialOperation : Special RegularOperation"""
| """ p[2].AddChildren(p[1])
if len(p) > 1: p[0] = p[2]
p[0] = ListFromConcat(p[1], p[2])
def p_Special(self, p): def p_Special(self, p):
"""Special : GETTER """Special : GETTER
| SETTER | SETTER
| CREATOR | DELETER"""
| DELETER
| LEGACYCALLER"""
p[0] = self.BuildTrue(p[1].upper()) p[0] = self.BuildTrue(p[1].upper())
def p_OperationRest(self, p): def p_OperationRest(self, p):
"""OperationRest : OptionalIdentifier '(' ArgumentList ')' ';'""" """OperationRest : OptionalOperationName '(' ArgumentList ')' ';'"""
arguments = self.BuildProduction('Arguments', p, 2, p[3]) arguments = self.BuildProduction('Arguments', p, 2, p[3])
p[0] = self.BuildNamed('Operation', p, 1, arguments) p[0] = self.BuildNamed('Operation', p, 1, arguments)
def p_OptionalIdentifier(self, p): def p_OptionalOperationName(self, p):
"""OptionalIdentifier : identifier """OptionalOperationName : identifier
|""" |"""
if len(p) > 1: if len(p) > 1:
p[0] = p[1] p[0] = p[1]
else: else:
......
...@@ -5,7 +5,6 @@ BYTESTRING ByteString ...@@ -5,7 +5,6 @@ BYTESTRING ByteString
BYTE byte BYTE byte
CALLBACK callback CALLBACK callback
CONST const CONST const
CREATOR creator
DELETER deleter DELETER deleter
DICTIONARY dictionary DICTIONARY dictionary
DOMSTRING DOMString DOMSTRING DOMString
...@@ -18,7 +17,6 @@ INFINITY Infinity ...@@ -18,7 +17,6 @@ INFINITY Infinity
INHERIT inherit INHERIT inherit
INTERFACE interface INTERFACE interface
ITERABLE iterable ITERABLE iterable
LEGACYCALLER legacycaller
LONG long LONG long
MAPLIKE maplike MAPLIKE maplike
MIXIN mixin MIXIN mixin
......
...@@ -271,7 +271,6 @@ interface MyIFaceBig { ...@@ -271,7 +271,6 @@ interface MyIFaceBig {
/** TREE /** TREE
*Interface(MyIFaceSpecials) *Interface(MyIFaceSpecials)
* Operation(set) * Operation(set)
* CREATOR: True
* SETTER: True * SETTER: True
* Arguments() * Arguments()
* Argument(property) * Argument(property)
...@@ -289,7 +288,7 @@ interface MyIFaceBig { ...@@ -289,7 +288,7 @@ interface MyIFaceBig {
* PrimitiveType(double) * PrimitiveType(double)
*/ */
interface MyIFaceSpecials { interface MyIFaceSpecials {
setter creator void set(DOMString property); setter void set(DOMString property);
getter double (DOMString property); getter double (DOMString property);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment