Comparing version 2.0.0 to 2.0.1
@@ -11,3 +11,3 @@ | ||
, "string": /^"[^"]*"/ | ||
, "whitespace": /^[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n)*?\*\/)[\t\n\r ]*)+/ | ||
, "whitespace": /^(?:[\t\n\r ]+|[\t\n\r ]*((\/\/.*|\/\*(.|\n|\r)*?\*\/)[\t\n\r ]*))+/ | ||
, "other": /^[^\t\n\r 0-9A-Z_a-z]/ | ||
@@ -30,3 +30,3 @@ } | ||
if (matched) continue; | ||
throw new Error("Token stream not progressing."); | ||
throw new Error("Token stream not progressing"); | ||
} | ||
@@ -47,2 +47,13 @@ return tokens; | ||
var WebIDLParseError = function (str, line, input, tokens) { | ||
this.message = str; | ||
this.line = line; | ||
this.input = input; | ||
this.tokens = tokens; | ||
}; | ||
WebIDLParseError.prototype.toString = function () { | ||
return this.message + ", line " + this.line + " (tokens: '" + this.input + "')\n" + | ||
JSON.stringify(this.tokens, null, 4); | ||
}; | ||
var error = function (str) { | ||
@@ -54,3 +65,3 @@ var tok = "", numTokens = 0, maxTokens = 5; | ||
} | ||
throw str + ", line " + line + " (tokens: '" + tok + "')\n" + JSON.stringify(tokens.slice(0, 5), null, 4); | ||
throw new WebIDLParseError(str, line, tok, tokens.slice(0, 5)); | ||
}; | ||
@@ -140,3 +151,6 @@ | ||
all_ws(); | ||
if (consume(OTHER, "?")) obj.nullable = true; | ||
if (consume(OTHER, "?")) { | ||
if (obj.nullable) error("Can't nullable more than once"); | ||
obj.nullable = true; | ||
} | ||
else if (consume(OTHER, "[")) { | ||
@@ -180,2 +194,3 @@ all_ws(); | ||
type_suffix(ret); | ||
if (ret.nullable && ret.idlType === "any") error("Type any cannot be made nullable"); | ||
return ret; | ||
@@ -427,2 +442,3 @@ }; | ||
ret.idlType = type() || error("No type in attribute"); | ||
if (ret.idlType.sequence) error("Attributes cannot accept sequence types"); | ||
all_ws(); | ||
@@ -503,2 +519,3 @@ var name = consume(ID) || error("No name in attribute"); | ||
consume(OTHER, ";") || error("Unterminated iterator"); | ||
return ret; | ||
} | ||
@@ -580,2 +597,4 @@ else { | ||
else { | ||
ret.idlType = return_type(); | ||
all_ws(); | ||
ret.operation = operation_rest(); | ||
@@ -813,4 +832,5 @@ } | ||
}; | ||
return definitions(); | ||
var res = definitions(); | ||
if (tokens.length) error("Unrecognised tokens"); | ||
return res; | ||
}; | ||
@@ -817,0 +837,0 @@ |
{ | ||
"name": "webidl2" | ||
, "description": "A WebIDL Parser" | ||
, "version": "2.0.0" | ||
, "version": "2.0.1" | ||
, "author": "Robin Berjon <robin@berjon.com>" | ||
@@ -9,8 +9,8 @@ , "dependencies": { | ||
, "devDependencies": { | ||
"mocha": "*" | ||
, "should": "*" | ||
, "underscore": "*" | ||
"mocha": "1.7.4" | ||
, "expect.js": "0.2.0" | ||
, "underscore": "1.4.3" | ||
, "jsondiffpatch": "*" | ||
, "benchmark": "*" | ||
, "microtime": "*" | ||
, "microtime": "*" | ||
} | ||
@@ -17,0 +17,0 @@ , "repository": "git://github.com/darobin/webidl2.js" |
Installation | ||
============ | ||
Just the usual: | ||
npm install webidl2 | ||
Testing | ||
======= | ||
In order to run the tests you need to ensure that the widlproc submodule inside `test` is | ||
initialised and up to date: | ||
git submodule init | ||
# or | ||
git submodule update | ||
TODO | ||
==== | ||
* run coverage to see if there's any glaring omission in the tests | ||
* test in browser | ||
* document | ||
* test invalid WebIDL too | ||
* review the test JSONs to for correctness |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
207
28
436247
2
80
1101
3
1