From 7bb4c7115c6970c4d15eca7c03385c4d1f4938f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20J=C3=A4genstedt?= Date: Fri, 18 May 2018 17:46:08 +0200 Subject: [PATCH] Squashed 'resources/webidl2/' changes from dd57b9f0db..68a37d21e8 68a37d21e8 chore(package): bump version number to 12.1.0 621d0b6c17 fix: prevent keywords from being identifiers (#157) 9ad8932034 chore(package): bump version number to 12.0.0 a154b63cea BREAKING CHANGE: remove allowNestedTypedefs (#155) 5a495f76a5 refactor: remove all_ws() and gather trivia implicitly (#154) e717aa67fa tests: Remove test/widlproc (#153) 131e74cc57 chore(package): bump version number to 11.0.0 09f8a1daae Prevent incorrect enums (#151) fa060611a9 BREAKING CHANGE: remove opt.ws (#150) 2bb4e1cbb2 chore(package): bump version number to 10.3.3 (#149) 80936fa3c9 oefactor simple_extended_attr() (#148) c060079cca docs: remove description about typePair (#147) 4169268630 docs: simple WebIDL checker. (#146) a28c7b55f7 chore(package): bump version number to 10.3.2 e311680dc0 fix: correctly handle whitespaces of implements and includes. (#145) 50c828344d refactor: remove eas.length check (#144) 968ca63fd4 refactor: one-to-one match for token matcher (#143) 8531535861 chore(package): bump version number to 10.3.1 96deeb3480 const-type as full IDL Type (#142) a13dfa8cf5 chore(package): bump version number to 10.3.0 c0ab164af2 always add extAttrs for .idlType (#141) 932dcfb96d docs(README): add missing typedef-type 56777f49dc docs(README): add missing types-of-types c14d7c1767 docs(README): add types of types (#140) 730a3b99db chore(CHANGELOG): regenerate git-subtree-dir: resources/webidl2 git-subtree-split: 68a37d21e81740563a5e98198e0e979232d363c0 --- .gitmodules | 3 - CHANGELOG.md | 8 + README.md | 77 +- checker/index.html | 55 ++ lib/webidl2.js | 692 ++++++++---------- lib/writer.js | 95 +-- package-lock.json | 2 +- package.json | 2 +- test/invalid/idl/enum-empty.widl | 1 + test/invalid/idl/enum-wo-comma.widl | 1 + test/invalid/idl/extattr-empty-ids.widl | 2 + test/invalid/idl/id-underscored-number.widl | 1 + .../idl/implements_and_includes_ws.widl | 4 + test/invalid/json/enum-empty.json | 4 + test/invalid/json/enum-wo-comma.json | 4 + test/invalid/json/extattr-empty-ids.json | 4 + test/invalid/json/id-underscored-number.json | 3 + .../json/implements_and_includes_ws.json | 4 + test/invalid/json/readonly-iterable.json | 2 +- test/invalid/json/typedef-nested.json | 2 +- .../idl/identifier-qualified-names.widl | 4 - test/syntax/idl/linecomment.widl | 2 - test/syntax/json/allowany.json | 24 +- test/syntax/json/attributes.json | 4 +- test/syntax/json/callback.json | 34 +- test/syntax/json/constants.json | 56 +- test/syntax/json/constructor.json | 22 +- test/syntax/json/dictionary-inherits.json | 16 +- test/syntax/json/dictionary.json | 31 +- test/syntax/json/enum.json | 24 +- test/syntax/json/equivalent-decl.json | 86 ++- test/syntax/json/extended-attributes.json | 29 +- test/syntax/json/generic.json | 41 +- test/syntax/json/getter-setter.json | 30 +- .../json/identifier-qualified-names.json | 74 +- test/syntax/json/implements.json | 26 +- test/syntax/json/indexed-properties.json | 76 +- test/syntax/json/inherits-getter.json | 12 +- test/syntax/json/interface-inherits.json | 12 +- test/syntax/json/iterable.json | 9 +- test/syntax/json/legacyiterable.json | 3 +- test/syntax/json/linecomment.json | 14 - test/syntax/json/maplike.json | 12 +- test/syntax/json/mixin.json | 8 +- test/syntax/json/namedconstructor.json | 6 +- test/syntax/json/namespace.json | 36 +- test/syntax/json/nointerfaceobject.json | 10 +- test/syntax/json/nullable.json | 11 +- test/syntax/json/nullableobjects.json | 20 +- test/syntax/json/operation-optional-arg.json | 26 +- test/syntax/json/overloading.json | 84 ++- test/syntax/json/overridebuiltins.json | 14 +- test/syntax/json/partial-interface.json | 8 +- test/syntax/json/primitives.json | 68 +- test/syntax/json/prototyperoot.json | 4 +- test/syntax/json/putforwards.json | 8 +- test/syntax/json/record.json | 58 +- test/syntax/json/reg-operations.json | 38 +- test/syntax/json/replaceable.json | 8 +- test/syntax/json/sequence.json | 34 +- test/syntax/json/setlike.json | 6 +- test/syntax/json/static.json | 38 +- test/syntax/json/stringifier-attribute.json | 8 +- test/syntax/json/stringifier-custom.json | 16 +- test/syntax/json/stringifier.json | 4 +- test/syntax/json/treatasnull.json | 18 +- test/syntax/json/treatasundefined.json | 18 +- test/syntax/json/typedef-union.json | 15 +- test/syntax/json/typedef.json | 46 +- test/syntax/json/typesuffixes.json | 13 +- test/syntax/json/uniontype.json | 32 +- test/syntax/json/variadic-operations.json | 24 +- test/syntax/opt/linecomment.json | 3 - test/syntax/opt/typedef-nested.json | 3 - test/widlproc | 1 - 75 files changed, 1351 insertions(+), 942 deletions(-) delete mode 100644 .gitmodules create mode 100644 checker/index.html create mode 100644 test/invalid/idl/enum-empty.widl create mode 100644 test/invalid/idl/enum-wo-comma.widl create mode 100644 test/invalid/idl/extattr-empty-ids.widl create mode 100644 test/invalid/idl/id-underscored-number.widl create mode 100644 test/invalid/idl/implements_and_includes_ws.widl create mode 100644 test/invalid/json/enum-empty.json create mode 100644 test/invalid/json/enum-wo-comma.json create mode 100644 test/invalid/json/extattr-empty-ids.json create mode 100644 test/invalid/json/id-underscored-number.json create mode 100644 test/invalid/json/implements_and_includes_ws.json delete mode 100644 test/syntax/idl/linecomment.widl delete mode 100644 test/syntax/json/linecomment.json delete mode 100644 test/syntax/opt/linecomment.json delete mode 100644 test/syntax/opt/typedef-nested.json delete mode 160000 test/widlproc diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index a3f5485cd338e4..00000000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "test/widlproc"] - path = test/widlproc - url = https://github.com/dontcallmedom/widlproc.git diff --git a/CHANGELOG.md b/CHANGELOG.md index 1596d71684aa2f..91e22275e0700e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Change Log +## [v10.2.1](https://github.com/w3c/webidl2.js/tree/v10.2.1) (2018-03-09) +[Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.2.0...v10.2.1) + +**Merged pull requests:** + +- Optimise tokenisation and whitespace skipping [\#139](https://github.com/w3c/webidl2.js/pull/139) ([ricea](https://github.com/ricea)) +- refactor: small syntax changes [\#137](https://github.com/w3c/webidl2.js/pull/137) ([saschanaz](https://github.com/saschanaz)) + ## [v10.2.0](https://github.com/w3c/webidl2.js/tree/v10.2.0) (2018-01-30) [Full Changelog](https://github.com/w3c/webidl2.js/compare/v10.1.0...v10.2.0) diff --git a/README.md b/README.md index 8791360d1c132d..c0a4e51f7c2a00 100644 --- a/README.md +++ b/README.md @@ -45,23 +45,6 @@ In the browser: ``` -### Advanced Parsing - -`parse()` can optionally accept a second parameter, an options object, which can be used to -modify parsing behavior. - -The following options are recognized: -```JS -{ - allowNestedTypedefs: false -} -``` - -And their meanings are as follows: - -* `allowNestedTypedefs`: Boolean indicating whether the parser should accept `typedef`s as valid members of `interface`s. -This is non-standard syntax and therefore the default is `false`. - ### Errors When there is a syntax error in the WebIDL, it throws an exception object with the following @@ -93,16 +76,19 @@ attached to a field called `idlType`: ```JS { + "type": "attribute-type", "sequence": false, "generic": null, - "idlType": "void", + "idlType": "unsigned short", "nullable": false, "union": false, + "extAttrs": [...] } ``` Where the fields are as follows: +* `type`: String indicating where this type is used. Can be `null` if not applicable. * `sequence`: Boolean indicating if it is a sequence. Same as `generic === "sequence"`. * `generic`: String indicating the generic type (e.g. "Promise", "sequence"). `null` otherwise. @@ -113,6 +99,7 @@ Where the fields are as follows: description for the type in the sequence, the eventual value of the promise, etc. * `nullable`: Boolean indicating whether this is nullable or not. * `union`: Boolean indicating whether this is a union type or not. +* `extAttrs`: A list of [extended attributes](#extended-attributes). ### Interface @@ -211,11 +198,13 @@ A callback looks like this: "type": "callback", "name": "AsyncOperationCallback", "idlType": { + "type": "return-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "arguments": [...], "extAttrs": [] @@ -244,11 +233,13 @@ A dictionary looks like this: "name": "fillPattern", "required": false, "idlType": { + "type": "dictionary-type", "sequence": false, "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [...] }, "extAttrs": [], "default": { @@ -311,17 +302,21 @@ A typedef looks like this: { "type": "typedef", "idlType": { + "type": "typedef-type", "sequence": true, "generic": "sequence", "nullable": false, "union": false, "idlType": { + "type": "typedef-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "Point" - } + "idlType": "Point", + "extAttrs": [...] + }, + "extAttrs": [...] }, "name": "PointSequence", "extAttrs": [] @@ -388,11 +383,13 @@ An operation looks like this: "static": false, "stringifier": false, "idlType": { + "type": "return-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "intersection", "arguments": [{ @@ -400,11 +397,13 @@ An operation looks like this: "variadic": true, "extAttrs": [], "idlType": { + "type": "argument-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [...] }, "name": "ints" }], @@ -437,11 +436,13 @@ An attribute member looks like this: "inherit": false, "readonly": false, "idlType": { + "type": "attribute-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "RegExp" + "idlType": "RegExp", + "extAttrs": [...] }, "name": "regexp", "extAttrs": [] @@ -467,7 +468,15 @@ A constant member looks like this: { "type": "const", "nullable": false, - "idlType": "boolean", + "idlType": { + "type": "const-type", + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "boolean" + "extAttrs": [] + }, "name": "DEBUG", "value": { "type": "boolean", @@ -481,7 +490,7 @@ The fields are as follows: * `type`: Always "const". * `nullable`: Whether its type is nullable. -* `idlType`: The type of the constant (a simple type, the type name). +* `idlType`: An [IDL Type](#idl-type) of the constant that represents a simple type, the type name. * `name`: The name of the constant. * `value`: The constant value as described by [Const Values](#default-and-const-values) * `extAttrs`: A list of [extended attributes](#extended-attributes). @@ -497,11 +506,13 @@ The arguments (e.g. for an operation) look like this: "variadic": true, "extAttrs": [], "idlType": { + "type": "argument-type", "sequence": false, "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [...] }, "name": "ints" }] @@ -546,8 +557,6 @@ The fields are as follows: * `type`: Always `"extended-attribute"`. * `rhs`: If there is a right-hand side, this will capture its `type` (which can be "identifier" or "identifier-list") and its `value`. -* `typePair`: If the extended attribute is a `MapClass` this will capture the - map's key type and value type respectively. ### Default and Const Values @@ -587,14 +596,6 @@ The fields are as follows: ## Testing -In order to run the tests you need to ensure that the widlproc submodule inside `test` is -initialized and up to date: - -```Bash -git submodule init -git submodule update -``` - ### Running The test runs with mocha and expect.js. Normally, running mocha in the root directory diff --git a/checker/index.html b/checker/index.html new file mode 100644 index 00000000000000..9897d8572f22a0 --- /dev/null +++ b/checker/index.html @@ -0,0 +1,55 @@ + + + +WebIDL 2 Checker + + + + + + +

WebIDL Checker

+

This is an online checker for WebIDL built on the webidl2.js project.

+

Enter your WebIDL to check below:

+ +
+ +

Validation results:

+ +

Parser output:

+ +
+Pretty Print + + diff --git a/lib/webidl2.js b/lib/webidl2.js index a7a61d957b55c5..22c02516d271dc 100644 --- a/lib/webidl2.js +++ b/lib/webidl2.js @@ -8,67 +8,96 @@ // against integers early. "float": /-?(?=[0-9]*\.|[0-9]+[eE])(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][-+]?[0-9]+)?|[0-9]+[Ee][-+]?[0-9]+)/y, "integer": /-?(0([Xx][0-9A-Fa-f]+|[0-7]*)|[1-9][0-9]*)/y, - "identifier": /[A-Z_a-z][0-9A-Z_a-z-]*/y, + "identifier": /_?[A-Za-z][0-9A-Z_a-z-]*/y, "string": /"[^"]*"/y, "whitespace": /[\t\n\r ]+/y, "comment": /((\/(\/.*|\*([^*]|\*[^\/])*\*\/)[\t\n\r ]*)+)/y, "other": /[^\t\n\r 0-9A-Z_a-z]/y }; - function attemptTokenMatch(str, type, re, lastIndex, tokens) { - re.lastIndex = lastIndex; - const result = re.exec(str); - if (result) { - tokens.push({ type, value: result[0] }); - return re.lastIndex; - } - return -1; - } + const namedTerminals = [ + "Infinity", + "NaN", + "attribute", + "boolean", + "byte", + "callback", + "const", + "deleter", + "dictionary", + "double", + "enum", + "false", + "float", + "getter", + "implements", + "includes", + "inherit", + "interface", + "iterable", + "legacyiterable", + "long", + "maplike", + "mixin", + "namespace", + "null", + "octet", + "optional", + "or", + "partial", + "readonly", + "required", + "setlike", + "setter", + "short", + "static", + "stringifier", + "true", + "typedef", + "unrestricted", + "unsigned", + "void" + ]; function tokenise(str) { const tokens = []; let lastIndex = 0; + let trivia = ""; while (lastIndex < str.length) { const nextChar = str.charAt(lastIndex); let result = -1; - if (/[-0-9.]/.test(nextChar)) { - result = attemptTokenMatch(str, "float", tokenRe.float, lastIndex, - tokens); + + if (/[\t\n\r ]/.test(nextChar)) { + result = attemptTokenMatch("whitespace", { noFlushTrivia: true }); + } else if (nextChar === '/') { + result = attemptTokenMatch("comment", { noFlushTrivia: true }); + } + + if (result !== -1) { + trivia += tokens.pop().value; + } else if (/[-0-9.]/.test(nextChar)) { + result = attemptTokenMatch("float"); if (result === -1) { - result = attemptTokenMatch(str, "integer", tokenRe.integer, lastIndex, - tokens); + result = attemptTokenMatch("integer"); } if (result === -1) { // '-' and '.' can also match "other". - result = attemptTokenMatch(str, "other", tokenRe.other, - lastIndex, tokens); + result = attemptTokenMatch("other"); } } else if (/[A-Z_a-z]/.test(nextChar)) { - result = attemptTokenMatch(str, "identifier", tokenRe.identifier, - lastIndex, tokens); + result = attemptTokenMatch("identifier"); + const token = tokens[tokens.length - 1]; + if (result !== -1 && namedTerminals.includes(token.value)) { + token.type = token.value; + } } else if (nextChar === '"') { - result = attemptTokenMatch(str, "string", tokenRe.string, - lastIndex, tokens); + result = attemptTokenMatch("string"); if (result === -1) { // '"' can also match "other". - result = attemptTokenMatch(str, "other", tokenRe.other, - lastIndex, tokens); - } - } else if (/[\t\n\r ]/.test(nextChar)) { - result = attemptTokenMatch(str, "whitespace", tokenRe.whitespace, - lastIndex, tokens); - } else if (nextChar === '/') { - // The parser expects comments to be labelled as "whitespace". - result = attemptTokenMatch(str, "whitespace", tokenRe.comment, - lastIndex, tokens); - if (result === -1) { - // '/' can also match "other". - result = attemptTokenMatch(str, "other", tokenRe.other, - lastIndex, tokens); + result = attemptTokenMatch("other"); } } else { - result = attemptTokenMatch(str, "other", tokenRe.other, - lastIndex, tokens); + result = attemptTokenMatch("other"); } if (result === -1) { throw new Error("Token stream not progressing"); @@ -76,6 +105,20 @@ lastIndex = result; } return tokens; + + function attemptTokenMatch(type, { noFlushTrivia } = {}) { + const re = tokenRe[type]; + re.lastIndex = lastIndex; + const result = re.exec(str); + if (result) { + tokens.push({ type, value: result[0], trivia }); + if (!noFlushTrivia) { + trivia = ""; + } + return re.lastIndex; + } + return -1; + } } class WebIDLParseError { @@ -87,11 +130,13 @@ } toString() { - return `${this.message}, line ${this.line} (tokens: '${this.input}')\n${JSON.stringify(this.tokens, null, 4)}`; + const escapedInput = JSON.stringify(this.input); + const tokens = JSON.stringify(this.tokens, null, 4); + return `${this.message}, line ${this.line} (tokens: ${escapedInput})\n${tokens}`; } } - function parse(tokens, opt) { + function parse(tokens) { let line = 1; tokens = tokens.slice(); const names = new Map(); @@ -112,15 +157,23 @@ stringifier: false }); + const EMPTY_IDLTYPE = Object.freeze({ + sequence: false, + generic: null, + nullable: false, + union: false, + idlType: null, + extAttrs: [] + }); + function error(str) { - let tok = ""; - let numTokens = 0; const maxTokens = 5; - while (numTokens < maxTokens && tokens.length > numTokens) { - tok += tokens[numTokens].value; - numTokens++; + const tok = tokens.slice(0, maxTokens).map(t => t.trivia + t.value).join(""); + // Count newlines preceding the actual errorneous token + if (tokens.length) { + line += count(tokens[0].trivia, "\n"); } - + let message; if (current) { message = `Got an error during or right after parsing \`${current.partial ? "partial " : ""}${current.type} ${current.name}\`: ${str}` @@ -147,79 +200,39 @@ if (!tokens.length || tokens[0].type !== type) return; if (typeof value === "undefined" || tokens[0].value === value) { last_token = tokens.shift(); - if (type === ID && last_token.value.startsWith('_')) - last_token.value = last_token.value.substring(1); + line += count(last_token.trivia, "\n"); return last_token; } } - function count(str, char) { - let total = 0; - for (let i = str.indexOf(char); i !== -1; i = str.indexOf(char, i + 1)) { - ++total; - } - return total; + function unescape(identifier) { + return identifier.startsWith('_') ? identifier.slice(1) : identifier; } - function ws() { - if (!tokens.length) return; - if (tokens[0].type === "whitespace") { - const t = tokens.shift(); - line += count(t.value, '\n'); - return t; + function unconsume(...toks) { + // TODO: use const when Servo updates its JS engine + // https://github.com/servo/servo/issues/20231 + for (let tok of toks) { + line -= count(tok.trivia, "\n"); } + tokens.unshift(...toks); } - const all_ws_re = { - "ws": /([\t\n\r ]+)/y, - "line-comment": /\/\/(.*)\r?\n?/y, - "multiline-comment": /\/\*((?:[^*]|\*[^/])*)\*\//y - }; - function all_ws(store, pea) { // pea == post extended attribute, tpea = same for types - const t = { type: "whitespace", value: "" }; - while (true) { - const w = ws(); - if (!w) break; - t.value += w.value; - } - if (t.value.length > 0) { - if (store) { - let w = t.value; - let lastIndex = 0; - while (lastIndex < w.length) { - let matched = false; - // Servo doesn't support using "const" in this construction yet. - // See https://github.com/servo/servo/issues/20231. - // |type| can be made const once Servo supports it. - for (let type in all_ws_re) { - const re = all_ws_re[type]; - re.lastIndex = lastIndex; - const result = re.exec(w); - if (result) { - store.push({ type: type + (pea ? ("-" + pea) : ""), value: result[1] }); - matched = true; - lastIndex = re.lastIndex; - break; - } - } - if (!matched) - throw new Error("Surprising white space construct."); // this shouldn't happen - } - } - return t; + function count(str, char) { + let total = 0; + for (let i = str.indexOf(char); i !== -1; i = str.indexOf(char, i + 1)) { + ++total; } + return total; } function integer_type() { let ret = ""; - all_ws(); - if (consume(ID, "unsigned")) ret = "unsigned "; - all_ws(); - if (consume(ID, "short")) return ret + "short"; - if (consume(ID, "long")) { + if (consume("unsigned")) ret = "unsigned "; + if (consume("short")) return ret + "short"; + if (consume("long")) { ret += "long"; - all_ws(); - if (consume(ID, "long")) return ret + " long"; + if (consume("long")) return ret + " long"; return ret; } if (ret) error("Failed to parse integer type"); @@ -227,41 +240,37 @@ function float_type() { let ret = ""; - all_ws(); - if (consume(ID, "unrestricted")) ret = "unrestricted "; - all_ws(); - if (consume(ID, "float")) return ret + "float"; - if (consume(ID, "double")) return ret + "double"; + if (consume("unrestricted")) ret = "unrestricted "; + if (consume("float")) return ret + "float"; + if (consume("double")) return ret + "double"; if (ret) error("Failed to parse float type"); } function primitive_type() { const num_type = integer_type() || float_type(); if (num_type) return num_type; - all_ws(); - if (consume(ID, "boolean")) return "boolean"; - if (consume(ID, "byte")) return "byte"; - if (consume(ID, "octet")) return "octet"; + if (consume("boolean")) return "boolean"; + if (consume("byte")) return "byte"; + if (consume("octet")) return "octet"; } function const_value() { - if (consume(ID, "true")) return { type: "boolean", value: true }; - if (consume(ID, "false")) return { type: "boolean", value: false }; - if (consume(ID, "null")) return { type: "null" }; - if (consume(ID, "Infinity")) return { type: "Infinity", negative: false }; - if (consume(ID, "NaN")) return { type: "NaN" }; + if (consume("true")) return { type: "boolean", value: true }; + if (consume("false")) return { type: "boolean", value: false }; + if (consume("null")) return { type: "null" }; + if (consume("Infinity")) return { type: "Infinity", negative: false }; + if (consume("NaN")) return { type: "NaN" }; const ret = consume(FLOAT) || consume(INT); if (ret) return { type: "number", value: ret.value }; const tok = consume(OTHER, "-"); if (tok) { - if (consume(ID, "Infinity")) return { type: "Infinity", negative: true }; - else tokens.unshift(tok); + if (consume("Infinity")) return { type: "Infinity", negative: true }; + else unconsume(tok); } } function type_suffix(obj) { while (true) { - all_ws(); if (consume(OTHER, "?")) { if (obj.nullable) error("Can't nullable more than once"); obj.nullable = true; @@ -271,14 +280,13 @@ function single_type(typeName) { const prim = primitive_type(); - const ret = { type: typeName || null, sequence: false, generic: null, nullable: false, union: false }; + const ret = Object.assign({ type: typeName || null }, EMPTY_IDLTYPE); let name; let value; if (prim) { ret.idlType = prim; } else if (name = consume(ID)) { value = name.value; - all_ws(); // Generic types if (consume(OTHER, "<")) { // backwards compat @@ -288,9 +296,7 @@ ret.generic = value; const types = []; do { - all_ws(); types.push(type_with_extended_attributes(typeName) || error("Error parsing generic type " + value)); - all_ws(); } while (consume(OTHER, ",")); if (value === "sequence") { @@ -300,12 +306,11 @@ if (!/^(DOMString|USVString|ByteString)$/.test(types[0].idlType)) { error("Record key must be DOMString, USVString, or ByteString"); } - if (types[0].extAttrs) error("Record key cannot have extended attribute"); + if (types[0].extAttrs.length) error("Record key cannot have extended attribute"); } else if (value === "Promise") { - if (types[0].extAttrs) error("Promise type cannot have extended attribute"); + if (types[0].extAttrs.length) error("Promise type cannot have extended attribute"); } ret.idlType = types.length === 1 ? types[0] : types; - all_ws(); if (!consume(OTHER, ">")) error("Unterminated generic type " + value); type_suffix(ret); return ret; @@ -321,14 +326,12 @@ } function union_type(typeName) { - all_ws(); if (!consume(OTHER, "(")) return; - const ret = { type: typeName || null, sequence: false, generic: null, nullable: false, union: true, idlType: [] }; + const ret = Object.assign({ type: typeName || null }, EMPTY_IDLTYPE, { union: true, idlType: [] }); const fst = type_with_extended_attributes() || error("Union type with no content"); ret.idlType.push(fst); while (true) { - all_ws(); - if (!consume(ID, "or")) break; + if (!consume("or")) break; const typ = type_with_extended_attributes() || error("No type after 'or' in union type"); ret.idlType.push(typ); } @@ -348,23 +351,20 @@ return ret; } - function argument(store) { + function argument() { const ret = { optional: false, variadic: false }; - ret.extAttrs = extended_attrs(store); - all_ws(store, "pea"); - const opt_token = consume(ID, "optional"); + ret.extAttrs = extended_attrs(); + const opt_token = consume("optional"); if (opt_token) { ret.optional = true; - all_ws(); } ret.idlType = type_with_extended_attributes("argument-type"); if (!ret.idlType) { - if (opt_token) tokens.unshift(opt_token); + if (opt_token) unconsume(opt_token); return; } const type_token = last_token; if (!ret.optional) { - all_ws(); if (tokens.length >= 3 && tokens[0].type === "other" && tokens[0].value === "." && tokens[1].type === "other" && tokens[1].value === "." && @@ -376,16 +376,15 @@ ret.variadic = true; } } - all_ws(); const name = consume(ID); if (!name) { - if (opt_token) tokens.unshift(opt_token); - tokens.unshift(type_token); + if (opt_token) unconsume(opt_token); + unconsume(type_token); return; } - ret.name = name.value; + ret.name = unescape(name.value); + ret.escapedName = name.value; if (ret.optional) { - all_ws(); const dflt = default_(); if (typeof dflt !== "undefined") { ret["default"] = dflt; @@ -394,94 +393,71 @@ return ret; } - function argument_list(store) { + function argument_list() { const ret = []; - const arg = argument(store ? ret : null); - if (!arg) return; + const arg = argument(); + if (!arg) return ret; ret.push(arg); while (true) { - all_ws(store ? ret : null); if (!consume(OTHER, ",")) return ret; - const nxt = argument(store ? ret : null) || error("Trailing comma in arguments list"); + const nxt = argument() || error("Trailing comma in arguments list"); ret.push(nxt); } } - function simple_extended_attr(store) { - all_ws(); + function simple_extended_attr() { const name = consume(ID); if (!name) return; const ret = { name: name.value, - "arguments": null, + arguments: null, type: "extended-attribute", rhs: null }; - all_ws(); const eq = consume(OTHER, "="); if (eq) { - all_ws(); ret.rhs = consume(ID) || consume(FLOAT) || consume(INT) || consume(STR); - if (!ret.rhs && consume(OTHER, "(")) { + if (ret.rhs) { + // No trivia exposure yet + ret.rhs.trivia = undefined; + } + } + if (consume(OTHER, "(")) { + if (eq && !ret.rhs) { // [Exposed=(Window,Worker)] - const rhs_list = []; - const id = consume(ID); - if (id) { - rhs_list.push(id.value); - } - identifiers(rhs_list); - consume(OTHER, ")") || error("Unexpected token in extended attribute argument list or type pair"); ret.rhs = { type: "identifier-list", - value: rhs_list + value: identifiers() }; } - if (!ret.rhs) return error("No right hand side to extended attribute assignment"); - } - all_ws(); - if (consume(OTHER, "(")) { - let args, pair; - // [Constructor(DOMString str)] - if (args = argument_list(store)) { - ret["arguments"] = args; - } - // [Constructor()] else { - ret["arguments"] = []; + // [NamedConstructor=Audio(DOMString src)] or [Constructor(DOMString str)] + ret.arguments = argument_list(); } - all_ws(); consume(OTHER, ")") || error("Unexpected token in extended attribute argument list"); } + if (eq && !ret.rhs) error("No right hand side to extended attribute assignment"); return ret; } // Note: we parse something simpler than the official syntax. It's all that ever // seems to be used - function extended_attrs(store) { + function extended_attrs() { const eas = []; - all_ws(store); if (!consume(OTHER, "[")) return eas; - eas[0] = simple_extended_attr(store) || error("Extended attribute with not content"); - all_ws(); + eas[0] = simple_extended_attr() || error("Extended attribute with not content"); while (consume(OTHER, ",")) { - if (eas.length) { - eas.push(simple_extended_attr(store)); - } else { - eas.push(simple_extended_attr(store) || error("Trailing comma in extended attribute")); - } + eas.push(simple_extended_attr() || error("Trailing comma in extended attribute")); } - all_ws(); consume(OTHER, "]") || error("No end of extended attribute"); return eas; } function default_() { - all_ws(); if (consume(OTHER, "=")) { - all_ws(); const def = const_value(); if (def) { return def; @@ -491,92 +467,74 @@ } else { const str = consume(STR) || error("No value for default"); str.value = str.value.slice(1, -1); + // No trivia exposure yet + str.trivia = undefined; return str; } } } - function const_(store) { - all_ws(store, "pea"); - if (!consume(ID, "const")) return; + function const_() { + if (!consume("const")) return; const ret = { type: "const", nullable: false }; - all_ws(); let typ = primitive_type(); if (!typ) { typ = consume(ID) || error("No type for const"); typ = typ.value; } - ret.idlType = { type: "const-type", idlType: typ }; - all_ws(); + ret.idlType = Object.assign({ type: "const-type" }, EMPTY_IDLTYPE, { idlType: typ }); if (consume(OTHER, "?")) { ret.nullable = true; - all_ws(); } const name = consume(ID) || error("No name for const"); ret.name = name.value; - all_ws(); consume(OTHER, "=") || error("No value assignment for const"); - all_ws(); const cnt = const_value(); if (cnt) ret.value = cnt; else error("No value for const"); - all_ws(); consume(OTHER, ";") || error("Unterminated const"); return ret; } function inheritance() { - all_ws(); if (consume(OTHER, ":")) { - all_ws(); const inh = consume(ID) || error("No type in inheritance"); return inh.value; } } - function operation_rest(ret, store) { - all_ws(); + function operation_rest(ret) { if (!ret) ret = {}; const name = consume(ID); - ret.name = name ? name.value : null; - all_ws(); + ret.name = name ? unescape(name.value) : null; + ret.escapedName = name ? name.value : null; consume(OTHER, "(") || error("Invalid operation"); - ret["arguments"] = argument_list(store) || []; - all_ws(); + ret.arguments = argument_list(); consume(OTHER, ")") || error("Unterminated operation"); - all_ws(); consume(OTHER, ";") || error("Unterminated operation"); return ret; } - function callback(store) { - all_ws(store, "pea"); + function callback() { let ret; - if (!consume(ID, "callback")) return; - all_ws(); - const tok = consume(ID, "interface"); + if (!consume("callback")) return; + const tok = consume("interface"); if (tok) { - ret = interface_rest(false, store, "callback interface"); + ret = interface_rest(false, "callback interface"); return ret; } const name = consume(ID) || error("No name for callback"); ret = current = { type: "callback", name: sanitize_name(name.value, "callback") }; - all_ws(); consume(OTHER, "=") || error("No assignment in callback"); - all_ws(); ret.idlType = return_type(); - all_ws(); consume(OTHER, "(") || error("No arguments in callback"); - ret["arguments"] = argument_list(store) || []; - all_ws(); + ret.arguments = argument_list(); consume(OTHER, ")") || error("Unterminated callback"); - all_ws(); consume(OTHER, ";") || error("Unterminated callback"); return ret; } - function attribute(store) { - all_ws(store, "pea"); + function attribute() { const grabbed = []; const ret = { type: "attribute", @@ -585,40 +543,32 @@ inherit: false, readonly: false }; - const w = all_ws(); - if (w) grabbed.push(w); - if (consume(ID, "inherit")) { + if (consume("inherit")) { if (ret.static || ret.stringifier) error("Cannot have a static or stringifier inherit"); ret.inherit = true; grabbed.push(last_token); - const w = all_ws(); - if (w) grabbed.push(w); } - if (consume(ID, "readonly")) { + if (consume("readonly")) { ret.readonly = true; grabbed.push(last_token); - const w = all_ws(); - if (w) grabbed.push(w); } const rest = attribute_rest(ret); if (!rest) { - tokens = grabbed.concat(tokens); + unconsume(...grabbed); } return rest; } function attribute_rest(ret) { - if (!consume(ID, "attribute")) { + if (!consume("attribute")) { return; } - all_ws(); ret.idlType = type_with_extended_attributes("attribute-type") || error("No type in attribute"); if (ret.idlType.sequence) error("Attributes cannot accept sequence types"); if (ret.idlType.generic === "record") error("Attributes cannot accept record types"); - all_ws(); const name = consume(ID) || error("No name in attribute"); - ret.name = name.value; - all_ws(); + ret.name = unescape(name.value); + ret.escapedName = name.value; consume(OTHER, ";") || error("Unterminated attribute"); return ret; } @@ -626,96 +576,90 @@ function return_type() { const typ = type("return-type"); if (!typ) { - if (consume(ID, "void")) { - return "void"; + if (consume("void")) { + return Object.assign({ type: "return-type" }, EMPTY_IDLTYPE, { idlType: "void" }); } else error("No return type"); } return typ; } - function operation(store) { - all_ws(store, "pea"); + function operation() { const ret = Object.assign({}, EMPTY_OPERATION); while (true) { - all_ws(); - if (consume(ID, "getter")) ret.getter = true; - else if (consume(ID, "setter")) ret.setter = true; - else if (consume(ID, "deleter")) ret.deleter = true; + if (consume("getter")) ret.getter = true; + else if (consume("setter")) ret.setter = true; + else if (consume("deleter")) ret.deleter = true; else break; } if (ret.getter || ret.setter || ret.deleter) { - all_ws(); ret.idlType = return_type(); - operation_rest(ret, store); + operation_rest(ret); return ret; } ret.idlType = return_type(); - all_ws(); - operation_rest(ret, store); + operation_rest(ret); return ret; } - function static_member(store) { - all_ws(store, "pea"); - if (!consume(ID, "static")) return; - all_ws(); - return noninherited_attribute(store, "static") || - regular_operation(store, "static") || + function static_member() { + if (!consume("static")) return; + return noninherited_attribute("static") || + regular_operation("static") || error("No body in static member"); } - function stringifier(store) { - all_ws(store, "pea"); - if (!consume(ID, "stringifier")) return; - all_ws(); + function stringifier() { + if (!consume("stringifier")) return; if (consume(OTHER, ";")) { return Object.assign({}, EMPTY_OPERATION, { stringifier: true }); } - return noninherited_attribute(store, "stringifier") || - regular_operation(store, "stringifier") || + return noninherited_attribute("stringifier") || + regular_operation("stringifier") || error("Unterminated stringifier"); } - function identifiers(arr) { + function identifiers() { + const arr = []; + const id = consume(ID); + if (id) { + arr.push(id.value); + } + else error("Expected identifiers but not found"); while (true) { - all_ws(); if (consume(OTHER, ",")) { - all_ws(); const name = consume(ID) || error("Trailing comma in identifiers list"); arr.push(name.value); } else break; } + return arr; } function iterable_type() { - if (consume(ID, "iterable")) return "iterable"; - else if (consume(ID, "legacyiterable")) return "legacyiterable"; - else if (consume(ID, "maplike")) return "maplike"; - else if (consume(ID, "setlike")) return "setlike"; + if (consume("iterable")) return "iterable"; + else if (consume("legacyiterable")) return "legacyiterable"; + else if (consume("maplike")) return "maplike"; + else if (consume("setlike")) return "setlike"; else return; } function readonly_iterable_type() { - if (consume(ID, "maplike")) return "maplike"; - else if (consume(ID, "setlike")) return "setlike"; + if (consume("maplike")) return "maplike"; + else if (consume("setlike")) return "setlike"; else return; } - function iterable(store) { - all_ws(store, "pea"); + function iterable() { const grabbed = []; const ret = { type: null, idlType: null, readonly: false }; - if (consume(ID, "readonly")) { + if (consume("readonly")) { ret.readonly = true; grabbed.push(last_token); - var w = all_ws(); - if (w) grabbed.push(w); } const consumeItType = ret.readonly ? readonly_iterable_type : iterable_type; const ittype = consumeItType(); if (!ittype) { - tokens = grabbed.concat(tokens); + unconsume(...grabbed); return; } @@ -724,21 +668,16 @@ ret.type = ittype; if (ret.type !== 'maplike' && ret.type !== 'setlike') delete ret.readonly; - all_ws(); if (consume(OTHER, "<")) { ret.idlType = [type_with_extended_attributes()] || error(`Error parsing ${ittype} declaration`); - all_ws(); if (secondTypeAllowed) { if (consume(OTHER, ",")) { - all_ws(); ret.idlType.push(type_with_extended_attributes()); - all_ws(); } else if (secondTypeRequired) error(`Missing second type argument in ${ittype} declaration`); } if (!consume(OTHER, ">")) error(`Unterminated ${ittype} declaration`); - all_ws(); if (!consume(OTHER, ";")) error(`Missing semicolon after ${ittype} declaration`); } else error(`Error parsing ${ittype} declaration`); @@ -746,8 +685,7 @@ return ret; } - function interface_rest(isPartial, store, typeName = "interface") { - all_ws(); + function interface_rest(isPartial, typeName = "interface") { const name = consume(ID) || error("No name for interface"); const mems = []; const ret = current = { @@ -757,39 +695,32 @@ members: mems }; if (!isPartial) ret.inheritance = inheritance() || null; - all_ws(); consume(OTHER, "{") || error("Bodyless interface"); while (true) { - all_ws(store ? mems : null); if (consume(OTHER, "}")) { - all_ws(); consume(OTHER, ";") || error("Missing semicolon after interface"); return ret; } - const ea = extended_attrs(store ? mems : null); - all_ws(); - const cnt = const_(store ? mems : null); + const ea = extended_attrs(); + const cnt = const_(); if (cnt) { cnt.extAttrs = ea; ret.members.push(cnt); continue; } - const mem = (opt.allowNestedTypedefs && typedef(store ? mems : null)) || - static_member(store ? mems : null) || - stringifier(store ? mems : null) || - iterable(store ? mems : null) || - attribute(store ? mems : null) || - operation(store ? mems : null) || + const mem = static_member() || + stringifier() || + iterable() || + attribute() || + operation() || error("Unknown member"); mem.extAttrs = ea; ret.members.push(mem); } } - function mixin_rest(isPartial, store) { - all_ws(); - if (!consume(ID, "mixin")) return; - all_ws(); + function mixin_rest(isPartial) { + if (!consume("mixin")) return; const name = consume(ID) || error("No name for interface mixin"); const mems = []; const ret = current = { @@ -798,44 +729,37 @@ partial: isPartial, 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); + const ea = extended_attrs(); + const cnt = const_(); 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) || + const mem = stringifier() || + noninherited_attribute() || + regular_operation() || 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) || + function interface_(isPartial) { + if (!consume("interface")) return; + return mixin_rest(isPartial) || + interface_rest(isPartial) || error("Interface has no proper body"); } - function namespace(isPartial, store) { - all_ws(isPartial ? null : store, "pea"); - if (!consume(ID, "namespace")) return; - all_ws(); + function namespace(isPartial) { + if (!consume("namespace")) return; const name = consume(ID) || error("No name for namespace"); const mems = []; const ret = current = { @@ -844,27 +768,22 @@ partial: isPartial, members: mems }; - all_ws(); consume(OTHER, "{") || error("Bodyless namespace"); while (true) { - all_ws(store ? mems : null); if (consume(OTHER, "}")) { - all_ws(); consume(OTHER, ";") || error("Missing semicolon after namespace"); return ret; } - const ea = extended_attrs(store ? mems : null); - all_ws(); - const mem = noninherited_attribute(store ? mems : null) || - regular_operation(store ? mems : null) || + const ea = extended_attrs(); + const mem = noninherited_attribute() || + regular_operation() || error("Unknown member"); mem.extAttrs = ea; ret.members.push(mem); } } - function noninherited_attribute(store, prefix) { - const w = all_ws(store, "pea"); + function noninherited_attribute(prefix) { const grabbed = []; const ret = { type: "attribute", @@ -876,44 +795,37 @@ if (prefix) { ret[prefix] = true; } - if (w) grabbed.push(w); - if (consume(ID, "readonly")) { + if (consume("readonly")) { ret.readonly = true; grabbed.push(last_token); - const w = all_ws(); - if (w) grabbed.push(w); } const rest = attribute_rest(ret); if (!rest) { - tokens = grabbed.concat(tokens); + unconsume(...grabbed); } return rest; } - function regular_operation(store, prefix) { - all_ws(store, "pea"); + function regular_operation(prefix) { const ret = Object.assign({}, EMPTY_OPERATION); if (prefix) { ret[prefix] = true; } ret.idlType = return_type(); - return operation_rest(ret, store); + return operation_rest(ret); } - function partial(store) { - all_ws(store, "pea"); - if (!consume(ID, "partial")) return; - const thing = dictionary(true, store) || - interface_(true, store) || - namespace(true, store) || + function partial() { + if (!consume("partial")) return; + const thing = dictionary(true) || + interface_(true) || + namespace(true) || error("Partial doesn't apply to anything"); return thing; } - function dictionary(isPartial, store) { - all_ws(isPartial ? null : store, "pea"); - if (!consume(ID, "dictionary")) return; - all_ws(); + function dictionary(isPartial) { + if (!consume("dictionary")) return; const name = consume(ID) || error("No name for dictionary"); const mems = []; const ret = current = { @@ -923,26 +835,22 @@ members: mems }; if (!isPartial) ret.inheritance = inheritance() || null; - all_ws(); consume(OTHER, "{") || error("Bodyless dictionary"); while (true) { - all_ws(store ? mems : null); if (consume(OTHER, "}")) { - all_ws(); consume(OTHER, ";") || error("Missing semicolon after dictionary"); return ret; } - const ea = extended_attrs(store ? mems : null); - all_ws(store ? mems : null, "pea"); - const required = consume(ID, "required"); + const ea = extended_attrs(); + const required = consume("required"); const typ = type_with_extended_attributes("dictionary-type") || error("No type for dictionary member"); - all_ws(); const name = consume(ID) || error("No name for dictionary member"); const dflt = default_(); if (required && dflt) error("Required member must not have a default"); const member = { type: "field", - name: name.value, + name: unescape(name.value), + escapedName: name.value, required: !!required, idlType: typ, extAttrs: ea @@ -951,15 +859,12 @@ member["default"] = dflt; } ret.members.push(member); - all_ws(); consume(OTHER, ";") || error("Unterminated dictionary member"); } } - function enum_(store) { - all_ws(store, "pea"); - if (!consume(ID, "enum")) return; - all_ws(); + function enum_() { + if (!consume("enum")) return; const name = consume(ID) || error("No name for enum"); const vals = []; const ret = current = { @@ -967,111 +872,97 @@ name: sanitize_name(name.value, "enum"), values: vals }; - all_ws(); consume(OTHER, "{") || error("No curly for enum"); - let saw_comma = false; + let value_expected = true; while (true) { - all_ws(store ? vals : null); if (consume(OTHER, "}")) { - all_ws(); + if (!ret.values.length) error("No value in enum"); consume(OTHER, ";") || error("No semicolon after enum"); return ret; } + else if (!value_expected) { + error("No comma between enum values"); + } const val = consume(STR) || error("Unexpected value in enum"); val.value = val.value.slice(1, -1); + // No trivia exposure yet + val.trivia = undefined; ret.values.push(val); - all_ws(store ? vals : null); if (consume(OTHER, ",")) { - if (store) vals.push({ type: "," }); - all_ws(store ? vals : null); - saw_comma = true; + value_expected = true; } else { - saw_comma = false; + value_expected = false; } } } - function typedef(store) { - all_ws(store, "pea"); - if (!consume(ID, "typedef")) return; + function typedef() { + if (!consume("typedef")) return; const ret = { type: "typedef" }; - all_ws(); ret.idlType = type_with_extended_attributes("typedef-type") || error("No type in typedef"); - all_ws(); const name = consume(ID) || error("No name in typedef"); ret.name = sanitize_name(name.value, "typedef"); current = ret; - all_ws(); consume(OTHER, ";") || error("Unterminated typedef"); return ret; } - function implements_(store) { - all_ws(store, "pea"); + function implements_() { const target = consume(ID); if (!target) return; - const w = all_ws(); - if (consume(ID, "implements")) { + if (consume("implements")) { const ret = { type: "implements", target: target.value }; - all_ws(); const imp = consume(ID) || error("Incomplete implements statement"); ret["implements"] = imp.value; - all_ws(); consume(OTHER, ";") || error("No terminating ; for implements statement"); return ret; } else { // rollback - tokens.unshift(w); - tokens.unshift(target); + unconsume(target); } } - function includes(store) { - all_ws(store, "pea"); + function includes() { const target = consume(ID); if (!target) return; - const w = all_ws(); - if (consume(ID, "includes")) { + if (consume("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); + unconsume(target); } } - function definition(store) { - return callback(store) || - interface_(false, store) || - partial(store) || - dictionary(false, store) || - enum_(store) || - typedef(store) || - implements_(store) || - includes(store) || - namespace(false, store); + function definition() { + return callback() || + interface_(false) || + partial() || + dictionary(false) || + enum_() || + typedef() || + implements_() || + includes() || + namespace(false); } - function definitions(store) { + function definitions() { if (!tokens.length) return []; const defs = []; while (true) { - const ea = extended_attrs(store ? defs : null); - const def = definition(store ? defs : null); + const ea = extended_attrs(); + const def = definition(); if (!def) { if (ea.length) error("Stray extended attributes"); break; @@ -1081,16 +972,15 @@ } return defs; } - const res = definitions(opt.ws); + const res = definitions(); if (tokens.length) error("Unrecognised tokens"); return res; } const obj = { - parse(str, opt) { - if (!opt) opt = {}; + parse(str) { const tokens = tokenise(str); - return parse(tokens, opt); + return parse(tokens); } }; diff --git a/lib/writer.js b/lib/writer.js index c00c0dd932221b..c6f5d0b7fdcbb7 100644 --- a/lib/writer.js +++ b/lib/writer.js @@ -2,8 +2,6 @@ (() => { function write(ast, opt = {}) { - let curPea = ""; - let curTPea = ""; const noop = str => str; const optNames = "type".split(" "); const context = []; @@ -14,23 +12,9 @@ function literal(it) { return it.value; }; - function wsPea(it) { - curPea += it.value; - return ""; - }; - function wsTPea(it) { - curTPea += it.value; - return ""; - }; - function lineComment(it) { - return `//${it.value}\n`; - }; - function multilineComment(it) { - return `/*${it.value}*/`; - }; function type(it) { if (typeof it === "string") return opt.type(it); // XXX should maintain some context - let ret = extended_attributes(it.extAttrs, curPea); + let ret = extended_attributes(it.extAttrs); if (it.union) ret += `(${it.idlType.map(type).join(" or ")})`; else { if (it.generic) ret += `${it.generic}<`; @@ -52,27 +36,21 @@ else if (tp === "sequence") return "[]"; else return `"${it.value}"`; }; - function argument(arg, pea) { - let ret = extended_attributes(arg.extAttrs, pea); + function argument(arg) { + let ret = extended_attributes(arg.extAttrs); if (arg.optional) ret += "optional "; ret += type(arg.idlType); if (arg.variadic) ret += "..."; - ret += ` ${arg.name}`; + ret += ` ${arg.escapedName}`; if (arg["default"]) ret += ` = ${const_value(arg["default"])}`; return ret; }; function args(its) { let res = ""; - let pea = ""; for (let i = 0, n = its.length; i < n; i++) { const arg = its[i]; - if (arg.type === "ws") res += arg.value; - else if (arg.type === "ws-pea") pea += arg.value; - else { - res += argument(arg, pea); - if (i < n - 1) res += ","; - pea = ""; - } + res += argument(arg); + if (i < n - 1) res += ","; } return res; }; @@ -87,39 +65,36 @@ context.shift(); // XXX need to add more contexts, but not more than needed for ReSpec return ret; }; - function extended_attributes(eats, pea) { + function extended_attributes(eats) { if (!eats || !eats.length) return ""; - return `[${eats.map(make_ext_at).join(", ")}]${pea}`; + return `[${eats.map(make_ext_at).join(", ")}]`; }; const modifiers = "getter setter creator deleter legacycaller stringifier static".split(" "); function operation(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.stringifier && !it.idlType) return "stringifier;"; for (const mod of modifiers) { if (it[mod]) ret += mod + " "; } ret += type(it.idlType) + " "; - if (it.name) ret += it.name; + if (it.name) ret += it.escapedName; ret += `(${args(it["arguments"])});`; return ret; }; function attribute(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it["static"]) ret += "static "; if (it.stringifier) ret += "stringifier "; if (it.readonly) ret += "readonly "; if (it.inherit) ret += "inherit "; - ret += `attribute ${type(it.idlType)} ${it.name};`; + ret += `attribute ${type(it.idlType)} ${it.escapedName};`; return ret; }; function interface_(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.partial) ret += "partial "; ret += `interface ${it.name} `; if (it.inheritance) ret += `: ${it.inheritance} `; @@ -128,8 +103,7 @@ }; function interface_mixin(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.partial) ret += "partial "; ret += `interface mixin ${it.name} `; ret += `{${iterate(it.members)}};`; @@ -137,8 +111,7 @@ } function namespace(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.partial) ret += "partial "; ret += `namespace ${it.name} `; ret += `{${iterate(it.members)}};`; @@ -146,8 +119,7 @@ } function dictionary(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.partial) ret += "partial "; ret += `dictionary ${it.name} `; if (it.inheritance) ret += `: ${it.inheritance} `; @@ -155,49 +127,39 @@ return ret; }; function field(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); if (it.required) ret += "required "; - ret += `${type(it.idlType)} ${it.name}`; + ret += `${type(it.idlType)} ${it.escapedName}`; if (it["default"]) ret += ` = ${const_value(it["default"])}`; ret += ";"; return ret; }; function const_(it) { - const ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + const ret = extended_attributes(it.extAttrs); return `${ret}const ${type(it.idlType)}${it.nullable ? "?" : ""} ${it.name} = ${const_value(it.value)};`; }; function typedef(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; - ret += `typedef ${extended_attributes(it.typeExtAttrs, curTPea)}`; - curTPea = ""; + let ret = extended_attributes(it.extAttrs); + ret += `typedef ${extended_attributes(it.typeExtAttrs)}`; return `${ret}${type(it.idlType)} ${it.name};`; }; function implements_(it) { - const ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + const ret = extended_attributes(it.extAttrs); return `${ret}${it.target} implements ${it["implements"]};`; }; function includes(it) { - const ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + const ret = extended_attributes(it.extAttrs); return `${ret}${it.target} includes ${it.includes};`; }; function callback(it) { - const ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + const ret = extended_attributes(it.extAttrs); return `${ret}callback ${it.name} = ${type(it.idlType)}(${args(it["arguments"])});`; }; function enum_(it) { - let ret = extended_attributes(it.extAttrs, curPea); - curPea = ""; + let ret = extended_attributes(it.extAttrs); ret += `enum ${it.name} {`; for (const v of it.values) { - if (v.type === "string") ret += `"${v.value}"`; - else if (v.type === "ws") ret += v.value; - else if (v.type === ",") ret += ","; + ret += `"${v.value}",`; } return ret + "};"; }; @@ -218,11 +180,6 @@ }; const table = { - ws: literal, - "ws-pea": wsPea, - "ws-tpea": wsTPea, - "line-comment": lineComment, - "multiline-comment": multilineComment, interface: interface_, "interface mixin": interface_mixin, namespace, diff --git a/package-lock.json b/package-lock.json index a6f529d6c7f11d..ca60e72676c3a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "webidl2", - "version": "10.2.1", + "version": "12.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index ab282d189bb9e5..c04976a77e616e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "webidl2", "description": "A WebIDL Parser", - "version": "10.2.1", + "version": "12.1.0", "contributors": [ "Robin Berjon (https://berjon.com)", "Marcos Caceres (https://marcosc.com)", diff --git a/test/invalid/idl/enum-empty.widl b/test/invalid/idl/enum-empty.widl new file mode 100644 index 00000000000000..7f189eb62c1bd2 --- /dev/null +++ b/test/invalid/idl/enum-empty.widl @@ -0,0 +1 @@ +enum Empty {}; diff --git a/test/invalid/idl/enum-wo-comma.widl b/test/invalid/idl/enum-wo-comma.widl new file mode 100644 index 00000000000000..ebc53065ededed --- /dev/null +++ b/test/invalid/idl/enum-wo-comma.widl @@ -0,0 +1 @@ +enum NoComma { "value1" "value2" }; diff --git a/test/invalid/idl/extattr-empty-ids.widl b/test/invalid/idl/extattr-empty-ids.widl new file mode 100644 index 00000000000000..93c48c3ade5fa4 --- /dev/null +++ b/test/invalid/idl/extattr-empty-ids.widl @@ -0,0 +1,2 @@ +[Exposed=()] +interface Unexposed {}; diff --git a/test/invalid/idl/id-underscored-number.widl b/test/invalid/idl/id-underscored-number.widl new file mode 100644 index 00000000000000..d00121fd54f2f3 --- /dev/null +++ b/test/invalid/idl/id-underscored-number.widl @@ -0,0 +1 @@ +interface _0 {}; diff --git a/test/invalid/idl/implements_and_includes_ws.widl b/test/invalid/idl/implements_and_includes_ws.widl new file mode 100644 index 00000000000000..6666daed00c3e7 --- /dev/null +++ b/test/invalid/idl/implements_and_includes_ws.widl @@ -0,0 +1,4 @@ +// This hits the unshifting of whitespace in the "implements" and +// "includes" productions. If there is a bug in that whitespace +// rollback, the wrong exception will be produced. +foobar; diff --git a/test/invalid/json/enum-empty.json b/test/invalid/json/enum-empty.json new file mode 100644 index 00000000000000..734bc67de1fd67 --- /dev/null +++ b/test/invalid/json/enum-empty.json @@ -0,0 +1,4 @@ +{ + "message": "Got an error during or right after parsing `enum Empty`: No value in enum", + "line": 1 +} diff --git a/test/invalid/json/enum-wo-comma.json b/test/invalid/json/enum-wo-comma.json new file mode 100644 index 00000000000000..bfd0b0951fce8d --- /dev/null +++ b/test/invalid/json/enum-wo-comma.json @@ -0,0 +1,4 @@ +{ + "message": "Got an error during or right after parsing `enum NoComma`: No comma between enum values", + "line": 1 +} diff --git a/test/invalid/json/extattr-empty-ids.json b/test/invalid/json/extattr-empty-ids.json new file mode 100644 index 00000000000000..4337f1e180c288 --- /dev/null +++ b/test/invalid/json/extattr-empty-ids.json @@ -0,0 +1,4 @@ +{ + "message": "Got an error before parsing any named definition: Expected identifiers but not found", + "line": 1 +} diff --git a/test/invalid/json/id-underscored-number.json b/test/invalid/json/id-underscored-number.json new file mode 100644 index 00000000000000..c49f3f5e35afe1 --- /dev/null +++ b/test/invalid/json/id-underscored-number.json @@ -0,0 +1,3 @@ +{ + "message": "Token stream not progressing" +} diff --git a/test/invalid/json/implements_and_includes_ws.json b/test/invalid/json/implements_and_includes_ws.json new file mode 100644 index 00000000000000..ad9fac6ca2f64e --- /dev/null +++ b/test/invalid/json/implements_and_includes_ws.json @@ -0,0 +1,4 @@ +{ + "message": "Got an error before parsing any named definition: Unrecognised tokens", + "line": 4 +} diff --git a/test/invalid/json/readonly-iterable.json b/test/invalid/json/readonly-iterable.json index 1a09264a6d0d65..126cf7317270d8 100644 --- a/test/invalid/json/readonly-iterable.json +++ b/test/invalid/json/readonly-iterable.json @@ -1,4 +1,4 @@ { - "message": "Got an error during or right after parsing `interface ReadonlyIterable`: Invalid operation", + "message": "Got an error during or right after parsing `interface ReadonlyIterable`: No return type", "line": 2 } diff --git a/test/invalid/json/typedef-nested.json b/test/invalid/json/typedef-nested.json index 8c6081496851ab..6bd8422fcb936f 100644 --- a/test/invalid/json/typedef-nested.json +++ b/test/invalid/json/typedef-nested.json @@ -1,4 +1,4 @@ { - "message": "Got an error during or right after parsing `interface Widget`: Invalid operation" + "message": "Got an error during or right after parsing `interface Widget`: No return type" , "line": 14 } diff --git a/test/syntax/idl/identifier-qualified-names.widl b/test/syntax/idl/identifier-qualified-names.widl index 986d0bf78c6a6f..18137c4877c78e 100644 --- a/test/syntax/idl/identifier-qualified-names.widl +++ b/test/syntax/idl/identifier-qualified-names.widl @@ -26,7 +26,3 @@ // Attribute identifier: "value" attribute DOMString? _value; }; - -interface Foo { - void op(object interface); -}; \ No newline at end of file diff --git a/test/syntax/idl/linecomment.widl b/test/syntax/idl/linecomment.widl deleted file mode 100644 index 5d31bdb62c999e..00000000000000 --- a/test/syntax/idl/linecomment.widl +++ /dev/null @@ -1,2 +0,0 @@ -/* first */ -// second diff --git a/test/syntax/json/allowany.json b/test/syntax/json/allowany.json index cd5c6e00ac33b2..7a1fd325eda22d 100644 --- a/test/syntax/json/allowany.json +++ b/test/syntax/json/allowany.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "g", + "escapedName": "g", "arguments": [], "extAttrs": [] }, @@ -36,9 +38,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "g", + "escapedName": "g", "arguments": [ { "optional": false, @@ -50,9 +54,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "B" + "idlType": "B", + "extAttrs": [] }, - "name": "b" + "name": "b", + "escapedName": "b" } ], "extAttrs": [] @@ -70,9 +76,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "g", + "escapedName": "g", "arguments": [ { "optional": false, @@ -91,9 +99,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "s" + "name": "s", + "escapedName": "s" } ], "extAttrs": [] diff --git a/test/syntax/json/attributes.json b/test/syntax/json/attributes.json index c90c70d7edc4ca..6d7d662a6b80b7 100644 --- a/test/syntax/json/attributes.json +++ b/test/syntax/json/attributes.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "age", + "escapedName": "age", "extAttrs": [] } ], diff --git a/test/syntax/json/callback.json b/test/syntax/json/callback.json index f31067dd25cb99..b82e9fd67c3c7f 100644 --- a/test/syntax/json/callback.json +++ b/test/syntax/json/callback.json @@ -8,7 +8,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "arguments": [ { @@ -21,9 +22,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "status" + "name": "status", + "escapedName": "status" } ], "extAttrs": [] @@ -46,9 +49,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "eventOccurred", + "escapedName": "eventOccurred", "arguments": [ { "optional": false, @@ -60,9 +65,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "details" + "name": "details", + "escapedName": "details" } ], "extAttrs": [] @@ -80,7 +87,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "arguments": [ { @@ -93,9 +101,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, - "name": "a" + "name": "a", + "escapedName": "a" }, { "optional": false, @@ -107,9 +117,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, - "name": "b" + "name": "b", + "escapedName": "b" } ], "extAttrs": [] diff --git a/test/syntax/json/constants.json b/test/syntax/json/constants.json index 4b98751622c339..e016b38b7d64e4 100644 --- a/test/syntax/json/constants.json +++ b/test/syntax/json/constants.json @@ -9,7 +9,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "boolean" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "boolean", + "extAttrs": [] }, "name": "DEBUG", "value": { @@ -23,7 +28,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "short" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "short", + "extAttrs": [] }, "name": "negative", "value": { @@ -37,7 +47,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "octet" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "octet", + "extAttrs": [] }, "name": "LF", "value": { @@ -51,7 +66,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "unsigned long" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "unsigned long", + "extAttrs": [] }, "name": "BIT_MASK", "value": { @@ -65,7 +85,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "float" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "float", + "extAttrs": [] }, "name": "AVOGADRO", "value": { @@ -79,7 +104,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "unrestricted float" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "unrestricted float", + "extAttrs": [] }, "name": "sobig", "value": { @@ -93,7 +123,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "unrestricted double" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "unrestricted double", + "extAttrs": [] }, "name": "minusonedividedbyzero", "value": { @@ -107,7 +142,12 @@ "nullable": false, "idlType": { "type": "const-type", - "idlType": "short" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "short", + "extAttrs": [] }, "name": "notanumber", "value": { diff --git a/test/syntax/json/constructor.json b/test/syntax/json/constructor.json index 292236f291bd9b..a7f551ef347839 100644 --- a/test/syntax/json/constructor.json +++ b/test/syntax/json/constructor.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "r", + "escapedName": "r", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "cx", + "escapedName": "cx", "extAttrs": [] }, { @@ -50,9 +54,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "cy", + "escapedName": "cy", "extAttrs": [] }, { @@ -67,9 +73,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "circumference", + "escapedName": "circumference", "extAttrs": [] } ], @@ -94,9 +102,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "radius" + "name": "radius", + "escapedName": "radius" } ], "type": "extended-attribute", diff --git a/test/syntax/json/dictionary-inherits.json b/test/syntax/json/dictionary-inherits.json index 9b928f4f0a6f22..93c632371cf6ee 100644 --- a/test/syntax/json/dictionary-inherits.json +++ b/test/syntax/json/dictionary-inherits.json @@ -7,6 +7,7 @@ { "type": "field", "name": "fillPattern", + "escapedName": "fillPattern", "required": false, "idlType": { "type": "dictionary-type", @@ -14,7 +15,8 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "extAttrs": [], "default": { @@ -25,6 +27,7 @@ { "type": "field", "name": "strokePattern", + "escapedName": "strokePattern", "required": false, "idlType": { "type": "dictionary-type", @@ -32,7 +35,8 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "extAttrs": [], "default": { @@ -42,6 +46,7 @@ { "type": "field", "name": "position", + "escapedName": "position", "required": false, "idlType": { "type": "dictionary-type", @@ -49,7 +54,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, "extAttrs": [] } @@ -65,6 +71,7 @@ { "type": "field", "name": "hydrometry", + "escapedName": "hydrometry", "required": false, "idlType": { "type": "dictionary-type", @@ -72,7 +79,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "extAttrs": [] } diff --git a/test/syntax/json/dictionary.json b/test/syntax/json/dictionary.json index f74fedc3d35b86..d2a9ac2592c527 100644 --- a/test/syntax/json/dictionary.json +++ b/test/syntax/json/dictionary.json @@ -7,6 +7,7 @@ { "type": "field", "name": "fillPattern", + "escapedName": "fillPattern", "required": false, "idlType": { "type": "dictionary-type", @@ -14,7 +15,8 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "extAttrs": [], "default": { @@ -25,6 +27,7 @@ { "type": "field", "name": "strokePattern", + "escapedName": "strokePattern", "required": false, "idlType": { "type": "dictionary-type", @@ -32,7 +35,8 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "extAttrs": [], "default": { @@ -42,6 +46,7 @@ { "type": "field", "name": "position", + "escapedName": "position", "required": false, "idlType": { "type": "dictionary-type", @@ -49,13 +54,15 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, "extAttrs": [] }, { "type": "field", "name": "seq", + "escapedName": "seq", "required": false, "idlType": { "type": "dictionary-type", @@ -69,8 +76,10 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" - } + "idlType": "long", + "extAttrs": [] + }, + "extAttrs": [] }, "extAttrs": [], "default": { @@ -81,6 +90,7 @@ { "type": "field", "name": "reqSeq", + "escapedName": "reqSeq", "required": true, "idlType": { "type": "dictionary-type", @@ -88,7 +98,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, "extAttrs": [] } @@ -104,6 +115,7 @@ { "type": "field", "name": "h", + "escapedName": "h", "required": false, "idlType": { "type": "dictionary-type", @@ -111,13 +123,15 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, "extAttrs": [] }, { "type": "field", "name": "d", + "escapedName": "d", "required": false, "idlType": { "type": "dictionary-type", @@ -125,7 +139,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, "extAttrs": [] } diff --git a/test/syntax/json/enum.json b/test/syntax/json/enum.json index 29d1c865b68eab..407855e2dcd5c1 100644 --- a/test/syntax/json/enum.json +++ b/test/syntax/json/enum.json @@ -35,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "MealType" + "idlType": "MealType", + "extAttrs": [] }, "name": "type", + "escapedName": "type", "extAttrs": [] }, { @@ -52,9 +54,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "size", + "escapedName": "size", "extAttrs": [] }, { @@ -70,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "initialize", + "escapedName": "initialize", "arguments": [ { "optional": false, @@ -84,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "MealType" + "idlType": "MealType", + "extAttrs": [] }, - "name": "type" + "name": "type", + "escapedName": "type" }, { "optional": false, @@ -98,9 +106,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "size" + "name": "size", + "escapedName": "size" } ], "extAttrs": [] diff --git a/test/syntax/json/equivalent-decl.json b/test/syntax/json/equivalent-decl.json index de8d4dbc70ba8d..9d1ec60ae30308 100644 --- a/test/syntax/json/equivalent-decl.json +++ b/test/syntax/json/equivalent-decl.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "propertyCount", + "escapedName": "propertyCount", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "getProperty", + "escapedName": "getProperty", "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" } ], "extAttrs": [] @@ -68,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "setProperty", + "escapedName": "setProperty", "arguments": [ { "optional": false, @@ -82,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" }, { "optional": false, @@ -96,9 +106,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "propertyValue" + "name": "propertyValue", + "escapedName": "propertyValue" } ], "extAttrs": [] @@ -124,9 +136,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "propertyCount", + "escapedName": "propertyCount", "extAttrs": [] }, { @@ -142,9 +156,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "getProperty", + "escapedName": "getProperty", "arguments": [ { "optional": false, @@ -156,9 +172,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" } ], "extAttrs": [] @@ -176,9 +194,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "setProperty", + "escapedName": "setProperty", "arguments": [ { "optional": false, @@ -190,9 +210,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" }, { "optional": false, @@ -204,9 +226,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "propertyValue" + "name": "propertyValue", + "escapedName": "propertyValue" } ], "extAttrs": [] @@ -224,9 +248,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [ { "optional": false, @@ -238,9 +264,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" } ], "extAttrs": [] @@ -258,9 +286,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [ { "optional": false, @@ -272,9 +302,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" }, { "optional": false, @@ -286,9 +318,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "propertyValue" + "name": "propertyValue", + "escapedName": "propertyValue" } ], "extAttrs": [] diff --git a/test/syntax/json/extended-attributes.json b/test/syntax/json/extended-attributes.json index e0dc2360f3af08..f907ffcd6a4636 100644 --- a/test/syntax/json/extended-attributes.json +++ b/test/syntax/json/extended-attributes.json @@ -82,9 +82,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "r", + "escapedName": "r", "extAttrs": [] }, { @@ -99,9 +101,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "cx", + "escapedName": "cx", "extAttrs": [] }, { @@ -116,9 +120,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "cy", + "escapedName": "cy", "extAttrs": [] }, { @@ -133,9 +139,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "circumference", + "escapedName": "circumference", "extAttrs": [] } ], @@ -160,9 +168,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, - "name": "radius" + "name": "radius", + "escapedName": "radius" } ], "type": "extended-attribute", @@ -194,7 +204,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, { "type": null, @@ -202,7 +213,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Node" + "idlType": "Node", + "extAttrs": [] } ], "extAttrs": [ @@ -215,6 +227,7 @@ ] }, "name": "attrib", + "escapedName": "attrib", "extAttrs": [] } ], diff --git a/test/syntax/json/generic.json b/test/syntax/json/generic.json index 62593859fb14ce..dea1e15ccd1054 100644 --- a/test/syntax/json/generic.json +++ b/test/syntax/json/generic.json @@ -35,12 +35,17 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" - } - } - } + "idlType": "DOMString", + "extAttrs": [] + }, + "extAttrs": [] + }, + "extAttrs": [] + }, + "extAttrs": [] }, "name": "bar", + "escapedName": "bar", "arguments": [], "extAttrs": [] }, @@ -62,10 +67,13 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" - } + "idlType": "DOMString", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "baz", + "escapedName": "baz", "extAttrs": [] } ], @@ -96,10 +104,13 @@ "generic": null, "nullable": true, "union": false, - "idlType": "Client" - } + "idlType": "Client", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "getServiced", + "escapedName": "getServiced", "arguments": [], "extAttrs": [] }, @@ -122,10 +133,13 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" - } + "idlType": "any", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "reloadAll", + "escapedName": "reloadAll", "arguments": [], "extAttrs": [] } @@ -157,10 +171,13 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" - } + "idlType": "any", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "default", + "escapedName": "default", "arguments": [], "extAttrs": [] } diff --git a/test/syntax/json/getter-setter.json b/test/syntax/json/getter-setter.json index 1213307f20309b..3a2546e9a480e7 100644 --- a/test/syntax/json/getter-setter.json +++ b/test/syntax/json/getter-setter.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "propertyCount", + "escapedName": "propertyCount", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" } ], "extAttrs": [] @@ -68,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [ { "optional": false, @@ -82,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "propertyName" + "name": "propertyName", + "escapedName": "propertyName" }, { "optional": false, @@ -96,9 +106,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "propertyValue" + "name": "propertyValue", + "escapedName": "propertyValue" } ], "extAttrs": [] diff --git a/test/syntax/json/identifier-qualified-names.json b/test/syntax/json/identifier-qualified-names.json index f4e295acd3e120..6015dff942917d 100644 --- a/test/syntax/json/identifier-qualified-names.json +++ b/test/syntax/json/identifier-qualified-names.json @@ -7,7 +7,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "number", "extAttrs": [] @@ -30,9 +31,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "object" + "idlType": "object", + "extAttrs": [] }, "name": "createObject", + "escapedName": "createObject", "arguments": [ { "optional": false, @@ -44,9 +47,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "interface" + "name": "interface", + "escapedName": "_interface" } ], "extAttrs": [] @@ -64,9 +69,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [ { "optional": false, @@ -78,9 +85,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "keyName" + "name": "keyName", + "escapedName": "keyName" } ], "extAttrs": [] @@ -106,9 +115,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "const", + "escapedName": "_const", "extAttrs": [] }, { @@ -123,52 +134,11 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "value", - "extAttrs": [] - } - ], - "inheritance": null, - "extAttrs": [] - }, - { - "type": "interface", - "name": "Foo", - "partial": false, - "members": [ - { - "type": "operation", - "getter": false, - "setter": false, - "deleter": false, - "static": false, - "stringifier": false, - "idlType": { - "type": "return-type", - "sequence": false, - "generic": null, - "nullable": false, - "union": false, - "idlType": "void" - }, - "name": "op", - "arguments": [ - { - "optional": false, - "variadic": false, - "extAttrs": [], - "idlType": { - "type": "argument-type", - "sequence": false, - "generic": null, - "nullable": false, - "union": false, - "idlType": "object" - }, - "name": "interface" - } - ], + "escapedName": "_value", "extAttrs": [] } ], diff --git a/test/syntax/json/implements.json b/test/syntax/json/implements.json index 69879d94f553d5..f943104c09ec19 100644 --- a/test/syntax/json/implements.json +++ b/test/syntax/json/implements.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "nodeType", + "escapedName": "nodeType", "extAttrs": [] } ], @@ -43,9 +45,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "addEventListener", + "escapedName": "addEventListener", "arguments": [ { "optional": false, @@ -57,9 +61,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "type" + "name": "type", + "escapedName": "type" }, { "optional": false, @@ -71,9 +77,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "EventListener" + "idlType": "EventListener", + "extAttrs": [] }, - "name": "listener" + "name": "listener", + "escapedName": "listener" }, { "optional": false, @@ -85,9 +93,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, - "name": "useCapture" + "name": "useCapture", + "escapedName": "useCapture" } ], "extAttrs": [] diff --git a/test/syntax/json/indexed-properties.json b/test/syntax/json/indexed-properties.json index 697b595546c788..f4d77207445099 100644 --- a/test/syntax/json/indexed-properties.json +++ b/test/syntax/json/indexed-properties.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "size", + "escapedName": "size", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, "name": "getByIndex", + "escapedName": "getByIndex", "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "index" + "name": "index", + "escapedName": "index" } ], "extAttrs": [] @@ -68,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "setByIndex", + "escapedName": "setByIndex", "arguments": [ { "optional": false, @@ -82,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "index" + "name": "index", + "escapedName": "index" }, { "optional": false, @@ -96,9 +106,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, - "name": "value" + "name": "value", + "escapedName": "value" } ], "extAttrs": [] @@ -116,9 +128,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "removeByIndex", + "escapedName": "removeByIndex", "arguments": [ { "optional": false, @@ -130,9 +144,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "index" + "name": "index", + "escapedName": "index" } ], "extAttrs": [] @@ -150,9 +166,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, "name": "get", + "escapedName": "get", "arguments": [ { "optional": false, @@ -164,9 +182,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "name" + "name": "name", + "escapedName": "name" } ], "extAttrs": [] @@ -184,9 +204,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "set", + "escapedName": "set", "arguments": [ { "optional": false, @@ -198,9 +220,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "name" + "name": "name", + "escapedName": "name" }, { "optional": false, @@ -212,9 +236,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, - "name": "value" + "name": "value", + "escapedName": "value" } ], "extAttrs": [] @@ -232,9 +258,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "remove", + "escapedName": "remove", "arguments": [ { "optional": false, @@ -246,9 +274,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "name" + "name": "name", + "escapedName": "name" } ], "extAttrs": [] diff --git a/test/syntax/json/inherits-getter.json b/test/syntax/json/inherits-getter.json index 818d8b6c16f824..a70d735a9a89b8 100644 --- a/test/syntax/json/inherits-getter.json +++ b/test/syntax/json/inherits-getter.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] } ], @@ -42,9 +44,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "age", + "escapedName": "age", "extAttrs": [] }, { @@ -59,9 +63,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] } ], diff --git a/test/syntax/json/interface-inherits.json b/test/syntax/json/interface-inherits.json index 74a4c39bb0ffb1..5d61dd3faaf016 100644 --- a/test/syntax/json/interface-inherits.json +++ b/test/syntax/json/interface-inherits.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] } ], @@ -42,9 +44,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Dog" + "idlType": "Dog", + "extAttrs": [] }, "name": "pet", + "escapedName": "pet", "extAttrs": [] } ], @@ -68,9 +72,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Human" + "idlType": "Human", + "extAttrs": [] }, "name": "owner", + "escapedName": "owner", "extAttrs": [] } ], diff --git a/test/syntax/json/iterable.json b/test/syntax/json/iterable.json index 7126a4ea2b01b1..179bdebccb1b26 100644 --- a/test/syntax/json/iterable.json +++ b/test/syntax/json/iterable.json @@ -13,7 +13,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] } ], "extAttrs": [] @@ -36,7 +37,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "short" + "idlType": "short", + "extAttrs": [] }, { "type": null, @@ -44,7 +46,8 @@ "generic": null, "nullable": true, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] } ], "extAttrs": [] diff --git a/test/syntax/json/legacyiterable.json b/test/syntax/json/legacyiterable.json index 5a1e526b50ae60..b5a9da996f6045 100644 --- a/test/syntax/json/legacyiterable.json +++ b/test/syntax/json/legacyiterable.json @@ -13,7 +13,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] } ], "extAttrs": [] diff --git a/test/syntax/json/linecomment.json b/test/syntax/json/linecomment.json deleted file mode 100644 index 11fd14f494bd20..00000000000000 --- a/test/syntax/json/linecomment.json +++ /dev/null @@ -1,14 +0,0 @@ -[ - { - "type": "multiline-comment", - "value": " first " - }, - { - "type": "ws", - "value": "\n" - }, - { - "type": "line-comment", - "value": " second" - } -] diff --git a/test/syntax/json/maplike.json b/test/syntax/json/maplike.json index b86e10487c1b61..dae12645914d17 100644 --- a/test/syntax/json/maplike.json +++ b/test/syntax/json/maplike.json @@ -13,7 +13,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, { "type": null, @@ -21,7 +22,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] } ], "readonly": false, @@ -45,7 +47,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, { "type": null, @@ -53,7 +56,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] } ], "readonly": true, diff --git a/test/syntax/json/mixin.json b/test/syntax/json/mixin.json index f0458e2b0841ca..0e80ceb4bc1a30 100644 --- a/test/syntax/json/mixin.json +++ b/test/syntax/json/mixin.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Crypto" + "idlType": "Crypto", + "extAttrs": [] }, "name": "crypto", + "escapedName": "crypto", "extAttrs": [] } ], @@ -53,9 +55,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Crypto" + "idlType": "Crypto", + "extAttrs": [] }, "name": "crypto", + "escapedName": "crypto", "extAttrs": [] } ], diff --git a/test/syntax/json/namedconstructor.json b/test/syntax/json/namedconstructor.json index f895461d15e0a5..f0526a7854e2f6 100644 --- a/test/syntax/json/namedconstructor.json +++ b/test/syntax/json/namedconstructor.json @@ -28,9 +28,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "src" + "name": "src", + "escapedName": "src" } ], "type": "extended-attribute", diff --git a/test/syntax/json/namespace.json b/test/syntax/json/namespace.json index 0611b710bf10d9..6919cc9f14ca2d 100644 --- a/test/syntax/json/namespace.json +++ b/test/syntax/json/namespace.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, "name": "unit", + "escapedName": "unit", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "dotProduct", + "escapedName": "dotProduct", "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" }, { "optional": false, @@ -62,9 +68,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, - "name": "y" + "name": "y", + "escapedName": "y" } ], "extAttrs": [] @@ -82,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, "name": "crossProduct", + "escapedName": "crossProduct", "arguments": [ { "optional": false, @@ -96,9 +106,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" }, { "optional": false, @@ -110,9 +122,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Vector" + "idlType": "Vector", + "extAttrs": [] }, - "name": "y" + "name": "y", + "escapedName": "y" } ], "extAttrs": [] diff --git a/test/syntax/json/nointerfaceobject.json b/test/syntax/json/nointerfaceobject.json index 03bb99442d5fe3..6eb3770dea4aca 100644 --- a/test/syntax/json/nointerfaceobject.json +++ b/test/syntax/json/nointerfaceobject.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] }, "name": "lookupEntry", + "escapedName": "lookupEntry", "arguments": [ { "optional": false, @@ -31,9 +33,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "key" + "name": "key", + "escapedName": "key" } ], "extAttrs": [] diff --git a/test/syntax/json/nullable.json b/test/syntax/json/nullable.json index ae4d2aa537594c..39e3d85a31095c 100644 --- a/test/syntax/json/nullable.json +++ b/test/syntax/json/nullable.json @@ -9,7 +9,12 @@ "nullable": true, "idlType": { "type": "const-type", - "idlType": "boolean" + "sequence": false, + "generic": null, + "nullable": false, + "union": false, + "idlType": "boolean", + "extAttrs": [] }, "name": "ARE_WE_THERE_YET", "value": { @@ -39,9 +44,11 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "namespaceURI", + "escapedName": "namespaceURI", "extAttrs": [] } ], diff --git a/test/syntax/json/nullableobjects.json b/test/syntax/json/nullableobjects.json index 29d1314f168651..9c084ec7482024 100644 --- a/test/syntax/json/nullableobjects.json +++ b/test/syntax/json/nullableobjects.json @@ -33,9 +33,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -47,9 +49,11 @@ "generic": null, "nullable": true, "union": false, - "idlType": "A" + "idlType": "A", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" } ], "extAttrs": [] @@ -67,9 +71,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -81,9 +87,11 @@ "generic": null, "nullable": true, "union": false, - "idlType": "B" + "idlType": "B", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" } ], "extAttrs": [] diff --git a/test/syntax/json/operation-optional-arg.json b/test/syntax/json/operation-optional-arg.json index 44c3a16dc2ee1a..2f6e325d1cfa61 100644 --- a/test/syntax/json/operation-optional-arg.json +++ b/test/syntax/json/operation-optional-arg.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "object" + "idlType": "object", + "extAttrs": [] }, "name": "createColor", + "escapedName": "createColor", "arguments": [ { "optional": false, @@ -31,9 +33,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "v1" + "name": "v1", + "escapedName": "v1" }, { "optional": false, @@ -45,9 +49,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "v2" + "name": "v2", + "escapedName": "v2" }, { "optional": false, @@ -59,9 +65,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "v3" + "name": "v3", + "escapedName": "v3" }, { "optional": true, @@ -73,9 +81,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "alpha", + "escapedName": "alpha", "default": { "type": "number", "value": "3.5" diff --git a/test/syntax/json/overloading.json b/test/syntax/json/overloading.json index 87169e9202ba40..128f22f428e60e 100644 --- a/test/syntax/json/overloading.json +++ b/test/syntax/json/overloading.json @@ -33,9 +33,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -47,9 +49,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "A" + "idlType": "A", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" } ], "extAttrs": [] @@ -67,9 +71,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -81,9 +87,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "B" + "idlType": "B", + "extAttrs": [] }, - "name": "x" + "name": "x", + "escapedName": "x" } ], "extAttrs": [] @@ -110,9 +118,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -124,9 +134,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "a" + "name": "a", + "escapedName": "a" } ], "extAttrs": [] @@ -144,9 +156,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -165,9 +179,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "a" + "name": "a", + "escapedName": "a" }, { "optional": false, @@ -179,9 +195,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "b" + "name": "b", + "escapedName": "b" }, { "optional": false, @@ -193,9 +211,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "c" + "name": "c", + "escapedName": "c" } ], "extAttrs": [] @@ -213,9 +233,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [], "extAttrs": [] }, @@ -232,9 +254,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f", + "escapedName": "f", "arguments": [ { "optional": false, @@ -246,9 +270,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, - "name": "a" + "name": "a", + "escapedName": "a" }, { "optional": false, @@ -260,9 +286,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "b" + "name": "b", + "escapedName": "b" }, { "optional": true, @@ -274,9 +302,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "c" + "name": "c", + "escapedName": "c" }, { "optional": false, @@ -288,9 +318,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, - "name": "d" + "name": "d", + "escapedName": "d" } ], "extAttrs": [] diff --git a/test/syntax/json/overridebuiltins.json b/test/syntax/json/overridebuiltins.json index d63f8f744113ee..1656bcfe168d89 100644 --- a/test/syntax/json/overridebuiltins.json +++ b/test/syntax/json/overridebuiltins.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "length", + "escapedName": "length", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "lookup", + "escapedName": "lookup", "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "key" + "name": "key", + "escapedName": "key" } ], "extAttrs": [] diff --git a/test/syntax/json/partial-interface.json b/test/syntax/json/partial-interface.json index c16c64d334dfc4..7cec46879c5eb9 100644 --- a/test/syntax/json/partial-interface.json +++ b/test/syntax/json/partial-interface.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "bar", + "escapedName": "bar", "extAttrs": [] } ], @@ -42,9 +44,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "quux", + "escapedName": "quux", "extAttrs": [] } ], diff --git a/test/syntax/json/primitives.json b/test/syntax/json/primitives.json index cf965399a4ff3e..ed51ad0515fefd 100644 --- a/test/syntax/json/primitives.json +++ b/test/syntax/json/primitives.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "truth", + "escapedName": "truth", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "byte" + "idlType": "byte", + "extAttrs": [] }, "name": "character", + "escapedName": "character", "extAttrs": [] }, { @@ -50,9 +54,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "octet" + "idlType": "octet", + "extAttrs": [] }, "name": "value", + "escapedName": "value", "extAttrs": [] }, { @@ -67,9 +73,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "short" + "idlType": "short", + "extAttrs": [] }, "name": "number", + "escapedName": "number", "extAttrs": [] }, { @@ -84,9 +92,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "positive", + "escapedName": "positive", "extAttrs": [] }, { @@ -101,9 +111,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, "name": "big", + "escapedName": "big", "extAttrs": [] }, { @@ -118,9 +130,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "bigpositive", + "escapedName": "bigpositive", "extAttrs": [] }, { @@ -135,9 +149,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long long" + "idlType": "long long", + "extAttrs": [] }, "name": "bigbig", + "escapedName": "bigbig", "extAttrs": [] }, { @@ -152,9 +168,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long long" + "idlType": "unsigned long long", + "extAttrs": [] }, "name": "bigbigpositive", + "escapedName": "bigbigpositive", "extAttrs": [] }, { @@ -169,9 +187,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "real", + "escapedName": "real", "extAttrs": [] }, { @@ -186,9 +206,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "double" + "idlType": "double", + "extAttrs": [] }, "name": "bigreal", + "escapedName": "bigreal", "extAttrs": [] }, { @@ -203,9 +225,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unrestricted float" + "idlType": "unrestricted float", + "extAttrs": [] }, "name": "realwithinfinity", + "escapedName": "realwithinfinity", "extAttrs": [] }, { @@ -220,9 +244,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unrestricted double" + "idlType": "unrestricted double", + "extAttrs": [] }, "name": "bigrealwithinfinity", + "escapedName": "bigrealwithinfinity", "extAttrs": [] }, { @@ -237,9 +263,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "string", + "escapedName": "string", "extAttrs": [] }, { @@ -254,9 +282,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "ByteString" + "idlType": "ByteString", + "extAttrs": [] }, "name": "bytes", + "escapedName": "bytes", "extAttrs": [] }, { @@ -271,9 +301,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Date" + "idlType": "Date", + "extAttrs": [] }, "name": "date", + "escapedName": "date", "extAttrs": [] }, { @@ -288,9 +320,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "RegExp" + "idlType": "RegExp", + "extAttrs": [] }, "name": "regexp", + "escapedName": "regexp", "extAttrs": [] } ], diff --git a/test/syntax/json/prototyperoot.json b/test/syntax/json/prototyperoot.json index eda7f14dae4c5d..92ccd13673173e 100644 --- a/test/syntax/json/prototyperoot.json +++ b/test/syntax/json/prototyperoot.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "nodeType", + "escapedName": "nodeType", "extAttrs": [] } ], diff --git a/test/syntax/json/putforwards.json b/test/syntax/json/putforwards.json index 4b809d2d34dcb5..3596c8fd5affb4 100644 --- a/test/syntax/json/putforwards.json +++ b/test/syntax/json/putforwards.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Name" + "idlType": "Name", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [ { "name": "PutForwards", @@ -43,9 +45,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned short" + "idlType": "unsigned short", + "extAttrs": [] }, "name": "age", + "escapedName": "age", "extAttrs": [] } ], diff --git a/test/syntax/json/record.json b/test/syntax/json/record.json index dd00b5df045e5c..0521d1ba6d9f41 100644 --- a/test/syntax/json/record.json +++ b/test/syntax/json/record.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "foo", + "escapedName": "foo", "arguments": [ { "optional": false, @@ -44,7 +46,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "ByteString" + "idlType": "ByteString", + "extAttrs": [] }, { "type": "argument-type", @@ -52,12 +55,16 @@ "generic": null, "nullable": false, "union": false, - "idlType": "any" + "idlType": "any", + "extAttrs": [] } - ] - } + ], + "extAttrs": [] + }, + "extAttrs": [] }, - "name": "param" + "name": "param", + "escapedName": "param" } ], "extAttrs": [] @@ -82,7 +89,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, { "type": "return-type", @@ -97,7 +105,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, { "type": null, @@ -105,13 +114,17 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] } - ] + ], + "extAttrs": [] } - ] + ], + "extAttrs": [] }, "name": "bar", + "escapedName": "bar", "arguments": [], "extAttrs": [] }, @@ -128,9 +141,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "record" + "idlType": "record", + "extAttrs": [] }, "name": "baz", + "escapedName": "baz", "arguments": [], "extAttrs": [] } @@ -157,7 +172,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "USVString" + "idlType": "USVString", + "extAttrs": [] }, { "type": "argument-type", @@ -165,11 +181,14 @@ "generic": null, "nullable": false, "union": false, - "idlType": "USVString" + "idlType": "USVString", + "extAttrs": [] } - ] + ], + "extAttrs": [] }, - "name": "init" + "name": "init", + "escapedName": "init" } ], "type": "extended-attribute", @@ -202,7 +221,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, { "type": "return-type", @@ -220,9 +240,11 @@ } ] } - ] + ], + "extAttrs": [] }, "name": "bar", + "escapedName": "bar", "arguments": [], "extAttrs": [] } diff --git a/test/syntax/json/reg-operations.json b/test/syntax/json/reg-operations.json index d696e907e0c663..ec68e99bec636d 100644 --- a/test/syntax/json/reg-operations.json +++ b/test/syntax/json/reg-operations.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "width", + "escapedName": "width", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "height", + "escapedName": "height", "extAttrs": [] } ], @@ -60,9 +64,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "isMouseOver", + "escapedName": "isMouseOver", "arguments": [], "extAttrs": [] }, @@ -79,9 +85,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "setDimensions", + "escapedName": "setDimensions", "arguments": [ { "optional": false, @@ -93,9 +101,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Dimensions" + "idlType": "Dimensions", + "extAttrs": [] }, - "name": "size" + "name": "size", + "escapedName": "size" } ], "extAttrs": [] @@ -113,9 +123,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "setDimensions", + "escapedName": "setDimensions", "arguments": [ { "optional": false, @@ -127,9 +139,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "width" + "name": "width", + "escapedName": "width" }, { "optional": false, @@ -141,9 +155,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, - "name": "height" + "name": "height", + "escapedName": "height" } ], "extAttrs": [] diff --git a/test/syntax/json/replaceable.json b/test/syntax/json/replaceable.json index a10b0bfd03b022..816cf0c36bbe74 100644 --- a/test/syntax/json/replaceable.json +++ b/test/syntax/json/replaceable.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "value", + "escapedName": "value", "extAttrs": [ { "name": "Replaceable", @@ -41,9 +43,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "increment", + "escapedName": "increment", "arguments": [], "extAttrs": [] } diff --git a/test/syntax/json/sequence.json b/test/syntax/json/sequence.json index c2d1765bfa506d..9f4f2e761bbd65 100644 --- a/test/syntax/json/sequence.json +++ b/test/syntax/json/sequence.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "drawPolygon", + "escapedName": "drawPolygon", "arguments": [ { "optional": false, @@ -37,10 +39,13 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" - } + "idlType": "float", + "extAttrs": [] + }, + "extAttrs": [] }, - "name": "coordinates" + "name": "coordinates", + "escapedName": "coordinates" } ], "extAttrs": [] @@ -64,10 +69,13 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" - } + "idlType": "float", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "getInflectionPoints", + "escapedName": "getInflectionPoints", "arguments": [], "extAttrs": [] } @@ -93,9 +101,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "sequence" + "idlType": "sequence", + "extAttrs": [] }, "name": "bar", + "escapedName": "bar", "arguments": [], "extAttrs": [] } @@ -121,9 +131,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "f1", + "escapedName": "f1", "arguments": [ { "optional": false, @@ -150,9 +162,11 @@ "rhs": null } ] - } + }, + "extAttrs": [] }, - "name": "arg" + "name": "arg", + "escapedName": "arg" } ], "extAttrs": [] diff --git a/test/syntax/json/setlike.json b/test/syntax/json/setlike.json index 12299a7ee0444a..609a0c5f335b5d 100644 --- a/test/syntax/json/setlike.json +++ b/test/syntax/json/setlike.json @@ -13,7 +13,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] } ], "readonly": false, @@ -37,7 +38,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] } ], "readonly": true, diff --git a/test/syntax/json/static.json b/test/syntax/json/static.json index 0951b2acf5ff99..734cc0f3505563 100644 --- a/test/syntax/json/static.json +++ b/test/syntax/json/static.json @@ -24,9 +24,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "cx", + "escapedName": "cx", "extAttrs": [] }, { @@ -41,9 +43,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "cy", + "escapedName": "cy", "extAttrs": [] }, { @@ -58,9 +62,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "radius", + "escapedName": "radius", "extAttrs": [] }, { @@ -75,9 +81,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, "name": "triangulationCount", + "escapedName": "triangulationCount", "extAttrs": [] }, { @@ -93,9 +101,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, "name": "triangulate", + "escapedName": "triangulate", "arguments": [ { "optional": false, @@ -107,9 +117,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Circle" + "idlType": "Circle", + "extAttrs": [] }, - "name": "c1" + "name": "c1", + "escapedName": "c1" }, { "optional": false, @@ -121,9 +133,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Circle" + "idlType": "Circle", + "extAttrs": [] }, - "name": "c2" + "name": "c2", + "escapedName": "c2" }, { "optional": false, @@ -135,9 +149,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Circle" + "idlType": "Circle", + "extAttrs": [] }, - "name": "c3" + "name": "c3", + "escapedName": "c3" } ], "extAttrs": [] diff --git a/test/syntax/json/stringifier-attribute.json b/test/syntax/json/stringifier-attribute.json index 36e2b6d50ac064..980d463bf122a9 100644 --- a/test/syntax/json/stringifier-attribute.json +++ b/test/syntax/json/stringifier-attribute.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "id", + "escapedName": "id", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] } ], diff --git a/test/syntax/json/stringifier-custom.json b/test/syntax/json/stringifier-custom.json index 3dc3ac1758c8a2..4febcb622eec12 100644 --- a/test/syntax/json/stringifier-custom.json +++ b/test/syntax/json/stringifier-custom.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "id", + "escapedName": "id", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "familyName", + "escapedName": "familyName", "extAttrs": [] }, { @@ -50,9 +54,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "givenName", + "escapedName": "givenName", "extAttrs": [] }, { @@ -68,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [], "extAttrs": [] } diff --git a/test/syntax/json/stringifier.json b/test/syntax/json/stringifier.json index 1a702765b0a656..e5dfce16084558 100644 --- a/test/syntax/json/stringifier.json +++ b/test/syntax/json/stringifier.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": null, + "escapedName": null, "arguments": [], "extAttrs": [] } diff --git a/test/syntax/json/treatasnull.json b/test/syntax/json/treatasnull.json index 611d9741043947..3c6ef32143f1da 100644 --- a/test/syntax/json/treatasnull.json +++ b/test/syntax/json/treatasnull.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "owner", + "escapedName": "owner", "extAttrs": [] }, { @@ -51,9 +55,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "isMemberOfBreed", + "escapedName": "isMemberOfBreed", "arguments": [ { "optional": false, @@ -75,9 +81,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "breedName" + "name": "breedName", + "escapedName": "breedName" } ], "extAttrs": [] diff --git a/test/syntax/json/treatasundefined.json b/test/syntax/json/treatasundefined.json index 258acdabd8593d..dd212235613b1a 100644 --- a/test/syntax/json/treatasundefined.json +++ b/test/syntax/json/treatasundefined.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "name", + "escapedName": "name", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, "name": "owner", + "escapedName": "owner", "extAttrs": [] }, { @@ -51,9 +55,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "isMemberOfBreed", + "escapedName": "isMemberOfBreed", "arguments": [ { "optional": false, @@ -75,9 +81,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] }, - "name": "breedName" + "name": "breedName", + "escapedName": "breedName" } ], "extAttrs": [] diff --git a/test/syntax/json/typedef-union.json b/test/syntax/json/typedef-union.json index 06735a80791006..c9a5460741377b 100644 --- a/test/syntax/json/typedef-union.json +++ b/test/syntax/json/typedef-union.json @@ -14,7 +14,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "ImageData" + "idlType": "ImageData", + "extAttrs": [] }, { "type": null, @@ -22,7 +23,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "HTMLImageElement" + "idlType": "HTMLImageElement", + "extAttrs": [] }, { "type": null, @@ -30,7 +32,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "HTMLCanvasElement" + "idlType": "HTMLCanvasElement", + "extAttrs": [] }, { "type": null, @@ -38,9 +41,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "HTMLVideoElement" + "idlType": "HTMLVideoElement", + "extAttrs": [] } - ] + ], + "extAttrs": [] }, "name": "TexImageSource", "extAttrs": [] diff --git a/test/syntax/json/typedef.json b/test/syntax/json/typedef.json index 5e9715da8fb2a7..b4340b5c039448 100644 --- a/test/syntax/json/typedef.json +++ b/test/syntax/json/typedef.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "x", + "escapedName": "x", "extAttrs": [] }, { @@ -33,9 +35,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, "name": "y", + "escapedName": "y", "extAttrs": [] } ], @@ -56,8 +60,10 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" - } + "idlType": "Point", + "extAttrs": [] + }, + "extAttrs": [] }, "name": "PointSequence", "extAttrs": [] @@ -79,9 +85,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, "name": "topleft", + "escapedName": "topleft", "extAttrs": [] }, { @@ -96,9 +104,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, "name": "bottomright", + "escapedName": "bottomright", "extAttrs": [] } ], @@ -122,9 +132,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Rect" + "idlType": "Rect", + "extAttrs": [] }, "name": "bounds", + "escapedName": "bounds", "extAttrs": [] }, { @@ -140,9 +152,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "pointWithinBounds", + "escapedName": "pointWithinBounds", "arguments": [ { "optional": false, @@ -154,9 +168,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Point" + "idlType": "Point", + "extAttrs": [] }, - "name": "p" + "name": "p", + "escapedName": "p" } ], "extAttrs": [] @@ -174,9 +190,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "boolean" + "idlType": "boolean", + "extAttrs": [] }, "name": "allPointsWithinBounds", + "escapedName": "allPointsWithinBounds", "arguments": [ { "optional": false, @@ -188,9 +206,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "PointSequence" + "idlType": "PointSequence", + "extAttrs": [] }, - "name": "ps" + "name": "ps", + "escapedName": "ps" } ], "extAttrs": [] diff --git a/test/syntax/json/typesuffixes.json b/test/syntax/json/typesuffixes.json index be0b1f226827d0..e17baae2fb65a9 100644 --- a/test/syntax/json/typesuffixes.json +++ b/test/syntax/json/typesuffixes.json @@ -17,9 +17,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "test", + "escapedName": "test", "arguments": [ { "optional": false, @@ -37,10 +39,13 @@ "generic": null, "nullable": true, "union": false, - "idlType": "DOMString" - } + "idlType": "DOMString", + "extAttrs": [] + }, + "extAttrs": [] }, - "name": "foo" + "name": "foo", + "escapedName": "foo" } ], "extAttrs": [] diff --git a/test/syntax/json/uniontype.json b/test/syntax/json/uniontype.json index 87735c7fb6320d..c55bb08cb6e812 100644 --- a/test/syntax/json/uniontype.json +++ b/test/syntax/json/uniontype.json @@ -23,7 +23,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "float" + "idlType": "float", + "extAttrs": [] }, { "type": null, @@ -38,7 +39,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Date" + "idlType": "Date", + "extAttrs": [] }, { "type": null, @@ -46,9 +48,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Event" + "idlType": "Event", + "extAttrs": [] } - ] + ], + "extAttrs": [] }, { "type": null, @@ -63,7 +67,8 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Node" + "idlType": "Node", + "extAttrs": [] }, { "type": null, @@ -71,13 +76,17 @@ "generic": null, "nullable": false, "union": false, - "idlType": "DOMString" + "idlType": "DOMString", + "extAttrs": [] } - ] + ], + "extAttrs": [] } - ] + ], + "extAttrs": [] }, "name": "test", + "escapedName": "test", "extAttrs": [] }, { @@ -115,11 +124,14 @@ "generic": null, "nullable": false, "union": false, - "idlType": "Date" + "idlType": "Date", + "extAttrs": [] } - ] + ], + "extAttrs": [] }, "name": "test2", + "escapedName": "test2", "extAttrs": [] } ], diff --git a/test/syntax/json/variadic-operations.json b/test/syntax/json/variadic-operations.json index 53b02dfb4ccb57..d2cad8abc4f31b 100644 --- a/test/syntax/json/variadic-operations.json +++ b/test/syntax/json/variadic-operations.json @@ -16,9 +16,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "unsigned long" + "idlType": "unsigned long", + "extAttrs": [] }, "name": "cardinality", + "escapedName": "cardinality", "extAttrs": [] }, { @@ -34,9 +36,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "union", + "escapedName": "union", "arguments": [ { "optional": false, @@ -48,9 +52,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, - "name": "ints" + "name": "ints", + "escapedName": "ints" } ], "extAttrs": [] @@ -68,9 +74,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "void" + "idlType": "void", + "extAttrs": [] }, "name": "intersection", + "escapedName": "intersection", "arguments": [ { "optional": false, @@ -82,9 +90,11 @@ "generic": null, "nullable": false, "union": false, - "idlType": "long" + "idlType": "long", + "extAttrs": [] }, - "name": "ints" + "name": "ints", + "escapedName": "ints" } ], "extAttrs": [] diff --git a/test/syntax/opt/linecomment.json b/test/syntax/opt/linecomment.json deleted file mode 100644 index fbcdbf4b71974b..00000000000000 --- a/test/syntax/opt/linecomment.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "ws": true -} diff --git a/test/syntax/opt/typedef-nested.json b/test/syntax/opt/typedef-nested.json deleted file mode 100644 index f0794e74e07eb1..00000000000000 --- a/test/syntax/opt/typedef-nested.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "allowNestedTypedefs": true -} \ No newline at end of file diff --git a/test/widlproc b/test/widlproc deleted file mode 160000 index 4ef8dde69c0ba3..00000000000000 --- a/test/widlproc +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4ef8dde69c0ba3d0167bccfa2775eea7f0d6c7fe