Comparing version 7.0.0 to 8.0.0
"use strict"; | ||
// Foo | ||
(function() { | ||
(() => { | ||
function tokenise(str) { | ||
@@ -57,2 +55,11 @@ const tokens = []; | ||
const EMPTY_OPERATION = Object.freeze({ | ||
type: "operation", | ||
getter: false, | ||
setter: false, | ||
deleter: false, | ||
"static": false, | ||
stringifier: false | ||
}); | ||
function error(str) { | ||
@@ -485,4 +492,3 @@ let tok = ""; | ||
if (tok) { | ||
tokens.unshift(tok); | ||
ret = interface_(); | ||
ret = interface_rest(); | ||
ret.type = "callback interface"; | ||
@@ -517,9 +523,2 @@ return ret; | ||
}; | ||
if (consume(ID, "static")) { | ||
ret["static"] = true; | ||
grabbed.push(last_token); | ||
} else if (consume(ID, "stringifier")) { | ||
ret.stringifier = true; | ||
grabbed.push(last_token); | ||
} | ||
const w = all_ws(); | ||
@@ -575,11 +574,3 @@ if (w) grabbed.push(w); | ||
all_ws(store, "pea"); | ||
const ret = { | ||
type: "operation", | ||
getter: false, | ||
setter: false, | ||
creator: false, | ||
deleter: false, | ||
"static": false, | ||
stringifier: false | ||
}; | ||
const ret = Object.assign({}, EMPTY_OPERATION); | ||
while (true) { | ||
@@ -589,7 +580,6 @@ all_ws(); | ||
else if (consume(ID, "setter")) ret.setter = true; | ||
else if (consume(ID, "creator")) ret.creator = true; | ||
else if (consume(ID, "deleter")) ret.deleter = true; | ||
else break; | ||
} | ||
if (ret.getter || ret.setter || ret.creator || ret.deleter) { | ||
if (ret.getter || ret.setter || ret.deleter) { | ||
all_ws(); | ||
@@ -600,15 +590,2 @@ ret.idlType = return_type(); | ||
} | ||
if (consume(ID, "static")) { | ||
ret["static"] = true; | ||
ret.idlType = return_type(); | ||
operation_rest(ret, store); | ||
return ret; | ||
} else if (consume(ID, "stringifier")) { | ||
ret.stringifier = true; - | ||
all_ws(); | ||
if (consume(OTHER, ";")) return ret; | ||
ret.idlType = return_type(); | ||
operation_rest(ret, store); | ||
return ret; | ||
} | ||
ret.idlType = return_type(); | ||
@@ -635,2 +612,23 @@ all_ws(); | ||
function static_member(store) { | ||
all_ws(store, "pea"); | ||
if (!consume(ID, "static")) return; | ||
all_ws(); | ||
return noninherited_attribute(store, "static") || | ||
regular_operation(store, "static") || | ||
error("No body in static member"); | ||
} | ||
function stringifier(store) { | ||
all_ws(store, "pea"); | ||
if (!consume(ID, "stringifier")) return; | ||
all_ws(); | ||
if (consume(OTHER, ";")) { | ||
return Object.assign({}, EMPTY_OPERATION, { stringifier: true }); | ||
} | ||
return noninherited_attribute(store, "stringifier") || | ||
regular_operation(store, "stringifier") || | ||
error("Unterminated stringifier"); | ||
} | ||
function identifiers(arr) { | ||
@@ -709,5 +707,3 @@ while (true) { | ||
function interface_(isPartial, store) { | ||
all_ws(isPartial ? null : store, "pea"); | ||
if (!consume(ID, "interface")) return; | ||
function interface_rest(isPartial, store) { | ||
all_ws(); | ||
@@ -741,2 +737,4 @@ const name = consume(ID) || error("No name for interface"); | ||
const mem = (opt.allowNestedTypedefs && typedef(store ? mems : null)) || | ||
static_member(store ? mems : null) || | ||
stringifier(store ? mems : null) || | ||
iterable(store ? mems : null) || | ||
@@ -751,2 +749,48 @@ attribute(store ? mems : null) || | ||
function mixin_rest(isPartial, store) { | ||
all_ws(); | ||
if (!consume(ID, "mixin")) return; | ||
all_ws(); | ||
const name = consume(ID) || error("No name for interface mixin"); | ||
const mems = []; | ||
const ret = { | ||
type: "interface mixin", | ||
name: isPartial ? name.value : sanitize_name(name.value, "interface mixin"), | ||
partial: false, | ||
members: mems | ||
}; | ||
all_ws(); | ||
consume(OTHER, "{") || error("Bodyless interface mixin"); | ||
while (true) { | ||
all_ws(store ? mems : null); | ||
if (consume(OTHER, "}")) { | ||
all_ws(); | ||
consume(OTHER, ";") || error("Missing semicolon after interface mixin"); | ||
return ret; | ||
} | ||
const ea = extended_attrs(store ? mems : null); | ||
all_ws(); | ||
const cnt = const_(store ? mems : null); | ||
if (cnt) { | ||
cnt.extAttrs = ea; | ||
ret.members.push(cnt); | ||
continue; | ||
} | ||
const mem = stringifier(store ? mems : null) || | ||
noninherited_attribute(store ? mems : null) || | ||
regular_operation(store ? mems : null) || | ||
error("Unknown member"); | ||
mem.extAttrs = ea; | ||
ret.members.push(mem); | ||
} | ||
} | ||
function interface_(isPartial, store) { | ||
all_ws(isPartial ? null : store, "pea"); | ||
if (!consume(ID, "interface")) return; | ||
return mixin_rest(isPartial, store) || | ||
interface_rest(isPartial, store) || | ||
error("Interface has no proper body"); | ||
} | ||
function namespace(isPartial, store) { | ||
@@ -776,3 +820,3 @@ all_ws(isPartial ? null : store, "pea"); | ||
const mem = noninherited_attribute(store ? mems : null) || | ||
nonspecial_operation(store ? mems : null) || | ||
regular_operation(store ? mems : null) || | ||
error("Unknown member"); | ||
@@ -784,3 +828,3 @@ mem.extAttrs = ea; | ||
function noninherited_attribute(store) { | ||
function noninherited_attribute(store, prefix) { | ||
const w = all_ws(store, "pea"); | ||
@@ -795,2 +839,5 @@ const grabbed = []; | ||
}; | ||
if (prefix) { | ||
ret[prefix] = true; | ||
} | ||
if (w) grabbed.push(w); | ||
@@ -809,14 +856,9 @@ if (consume(ID, "readonly")) { | ||
} | ||
function nonspecial_operation(store) { | ||
function regular_operation(store, prefix) { | ||
all_ws(store, "pea"); | ||
const ret = { | ||
type: "operation", | ||
getter: false, | ||
setter: false, | ||
creator: false, | ||
deleter: false, | ||
"static": false, | ||
stringifier: false | ||
}; | ||
const ret = Object.assign({}, EMPTY_OPERATION); | ||
if (prefix) { | ||
ret[prefix] = true; | ||
} | ||
ret.idlType = return_type(); | ||
@@ -883,3 +925,3 @@ return operation_rest(ret, store); | ||
const enum_ = function(store) { | ||
function enum_(store) { | ||
all_ws(store, "pea"); | ||
@@ -907,3 +949,3 @@ if (!consume(ID, "enum")) return; | ||
val.value = val.value.replace(/"/g, ""); | ||
ret.values.push( val ); | ||
ret.values.push(val); | ||
all_ws(store ? vals : null); | ||
@@ -959,2 +1001,25 @@ if (consume(OTHER, ",")) { | ||
function includes(store) { | ||
all_ws(store, "pea"); | ||
const target = consume(ID); | ||
if (!target) return; | ||
const w = all_ws(); | ||
if (consume(ID, "includes")) { | ||
const ret = { | ||
type: "includes", | ||
target: target.value | ||
}; | ||
all_ws(); | ||
const imp = consume(ID) || error("Incomplete includes statement"); | ||
ret["includes"] = imp.value; | ||
all_ws(); | ||
consume(OTHER, ";") || error("No terminating ; for includes statement"); | ||
return ret; | ||
} else { | ||
// rollback | ||
tokens.unshift(w); | ||
tokens.unshift(target); | ||
} | ||
}; | ||
function definition(store) { | ||
@@ -968,2 +1033,3 @@ return callback(store) || | ||
implements_(store) || | ||
includes(store) || | ||
namespace(false, store); | ||
@@ -1007,2 +1073,2 @@ }; | ||
} | ||
}()); | ||
})(); |
{ | ||
"name": "webidl2", | ||
"description": "A WebIDL Parser", | ||
"version": "7.0.0", | ||
"version": "8.0.0", | ||
"contributors": [ | ||
@@ -6,0 +6,0 @@ "Robin Berjon <robin@berjon.com> (https://berjon.com)", |
@@ -139,2 +139,3 @@ | ||
### Interface | ||
Interfaces look like this: | ||
@@ -171,3 +172,32 @@ | ||
### Interface mixins | ||
Interfaces mixins look like this: | ||
```JS | ||
{ | ||
"type": "interface mixin", | ||
"name": "Animal", | ||
"partial": false, | ||
"members": [...], | ||
"extAttrs": [...] | ||
}, { | ||
"type": "interface mixin", | ||
"name": "Human", | ||
"partial": false, | ||
"members": [...], | ||
"extAttrs": [...] | ||
} | ||
``` | ||
The fields are as follows: | ||
* `type`: Always "interface mixin". | ||
* `name`: The name of the interface mixin. | ||
* `partial`: A boolean indicating whether it's a partial interface mixin. | ||
* `members`: An array of interface members (attributes, operations, etc.). Empty if there are none. | ||
* `extAttrs`: A list of [extended attributes](#extended-attributes). | ||
### Namespace | ||
Namespaces look like this: | ||
@@ -296,3 +326,3 @@ | ||
* `name`: The enum's name. | ||
* `value`: An array of values. | ||
* `values`: An array of values. | ||
* `extAttrs`: A list of [extended attributes](#extended-attributes). | ||
@@ -356,2 +386,22 @@ | ||
### Includes | ||
An includes definition looks like this: | ||
```JS | ||
{ | ||
"type": "includes", | ||
"target": "Node", | ||
"includes": "EventTarget", | ||
"extAttrs": [] | ||
} | ||
``` | ||
The fields are as follows: | ||
* `type`: Always "includes". | ||
* `target`: The interface that includes an interface mixin. | ||
* `includes`: The interface mixin that is being included by the target. | ||
* `extAttrs`: A list of [extended attributes](#extended-attributes). | ||
### Operation Member | ||
@@ -365,3 +415,2 @@ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -400,3 +449,2 @@ "static": false, | ||
* `setter`: True if a setter operation. | ||
* `creator`: True if a creator operation. | ||
* `deleter`: True if a deleter operation. | ||
@@ -480,3 +528,2 @@ * `static`: True if a static operation. | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -483,0 +530,0 @@ "static": false, |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -31,3 +30,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -65,3 +63,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -105,2 +102,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -38,3 +38,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -112,2 +111,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -53,3 +53,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -110,2 +109,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": true, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -133,3 +131,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -167,3 +164,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -214,3 +210,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -248,3 +243,2 @@ "static": false, | ||
"setter": true, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -295,2 +289,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -80,3 +79,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -106,3 +104,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -141,3 +138,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -167,2 +163,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": true, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -108,2 +106,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -23,3 +23,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -57,3 +56,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -141,3 +139,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -144,0 +141,0 @@ "static": false, |
@@ -36,3 +36,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -102,2 +101,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": true, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -108,3 +106,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": true, | ||
@@ -142,3 +139,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -176,3 +172,2 @@ "static": false, | ||
"setter": true, | ||
"creator": true, | ||
"deleter": false, | ||
@@ -223,3 +218,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": true, | ||
@@ -257,2 +251,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -113,3 +111,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -163,3 +160,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -241,3 +237,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -269,3 +264,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -288,2 +282,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -74,3 +73,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -127,2 +125,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -51,2 +50,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -95,2 +93,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -88,2 +87,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -104,3 +102,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -138,3 +135,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -204,3 +200,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -224,3 +219,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -297,2 +291,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -67,2 +66,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -66,3 +65,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -116,3 +114,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -180,3 +177,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -183,0 +179,0 @@ "static": false, |
@@ -52,3 +52,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -72,3 +71,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -106,3 +104,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -153,2 +150,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -33,3 +33,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -53,2 +52,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -51,3 +50,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -87,3 +85,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -107,3 +104,3 @@ "static": false, | ||
}, | ||
{ | ||
@@ -118,3 +115,2 @@ "type": "interface", | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -165,2 +161,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -83,3 +83,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -143,2 +142,2 @@ "static": true, | ||
} | ||
] | ||
] |
@@ -59,3 +59,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -85,2 +84,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -40,3 +39,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -51,2 +49,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -43,3 +43,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -87,2 +86,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -43,3 +43,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -87,2 +86,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -127,3 +127,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -161,3 +160,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -164,0 +162,0 @@ "static": false, |
@@ -11,3 +11,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -51,2 +50,2 @@ "static": false, | ||
} | ||
] | ||
] |
@@ -27,3 +27,2 @@ [ | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -61,3 +60,2 @@ "static": false, | ||
"setter": false, | ||
"creator": false, | ||
"deleter": false, | ||
@@ -95,2 +93,2 @@ "static": false, | ||
} | ||
] | ||
] |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
864763
308
7152
688
0