Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

webidl2

Package Overview
Dependencies
Maintainers
4
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webidl2 - npm Package Compare versions

Comparing version 10.3.1 to 10.3.2

test/invalid/idl/implements_and_includes_ws.widl

48

lib/webidl2.js

@@ -18,3 +18,4 @@ "use strict";

function attemptTokenMatch(str, type, re, lastIndex, tokens) {
function attemptTokenMatch(str, type, lastIndex, tokens) {
const re = tokenRe[type];
re.lastIndex = lastIndex;

@@ -36,39 +37,28 @@ const result = re.exec(str);

if (/[-0-9.]/.test(nextChar)) {
result = attemptTokenMatch(str, "float", tokenRe.float, lastIndex,
tokens);
result = attemptTokenMatch(str, "float", lastIndex, tokens);
if (result === -1) {
result = attemptTokenMatch(str, "integer", tokenRe.integer, lastIndex,
tokens);
result = attemptTokenMatch(str, "integer", lastIndex, tokens);
}
if (result === -1) {
// '-' and '.' can also match "other".
result = attemptTokenMatch(str, "other", tokenRe.other,
lastIndex, tokens);
result = attemptTokenMatch(str, "other", lastIndex, tokens);
}
} else if (/[A-Z_a-z]/.test(nextChar)) {
result = attemptTokenMatch(str, "identifier", tokenRe.identifier,
lastIndex, tokens);
result = attemptTokenMatch(str, "identifier", lastIndex, tokens);
} else if (nextChar === '"') {
result = attemptTokenMatch(str, "string", tokenRe.string,
lastIndex, tokens);
result = attemptTokenMatch(str, "string", lastIndex, tokens);
if (result === -1) {
// '"' can also match "other".
result = attemptTokenMatch(str, "other", tokenRe.other,
lastIndex, tokens);
result = attemptTokenMatch(str, "other", lastIndex, tokens);
}
} else if (/[\t\n\r ]/.test(nextChar)) {
result = attemptTokenMatch(str, "whitespace", tokenRe.whitespace,
lastIndex, tokens);
result = attemptTokenMatch(str, "whitespace", lastIndex, tokens);
} else if (nextChar === '/') {
// The parser expects comments to be labelled as "whitespace".
result = attemptTokenMatch(str, "whitespace", tokenRe.comment,
lastIndex, tokens);
result = attemptTokenMatch(str, "comment", lastIndex, tokens);
if (result === -1) {
// '/' can also match "other".
result = attemptTokenMatch(str, "other", tokenRe.other,
lastIndex, tokens);
result = attemptTokenMatch(str, "other", lastIndex, tokens);
}
} else {
result = attemptTokenMatch(str, "other", tokenRe.other,
lastIndex, tokens);
result = attemptTokenMatch(str, "other", lastIndex, tokens);
}

@@ -177,3 +167,3 @@ if (result === -1) {

if (!tokens.length) return;
if (tokens[0].type === "whitespace") {
if (tokens[0].type === "whitespace" || tokens[0].type === "comment") {
const t = tokens.shift();

@@ -482,7 +472,3 @@ line += count(t.value, '\n');

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(store) || error("Trailing comma in extended attribute"));
}

@@ -1042,3 +1028,4 @@ all_ws();

// rollback
tokens.unshift(w);
if (w)
tokens.unshift(w);
tokens.unshift(target);

@@ -1066,3 +1053,4 @@ }

// rollback
tokens.unshift(w);
if (w)
tokens.unshift(w);
tokens.unshift(target);

@@ -1069,0 +1057,0 @@ }

{
"name": "webidl2",
"description": "A WebIDL Parser",
"version": "10.3.1",
"version": "10.3.2",
"contributors": [

@@ -6,0 +6,0 @@ "Robin Berjon <robin@berjon.com> (https://berjon.com)",

@@ -0,0 +0,0 @@ [

@@ -0,0 +0,0 @@ [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc