Skip to content

Commit

Permalink
Squashed 'resources/webidl2/' changes from bd216bcd55..88c5c5b6bb
Browse files Browse the repository at this point in the history
88c5c5b6bb chore(package): bump version
8b3bc38a24 chore(package): bump version
c64fe13a42 chore(package): update deps
a0bccdf485 fix "Trailing comma in extended attribute" error (#63)
62633a1025 Remove support for MapClass (no longer valid in WebIDL) (#62)
3a7d1bbe3e Merge pull request #61 from w3c/annotated_types
49ea372ba3 Fix spaces in JSON output for updated test
7488ee661f docs(README): fix markdown.
5530e9fecc Adapt test to support for annotated types
a387b679ca Add support for annotated types
ffe9400aba Merge pull request #58 from SaschaNaz/namespace
9a154bb963 implement namespace
830d19191f chore(package): bump version
e5771f11e8 Revert "style: use U.S. English"
8c712c9cb8 chore(package): bump version
8ee9a85ad8 style: use U.S. English
bc7b7c6897 style(lib): beautify code
96699646e1 chore(package): bump version
86ea904cbf chore(package): update dependencies
44d7b22851 Merge pull request #57 from TimothyGu/develop
0b5300ec76 Make writer less strict about generic idlType's type
064622bf59 Add support for records
fcb88fb1ac Merge pull request #50 from w3c/refactor
a23527043e refactor(webidl.js): move WebIDLParseError
c64e97c3b8 Merge pull request #49 from w3c/amd_compat
d1e704bd40 feat(lib): add AMD export support (closes #48)
5458831df8 style(writer.js): fix whitespace
481c29427a style(webidl2.js): fix whitespace
ed24e286ee chore(package): update deps
2668a8be5f docs(README): fixup markdown highlighting
9df3430244 Merge pull request #47 from mkwtys/fix-default
ec61c0a096 Merge branch 'halton-replace_expect' into develop
fb59b13c2c Really be deterministic
128d7335bb Remove reliance on undeterministic object key order
7bf2df2276 Confirm support for union in typedef
1b5b83438e Remove test of now invalid nested typdef
2d8cd93bd4 Update location of expect.js library
1ed22de9b5 Correct jsondiffpatch location.
a2e2f8e902 Bump microtime to 2.1.1
23b63723e9 Expand writer support
9cc1281a1c Accept wider (but still incomplete) set of allowed syntax for extended attributes.
cb04f7777c Identifier allow `-`
d9b4989425 Merge pull request #39 from markandrus/develop
1ab320df8d Merge pull request #37 from artillery/develop
524000bfd6 Merge pull request #31 from othree/in-draft
99127088c2 Fix `"default": undefined`
191685b05f Really be deterministic
300b1e0fae Remove reliance on undeterministic object key order
61c8e65035 Confirm support for union in typedef
f0cd831c6c Remove test of now invalid nested typdef
77b5e3df87 Update location of expect.js library
f84b8e684c Merge pull request #44 from halton/fix_jsondiffpatch
b52117cf05 Merge pull request #43 from halton/bump_microtime
65382bf16b Replace expect.js with expct
be6c2e21e9 Correct jsondiffpatch location.
0b0fa3e92d Bump microtime to 2.1.1
e470735423 Expand writer support
9e2ccfc940 Accept wider (but still incomplete) set of allowed syntax for extended attributes.
989591f675 Allow trailing comma in enum
9385d07a54 Identifier allow `-`

git-subtree-dir: resources/webidl2
git-subtree-split: 88c5c5b6bb675d0d95ae3ec4db3258768d0c8fc0
  • Loading branch information
jgraham committed Apr 24, 2017
1 parent 5353ef7 commit 3afe26c
Show file tree
Hide file tree
Showing 26 changed files with 2,287 additions and 1,945 deletions.
726 changes: 380 additions & 346 deletions README.md

Large diffs are not rendered by default.

2,028 changes: 1,050 additions & 978 deletions lib/webidl2.js

Large diffs are not rendered by default.

494 changes: 269 additions & 225 deletions lib/writer.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "webidl2",
"description": "A WebIDL Parser",
"version": "2.0.11",
"version": "2.4.0",
"author": "Robin Berjon <robin@berjon.com>",
"license": "MIT",
"dependencies": {},
"devDependencies": {
"mocha": "2.2.5",
"expect.js": "0.3.1",
"mocha": "3.2.0",
"expect": "1.20.2",
"underscore": "1.8.3",
"jsondiffpatch": "0.1.31",
"jsondiffpatch": "0.2.4",
"benchmark": "*",
"microtime": "1.4.2"
"microtime": "2.1.3"
},
"scripts": {
"test": "mocha"
Expand Down
12 changes: 6 additions & 6 deletions test/invalid.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// are fully correct interpretations of the IDLs

var wp = process.env.JSCOV ? require("../lib-cov/webidl2") : require("../lib/webidl2")
, expect = require("expect.js")
, expect = require("expect")
, pth = require("path")
, fs = require("fs")
;
Expand All @@ -16,7 +16,7 @@ describe("Parses all of the invalid IDLs to check that they blow up correctly",
.map(function (it) { return pth.join(dir, it); })
, errors = idls.map(function (it) { return pth.join(__dirname, "invalid", "json", pth.basename(it).replace(/\.w?idl/, ".json")); })
;

for (var i = 0, n = idls.length; i < n; i++) {
var idl = idls[i], error = JSON.parse(fs.readFileSync(errors[i], "utf8"));
var func = (function (idl, err) {
Expand All @@ -30,11 +30,11 @@ describe("Parses all of the invalid IDLs to check that they blow up correctly",
error = e;
}
finally {
expect(error).to.be.ok();
expect(error.message).to.equal(err.message);
expect(error.line).to.equal(err.line);
expect(error).toExist();
expect(error.message).toEqual(err.message);
expect(error.line).toEqual(err.line);
}

};
}(idl, error));
it("should produce the right error for " + idl, func);
Expand Down
3 changes: 3 additions & 0 deletions test/invalid/idl/record-key.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface Foo {
void foo(record<octet, any> param);
};
4 changes: 4 additions & 0 deletions test/invalid/json/record-key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"message": "Record key must be DOMString, USVString, or ByteString",
"line": 2
}
6 changes: 3 additions & 3 deletions test/syntax.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

var wp = process.env.JSCOV ? require("../lib-cov/webidl2") : require("../lib/webidl2")
, expect = require("expect.js")
, expect = require("expect")
, pth = require("path")
, fs = require("fs")
, jdp = require("jsondiffpatch")
Expand All @@ -14,7 +14,7 @@ describe("Parses all of the IDLs to produce the correct ASTs", function () {
.map(function (it) { return pth.join(dir, it); })
, jsons = idls.map(function (it) { return pth.join(__dirname, "syntax/json", pth.basename(it).replace(".widl", ".json")); })
;

for (var i = 0, n = idls.length; i < n; i++) {
var idl = idls[i], json = jsons[i];

Expand All @@ -28,7 +28,7 @@ describe("Parses all of the IDLs to produce the correct ASTs", function () {
var diff = jdp.diff(JSON.parse(fs.readFileSync(json, "utf8")),
wp.parse(fs.readFileSync(idl, "utf8"), opt));
if (diff && debug) console.log(JSON.stringify(diff, null, 4));
expect(diff).to.be(undefined);
expect(diff).toBe(undefined);
}
catch (e) {
console.log(e.toString());
Expand Down
7 changes: 6 additions & 1 deletion test/syntax/idl/extended-attributes.widl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
[Global=(Worker,ServiceWorker), Exposed=ServiceWorker]
interface ServiceWorkerGlobalScope : WorkerGlobalScope {

};
};

// Conformance with ExtendedAttributeList grammar in http://www.w3.org/TR/WebIDL/#idl-extended-attributes
// Section 3.11
[IntAttr=0, FloatAttr=3.14, StringAttr="abc"]
interface IdInterface {};
5 changes: 0 additions & 5 deletions test/syntax/idl/map.widl

This file was deleted.

10 changes: 10 additions & 0 deletions test/syntax/idl/namespace.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Extracted from Web IDL editors draft March 27 2017
namespace VectorUtils {
readonly attribute Vector unit;
double dotProduct(Vector x, Vector y);
Vector crossProduct(Vector x, Vector y);
};

partial namespace SomeNamespace {
/* namespace_members... */
};
8 changes: 8 additions & 0 deletions test/syntax/idl/record.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Constructor(record<USVString, USVString> init)]
interface Foo {
void foo(sequence<record<ByteString, any>> param);
record<DOMString, (float or DOMString)?> bar();

// Make sure record can still be registered as a type.
record baz();
};
22 changes: 0 additions & 22 deletions test/syntax/idl/typedef-nested.widl

This file was deleted.

4 changes: 4 additions & 0 deletions test/syntax/idl/typedef-union.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
typedef (ImageData or
HTMLImageElement or
HTMLCanvasElement or
HTMLVideoElement) TexImageSource;
1 change: 1 addition & 0 deletions test/syntax/idl/uniontype.widl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
interface Union {
attribute (float or (Date or Event) or (Node or DOMString)?) test;
attribute ([EnforceRange] long or Date) test2;
};
35 changes: 34 additions & 1 deletion test/syntax/json/extended-attributes.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,38 @@
}
}
]
},
{
"type": "interface",
"name": "IdInterface",
"partial": false,
"members": [],
"inheritance": null,
"extAttrs": [
{
"name": "IntAttr",
"arguments": null,
"rhs": {
"type": "integer",
"value": "0"
}
},
{
"name": "FloatAttr",
"arguments": null,
"rhs": {
"type": "float",
"value": "3.14"
}
},
{
"name": "StringAttr",
"arguments": null,
"rhs": {
"type": "string",
"value": "\"abc\""
}
}
]
}
]
]
3 changes: 1 addition & 2 deletions test/syntax/json/identifier-qualified-names.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[
{
"type": "typedef",
"typeExtAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
Expand Down Expand Up @@ -214,4 +213,4 @@
"inheritance": null,
"extAttrs": []
}
]
]
29 changes: 0 additions & 29 deletions test/syntax/json/map.json

This file was deleted.

134 changes: 134 additions & 0 deletions test/syntax/json/namespace.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
[
{
"type": "namespace",
"name": "VectorUtils",
"partial": false,
"members": [
{
"type": "attribute",
"static": false,
"stringifier": false,
"inherit": false,
"readonly": true,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "unit",
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "double"
},
"name": "dotProduct",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "x"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "y"
}
],
"extAttrs": []
},
{
"type": "operation",
"getter": false,
"setter": false,
"creator": false,
"deleter": false,
"legacycaller": false,
"static": false,
"stringifier": false,
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "crossProduct",
"arguments": [
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "x"
},
{
"optional": false,
"variadic": false,
"extAttrs": [],
"idlType": {
"sequence": false,
"generic": null,
"nullable": false,
"array": false,
"union": false,
"idlType": "Vector"
},
"name": "y"
}
],
"extAttrs": []
}
],
"extAttrs": []
},
{
"type": "namespace",
"name": "SomeNamespace",
"partial": true,
"members": [],
"extAttrs": []
}
]
Loading

0 comments on commit 3afe26c

Please sign in to comment.