Comparing version 10.0.0 to 10.1.0
@@ -48,2 +48,3 @@ "use strict"; | ||
const names = new Map(); | ||
let current = null; | ||
@@ -73,3 +74,13 @@ const FLOAT = "float"; | ||
} | ||
throw new WebIDLParseError(str, line, tok, tokens.slice(0, maxTokens)); | ||
let message; | ||
if (current) { | ||
message = `Got an error during or right after parsing \`${current.partial ? "partial " : ""}${current.type} ${current.name}\`: ${str}` | ||
} | ||
else { | ||
// throwing before any valid definition | ||
message = `Got an error before parsing any named definition: ${str}`; | ||
} | ||
throw new WebIDLParseError(message, line, tok, tokens.slice(0, maxTokens)); | ||
}; | ||
@@ -489,8 +500,7 @@ | ||
if (tok) { | ||
ret = interface_rest(); | ||
ret.type = "callback interface"; | ||
ret = interface_rest(false, store, "callback interface"); | ||
return ret; | ||
} | ||
const name = consume(ID) || error("No name for callback"); | ||
ret = { type: "callback", name: sanitize_name(name.value, "callback") }; | ||
ret = current = { type: "callback", name: sanitize_name(name.value, "callback") }; | ||
all_ws(); | ||
@@ -681,10 +691,10 @@ consume(OTHER, "=") || error("No assignment in callback"); | ||
function interface_rest(isPartial, store) { | ||
function interface_rest(isPartial, store, typeName = "interface") { | ||
all_ws(); | ||
const name = consume(ID) || error("No name for interface"); | ||
const mems = []; | ||
const ret = { | ||
type: "interface", | ||
const ret = current = { | ||
type: typeName, | ||
name: isPartial ? name.value : sanitize_name(name.value, "interface"), | ||
partial: false, | ||
partial: isPartial, | ||
members: mems | ||
@@ -728,6 +738,6 @@ }; | ||
const mems = []; | ||
const ret = { | ||
const ret = current = { | ||
type: "interface mixin", | ||
name: isPartial ? name.value : sanitize_name(name.value, "interface mixin"), | ||
partial: false, | ||
partial: isPartial, | ||
members: mems | ||
@@ -775,3 +785,3 @@ }; | ||
const mems = []; | ||
const ret = { | ||
const ret = current = { | ||
type: "namespace", | ||
@@ -845,3 +855,2 @@ name: isPartial ? name.value : sanitize_name(name.value, "namespace"), | ||
error("Partial doesn't apply to anything"); | ||
thing.partial = true; | ||
return thing; | ||
@@ -856,6 +865,6 @@ }; | ||
const mems = []; | ||
const ret = { | ||
const ret = current = { | ||
type: "dictionary", | ||
name: isPartial ? name.value : sanitize_name(name.value, "dictionary"), | ||
partial: false, | ||
partial: isPartial, | ||
members: mems | ||
@@ -903,3 +912,3 @@ }; | ||
const vals = []; | ||
const ret = { | ||
const ret = current = { | ||
type: "enum", | ||
@@ -944,2 +953,3 @@ name: sanitize_name(name.value, "enum"), | ||
ret.name = sanitize_name(name.value, "typedef"); | ||
current = ret; | ||
all_ws(); | ||
@@ -946,0 +956,0 @@ consume(OTHER, ";") || error("Unterminated typedef"); |
{ | ||
"name": "webidl2", | ||
"description": "A WebIDL Parser", | ||
"version": "10.0.0", | ||
"version": "10.1.0", | ||
"contributors": [ | ||
@@ -14,5 +14,5 @@ "Robin Berjon <robin@berjon.com> (https://berjon.com)", | ||
"devDependencies": { | ||
"expect": "22.0.3", | ||
"expect": "22.1.0", | ||
"jsondiffpatch": "0.2.5", | ||
"mocha": "4.0.1" | ||
"mocha": "5.0.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "scripts": { |
{ | ||
"message": "No name in attribute", | ||
"message": "Got an error during or right after parsing `interface LotteryResults`: No name in attribute", | ||
"line": 5 | ||
} | ||
} |
{ | ||
"message": "Invalid operation", | ||
"message": "Got an error during or right after parsing `interface NumberQuadrupler`: Invalid operation", | ||
"line": 6 | ||
} |
{ | ||
"message": "Required member must not have a default" | ||
"message": "Got an error during or right after parsing `dictionary Dict`: Required member must not have a default" | ||
, "line": 4 | ||
} |
{ | ||
"message": "The name \"Test\" of type \"typedef\" is already seen", | ||
"message": "Got an error during or right after parsing `typedef Test`: The name \"Test\" of type \"typedef\" is already seen", | ||
"line": 3 | ||
} | ||
} |
{ | ||
"message": "Unexpected value in enum" | ||
"message": "Got an error during or right after parsing `enum foo`: Unexpected value in enum" | ||
, "line": 1 | ||
} |
{ | ||
"message": "Unrecognised tokens", | ||
"message": "Got an error before parsing any named definition: Unrecognised tokens", | ||
"line": 4 | ||
} |
{ | ||
"message": "Invalid operation", | ||
"message": "Got an error during or right after parsing `interface SessionManager`: Invalid operation", | ||
"line": 5 | ||
} |
{ | ||
"message": "Missing second type argument in maplike declaration", | ||
"message": "Got an error during or right after parsing `interface MapLikeOneType`: Missing second type argument in maplike declaration", | ||
"line": 2 | ||
} | ||
} |
{ | ||
"message": "Unrecognised tokens" | ||
"message": "Got an error before parsing any named definition: Unrecognised tokens" | ||
, "line": 2 | ||
} |
{ | ||
"message": "Type any cannot be made nullable" | ||
"message": "Got an error during or right after parsing `interface NonNullable`: Type any cannot be made nullable" | ||
, "line": 2 | ||
} |
{ | ||
"message": "Can't nullable more than once" | ||
"message": "Got an error during or right after parsing `interface NonNullable`: Can't nullable more than once" | ||
, "line": 4 | ||
} |
{ | ||
"message": "Promise type cannot have extended attribute", | ||
"message": "Got an error during or right after parsing `interface Foo`: Promise type cannot have extended attribute", | ||
"line": 2 | ||
} |
{ | ||
"message": "Unterminated attribute" | ||
"message": "Got an error during or right after parsing `interface Person`: Unterminated attribute" | ||
, "line": 5 | ||
} |
{ | ||
"message": "Invalid operation", | ||
"message": "Got an error during or right after parsing `interface ReadonlyIterable`: Invalid operation", | ||
"line": 2 | ||
} | ||
} |
{ | ||
"message": "Record key cannot have extended attribute", | ||
"message": "Got an error during or right after parsing `interface Foo`: Record key cannot have extended attribute", | ||
"line": 2 | ||
} |
{ | ||
"message": "Record key must be DOMString, USVString, or ByteString", | ||
"message": "Got an error during or right after parsing `interface Foo`: Record key must be DOMString, USVString, or ByteString", | ||
"line": 2 | ||
} |
{ | ||
"message": "No name in typedef" | ||
"message": "Got an error before parsing any named definition: No name in typedef" | ||
, "line": 2 | ||
} |
{ | ||
"message": "Attributes cannot accept sequence types" | ||
"message": "Got an error during or right after parsing `interface sequenceAsAttribute`: Attributes cannot accept sequence types" | ||
, "line": 2 | ||
} |
{ | ||
"message": "Unterminated setlike declaration", | ||
"message": "Got an error during or right after parsing `interface SetLikeTwoTypes`: Unterminated setlike declaration", | ||
"line": 2 | ||
} | ||
} |
{ | ||
"message": "Invalid operation", | ||
"message": "Got an error during or right after parsing `interface OrderedMap`: Invalid operation", | ||
"line": 3 | ||
} |
{ | ||
"message": "Invalid operation" | ||
"message": "Got an error during or right after parsing `interface Dictionary`: Invalid operation" | ||
, "line": 6 | ||
} |
{ | ||
"message": "No value for const" | ||
"message": "Got an error during or right after parsing `interface Util`: No value for const" | ||
, "line": 2 | ||
} |
{ | ||
"message": "Invalid operation" | ||
"message": "Got an error during or right after parsing `interface Widget`: Invalid operation" | ||
, "line": 14 | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
872516
317
7311