Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for mixin syntax #32

Closed
tobie opened this issue Nov 3, 2017 · 2 comments · Fixed by #33
Closed

Add support for mixin syntax #32

tobie opened this issue Nov 3, 2017 · 2 comments · Fixed by #33

Comments

@tobie
Copy link

tobie commented Nov 3, 2017

Hey,

We recently changed the WebIDL syntax to add support for mixins. We also added CI tooling to make sure the grammar stayed LL(1), and fixed a couple of issues in the process.

Here's an indicative diff of the recent grammar changes, but please do refer to the IDL index section in the spec for details:

--- (old)
+++ (new)
@@ -3,17 +3,13 @@
     ε
 
 Definition ::
-    CallbackOrInterface
+    CallbackOrInterfaceOrMixin
     Namespace
     Partial
     Dictionary
     Enum
     Typedef
-    ImplementsStatement
-
-CallbackOrInterface ::
-    callback CallbackRestOrInterface
-    Interface
+    IncludesStatement
 
 ArgumentNameKeyword ::
     attribute
@@ -23,7 +19,7 @@
     dictionary
     enum
     getter
-    implements
+    includes
     inherit
     interface
     iterable
@@ -38,23 +34,35 @@
     typedef
     unrestricted
 
+CallbackOrInterfaceOrMixin ::
+    callback CallbackRestOrInterface
+    interface InterfaceOrMixin
+
 CallbackRestOrInterface ::
     CallbackRest
-    Interface
+    interface InterfaceRest
+
+InterfaceOrMixin ::
+    InterfaceRest
+    MixinRest
 
-Interface ::
-    interface identifier Inheritance { InterfaceMembers } ;
+InterfaceRest ::
+    identifier Inheritance { InterfaceMembers } ;
 
 Partial ::
     partial PartialDefinition
 
 PartialDefinition ::
-    PartialInterface
+    interface PartialInterfaceOrPartialMixin
     PartialDictionary
     Namespace
 
-PartialInterface ::
-    interface identifier { InterfaceMembers } ;
+PartialInterfaceOrPartialMixin ::
+    PartialInterfaceRest
+    MixinRest
+
+PartialInterfaceRest ::
+    identifier { InterfaceMembers } ;
 
 InterfaceMembers ::
     ExtendedAttributeList InterfaceMember InterfaceMembers
@@ -75,6 +83,22 @@
     : identifier
     ε
 
+MixinRest ::
+    mixin identifier { MixinMembers } ;
+
+MixinMembers ::
+    ExtendedAttributeList MixinMember MixinMembers
+    ε
+
+MixinMember ::
+    Const
+    RegularOperation
+    Stringifier
+    ReadOnly AttributeRest
+
+IncludesStatement ::
+    identifier includes identifier ;
+
 Const ::
     const ConstType identifier = ConstValue ;
 
@@ -130,11 +154,14 @@
     [ ]
 
 Operation ::
-    ReturnType OperationRest
+    RegularOperation
     SpecialOperation
 
+RegularOperation ::
+    ReturnType OperationRest
+
 SpecialOperation ::
-    Special Specials ReturnType OperationRest
+    Special Specials RegularOperation
 
 Specials ::
     Special Specials
@@ -161,8 +188,11 @@
     ε
 
 Argument ::
-    ExtendedAttributeList optional TypeWithExtendedAttributes ArgumentName Default
-    ExtendedAttributeList Type Ellipsis ArgumentName
+    ExtendedAttributeList ArgumentRest
+
+ArgumentRest ::
+    optional TypeWithExtendedAttributes ArgumentName Default
+    Type Ellipsis ArgumentName
 
 ArgumentName ::
     ArgumentNameKeyword
@@ -181,7 +211,7 @@
 
 StringifierRest ::
     ReadOnly AttributeRest
-    ReturnType OperationRest
+    RegularOperation
     ;
 
 StaticMember ::
@@ -189,7 +219,7 @@
 
 StaticMemberRest ::
     ReadOnly AttributeRest
-    ReturnType OperationRest
+    RegularOperation
 
 Iterable ::
     iterable < TypeWithExtendedAttributes OptionalType > ;
@@ -218,7 +248,7 @@
     ε
 
 NamespaceMember ::
-    ReturnType OperationRest
+    RegularOperation
     readonly AttributeRest
 
 Dictionary ::
@@ -229,8 +259,11 @@
     ε
 
 DictionaryMember ::
-    ExtendedAttributeList required TypeWithExtendedAttributes identifier Default ;
-    ExtendedAttributeList Type identifier Default ;
+    ExtendedAttributeList DictionaryMemberRest
+
+DictionaryMemberRest ::
+    required TypeWithExtendedAttributes identifier Default ;
+    Type identifier Default ;
 
 PartialDictionary ::
     dictionary identifier { DictionaryMembers } ;
@@ -259,16 +292,12 @@
 Typedef ::
     typedef TypeWithExtendedAttributes identifier ;
 
-ImplementsStatement ::
-    identifier implements identifier ;
-
 Type ::
     SingleType
     UnionType Null
 
 TypeWithExtendedAttributes ::
-    ExtendedAttributeList SingleType
-    ExtendedAttributeList UnionType Null
+    ExtendedAttributeList Type
 
 SingleType ::
     NonAnyType

Let me know if there's anything I can do to help!


Tracked in: whatwg/webidl#472 | Original pull-request: whatwg/webidl#433

romandev added a commit to romandev/widlparser that referenced this issue Nov 11, 2017
@domenic
Copy link
Contributor

domenic commented Dec 5, 2017

Ping; this is blocking a lot of specs that would like to update :)

romandev added a commit to romandev/widlparser that referenced this issue Dec 6, 2017
This change includes the following things:
  - Add Mixin class
  - Add MixinMember class
    (It only allows Const, Operation, Stringifier, ReadOnlyAttribute)
  - Add IncludesStatement
  - Add tests

This change fixes plinss#32.
@plinss plinss closed this as completed in #33 Dec 7, 2017
@plinss
Copy link
Owner

plinss commented Dec 7, 2017

Ping @tabatkins to upstream into Bikeshed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants