protocol-buffers-schema
Advanced tools
Comparing version 2.0.3 to 2.0.4
{ | ||
"name": "protocol-buffers-schema", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "No nonsense protocol buffers schema parser written in Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20
parse.js
@@ -18,3 +18,2 @@ var tokenize = require('./tokenize') | ||
break | ||
case ']': | ||
@@ -332,2 +331,21 @@ tokens.shift() | ||
var tokens = tokenize(buf.toString()) | ||
// check for isolated strings in tokens by looking for opening quote | ||
for (var i = 0; i < tokens.length; i++) { | ||
if (/^(\"|\')([^\'\"]*)$/.test(tokens[i])) { | ||
var j | ||
if (tokens[i].length === 1) { | ||
j = i + 1 | ||
} else { | ||
j = i | ||
} | ||
// look ahead for the closing quote and collapse all | ||
// in-between tokens into a single token | ||
for (j; j < tokens.length; j++) { | ||
if (/^([^\'\"]*)(\"|\')$/.test(tokens[j])) { | ||
tokens = tokens.slice(0, i).concat(tokens.slice(i, j + 1).join('')).concat(tokens.slice(j + 1)) | ||
break | ||
} | ||
} | ||
} | ||
} | ||
var schema = { | ||
@@ -334,0 +352,0 @@ syntax: 3, |
@@ -95,1 +95,6 @@ var tape = require('tape') | ||
}) | ||
tape('schema with reserved characters in options', function (t) { | ||
t.same(schema.parse(fixture('options.proto')), require('./fixtures/options.json')) | ||
t.end() | ||
}) |
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
36590
30
1245